systemd: Disable linker GCS warning on aarch64 when using compiler-rt
PATCH 1/1 systemd: Disable linker GCS warning on aarch64 when using compiler-rt
when Distros set TC_RUNTIME_CXX = 'llvm', it will use LLVM provided runtime libraries for unwinding/Compiler-builtins and C++ runtime ( compiler-rt/libunwind/libc++ ), systemd -> libc++ -> compiler-rt, assembly routines in compiler-rt are not GCS compliant so the link step for libc++.so does not emit this into .note.gnu.property section
Displaying notes found in: .note.gnu.property
Owner Data size Description GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0
Properties: AArch64 feature: BTI, PAC
it should have been
Properties: AArch64 feature: BTI, PAC, GCS
if it has GCS support.
When libsystemd links the C++ standard library then it also does not get the GCS flags and it gets reported when some tests in systemd tries to link with libsystemd. The reason for warning-as-error is same as [1]
--- meta/recipes-core/systemd/systemd_257.6.bb | 4 ++++ 1 file changed, 4 insertions(+)
meta/recipes-core/systemd/systemd_257.6.bb +4 -0
@@ -240,6 +240,10 @@ RESOLV_CONF ??= "" # the eBPFs, so that it can find needed system includes in there. CFLAGS:append = " --sysroot=${STAGING_DIR_TARGET}" LDFLAGS:append:aarch64 = " ${@bb.utils.contains('PACKAGECONFIG', 'openssl', '-Wl,-z,gcs-report-dynamic=none', '', d)}" +# compiler-rt assembly routines do not yet support GCS +# see - https://github.com/llvm/llvm-project/issues/152427 +# check again when this gets implemented in compiler-rt to remove it +LDFLAGS:append:aarch64 = "${@bb.utils.contains('TC_CXX_RUNTIME', 'llvm', ' -Wl,-z,gcs-report-dynamic=none', '', d)}" EXTRA_OEMESON += "-Dnobody-user=nobody \ -Dnobody-group=nogroup \
I have sent a fix which is a backport from llvm upstream to fix compiler-rt
https://lore.kernel.org/openembedded-core/[email protected]/T/#u
Please use that patch, this means that this patch is no longer needed. So please drop it from staging branches
Quoted 45 lines · Khem Raj
when Distros set
TC_RUNTIME_CXX= 'llvm', it will use LLVM provided runtime libraries for unwinding/Compiler-builtins and C++ runtime ( compiler-rt/libunwind/libc++ ), systemd -> libc++ -> compiler-rt, assembly routines in compiler-rt are not GCS compliant so the link step for libc++.so does not emit this into .note.gnu.property sectionDisplaying notes found in: .note.gnu.property
Owner Data size Description GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0Properties: AArch64 feature: BTI, PAC
it should have been
Properties: AArch64 feature: BTI, PAC, GCS
if it has GCS support.
When libsystemd links the C++ standard library then it also does not get the GCS flags and it gets reported when some tests in systemd tries to link with libsystemd. The reason for warning-as-error is same as [1]
Signed-off-by Khem Raj <[email protected]>--- meta/recipes-core/systemd/systemd_257.6.bb | 4 ++++ 1 file changed, 4 insertions(+)meta/recipes-core/systemd/systemd_257.6.bb +4
-0@@ -240,6 +240,10 @@ RESOLV_CONF ??= "" # the eBPFs, so that it can find needed system includes in there. CFLAGS:append = " --sysroot=${STAGING_DIR_TARGET}" LDFLAGS:append:aarch64 = " ${@bb.utils.contains('PACKAGECONFIG', 'openssl', '-Wl,-z,gcs-report-dynamic=none', '', d)}" +# compiler-rt assembly routines do not yet support GCS +# see - https://github.com/llvm/llvm-project/issues/152427 +# check again when this gets implemented in compiler-rt to remove it +LDFLAGS:append:aarch64 = "${@bb.utils.contains('TC_CXX_RUNTIME', 'llvm', ' -Wl,-z,gcs-report-dynamic=none', '', d)}" EXTRA_OEMESON += "-Dnobody-user=nobody \ -Dnobody-group=nogroup \
Quoted 7 lines · Khem Raj via lists.openembedded.org
I have sent a fix which is a backport from llvm upstream to fix compiler-rt
https://lore.kernel.org/openembedded-core/[email protected]/T/#u
Please use that patch, this means that this patch is no longer needed. So please drop it from staging branches
Thanks Khem, I'm dropping this patch and taking the other one.
Signature · 3 lines
Mathieu Dubois-Briand, Bootlin Embedded Linux and Kernel engineering https://bootlin.com