Procházet zdrojové kódy

Make relocation type more precise compared to output of gas.
Change and to or in case symbol in other section is not exported.

git-svn-id: trunk@32852 -

Jeppe Johansen před 9 roky
rodič
revize
1b02dd27dc
3 změnil soubory, kde provedl 8 přidání a 2 odebrání
  1. 5 2
      compiler/arm/aasmcpu.pas
  2. 2 0
      compiler/arm/cpuelf.pas
  3. 1 0
      compiler/ogbase.pas

+ 5 - 2
compiler/arm/aasmcpu.pas

@@ -2974,9 +2974,12 @@ implementation
               else
                 begin
                   currsym:=objdata.symbolref(oper[0]^.ref^.symbol);
-                  if (currsym.bind<>AB_LOCAL) and (currsym.objsection<>objdata.CurrObjSec) then
+                  if (currsym.bind<>AB_LOCAL) or (currsym.objsection<>objdata.CurrObjSec) then
                     begin
-                      objdata.writereloc(oper[0]^.ref^.offset,0,currsym,RELOC_RELATIVE_24);
+                      if (opcode<>A_BL) or (condition<>C_None) then
+                        objdata.writereloc(oper[0]^.ref^.offset,0,currsym,RELOC_RELATIVE_24)
+                      else
+                        objdata.writereloc(oper[0]^.ref^.offset,0,currsym,RELOC_RELATIVE_CALL);
                       bytes:=bytes or $fffffe; // TODO: Not sure this is right, but it matches the output of gas
                     end
                   else

+ 2 - 0
compiler/arm/cpuelf.pas

@@ -327,6 +327,8 @@ implementation
           result:=R_ARM_REL32;
         RELOC_RELATIVE_24:
           result:=R_ARM_JUMP24;
+        RELOC_RELATIVE_CALL:
+          result:=R_ARM_CALL;
         RELOC_RELATIVE_24_THUMB:
           result:=R_ARM_CALL;
         RELOC_RELATIVE_CALL_THUMB:

+ 1 - 0
compiler/ogbase.pas

@@ -80,6 +80,7 @@ interface
 {$endif i8086}
 {$ifdef arm}
          RELOC_RELATIVE_24,
+         RELOC_RELATIVE_CALL,
          RELOC_RELATIVE_24_THUMB,
          RELOC_RELATIVE_CALL_THUMB,
          RELOC_GOT32,