From d46cd7d3585ac98b81e521a9054bf085082570f1 Mon Sep 17 00:00:00 2001 From: Matthias Braun Date: Mon, 21 Sep 2009 13:58:21 +0000 Subject: [PATCH] fix relative entity emitter [r26566] --- ir/be/ia32/ia32_emitter.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ir/be/ia32/ia32_emitter.c b/ir/be/ia32/ia32_emitter.c index 8909df278..766ec26a7 100644 --- a/ir/be/ia32/ia32_emitter.c +++ b/ir/be/ia32/ia32_emitter.c @@ -2303,6 +2303,10 @@ static void bemit32(const unsigned u32) be_emit_write_line(); } +/** + * Emit address of an entity. If @p is_relative is true then a relative + * offset from behind the address to the entity is created. + */ static void bemit_entity(ir_entity *entity, bool entity_sign, int offset, bool is_relative) { @@ -2311,6 +2315,10 @@ static void bemit_entity(ir_entity *entity, bool entity_sign, int offset, return; } + if (is_relative) { + offset -= 4; + } + /* the final version should remember the position in the bytestream and patch it with the correct address at linktime... */ be_emit_cstring("\t.long "); -- 2.20.1