[all-commits] [llvm/llvm-project] e5130a: [Driver][OpenBSD] Pass -pie for static PIE links (...
Keith Smiley via All-commits
all-commits at lists.llvm.org
Wed Sep 9 20:24:03 PDT 2026
Branch: refs/heads/release/23.x
Home: https://github.com/llvm/llvm-project
Commit: e5130a252e5de6a3bf28c93e3f7d8687c5c252ad
https://github.com/llvm/llvm-project/commit/e5130a252e5de6a3bf28c93e3f7d8687c5c252ad
Author: Angel J <github at sl.jrz.me>
Date: 2026-09-10 (Thu, 10 Sep 2026)
Changed paths:
M clang/lib/Driver/ToolChains/OpenBSD.cpp
M clang/test/Driver/openbsd.c
Log Message:
-----------
[Driver][OpenBSD] Pass -pie for static PIE links (#216907)
OpenBSD uses `rcrt0.o` for static PIE executables. This startup object
references the linker-defined `_DYNAMIC` symbol.
OpenBSD's system linker defaults to PIE, which previously masked the
missing driver flag. An LLD cross-linker built on a non-OpenBSD host
does not share that default. Consequently,
`clang --target=...-openbsd -static` selects `rcrt0.o`, but LLD does not
create `_DYNAMIC`, causing the link to fail.
(cherry picked from commit 118efe7680bdc010ab984f8ae4505699f53bbca6)
Commit: 24ba344c56c5d156397c09d503b6482f27e1ee6b
https://github.com/llvm/llvm-project/commit/24ba344c56c5d156397c09d503b6482f27e1ee6b
Author: Keith Smiley <keithbsmiley at gmail.com>
Date: 2026-09-10 (Thu, 10 Sep 2026)
Changed paths:
M clang/lib/Driver/ToolChains/OpenBSD.cpp
M clang/test/Driver/openbsd.c
M clang/test/Driver/pic.c
Log Message:
-----------
[Driver][OpenBSD] Use -no-pie instead of -nopie (#220464)
Downstream in OpenBSD there is a patch to add support for -nopie in lld
(which it has used by default since 2018). In this repo lld does not
support `-nopie`, so when building clang and lld, you cannot link an
executable with `clang -fno-pic`. Clang now uses the more widely used
spelling here so that toolchains built from this repo can cross compile
to OpenBSD successfully.
This change is an issue on OpenBSD if users passed a different linker
with `-fuse-ld` / `--ld-path` to `ld.bfd` which is still installed by
default but doesn't support the `-no-pie` spelling with their patches.
(cherry picked from commit a2171756dd5d690faf30bafe63810d1dc6cdb342)
Compare: https://github.com/llvm/llvm-project/compare/e280c5056ed1...24ba344c56c5
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list