Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 901247 - sys-devel/clang-15.0.7-r1: 'clang -target aarch64-windows' fails because of gentoo-hardened -fPIE option
Summary: sys-devel/clang-15.0.7-r1: 'clang -target aarch64-windows' fails because of g...
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: ARM64 Linux
: Normal normal (vote)
Assignee: LLVM support project
Keywords: PullRequest
Depends on:
Reported: 2023-03-14 22:22 UTC by Brendan Shanks
Modified: 2023-08-18 09:22 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Note You need to log in before you can comment on or make changes to this bug.
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):

commit 43a24d68531ab4ca9ad83d686a620cd2937dbf4f
Author:     Sam James <>
AuthorDate: 2023-08-18 02:06:05 +0000
Commit:     Sam James <>
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.]
    Signed-off-by: Sam James <>

 sys-devel/clang-common/clang-common-               | 5 ++++-
 sys-devel/clang-common/clang-common-17.0.0_rc2-r1.ebuild             | 5 ++++-
 sys-devel/clang-common/clang-common-               | 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(-)