Skip to contentSkip to conversation

gcompat: Do not use static-pie on ppc

PATCH In review Khem Raj 2 participants 5 messages Mar 13, 2022 – Mar 14, 2022

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

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

It fails currently with binutils 2.38
powerpc-yoe-linux-musl-ld: read-only segment has dynamic relocations

---
 ...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
meta/recipes-core/musl/gcompat/0001-make-Static-PIE-does-not-work-on-musl-ppc.patch new file +30 -0
new file mode 100644
index 00000000000..1d731163d07
@@ -0,0 +1,30 @@
+From 01180e78fe9568e7fb2673ba61801c42f0f70115 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+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 <[email protected]>
+---
+ 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
+
meta/recipes-core/musl/gcompat_git.bb +5 -2
index cab1a97a84d..962bcd8c75f 100644
@@ -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"
 
Signature · 1 line
2.35.1
author
#1 lore raw

PATCH 2/3 linux-yocto: Ignore textrels for ppc64 kernel

---
 meta/recipes-kernel/linux/linux-yocto_5.15.bb | 3 +++
 1 file changed, 3 insertions(+)
meta/recipes-kernel/linux/linux-yocto_5.15.bb +3 -0
index b9715e71eec..9a147023e83 100644
@@ -66,3 +66,6 @@ KERNEL_FEATURES:append:qemux86-64=" cfg/sound.scc cfg/paravirt_kvm.scc"
 KERNEL_FEATURES:append = " ${@bb.utils.contains("TUNE_FEATURES", "mx32", " cfg/x32.scc", "", d)}"
 KERNEL_FEATURES:append = " ${@bb.utils.contains("DISTRO_FEATURES", "ptest", " features/scsi/scsi-debug.scc", "", d)}"
 KERNEL_FEATURES:append = " ${@bb.utils.contains("DISTRO_FEATURES", "ptest", " features/gpio/mockup.scc", "", d)}"
+
+INSANE_SKIP:kernel-vmlinux:qemuppc64 = "textrel"
+
Signature · 1 line
2.35.1
#2 lore raw

Re: [OE-core] [PATCH 2/3] linux-yocto: Ignore textrels for ppc64 kernel

Quoted 19 lines · Khem Raj
---
 meta/recipes-kernel/linux/linux-yocto_5.15.bb | 3 +++
 1 file changed, 3 insertions(+)
meta/recipes-kernel/linux/linux-yocto_5.15.bb +0 -0
index b9715e71eec..9a147023e83 100644
@@ -66,3 +66,6 @@ KERNEL_FEATURES:append:qemux86-64=" cfg/sound.scc

cfg/paravirt_kvm.scc"
KERNEL_FEATURES:append = " ${@bb.utils.contains("TUNE_FEATURES", "mx32",
" cfg/x32.scc", "", d)}"
KERNEL_FEATURES:append = " ${@bb.utils.contains("DISTRO_FEATURES",
"ptest", " features/scsi/scsi-debug.scc", "", d)}"
KERNEL_FEATURES:append = " ${@bb.utils.contains("DISTRO_FEATURES",
"ptest", " features/gpio/mockup.scc", "", d)}"

meta/recipes-kernel/linux/linux-yocto_5.15.bb KERNEL_FEATURES:append:qemux86-64=" cfg/sound.scc cfg/paravirt_kvm.scc" · line 70

Quoted 2 lines
meta/recipes-kernel/linux/linux-yocto_5.15.bb +2 -0
+
+INSANE_SKIP:kernel-vmlinux:qemuppc64 = "textrel"

Fine with me. We could also do the same tweak to linux-yocto-dev, when I'm back from vacation, I'll check on that (if I don't see anything on the list).

Bruce

Quoted 16 lines

+
--
2.35.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#163103):
https://lists.openembedded.org/g/openembedded-core/message/163103
Mute This Topic: https://lists.openembedded.org/mt/89747768/1050810
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Signature · 3 lines
- Thou shalt not follow the NULL pointer, for chaos and madness await thee
at its end
- "Use the force Harry" - Gandalf, Star Trek II
author
#3 lore raw

Re: [OE-core] [PATCH 2/3] linux-yocto: Ignore textrels for ppc64 kernel

Quoted 10 lines · Bruce Ashfield
Quoted 6 lines · Khem Raj
---
 meta/recipes-kernel/linux/linux-yocto_5.15.bb | 3 +++
 1 file changed, 3 insertions(+)
Quoted 13 lines

meta/recipes-kernel/linux/linux-yocto_5.15.bb KERNEL_FEATURES:append:qemux86-64=" cfg/sound.scc cfg/paravirt_kvm.scc" · line 70

Quoted 10 lines
meta/recipes-kernel/linux/linux-yocto_5.15.bb +2 -0
index b9715e71eec..9a147023e83 100644
@@ -66,3 +66,6 @@ KERNEL_FEATURES:append:qemux86-64=" cfg/sound.scc cfg/paravirt_kvm.scc"
 KERNEL_FEATURES:append = " ${@bb.utils.contains("TUNE_FEATURES", "mx32", " cfg/x32.scc", "", d)}"
 KERNEL_FEATURES:append = " ${@bb.utils.contains("DISTRO_FEATURES", "ptest", " features/scsi/scsi-debug.scc", "", d)}"
 KERNEL_FEATURES:append = " ${@bb.utils.contains("DISTRO_FEATURES", "ptest", " features/gpio/mockup.scc", "", d)}"
+
+INSANE_SKIP:kernel-vmlinux:qemuppc64 = "textrel"

Fine with me. We could also do the same tweak to linux-yocto-dev, when I'm back from vacation, I'll check on that (if I don't see anything on the list).

I have seen same on latest master as well yes. but scanelf results in no relocations so I wonder why this section is generated into vmlinux first of all
secondly, I think our textrel QA check could be made a bit more accurate by checking for relocations rather than presense of dynamic section alone
as trigger point.

I am also think that we should perhaps take advantage of linker option now a days to flag these textrels during linking stage itself by enabling
--enable-textrel-check=[yes|no|warning|error] configure option perhaps set it to 'warn' for now and then turn it into 'error' later when things are settled.

Quoted 24 lines

Bruce

Quoted 6 lines
meta/recipes-kernel/linux/linux-yocto_5.15.bb +1 -1
+
--

2.35.1

Quoted 8 lines

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#163103): https://lists.openembedded.org/g/openembedded-core/message/163103
Mute This Topic: https://lists.openembedded.org/mt/89747768/1050810
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

--
- Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end
- "Use the force Harry" - Gandalf, Star Trek II

author
#4 lore raw

PATCH 3/3 binutils: Bump to latest 2.38 release branch

In reply to Khem Raj

Fixes building ppc32 kernels

Brings following fixes

* 2d92604cd30 Revert "Check thin archive element file size against archive header"
* ed9b2e40ebf binutils 2.38 vs. ppc32 linux kernel
* 40d32f56f63 Updated Serbian translations for the bfd, gold, ld and opcodes directories
* 6aa1b7df2fc ld: Keep indirect symbol from IR if referenced from shared object
* ae1cab7d3f3 i386: Update I386_NEED_DYNAMIC_RELOC_TYPE_P for DT_TEXTREL
* df9071487a8 PR28882, build failure with gcc-4.2 due to use of 0b literals
* caa6172de4b x86: Disallow invalid relocation against protected symbol

---
 meta/recipes-devtools/binutils/binutils-2.38.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-devtools/binutils/binutils-2.38.inc +1 -1
index 4ce74f94bfa..3544c0c7e7c 100644
@@ -18,7 +18,7 @@ SRCBRANCH ?= "binutils-2_38-branch"
 
 UPSTREAM_CHECK_GITTAGREGEX = "binutils-(?P<pver>\d+_(\d_?)*)"
 
-SRCREV ?= "a96f7ba94b69b588bf524624ff2410b31420c957"
+SRCREV ?= "6938a3aca19044aeb9bc4b9564e04f9092a701ed"
 BINUTILS_GIT_URI ?= "git://sourceware.org/git/binutils-gdb.git;branch=${SRCBRANCH};protocol=git"
 SRC_URI = "\
      ${BINUTILS_GIT_URI} \
Signature · 1 line
2.35.1