Monday, August 28, 2023

Fix lang/php/{8.1,8.2} build on mips64

Building lang/php/{8.1,8.2} fails on mips64:

/usr/bin/ld: Zend/asm/.libs/make_mips64_n64_elf_gas.o: CALL16 reloc at 0x14 not against global symbol
Zend/asm/.libs/make_mips64_n64_elf_gas.o: could not read symbols: Bad value
cc: error: linker command failed with exit code 1 (use -v to see invocation)

Make the offending symbol explicitly local so that the assembler
produces a local GOT reference. This fixes the build.

Index: 8.1/patches/patch-Zend_asm_make_mips64_n64_elf_gas_S
===================================================================
RCS file: 8.1/patches/patch-Zend_asm_make_mips64_n64_elf_gas_S
diff -N 8.1/patches/patch-Zend_asm_make_mips64_n64_elf_gas_S
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ 8.1/patches/patch-Zend_asm_make_mips64_n64_elf_gas_S 28 Aug 2023 15:04:01 -0000
@@ -0,0 +1,13 @@
+Avoid an incorrect R_MIPS_CALL16 relocation with a local symbol.
+
+Index: Zend/asm/make_mips64_n64_elf_gas.S
+--- Zend/asm/make_mips64_n64_elf_gas.S.orig
++++ Zend/asm/make_mips64_n64_elf_gas.S
+@@ -70,6 +70,7 @@ make_fcontext:
+ sd $gp, 136($v0)
+
+ # psudo instruction compute abs address of label finish based on GP
++ .local finish
+ dla $t9, finish
+
+ # save address of finish as return-address for context-function
Index: 8.2/patches/patch-Zend_asm_make_mips64_n64_elf_gas_S
===================================================================
RCS file: 8.2/patches/patch-Zend_asm_make_mips64_n64_elf_gas_S
diff -N 8.2/patches/patch-Zend_asm_make_mips64_n64_elf_gas_S
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ 8.2/patches/patch-Zend_asm_make_mips64_n64_elf_gas_S 28 Aug 2023 15:04:01 -0000
@@ -0,0 +1,13 @@
+Avoid an incorrect R_MIPS_CALL16 relocation with a local symbol.
+
+Index: Zend/asm/make_mips64_n64_elf_gas.S
+--- Zend/asm/make_mips64_n64_elf_gas.S.orig
++++ Zend/asm/make_mips64_n64_elf_gas.S
+@@ -70,6 +70,7 @@ make_fcontext:
+ sd $gp, 136($v0)
+
+ # psudo instruction compute abs address of label finish based on GP
++ .local finish
+ dla $t9, finish
+
+ # save address of finish as return-address for context-function

No comments:

Post a Comment