diff mbox series

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

Message ID 20250807024618.1819516-1-raj.khem@gmail.com
State New
Headers show
Series systemd: Disable linker GCS warning on aarch64 when using compiler-rt | expand

Commit Message

Khem Raj Aug. 7, 2025, 2:46 a.m. UTC
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

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-core/systemd/systemd_257.6.bb | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Khem Raj Aug. 7, 2025, 9:32 p.m. UTC | #1
I have sent a fix which is a backport from llvm upstream to fix compiler-rt

https://lore.kernel.org/openembedded-core/20250807212937.2927262-1-raj.khem@gmail.com/T/#u

Please use that patch, this means that this patch is no longer needed. So please
drop it from staging branches

On Wed, Aug 6, 2025 at 7:46 PM Khem Raj <raj.khem@gmail.com> wrote:
>
> 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
>
> Signed-off-by: Khem Raj <raj.khem@gmail.com>
> ---
>  meta/recipes-core/systemd/systemd_257.6.bb | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/meta/recipes-core/systemd/systemd_257.6.bb b/meta/recipes-core/systemd/systemd_257.6.bb
> index adc27f6cff1..b487683f5f8 100644
> --- a/meta/recipes-core/systemd/systemd_257.6.bb
> +++ b/meta/recipes-core/systemd/systemd_257.6.bb
> @@ -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 \
Mathieu Dubois-Briand Aug. 8, 2025, 5:35 a.m. UTC | #2
On Thu Aug 7, 2025 at 11:32 PM CEST, Khem Raj via lists.openembedded.org wrote:
> I have sent a fix which is a backport from llvm upstream to fix compiler-rt
>
> https://lore.kernel.org/openembedded-core/20250807212937.2927262-1-raj.khem@gmail.com/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.
diff mbox series

Patch

diff --git a/meta/recipes-core/systemd/systemd_257.6.bb b/meta/recipes-core/systemd/systemd_257.6.bb
index adc27f6cff1..b487683f5f8 100644
--- a/meta/recipes-core/systemd/systemd_257.6.bb
+++ b/meta/recipes-core/systemd/systemd_257.6.bb
@@ -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 \