9878662e8a
- Add patch to fix ARM builds: * ldc-1.9.0-fix_arm_build.patch - Update to 1.9.0 and use 0.17.5 to bootstrap - Add patch to fix rpmlint error: * ldc-0.17.5-add_missing_include.patch - Add patches to add LLVM6 support: * ldc-0.17.5-add_support_to_LLVM6.patch * ldc-0.17.5-backport_pr_2315.patch - Add patch to be able to use ldc: * ldc-0.17.5-default-to-pic.patch - update to version 0.17.5: * Added LLVM 5.0 support. * druntime: fixes for Android and addition of core.math.yl2x[p1]() for x86(_64) targets. * dmd-testsuite: backported runnable/cppa.d fix for GCC > 5. * CI updates. OBS-URL: https://build.opensuse.org/request/show/614484 OBS-URL: https://build.opensuse.org/package/show/devel:languages:D/ldc?expand=0&rev=14
34 lines
1.5 KiB
Diff
34 lines
1.5 KiB
Diff
From d9496882163e173ea718756a7fb0cbc627c5326f Mon Sep 17 00:00:00 2001
|
|
From: Matthias Klumpp <matthias@tenstral.net>
|
|
Date: Tue, 2 Aug 2016 17:10:09 +0200
|
|
Subject: [PATCH] Default to PIC code on Linux
|
|
|
|
Modern Linux distributions have their toolchain generate PIC code for
|
|
additional security features (like ASLR).
|
|
Since there is no (sane) way to detect whether the toolchain defaults to
|
|
PIC code, we simply default to PIC code on all Linux
|
|
distributions to avoid linking issues on these OSes.
|
|
|
|
The relocation model can be switched back to non-PIC code manually at
|
|
any time.
|
|
---
|
|
driver/targetmachine.cpp | 5 ++++-
|
|
1 file changed, 4 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/driver/targetmachine.cpp b/driver/targetmachine.cpp
|
|
index 1a0fddf70..987be4263 100644
|
|
--- a/driver/targetmachine.cpp
|
|
+++ b/driver/targetmachine.cpp
|
|
@@ -528,7 +528,10 @@ llvm::TargetMachine *createTargetMachine(
|
|
// Darwin defaults to PIC (and as of 10.7.5/LLVM 3.1-3.3, TLS use leads
|
|
// to crashes for non-PIC code). LLVM doesn't handle this.
|
|
relocModel = llvm::Reloc::PIC_;
|
|
- } else if (triple.getEnvironment() == llvm::Triple::Android) {
|
|
+ } else if (triple.isOSLinux()) {
|
|
+ // Modern Linux distributions have their toolchain generate PIC code for additional security
|
|
+ // features (like ASLR). We default to PIC code to avoid linking issues on these OSes.
|
|
+ // On Android, PIC is default as well.
|
|
relocModel = llvm::Reloc::PIC_;
|
|
} else {
|
|
// ARM for other than Darwin or Android defaults to static
|