diff options
author | Gunnar Beutner <gbeutner@serenityos.org> | 2021-05-02 01:33:12 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-05-03 08:42:39 +0200 |
commit | d685db6eb665885be85f0e5f6464d93a2de27fec (patch) | |
tree | 0c197e2acc6b3b67949e9969d2ffd6eb9b8241b0 /Toolchain | |
parent | a050b4329057bb61acdd67b836a8bf09d7ab366b (diff) | |
download | serenity-d685db6eb665885be85f0e5f6464d93a2de27fec.zip |
Toolchain: Enable building all code with -fPIC
Ordinarily this would force the compiler to not inline certain
symbols and call them via the PLT instead. To counteract this
I've also added -fno-semantic-interposition which disables
ELF symbol interposition. Our dynamic loader doesn't support
this anyway and we might even consider not implementing this
at all.
Even though this is a toolchain change this doesn't require
rebuilding the toolchain unless you're planning to build
for the x86_64 arch.
Diffstat (limited to 'Toolchain')
-rw-r--r-- | Toolchain/Patches/gcc.patch | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Toolchain/Patches/gcc.patch b/Toolchain/Patches/gcc.patch index 6d4f2840ed..39f5eefd91 100644 --- a/Toolchain/Patches/gcc.patch +++ b/Toolchain/Patches/gcc.patch @@ -129,7 +129,7 @@ diff -Naur gcc-11.1.0-RC-20210420/gcc/config/serenity.h gcc-11.1.0-RC-20210420.s +#define LINK_SPEC "%{shared:-shared} %{static:-static} %{!static: %{rdynamic:-export-dynamic} %{!fbuilding-libgcc:-lgcc_s -dynamic-linker /usr/lib/Loader.so}}" + +#undef CC1_SPEC -+#define CC1_SPEC "-fno-exceptions -ftls-model=initial-exec" ++#define CC1_SPEC "-fno-exceptions -ftls-model=initial-exec %{!fno-pic:%{!fno-PIC:%{!fpic:%{!fPIC: -fPIC}}}} -fno-semantic-interposition" + +#undef CC1PLUS_SPEC +#define CC1PLUS_SPEC "-fno-exceptions -ftls-model=initial-exec" |