Skip to contentSkip to conversation

systemd: Disable linker GCS warning on aarch64 when using compiler-rt

PATCH In review Khem Raj 2 participants 3 messages Aug 7, 2025 – Aug 8, 2025

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

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]

[1] https://git.openembedded.org/openembedded-core/commit/meta/recipes-core/systemd?id=295e30eac69e152778246c7271b72f7e8498a40a

---
 meta/recipes-core/systemd/systemd_257.6.bb | 4 ++++
 1 file changed, 4 insertions(+)
meta/recipes-core/systemd/systemd_257.6.bb +4 -0
index adc27f6cff1..b487683f5f8 100644
@@ -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 \
author
#1 lore raw

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 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]

[1] https://git.openembedded.org/openembedded-core/commit/meta/recipes-core/systemd?id=295e30eac69e152778246c7271b72f7e8498a40a

---
 meta/recipes-core/systemd/systemd_257.6.bb | 4 ++++
 1 file changed, 4 insertions(+)
meta/recipes-core/systemd/systemd_257.6.bb +4 -0
index adc27f6cff1..b487683f5f8 100644
@@ -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 \
#2 lore raw
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