[2/5] symaddr: give a type to OP_SYMADDR
diff mbox

Message ID 20180309023010.94475-3-luc.vanoostenryck@gmail.com
State Under Review
Headers show

Commit Message

Luc Van Oostenryck March 9, 2018, 2:30 a.m. UTC
Currently, OP_SYMADDR are given a size but not a type.

For consistency, give it a type too.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 linearize.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Patch
diff mbox

diff --git a/linearize.c b/linearize.c
index 58da7ceb3..02ddc2d58 100644
--- a/linearize.c
+++ b/linearize.c
@@ -1001,9 +1001,10 @@  static pseudo_t add_setfval(struct entrypoint *ep, struct symbol *ctype, long do
 	return target;
 }
 
-static pseudo_t add_symbol_address(struct entrypoint *ep, struct symbol *sym)
+static pseudo_t add_symbol_address(struct entrypoint *ep, struct expression *expr)
 {
-	struct instruction *insn = alloc_instruction(OP_SYMADDR, bits_in_pointer);
+	struct instruction *insn = alloc_typed_instruction(OP_SYMADDR, expr->ctype);
+	struct symbol *sym = expr->symbol;
 	pseudo_t target = alloc_pseudo(insn);
 
 	insn->target = target;
@@ -1595,7 +1596,7 @@  static pseudo_t linearize_expression(struct entrypoint *ep, struct expression *e
 	switch (expr->type) {
 	case EXPR_SYMBOL:
 		linearize_one_symbol(ep, expr->symbol);
-		return add_symbol_address(ep, expr->symbol);
+		return add_symbol_address(ep, expr);
 
 	case EXPR_VALUE:
 		return value_pseudo(expr->value);