[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#980204: gdc: Resulting executables segfault on mipsel architecture (signal 11)



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.

Regards,
Iain.


Reply to: