Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 901247

Summary: sys-devel/clang-15.0.7-r1: 'clang -target aarch64-windows' fails because of gentoo-hardened -fPIE option
Product: Gentoo Linux Reporter: Brendan Shanks <mrpippy>
Component: Current packagesAssignee: LLVM support project <llvm>
Status: RESOLVED FIXED    
Severity: normal CC: sam
Priority: Normal Keywords: PullRequest
Version: unspecified   
Hardware: ARM64   
OS: Linux   
See Also: https://bugs.gentoo.org/show_bug.cgi?id=912237
https://github.com/gentoo/gentoo/pull/32367
Whiteboard:
Package list:
Runtime testing required: ---

Description Brendan Shanks 2023-03-14 22:22:48 UTC
On ARM64 with clang-15.0.7-r1, running 'clang -target aarch64-windows -o test test.c' fails with:

clang-15: error: unsupported option '-fPIE' for target 'aarch64-unknown-windows-msvc'

'-fPIE' is being added by /etc/clang/gentoo-hardened.cfg.
Creating an empty '/etc/clang/aarch64-unknown-windows-msvc-clang.cfg' fixes the problem.

On ARM64, Wine requires clang and uses 'clang -target aarch64-windows'.

Reproducible: Always
Comment 1 Viorel Munteanu gentoo-dev 2023-03-17 08:13:24 UTC
Please add the output of emerge --info.
Comment 2 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-03-22 04:44:32 UTC
This is kind of an interesting-annoying one. We could just install the config file only for the native CHOST and let cross people be. I feel like that's probably the best course of action.
Comment 3 Larry the Git Cow gentoo-dev 2023-08-18 09:22:57 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=43a24d68531ab4ca9ad83d686a620cd2937dbf4f

commit 43a24d68531ab4ca9ad83d686a620cd2937dbf4f
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2023-08-18 02:06:05 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2023-08-18 09:22:32 +0000

    sys-devel/clang-common: only add default configs (e.g. -fPIE) for native tools
    
    We don't want to add our configs to 'clang', 'clang++', etc because that might
    be used for crosscompilation.
    
    Use the prefixed CHOST versions instead.
    
    [I suspect I didn't do this before because the old config logic, before we improved
    it upstream, didn't have the fallback behaviour for clang->${CHOST}-clang or similar.]
    
    Closes: https://bugs.gentoo.org/901247
    Closes: https://bugs.gentoo.org/912237
    Signed-off-by: Sam James <sam@gentoo.org>

 sys-devel/clang-common/clang-common-17.0.0.9999.ebuild               | 5 ++++-
 sys-devel/clang-common/clang-common-17.0.0_rc2-r1.ebuild             | 5 ++++-
 sys-devel/clang-common/clang-common-18.0.0.9999.ebuild               | 5 ++++-
 sys-devel/clang-common/clang-common-18.0.0_pre20230803.ebuild        | 5 ++++-
 ..._pre20230810.ebuild => clang-common-18.0.0_pre20230810-r1.ebuild} | 5 ++++-
 5 files changed, 20 insertions(+), 5 deletions(-)