[1/3] gcompat: Do not use static-pie on ppc

Message ID 20220313075932.3031649-1-raj.khem@gmail.com
State Accepted, archived
Commit 6a8c1e04e2bf37fa4128b1742ef4184380e3321d
Headers show
Series [1/3] gcompat: Do not use static-pie on ppc | expand

Commit Message

Khem Raj March 13, 2022, 7:59 a.m. UTC
It fails currently with binutils 2.38
powerpc-yoe-linux-musl-ld: read-only segment has dynamic relocations

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...Static-PIE-does-not-work-on-musl-ppc.patch | 30 +++++++++++++++++++
 meta/recipes-core/musl/gcompat_git.bb         |  7 +++--
 2 files changed, 35 insertions(+), 2 deletions(-)
 create mode 100644 meta/recipes-core/musl/gcompat/0001-make-Static-PIE-does-not-work-on-musl-ppc.patch

Patch

diff --git a/meta/recipes-core/musl/gcompat/0001-make-Static-PIE-does-not-work-on-musl-ppc.patch b/meta/recipes-core/musl/gcompat/0001-make-Static-PIE-does-not-work-on-musl-ppc.patch
new file mode 100644
index 00000000000..1d731163d07
--- /dev/null
+++ b/meta/recipes-core/musl/gcompat/0001-make-Static-PIE-does-not-work-on-musl-ppc.patch
@@ -0,0 +1,30 @@ 
+From 01180e78fe9568e7fb2673ba61801c42f0f70115 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Fri, 11 Mar 2022 10:37:51 -0800
+Subject: [PATCH] make: Static PIE does not work on musl/ppc
+
+Fixes linker error e.g.
+"read-only segment has dynamic relocations"
+
+Upstream-Status: Inappropriate [OE specific]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ Makefile | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/Makefile b/Makefile
+index cbb7634..69ee228 100644
+--- a/Makefile
++++ b/Makefile
+@@ -76,7 +76,7 @@ ${LIBGCOMPAT_NAME}: ${LIBGCOMPAT_OBJ}
+ ${LIBGCOMPAT_OBJ}: ${LIBGCOMPAT_INCLUDE}
+ 
+ ${LOADER_NAME}: ${LOADER_OBJ}
+-	${CC} ${CFLAGS} ${LDFLAGS} -static-pie -o ${LOADER_NAME} ${LOADER_OBJ}
++	${CC} ${CFLAGS} ${LDFLAGS} -static -o ${LOADER_NAME} ${LOADER_OBJ}
+ 
+ .c.o:
+ 	${CC} ${CPPFLAGS} ${CFLAGS} -c -D_BSD_SOURCE \
+-- 
+2.35.1
+
diff --git a/meta/recipes-core/musl/gcompat_git.bb b/meta/recipes-core/musl/gcompat_git.bb
index cab1a97a84d..962bcd8c75f 100644
--- a/meta/recipes-core/musl/gcompat_git.bb
+++ b/meta/recipes-core/musl/gcompat_git.bb
@@ -7,8 +7,11 @@  HOMEPAGE = "https://git.adelielinux.org/adelie/gcompat"
 LICENSE = "NCSA"
 LIC_FILES_CHKSUM = "file://LICENSE;md5=eb33ef4af05a9c7602843afb7adfe792"
 
-SRC_URI = "git://git.adelielinux.org/adelie/gcompat.git;protocol=https;branch=current"
-
+SRC_URI = "git://git.adelielinux.org/adelie/gcompat.git;protocol=https;branch=current \
+          "
+SRC_URI:append:powerpc = "\
+           file://0001-make-Static-PIE-does-not-work-on-musl-ppc.patch \
+           "
 PV = "1.0.0+1.1+git${SRCPV}"
 SRCREV = "4d6a5156a6eb7f56b30d93853a872e36dadde81b"