diff --git a/clang/lib/Basic/Targets/OSTargets.h b/clang/lib/Basic/Targets/OSTargets.h --- a/clang/lib/Basic/Targets/OSTargets.h +++ b/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; diff --git a/clang/lib/Driver/ToolChains/Haiku.h b/clang/lib/Driver/ToolChains/Haiku.h --- a/clang/lib/Driver/ToolChains/Haiku.h +++ b/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, diff --git a/clang/test/Driver/pic.c b/clang/test/Driver/pic.c --- a/clang/test/Driver/pic.c +++ b/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 diff --git a/clang/test/Sema/tls.c b/clang/test/Sema/tls.c --- a/clang/test/Sema/tls.c +++ b/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;