Fix Bugzilla 24401 - OSX: Linker error: GOT load reloc does not point to a movq instruction

This commit is contained in:
Iain Buclaw 2024-02-22 14:50:59 +01:00 committed by Nicholas Wilson
parent 6f2a6f919d
commit baf8ee195a
2 changed files with 10 additions and 6 deletions

View file

@ -942,6 +942,8 @@ void MachObj_term(const(char)* objfilename)
}
// Put out relocation data
// See mach-o/reloc.h for some examples of what should be generated and when:
// https://github.com/apple-oss-distributions/xnu/blob/rel/xnu-10002/EXTERNAL_HEADERS/mach-o/x86_64/reloc.h
mach_numbersyms();
for (int seg = 1; seg < SegData.length; seg++)
{
@ -1053,12 +1055,8 @@ void MachObj_term(const(char)* objfilename)
rel.r_type = X86_64_RELOC_SIGNED;
else if ((s.Sfl == FLfunc || s.Sfl == FLextern || s.Sclass == SC.global ||
s.Sclass == SC.comdat || s.Sclass == SC.comdef) && r.rtype == RELaddr)
{
rel.r_type = X86_64_RELOC_GOT_LOAD;
if (seg == eh_frame_seg ||
seg == except_table_seg)
rel.r_type = X86_64_RELOC_GOT;
}
rel.r_type = X86_64_RELOC_GOT;
rel.r_address = cast(int)r.offset;
rel.r_symbolnum = s.Sxtrnnum;
rel.r_pcrel = 1;

View file

@ -0,0 +1,6 @@
// PERMUTE_ARGS:
// https://issues.dlang.org/show_bug.cgi?id=24401
int main()
{
return (() @trusted => 0)();
}