mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-20 14:29:21 +02:00
* generate jump tables into the same section as the code as otherwise we'll get bogus relocations (in case of clang.exe) or a future support for armasm64.exe will reject the relative symbols outright
git-svn-id: trunk@44949 -
This commit is contained in:
parent
b88107fa1d
commit
7f4b94e408
@ -42,7 +42,7 @@ implementation
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
systems,
|
systems,
|
||||||
verbose,globals,constexp,
|
verbose,globals,constexp,cutils,
|
||||||
symconst,symdef,defutil,
|
symconst,symdef,defutil,
|
||||||
paramgr,
|
paramgr,
|
||||||
cpuinfo,
|
cpuinfo,
|
||||||
@ -254,24 +254,37 @@ implementation
|
|||||||
{ and finally jump }
|
{ and finally jump }
|
||||||
current_asmdata.CurrAsmList.concat(taicpu.op_reg(A_BR,jumpreg));
|
current_asmdata.CurrAsmList.concat(taicpu.op_reg(A_BR,jumpreg));
|
||||||
{ generate jump table }
|
{ generate jump table }
|
||||||
if not(target_info.system in systems_darwin) then
|
if target_info.system=system_aarch64_win64 then
|
||||||
sectype:=sec_rodata
|
begin
|
||||||
|
{ for Windows we need to make sure that the jump table is located in the
|
||||||
|
same section as the corresponding code as for one clang generates a
|
||||||
|
ABSOLUTE32 relocation that can not be handled correctly and armasm64
|
||||||
|
rejects the difference entries due to the symbols being located in
|
||||||
|
different sections }
|
||||||
|
sectype:=sec_code;
|
||||||
|
new_section(current_procinfo.aktlocaldata,sectype,lower(current_procinfo.procdef.mangledname),getprocalign);
|
||||||
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
{ on Mac OS X, dead code stripping ("smart linking") happens based on
|
if not(target_info.system in systems_darwin) then
|
||||||
global symbols: every global/static symbol (symbols that do not
|
sectype:=sec_rodata
|
||||||
start with "L") marks the start of a new "subsection" that is
|
else
|
||||||
discarded by the linker if there are no references to this symbol.
|
begin
|
||||||
This means that if you put the jump table in the rodata section, it
|
{ on Mac OS X, dead code stripping ("smart linking") happens based on
|
||||||
will become part of the block of data associated with the previous
|
global symbols: every global/static symbol (symbols that do not
|
||||||
non-L-label in the rodata section and stay or be thrown away
|
start with "L") marks the start of a new "subsection" that is
|
||||||
depending on whether that block of data is referenced. Therefore,
|
discarded by the linker if there are no references to this symbol.
|
||||||
jump tables must be added in the code section and since aktlocaldata
|
This means that if you put the jump table in the rodata section, it
|
||||||
is inserted right after the routine, it will become part of the
|
will become part of the block of data associated with the previous
|
||||||
same subsection that contains the routine's code }
|
non-L-label in the rodata section and stay or be thrown away
|
||||||
sectype:=sec_code;
|
depending on whether that block of data is referenced. Therefore,
|
||||||
|
jump tables must be added in the code section and since aktlocaldata
|
||||||
|
is inserted right after the routine, it will become part of the
|
||||||
|
same subsection that contains the routine's code }
|
||||||
|
sectype:=sec_code;
|
||||||
|
end;
|
||||||
|
new_section(current_procinfo.aktlocaldata,sectype,current_procinfo.procdef.mangledname,4);
|
||||||
end;
|
end;
|
||||||
new_section(current_procinfo.aktlocaldata,sectype,current_procinfo.procdef.mangledname,4);
|
|
||||||
if target_info.system in systems_darwin then
|
if target_info.system in systems_darwin then
|
||||||
begin
|
begin
|
||||||
{ additionally, these tables are now marked via ".data_region jt32"
|
{ additionally, these tables are now marked via ".data_region jt32"
|
||||||
|
Loading…
Reference in New Issue
Block a user