Bug#980204: gdc: Resulting executables segfault on mipsel architecture (signal 11)
Excerpts from Iain Buclaw's message of January 23, 2021 11:07 am:
> Excerpts from Iain Buclaw's message of January 23, 2021 2:36 am:
>>
>> So the crux of the matter is that on MIPS, dynamic sections are read-only
>> (glibc sets DL_RO_DYN_SECTION 1), which requires special handling when pulling
>> data from dl_phdr_info.
>>
>> Re-running with the attached patch applied.
>>
>> Iain.
>>
>> --- a/libphobos/libdruntime/gcc/sections/elf_shared.d
>> +++ b/libphobos/libdruntime/gcc/sections/elf_shared.d
>> @@ -22,6 +22,8 @@
>>
>> module gcc.sections.elf_shared;
>>
>> +version (MIPS32) version = MIPS_Any;
>> +version (MIPS64) version = MIPS_Any;
>> version (RISCV32) version = RISCV_Any;
>> version (RISCV64) version = RISCV_Any;
>> version (S390) version = IBMZ_Any;
>> @@ -763,6 +765,8 @@ version (Shared)
>> // in glibc: #define DL_RO_DYN_SECTION 1
>> version (RISCV_Any)
>> strtab = cast(const(char)*)(info.dlpi_addr + dyn.d_un.d_ptr); // relocate
>> + else version (MIPS_Any)
>> + strtab = cast(const(char)*)(info.dlpi_addr + dyn.d_un.d_ptr); // relocate
>> else
>> strtab = cast(const(char)*)dyn.d_un.d_ptr;
>> }
>>
>>
>
> It's halfway through now, and confirm that I see no more failures in the
> testsuite, so I'm fairly confident that everything should be OK now,
> though I'll try building your package later.
>
> In case I don't get round to doing it myself this weekend, could a PR be
> raised in gcc bugzilla about it? This so I can reference it in
> backports to gdc-10 and gdc-9.
>
The logmake application runs just fine here. Fix has been committed to
gcc mainline, and backported to the version 9 and 10 release branches.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98806
Regards
Iain.
Reply to: