[PATCH] D159390: Haiku: Enable thread-local storag, disable PIE / enable PIC by default

Brad Smith via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Sep 2 23:03:27 PDT 2023


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG99be6b6d598f: Haiku: Enable thread-local storag, disable PIE / enable PIC by default (authored by Jerome Duval <jerome.duval at gmail.com>, committed by brad).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D159390/new/

https://reviews.llvm.org/D159390

Files:
  clang/lib/Basic/Targets/OSTargets.h
  clang/lib/Driver/ToolChains/Haiku.h
  clang/test/Driver/pic.c
  clang/test/Sema/tls.c


Index: clang/test/Sema/tls.c
===================================================================
--- clang/test/Sema/tls.c
+++ clang/test/Sema/tls.c
@@ -16,7 +16,8 @@
 // RUN: %clang_cc1 -triple x86_64-pc-openbsd -fsyntax-only %s
 // RUN: %clang_cc1 -triple i386-pc-openbsd -fsyntax-only %s
 
-// Haiku does not support TLS.
-// RUN: not %clang_cc1 -triple i586-pc-haiku -fsyntax-only %s
+// Haiku supports TLS.
+// RUN: %clang_cc1 -triple x86_64-unknown-haiku -fsyntax-only %s
+// RUN: %clang_cc1 -triple i586-pc-haiku -fsyntax-only %s
 
 __thread int x;
Index: clang/test/Driver/pic.c
===================================================================
--- clang/test/Driver/pic.c
+++ clang/test/Driver/pic.c
@@ -324,3 +324,9 @@
 // RUN:   -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-PIC-DATA-TEXT-REL-NON-SYSTEMZ
 // RUN: not %clang -fpic -c --target=arm-arm-none-eabi -mpic-data-is-text-relative %s \
 // RUN:   -### 2>&1 | FileCheck %s --check-prefix=CHECK-PIC-DATA-TEXT-REL-NON-SYSTEMZ
+
+// On Haiku, PIC is enabled by default, and PIE is disabled by default.
+// RUN: %clang -c %s --target=x86_64-unknown-haiku -### 2>&1 \
+// RUN:   | FileCheck %s --check-prefix=CHECK-PIC2
+// RUN: %clang -c %s --target=i586-pc-haiku -### 2>&1 \
+// RUN:   | FileCheck %s --check-prefix=CHECK-PIC2
Index: clang/lib/Driver/ToolChains/Haiku.h
===================================================================
--- clang/lib/Driver/ToolChains/Haiku.h
+++ clang/lib/Driver/ToolChains/Haiku.h
@@ -22,9 +22,7 @@
   Haiku(const Driver &D, const llvm::Triple &Triple,
           const llvm::opt::ArgList &Args);
 
-  bool isPIEDefault(const llvm::opt::ArgList &Args) const override {
-    return getTriple().getArch() == llvm::Triple::x86_64;
-  }
+  bool isPICDefault() const override { return true; }
 
   void AddClangSystemIncludeArgs(
       const llvm::opt::ArgList &DriverArgs,
Index: clang/lib/Basic/Targets/OSTargets.h
===================================================================
--- clang/lib/Basic/Targets/OSTargets.h
+++ clang/lib/Basic/Targets/OSTargets.h
@@ -268,7 +268,6 @@
     this->IntPtrType = TargetInfo::SignedLong;
     this->PtrDiffType = TargetInfo::SignedLong;
     this->ProcessIDType = TargetInfo::SignedLong;
-    this->TLSSupported = false;
     switch (Triple.getArch()) {
     default:
       break;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D159390.555614.patch
Type: text/x-patch
Size: 2330 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230903/ef1cc0be/attachment.bin>


More information about the cfe-commits mailing list