fix relative entity emitter
authorMatthias Braun <matze@braunis.de>
Mon, 21 Sep 2009 13:58:21 +0000 (13:58 +0000)
committerMatthias Braun <matze@braunis.de>
Mon, 21 Sep 2009 13:58:21 +0000 (13:58 +0000)
[r26566]

ir/be/ia32/ia32_emitter.c

index 8909df2..766ec26 100644 (file)
@@ -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 ");