Browse Source

* If relocation to a local label cannot be translated into (section+offset), then the target symbol must be written into symbol table. Fixes IE 200603012 in number of tests with -Cg on i386-linux (and possibly other targets with internal ELF assembler).

git-svn-id: trunk@21759 -
sergei 13 years ago
parent
commit
37b8cd1b7a
1 changed files with 5 additions and 0 deletions
  1. 5 0
      compiler/ogelf.pas

+ 5 - 0
compiler/ogelf.pas

@@ -940,6 +940,11 @@ implementation
              begin
                objreloc:=TObjRelocation.CreateSymbol(CurrObjSec.Size,p,reltype);
                CurrObjSec.ObjRelocations.Add(objreloc);
+               { If target is a local label and it isn't handled above,
+                 patch its type in order to get it written to symtable.
+                 This may happen e.g. when taking address of Pascal label in PIC mode. }
+               if (p.bind=AB_LOCAL) and (p.typ=AT_LABEL) then
+                 p.typ:=AT_ADDR;
             end;
          end;
         if assigned(objreloc) then