]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libphobos: Fix executables segfault on mipsel architecture
authorIain Buclaw <ibuclaw@gdcproject.org>
Sat, 23 Jan 2021 23:20:25 +0000 (00:20 +0100)
committerIain Buclaw <ibuclaw@gdcproject.org>
Sun, 24 Jan 2021 00:08:21 +0000 (01:08 +0100)
The dynamic section on MIPS is read-only, but this was not properly
handled in the runtime library.  The segfault only occurred for programs
that linked to the shared libphobos library.

libphobos/ChangeLog:

PR d/98806
* libdruntime/gcc/sections/elf_shared.d (MIPS_Any): Declare version
for MIPS32 and MIPS64.
(getDependencies): Adjust dlpi_addr on MIPS_Any.

(cherry picked from commit 81f928ec8e8abf1f21c5ff008c39b5d6af78f6cb)

libphobos/libdruntime/gcc/sections/elf_shared.d

index 59e2dd60a1feddfdc67a73d2023fa7fc5a504b87..64f89c13393011d0f0518a659400fed08e78fac7 100644 (file)
@@ -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;
                 }