diff mbox series

[committed] libphobos: Fix executables segfault on mipsel architecture

Message ID 20210124001141.1005325-1-ibuclaw@gdcproject.org
State New
Headers show
Series [committed] libphobos: Fix executables segfault on mipsel architecture | expand

Commit Message

Iain Buclaw Jan. 24, 2021, 12:11 a.m. UTC
Hi,

This patch fixes an issue running programs linked to the shared
libphobos library on MIPS.  The dynamic section on MIPS is read-only,
but this was not properly handled in the runtime library.

Bootstrapped and regression tested on mipsel-linux-gnu, and committed to
mainline with backports to the releases/gcc-10 and gcc-9 branches.

Regards
Iain

---
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.
---
 libphobos/libdruntime/gcc/sections/elf_shared.d | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/libphobos/libdruntime/gcc/sections/elf_shared.d b/libphobos/libdruntime/gcc/sections/elf_shared.d
index 9050413b261..427759a4f94 100644
--- 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;
                 }