r337660 - OpenBSD/arm has switched to float ABI SoftFP.
Author: brad Date: Sun Jul 22 14:39:54 2018 New Revision: 337660 URL: http://llvm.org/viewvc/llvm-project?rev=337660&view=rev Log: OpenBSD/arm has switched to float ABI SoftFP. Modified: cfe/trunk/lib/Driver/ToolChains/Arch/ARM.cpp cfe/trunk/test/Driver/openbsd.c Modified: cfe/trunk/lib/Driver/ToolChains/Arch/ARM.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Arch/ARM.cpp?rev=337660&r1=337659&r2=337660&view=diff == --- cfe/trunk/lib/Driver/ToolChains/Arch/ARM.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/Arch/ARM.cpp Sun Jul 22 14:39:54 2018 @@ -232,7 +232,7 @@ arm::FloatABI arm::getARMFloatABI(const break; case llvm::Triple::OpenBSD: - ABI = FloatABI::Soft; + ABI = FloatABI::SoftFP; break; default: Modified: cfe/trunk/test/Driver/openbsd.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/openbsd.c?rev=337660&r1=337659&r2=337660&view=diff == --- cfe/trunk/test/Driver/openbsd.c (original) +++ cfe/trunk/test/Driver/openbsd.c Sun Jul 22 14:39:54 2018 @@ -110,4 +110,4 @@ // Check ARM float ABI // RUN: %clang -target arm-unknown-openbsd -### -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK-ARM-FLOAT-ABI %s -// CHECK-ARM-FLOAT-ABI: "-mfloat-abi" "soft" +// CHECK-ARM-FLOAT-ABI: "-mfloat-abi" "softfp" ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r337663 - Fix the test
Author: brad Date: Sun Jul 22 15:04:28 2018 New Revision: 337663 URL: http://llvm.org/viewvc/llvm-project?rev=337663&view=rev Log: Fix the test Modified: cfe/trunk/test/Driver/openbsd.c Modified: cfe/trunk/test/Driver/openbsd.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/openbsd.c?rev=337663&r1=337662&r2=337663&view=diff == --- cfe/trunk/test/Driver/openbsd.c (original) +++ cfe/trunk/test/Driver/openbsd.c Sun Jul 22 15:04:28 2018 @@ -110,4 +110,5 @@ // Check ARM float ABI // RUN: %clang -target arm-unknown-openbsd -### -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK-ARM-FLOAT-ABI %s -// CHECK-ARM-FLOAT-ABI: "-mfloat-abi" "softfp" +// CHECK-ARM-FLOAT-ABI-NOT: "-target-feature" "+soft-float" +// CHECK-ARM-FLOAT-ABI: "-target-feature" "+soft-float-abi" ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r344257 - Some improvements to the OpenBSD driver.
Author: brad Date: Thu Oct 11 09:13:44 2018 New Revision: 344257 URL: http://llvm.org/viewvc/llvm-project?rev=344257&view=rev Log: Some improvements to the OpenBSD driver. - OpenBSD has switched to compiler_rt / libcxx - Fix sysroot and lib path handling - Some cleaning up Added: cfe/trunk/test/Driver/openbsd.cpp Modified: cfe/trunk/lib/Driver/ToolChains/OpenBSD.cpp cfe/trunk/lib/Driver/ToolChains/OpenBSD.h cfe/trunk/test/Driver/openbsd.c Modified: cfe/trunk/lib/Driver/ToolChains/OpenBSD.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/OpenBSD.cpp?rev=344257&r1=344256&r2=344257&view=diff == --- cfe/trunk/lib/Driver/ToolChains/OpenBSD.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/OpenBSD.cpp Thu Oct 11 09:13:44 2018 @@ -111,9 +111,9 @@ void openbsd::Linker::ConstructJob(Compi // handled somewhere else. Args.ClaimAllArgs(options::OPT_w); - if (getToolChain().getArch() == llvm::Triple::mips64) + if (ToolChain.getArch() == llvm::Triple::mips64) CmdArgs.push_back("-EB"); - else if (getToolChain().getArch() == llvm::Triple::mips64el) + else if (ToolChain.getArch() == llvm::Triple::mips64el) CmdArgs.push_back("-EL"); if (!Args.hasArg(options::OPT_nostdlib, options::OPT_shared)) { @@ -149,44 +149,40 @@ void openbsd::Linker::ConstructJob(Compi } if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles)) { +const char *crt0 = nullptr; +const char *crtbegin = nullptr; if (!Args.hasArg(options::OPT_shared)) { if (Args.hasArg(options::OPT_pg)) -CmdArgs.push_back( -Args.MakeArgString(getToolChain().GetFilePath("gcrt0.o"))); +crt0 = "gcrt0.o"; else if (Args.hasArg(options::OPT_static) && !Args.hasArg(options::OPT_nopie)) -CmdArgs.push_back( -Args.MakeArgString(getToolChain().GetFilePath("rcrt0.o"))); +crt0 = "rcrt0.o"; else -CmdArgs.push_back( -Args.MakeArgString(getToolChain().GetFilePath("crt0.o"))); - CmdArgs.push_back( - Args.MakeArgString(getToolChain().GetFilePath("crtbegin.o"))); +crt0 = "crt0.o"; + crtbegin = "crtbegin.o"; } else { - CmdArgs.push_back( - Args.MakeArgString(getToolChain().GetFilePath("crtbeginS.o"))); + crtbegin = "crtbeginS.o"; } - } - std::string Triple = getToolChain().getTripleString(); - if (Triple.substr(0, 6) == "x86_64") -Triple.replace(0, 6, "amd64"); - CmdArgs.push_back( - Args.MakeArgString("-L/usr/lib/gcc-lib/" + Triple + "/4.2.1")); - CmdArgs.push_back(Args.MakeArgString("-L/usr/lib")); +if (crt0) + CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath(crt0))); +CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath(crtbegin))); + } - Args.AddAllArgs(CmdArgs, {options::OPT_L, options::OPT_T_Group, -options::OPT_e, options::OPT_s, options::OPT_t, + Args.AddAllArgs(CmdArgs, options::OPT_L); + ToolChain.AddFilePathLibArgs(Args, CmdArgs); + Args.AddAllArgs(CmdArgs, {options::OPT_T_Group, options::OPT_e, +options::OPT_s, options::OPT_t, options::OPT_Z_Flag, options::OPT_r}); bool NeedsSanitizerDeps = addSanitizerRuntimes(ToolChain, Args, CmdArgs); bool NeedsXRayDeps = addXRayRuntime(ToolChain, Args, CmdArgs); - AddLinkerInputs(getToolChain(), Inputs, Args, CmdArgs, JA); + AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs, JA); if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs)) { if (D.CCCIsCXX()) { - if (getToolChain().ShouldLinkCXXStdlib(Args)) -getToolChain().AddCXXStdlibLibArgs(Args, CmdArgs); + if (ToolChain.ShouldLinkCXXStdlib(Args)) +ToolChain.AddCXXStdlibLibArgs(Args, CmdArgs); if (Args.hasArg(options::OPT_pg)) CmdArgs.push_back("-lm_p"); else @@ -202,7 +198,7 @@ void openbsd::Linker::ConstructJob(Compi } // FIXME: For some reason GCC passes -lgcc before adding // the default system libraries. Just mimic this for now. -CmdArgs.push_back("-lgcc"); +CmdArgs.push_back("-lcompiler_rt"); if (Args.hasArg(options::OPT_pthread)) { if (!Args.hasArg(options::OPT_shared) && Args.hasArg(options::OPT_pg)) @@ -218,21 +214,22 @@ void openbsd::Linker::ConstructJob(Compi CmdArgs.push_back("-lc"); } -CmdArgs.push_back("-lgcc"); +CmdArgs.push_back("-lcompiler_rt"); } if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles)) { +const char *crtend = nullptr; if (!Args.hasArg(options::OPT_shared)) - CmdArgs.push_back( - Args.MakeArgString(getToolChain().GetFilePath("crtend.o"))); + crtend = "crtend.o"; else - CmdArgs.push_back( - Args.MakeArgString(getToolChain().GetFilePath("crtendS.o"))); + crtend = "crtendS.o";
r345439 - Pass the nopie flag to the linker when linking with -pg.
Author: brad Date: Fri Oct 26 17:23:28 2018 New Revision: 345439 URL: http://llvm.org/viewvc/llvm-project?rev=345439&view=rev Log: Pass the nopie flag to the linker when linking with -pg. Modified: cfe/trunk/lib/Driver/ToolChains/OpenBSD.cpp cfe/trunk/test/Driver/openbsd.c Modified: cfe/trunk/lib/Driver/ToolChains/OpenBSD.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/OpenBSD.cpp?rev=345439&r1=345438&r2=345439&view=diff == --- cfe/trunk/lib/Driver/ToolChains/OpenBSD.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/OpenBSD.cpp Fri Oct 26 17:23:28 2018 @@ -138,7 +138,7 @@ void openbsd::Linker::ConstructJob(Compi if (Args.hasArg(options::OPT_pie)) CmdArgs.push_back("-pie"); - if (Args.hasArg(options::OPT_nopie)) + if (Args.hasArg(options::OPT_nopie) || Args.hasArg(options::OPT_pg)) CmdArgs.push_back("-nopie"); if (Output.isFilename()) { Modified: cfe/trunk/test/Driver/openbsd.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/openbsd.c?rev=345439&r1=345438&r2=345439&view=diff == --- cfe/trunk/test/Driver/openbsd.c (original) +++ cfe/trunk/test/Driver/openbsd.c Fri Oct 26 17:23:28 2018 @@ -84,6 +84,8 @@ // Check linking against correct startup code when (not) using PIE // RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd %s -### 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK-PIE %s +// RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd -pg %s -### 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-NOPIE %s // RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd -pie %s -### 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK-PIE-FLAG %s // RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd -fno-pie %s -### 2>&1 \ ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r345440 - Update the other test.
Author: brad Date: Fri Oct 26 17:46:12 2018 New Revision: 345440 URL: http://llvm.org/viewvc/llvm-project?rev=345440&view=rev Log: Update the other test. Modified: cfe/trunk/test/Driver/openbsd.c Modified: cfe/trunk/test/Driver/openbsd.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/openbsd.c?rev=345440&r1=345439&r2=345440&view=diff == --- cfe/trunk/test/Driver/openbsd.c (original) +++ cfe/trunk/test/Driver/openbsd.c Fri Oct 26 17:46:12 2018 @@ -12,7 +12,7 @@ // RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd -pg -pthread %s -### 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-PG %s // CHECK-PG: clang{{.*}}" "-cc1" "-triple" "i686-pc-openbsd" -// CHECK-PG: ld{{.*}}" "-e" "__start" "--eh-frame-hdr" "-Bdynamic" "-dynamic-linker" "{{.*}}ld.so" "-o" "a.out" "{{.*}}gcrt0.o" "{{.*}}crtbegin.o" "{{.*}}.o" "-lcompiler_rt" "-lpthread_p" "-lc_p" "-lcompiler_rt" "{{.*}}crtend.o" +// CHECK-PG: ld{{.*}}" "-e" "__start" "--eh-frame-hdr" "-Bdynamic" "-dynamic-linker" "{{.*}}ld.so" "-o" "a.out" "-nopie" "{{.*}}gcrt0.o" "{{.*}}crtbegin.o" "{{.*}}.o" "-lcompiler_rt" "-lpthread_p" "-lc_p" "-lcompiler_rt" "{{.*}}crtend.o" // Check CPU type for MIPS64 // RUN: %clang -target mips64-unknown-openbsd -### -c %s 2>&1 \ ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r345443 - Revert "Pass the nopie flag to the linker when linking with -pg." until
Author: brad Date: Fri Oct 26 18:14:22 2018 New Revision: 345443 URL: http://llvm.org/viewvc/llvm-project?rev=345443&view=rev Log: Revert "Pass the nopie flag to the linker when linking with -pg." until one of the tests can be fixed on !OpenBSD hosts. Modified: cfe/trunk/lib/Driver/ToolChains/OpenBSD.cpp cfe/trunk/test/Driver/openbsd.c Modified: cfe/trunk/lib/Driver/ToolChains/OpenBSD.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/OpenBSD.cpp?rev=345443&r1=345442&r2=345443&view=diff == --- cfe/trunk/lib/Driver/ToolChains/OpenBSD.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/OpenBSD.cpp Fri Oct 26 18:14:22 2018 @@ -138,7 +138,7 @@ void openbsd::Linker::ConstructJob(Compi if (Args.hasArg(options::OPT_pie)) CmdArgs.push_back("-pie"); - if (Args.hasArg(options::OPT_nopie) || Args.hasArg(options::OPT_pg)) + if (Args.hasArg(options::OPT_nopie)) CmdArgs.push_back("-nopie"); if (Output.isFilename()) { Modified: cfe/trunk/test/Driver/openbsd.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/openbsd.c?rev=345443&r1=345442&r2=345443&view=diff == --- cfe/trunk/test/Driver/openbsd.c (original) +++ cfe/trunk/test/Driver/openbsd.c Fri Oct 26 18:14:22 2018 @@ -12,7 +12,7 @@ // RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd -pg -pthread %s -### 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-PG %s // CHECK-PG: clang{{.*}}" "-cc1" "-triple" "i686-pc-openbsd" -// CHECK-PG: ld{{.*}}" "-e" "__start" "--eh-frame-hdr" "-Bdynamic" "-dynamic-linker" "{{.*}}ld.so" "-o" "a.out" "-nopie" "{{.*}}gcrt0.o" "{{.*}}crtbegin.o" "{{.*}}.o" "-lcompiler_rt" "-lpthread_p" "-lc_p" "-lcompiler_rt" "{{.*}}crtend.o" +// CHECK-PG: ld{{.*}}" "-e" "__start" "--eh-frame-hdr" "-Bdynamic" "-dynamic-linker" "{{.*}}ld.so" "-o" "a.out" "{{.*}}gcrt0.o" "{{.*}}crtbegin.o" "{{.*}}.o" "-lcompiler_rt" "-lpthread_p" "-lc_p" "-lcompiler_rt" "{{.*}}crtend.o" // Check CPU type for MIPS64 // RUN: %clang -target mips64-unknown-openbsd -### -c %s 2>&1 \ @@ -84,8 +84,6 @@ // Check linking against correct startup code when (not) using PIE // RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd %s -### 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK-PIE %s -// RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd -pg %s -### 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK-NOPIE %s // RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd -pie %s -### 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK-PIE-FLAG %s // RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd -fno-pie %s -### 2>&1 \ ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r345470 - Reapply Pass the nopie flag to the linker when linking with -pg.
Author: brad Date: Sat Oct 27 20:30:18 2018 New Revision: 345470 URL: http://llvm.org/viewvc/llvm-project?rev=345470&view=rev Log: Reapply Pass the nopie flag to the linker when linking with -pg. Modified: cfe/trunk/lib/Driver/ToolChains/OpenBSD.cpp cfe/trunk/test/Driver/openbsd.c Modified: cfe/trunk/lib/Driver/ToolChains/OpenBSD.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/OpenBSD.cpp?rev=345470&r1=345469&r2=345470&view=diff == --- cfe/trunk/lib/Driver/ToolChains/OpenBSD.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/OpenBSD.cpp Sat Oct 27 20:30:18 2018 @@ -138,7 +138,7 @@ void openbsd::Linker::ConstructJob(Compi if (Args.hasArg(options::OPT_pie)) CmdArgs.push_back("-pie"); - if (Args.hasArg(options::OPT_nopie)) + if (Args.hasArg(options::OPT_nopie) || Args.hasArg(options::OPT_pg)) CmdArgs.push_back("-nopie"); if (Output.isFilename()) { Modified: cfe/trunk/test/Driver/openbsd.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/openbsd.c?rev=345470&r1=345469&r2=345470&view=diff == --- cfe/trunk/test/Driver/openbsd.c (original) +++ cfe/trunk/test/Driver/openbsd.c Sat Oct 27 20:30:18 2018 @@ -12,7 +12,7 @@ // RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd -pg -pthread %s -### 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-PG %s // CHECK-PG: clang{{.*}}" "-cc1" "-triple" "i686-pc-openbsd" -// CHECK-PG: ld{{.*}}" "-e" "__start" "--eh-frame-hdr" "-Bdynamic" "-dynamic-linker" "{{.*}}ld.so" "-o" "a.out" "{{.*}}gcrt0.o" "{{.*}}crtbegin.o" "{{.*}}.o" "-lcompiler_rt" "-lpthread_p" "-lc_p" "-lcompiler_rt" "{{.*}}crtend.o" +// CHECK-PG: ld{{.*}}" "-e" "__start" "--eh-frame-hdr" "-Bdynamic" "-dynamic-linker" "{{.*}}ld.so" "-nopie" "-o" "a.out" "{{.*}}gcrt0.o" "{{.*}}crtbegin.o" "{{.*}}.o" "-lcompiler_rt" "-lpthread_p" "-lc_p" "-lcompiler_rt" "{{.*}}crtend.o" // Check CPU type for MIPS64 // RUN: %clang -target mips64-unknown-openbsd -### -c %s 2>&1 \ ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r351217 - [Solaris] Move enabling IAS for SPARC from the Solaris toolchain to Generic_GCC.
Author: brad Date: Tue Jan 15 10:24:03 2019 New Revision: 351217 URL: http://llvm.org/viewvc/llvm-project?rev=351217&view=rev Log: [Solaris] Move enabling IAS for SPARC from the Solaris toolchain to Generic_GCC. Modified: cfe/trunk/lib/Driver/ToolChains/Gnu.cpp cfe/trunk/lib/Driver/ToolChains/Solaris.h Modified: cfe/trunk/lib/Driver/ToolChains/Gnu.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Gnu.cpp?rev=351217&r1=351216&r2=351217&view=diff == --- cfe/trunk/lib/Driver/ToolChains/Gnu.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/Gnu.cpp Tue Jan 15 10:24:03 2019 @@ -2475,6 +2475,12 @@ bool Generic_GCC::IsIntegratedAssemblerD case llvm::Triple::mips64: case llvm::Triple::mips64el: return true; + case llvm::Triple::sparc: + case llvm::Triple::sparcel: + case llvm::Triple::sparcv9: +if (getTriple().isOSSolaris()) + return true; +return false; default: return false; } Modified: cfe/trunk/lib/Driver/ToolChains/Solaris.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Solaris.h?rev=351217&r1=351216&r2=351217&view=diff == --- cfe/trunk/lib/Driver/ToolChains/Solaris.h (original) +++ cfe/trunk/lib/Driver/ToolChains/Solaris.h Tue Jan 15 10:24:03 2019 @@ -55,8 +55,6 @@ public: Solaris(const Driver &D, const llvm::Triple &Triple, const llvm::opt::ArgList &Args); - bool IsIntegratedAssemblerDefault() const override { return true; } - void AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const override; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r351245 - Enable IAS for OpenBSD SPARC.
Author: brad Date: Tue Jan 15 13:04:36 2019 New Revision: 351245 URL: http://llvm.org/viewvc/llvm-project?rev=351245&view=rev Log: Enable IAS for OpenBSD SPARC. Modified: cfe/trunk/lib/Driver/ToolChains/Gnu.cpp cfe/trunk/test/Driver/openbsd.c Modified: cfe/trunk/lib/Driver/ToolChains/Gnu.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Gnu.cpp?rev=351245&r1=351244&r2=351245&view=diff == --- cfe/trunk/lib/Driver/ToolChains/Gnu.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/Gnu.cpp Tue Jan 15 13:04:36 2019 @@ -2512,7 +2512,7 @@ bool Generic_GCC::IsIntegratedAssemblerD case llvm::Triple::sparc: case llvm::Triple::sparcel: case llvm::Triple::sparcv9: -if (getTriple().isOSSolaris()) +if (getTriple().isOSSolaris() || getTriple().isOSOpenBSD()) return true; return false; default: Modified: cfe/trunk/test/Driver/openbsd.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/openbsd.c?rev=351245&r1=351244&r2=351245&view=diff == --- cfe/trunk/test/Driver/openbsd.c (original) +++ cfe/trunk/test/Driver/openbsd.c Tue Jan 15 13:04:36 2019 @@ -74,12 +74,16 @@ // CHECK-MIPS64EL: as{{.*}}" "-mabi" "64" "-EL" // CHECK-MIPS64EL-PIC: as{{.*}}" "-mabi" "64" "-EL" "-KPIC" -// Check that the integrated assembler is enabled for MIPS64 +// Check that the integrated assembler is enabled for MIPS64/SPARC // RUN: %clang -target mips64-unknown-openbsd -### -c %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK-MIPS64-AS %s +// RUN: | FileCheck -check-prefix=CHECK-IAS %s // RUN: %clang -target mips64el-unknown-openbsd -### -c %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK-MIPS64-AS %s -// CHECK-MIPS64-AS-NOT: "-no-integrated-as" +// RUN: | FileCheck -check-prefix=CHECK-IAS %s +// RUN: %clang -target sparc-unknown-openbsd -### -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-IAS %s +// RUN: %clang -target sparc64-unknown-openbsd -### -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-IAS %s +// CHECK-IAS-NOT: "-no-integrated-as" // Check linking against correct startup code when (not) using PIE // RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd %s -### 2>&1 \ ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r347178 - Replace the UTF-8 characters in the error message.
Author: brad Date: Sun Nov 18 14:30:58 2018 New Revision: 347178 URL: http://llvm.org/viewvc/llvm-project?rev=347178&view=rev Log: Replace the UTF-8 characters in the error message. Modified: cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td cfe/trunk/test/Driver/mips-abicalls-error.c Modified: cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td?rev=347178&r1=347177&r2=347178&view=diff == --- cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td (original) +++ cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td Sun Nov 18 14:30:58 2018 @@ -357,7 +357,7 @@ def warn_drv_unsupported_pic_with_mabica "%select{implicit usage of|}1 -mabicalls and the N64 ABI">, InGroup; def err_drv_unsupported_noabicalls_pic : Error< - "position-independent code requires â-mabicallsâ">; + "position-independent code requires '-mabicalls'">; def err_drv_unsupported_indirect_jump_opt : Error< "'-mindirect-jump=%0' is unsupported with the '%1' architecture">; def err_drv_unknown_indirect_jump_opt : Error< Modified: cfe/trunk/test/Driver/mips-abicalls-error.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/mips-abicalls-error.c?rev=347178&r1=347177&r2=347178&view=diff == --- cfe/trunk/test/Driver/mips-abicalls-error.c (original) +++ cfe/trunk/test/Driver/mips-abicalls-error.c Sun Nov 18 14:30:58 2018 @@ -1,2 +1,2 @@ // RUN: not %clang -c -target mips64-linux-gnu -fPIC -mno-abicalls %s 2>&1 | FileCheck %s -// CHECK: error: position-independent code requires â-mabicallsâ +// CHECK: error: position-independent code requires '-mabicalls' ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r347179 - [PowerPC] Set the default PLT mode on OpenBSD/powerpc to Secure PLT.
Author: brad Date: Sun Nov 18 16:21:06 2018 New Revision: 347179 URL: http://llvm.org/viewvc/llvm-project?rev=347179&view=rev Log: [PowerPC] Set the default PLT mode on OpenBSD/powerpc to Secure PLT. OpenBSD/powerpc only supports Secure PLT. Modified: cfe/trunk/lib/Driver/ToolChains/Arch/PPC.cpp cfe/trunk/lib/Driver/ToolChains/Arch/PPC.h cfe/trunk/test/Driver/openbsd.c Modified: cfe/trunk/lib/Driver/ToolChains/Arch/PPC.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Arch/PPC.cpp?rev=347179&r1=347178&r2=347179&view=diff == --- cfe/trunk/lib/Driver/ToolChains/Arch/PPC.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/Arch/PPC.cpp Sun Nov 18 16:21:06 2018 @@ -107,15 +107,19 @@ void ppc::getPPCTargetFeatures(const Dri if (FloatABI == ppc::FloatABI::Soft) Features.push_back("-hard-float"); - ppc::ReadGOTPtrMode ReadGOT = ppc::getPPCReadGOTPtrMode(D, Args); + ppc::ReadGOTPtrMode ReadGOT = ppc::getPPCReadGOTPtrMode(D, Triple, Args); if (ReadGOT == ppc::ReadGOTPtrMode::SecurePlt) Features.push_back("+secure-plt"); } -ppc::ReadGOTPtrMode ppc::getPPCReadGOTPtrMode(const Driver &D, const ArgList &Args) { +ppc::ReadGOTPtrMode ppc::getPPCReadGOTPtrMode(const Driver &D, const llvm::Triple &Triple, + const ArgList &Args) { if (Args.getLastArg(options::OPT_msecure_plt)) return ppc::ReadGOTPtrMode::SecurePlt; - return ppc::ReadGOTPtrMode::Bss; + if (Triple.isOSOpenBSD()) +return ppc::ReadGOTPtrMode::SecurePlt; + else +return ppc::ReadGOTPtrMode::Bss; } ppc::FloatABI ppc::getPPCFloatABI(const Driver &D, const ArgList &Args) { Modified: cfe/trunk/lib/Driver/ToolChains/Arch/PPC.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Arch/PPC.h?rev=347179&r1=347178&r2=347179&view=diff == --- cfe/trunk/lib/Driver/ToolChains/Arch/PPC.h (original) +++ cfe/trunk/lib/Driver/ToolChains/Arch/PPC.h Sun Nov 18 16:21:06 2018 @@ -38,7 +38,7 @@ FloatABI getPPCFloatABI(const Driver &D, std::string getPPCTargetCPU(const llvm::opt::ArgList &Args); const char *getPPCAsmModeForCPU(StringRef Name); -ReadGOTPtrMode getPPCReadGOTPtrMode(const Driver &D, +ReadGOTPtrMode getPPCReadGOTPtrMode(const Driver &D, const llvm::Triple &Triple, const llvm::opt::ArgList &Args); void getPPCTargetFeatures(const Driver &D, const llvm::Triple &Triple, Modified: cfe/trunk/test/Driver/openbsd.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/openbsd.c?rev=347179&r1=347178&r2=347179&view=diff == --- cfe/trunk/test/Driver/openbsd.c (original) +++ cfe/trunk/test/Driver/openbsd.c Sun Nov 18 16:21:06 2018 @@ -112,3 +112,8 @@ // RUN: | FileCheck -check-prefix=CHECK-ARM-FLOAT-ABI %s // CHECK-ARM-FLOAT-ABI-NOT: "-target-feature" "+soft-float" // CHECK-ARM-FLOAT-ABI: "-target-feature" "+soft-float-abi" + +// Check PowerPC for Secure PLT +// RUN: %clang -target powerpc-unknown-openbsd -### -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-POWERPC-SECUREPLT %s +// CHECK-POWERPC-SECUREPLT: "-target-feature" "+secure-plt" ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] Add myself as code owner for OpenBSD driver
Add myself as code owner for OpenBSD driver. Index: CODE_OWNERS.TXT === --- CODE_OWNERS.TXT (revision 347715) +++ CODE_OWNERS.TXT (working copy) @@ -49,6 +49,10 @@ E: rjmcc...@apple.com D: Clang LLVM IR generation +N: Brad Smith +E: b...@comstyle.com +D: OpenBSD driver + N: Richard Smith E: rich...@metafoo.co.uk D: All parts of Clang not covered by someone else ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r348041 - Add myself as code owner for OpenBSD driver
Author: brad Date: Fri Nov 30 13:42:34 2018 New Revision: 348041 URL: http://llvm.org/viewvc/llvm-project?rev=348041&view=rev Log: Add myself as code owner for OpenBSD driver Modified: cfe/trunk/CODE_OWNERS.TXT Modified: cfe/trunk/CODE_OWNERS.TXT URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CODE_OWNERS.TXT?rev=348041&r1=348040&r2=348041&view=diff == --- cfe/trunk/CODE_OWNERS.TXT (original) +++ cfe/trunk/CODE_OWNERS.TXT Fri Nov 30 13:42:34 2018 @@ -49,6 +49,10 @@ N: John McCall E: rjmcc...@apple.com D: Clang LLVM IR generation +N: Brad Smith +E: b...@comstyle.com +D: OpenBSD driver + N: Richard Smith E: rich...@metafoo.co.uk D: All parts of Clang not covered by someone else ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r357878 - Enable IAS for FreeBSD SPARC64.
Author: brad Date: Sun Apr 7 16:12:31 2019 New Revision: 357878 URL: http://llvm.org/viewvc/llvm-project?rev=357878&view=rev Log: Enable IAS for FreeBSD SPARC64. Modified: cfe/trunk/lib/Driver/ToolChains/Gnu.cpp cfe/trunk/test/Driver/freebsd.c Modified: cfe/trunk/lib/Driver/ToolChains/Gnu.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Gnu.cpp?rev=357878&r1=357877&r2=357878&view=diff == --- cfe/trunk/lib/Driver/ToolChains/Gnu.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/Gnu.cpp Sun Apr 7 16:12:31 2019 @@ -2547,7 +2547,8 @@ bool Generic_GCC::IsIntegratedAssemblerD case llvm::Triple::sparc: case llvm::Triple::sparcel: case llvm::Triple::sparcv9: -if (getTriple().isOSSolaris() || getTriple().isOSOpenBSD()) +if (getTriple().isOSFreeBSD() || getTriple().isOSOpenBSD() || +getTriple().isOSSolaris()) return true; return false; default: Modified: cfe/trunk/test/Driver/freebsd.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/freebsd.c?rev=357878&r1=357877&r2=357878&view=diff == --- cfe/trunk/test/Driver/freebsd.c (original) +++ cfe/trunk/test/Driver/freebsd.c Sun Apr 7 16:12:31 2019 @@ -184,9 +184,11 @@ // RUN: | FileCheck -check-prefix=CHECK-MIPS64-CPU %s // CHECK-MIPS64-CPU: "-target-cpu" "mips3" -// Check that the integrated assembler is enabled for MIPS64 +// Check that the integrated assembler is enabled for MIPS64/SPARC64 // RUN: %clang -target mips64-unknown-freebsd -### -c %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK-MIPS64-AS %s +// RUN: | FileCheck -check-prefix=CHECK-IAS %s // RUN: %clang -target mips64el-unknown-freebsd -### -c %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK-MIPS64-AS %s -// CHECK-MIPS64-AS-NOT: "-no-integrated-as" +// RUN: | FileCheck -check-prefix=CHECK-IAS %s +// RUN: %clang -target sparc64-unknown-freebsd -### -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-IAS %s +// CHECK-IAS-NOT: "-no-integrated-as" ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r357879 - IAS is now enabled for all OS on MIPS64
Author: brad Date: Sun Apr 7 17:03:01 2019 New Revision: 357879 URL: http://llvm.org/viewvc/llvm-project?rev=357879&view=rev Log: IAS is now enabled for all OS on MIPS64 Modified: cfe/trunk/test/Driver/freebsd.c cfe/trunk/test/Driver/openbsd.c Modified: cfe/trunk/test/Driver/freebsd.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/freebsd.c?rev=357879&r1=357878&r2=357879&view=diff == --- cfe/trunk/test/Driver/freebsd.c (original) +++ cfe/trunk/test/Driver/freebsd.c Sun Apr 7 17:03:01 2019 @@ -184,11 +184,7 @@ // RUN: | FileCheck -check-prefix=CHECK-MIPS64-CPU %s // CHECK-MIPS64-CPU: "-target-cpu" "mips3" -// Check that the integrated assembler is enabled for MIPS64/SPARC64 -// RUN: %clang -target mips64-unknown-freebsd -### -c %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK-IAS %s -// RUN: %clang -target mips64el-unknown-freebsd -### -c %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK-IAS %s +// Check that the integrated assembler is enabled for SPARC64 // RUN: %clang -target sparc64-unknown-freebsd -### -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK-IAS %s // CHECK-IAS-NOT: "-no-integrated-as" Modified: cfe/trunk/test/Driver/openbsd.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/openbsd.c?rev=357879&r1=357878&r2=357879&view=diff == --- cfe/trunk/test/Driver/openbsd.c (original) +++ cfe/trunk/test/Driver/openbsd.c Sun Apr 7 17:03:01 2019 @@ -74,11 +74,7 @@ // CHECK-MIPS64EL: as{{.*}}" "-mabi" "64" "-EL" // CHECK-MIPS64EL-PIC: as{{.*}}" "-mabi" "64" "-EL" "-KPIC" -// Check that the integrated assembler is enabled for MIPS64/SPARC -// RUN: %clang -target mips64-unknown-openbsd -### -c %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK-IAS %s -// RUN: %clang -target mips64el-unknown-openbsd -### -c %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK-IAS %s +// Check that the integrated assembler is enabled for SPARC // RUN: %clang -target sparc-unknown-openbsd -### -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK-IAS %s // RUN: %clang -target sparc64-unknown-openbsd -### -c %s 2>&1 \ ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r358245 - Enable frame pointer elimination for OpenBSD on x86 and mips64.
Author: brad Date: Thu Apr 11 18:29:18 2019 New Revision: 358245 URL: http://llvm.org/viewvc/llvm-project?rev=358245&view=rev Log: Enable frame pointer elimination for OpenBSD on x86 and mips64. Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp cfe/trunk/test/Driver/frame-pointer-elim.c Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Clang.cpp?rev=358245&r1=358244&r2=358245&view=diff == --- cfe/trunk/lib/Driver/ToolChains/Clang.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp Thu Apr 11 18:29:18 2019 @@ -534,6 +534,18 @@ static bool useFramePointerForTargetByDe return !areOptimizationsEnabled(Args); } + if (Triple.isOSOpenBSD()) { +switch (Triple.getArch()) { +case llvm::Triple::mips64: +case llvm::Triple::mips64el: +case llvm::Triple::x86: +case llvm::Triple::x86_64: + return !areOptimizationsEnabled(Args); +default: + return true; +} + } + if (Triple.isOSLinux() || Triple.getOS() == llvm::Triple::CloudABI || Triple.isOSHurd()) { switch (Triple.getArch()) { Modified: cfe/trunk/test/Driver/frame-pointer-elim.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/frame-pointer-elim.c?rev=358245&r1=358244&r2=358245&view=diff == --- cfe/trunk/test/Driver/frame-pointer-elim.c (original) +++ cfe/trunk/test/Driver/frame-pointer-elim.c Thu Apr 11 18:29:18 2019 @@ -26,6 +26,15 @@ // RUN: FileCheck --check-prefix=NETBSD %s // NETBSD-NOT: "-momit-leaf-frame-pointer" +// OpenBSD follows the same rules as Linux. +// RUN: %clang -### -target x86_64-unknown-openbsd -S -O1 %s 2>&1 | \ +// RUN: FileCheck --check-prefix=OPENBSD-OPT %s +// OPENBSD-OPT: "-momit-leaf-frame-pointer" + +// RUN: %clang -### -target x86_64-unknown-openbsd -S %s 2>&1 | \ +// RUN: FileCheck --check-prefix=OPENBSD %s +// OPENBSD-NOT: "-momit-leaf-frame-pointer" + // Darwin disables omitting the leaf frame pointer even under optimization // unless the command lines are given. // RUN: %clang -### -target i386-apple-darwin -S %s 2>&1 | \ ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r358775 - Enable frame pointer elimination for OpenBSD on powerpc.
Author: brad Date: Fri Apr 19 11:41:40 2019 New Revision: 358775 URL: http://llvm.org/viewvc/llvm-project?rev=358775&view=rev Log: Enable frame pointer elimination for OpenBSD on powerpc. Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp cfe/trunk/test/Driver/frame-pointer-elim.c Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Clang.cpp?rev=358775&r1=358774&r2=358775&view=diff == --- cfe/trunk/lib/Driver/ToolChains/Clang.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp Fri Apr 19 11:41:40 2019 @@ -538,6 +538,7 @@ static bool useFramePointerForTargetByDe switch (Triple.getArch()) { case llvm::Triple::mips64: case llvm::Triple::mips64el: +case llvm::Triple::ppc: case llvm::Triple::x86: case llvm::Triple::x86_64: return !areOptimizationsEnabled(Args); Modified: cfe/trunk/test/Driver/frame-pointer-elim.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/frame-pointer-elim.c?rev=358775&r1=358774&r2=358775&view=diff == --- cfe/trunk/test/Driver/frame-pointer-elim.c (original) +++ cfe/trunk/test/Driver/frame-pointer-elim.c Fri Apr 19 11:41:40 2019 @@ -29,10 +29,14 @@ // OpenBSD follows the same rules as Linux. // RUN: %clang -### -target x86_64-unknown-openbsd -S -O1 %s 2>&1 | \ // RUN: FileCheck --check-prefix=OPENBSD-OPT %s +// RUN: %clang -### -target powerpc-unknown-openbsd -S -O1 %s 2>&1 | \ +// RUN: FileCheck --check-prefix=OPENBSD-OPT %s // OPENBSD-OPT: "-momit-leaf-frame-pointer" // RUN: %clang -### -target x86_64-unknown-openbsd -S %s 2>&1 | \ // RUN: FileCheck --check-prefix=OPENBSD %s +// RUN: %clang -### -target powerpc-unknown-openbsd -S %s 2>&1 | \ +// RUN: FileCheck --check-prefix=OPENBSD %s // OPENBSD-NOT: "-momit-leaf-frame-pointer" // Darwin disables omitting the leaf frame pointer even under optimization ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r353656 - long double is double on OpenBSD/NetBSD/PPC.
Author: brad Date: Sun Feb 10 18:53:16 2019 New Revision: 353656 URL: http://llvm.org/viewvc/llvm-project?rev=353656&view=rev Log: long double is double on OpenBSD/NetBSD/PPC. Patch by George Koehler. Modified: cfe/trunk/lib/Basic/Targets/PPC.h cfe/trunk/test/CodeGen/powerpc_types.c Modified: cfe/trunk/lib/Basic/Targets/PPC.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/PPC.h?rev=353656&r1=353655&r2=353656&view=diff == --- cfe/trunk/lib/Basic/Targets/PPC.h (original) +++ cfe/trunk/lib/Basic/Targets/PPC.h Sun Feb 10 18:53:16 2019 @@ -330,9 +330,15 @@ public: break; } -if (getTriple().isOSFreeBSD()) { +switch (getTriple().getOS()) { +case llvm::Triple::FreeBSD: +case llvm::Triple::NetBSD: +case llvm::Triple::OpenBSD: LongDoubleWidth = LongDoubleAlign = 64; LongDoubleFormat = &llvm::APFloat::IEEEdouble(); + break; +default: + break; } // PPC32 supports atomics up to 4 bytes. Modified: cfe/trunk/test/CodeGen/powerpc_types.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/powerpc_types.c?rev=353656&r1=353655&r2=353656&view=diff == --- cfe/trunk/test/CodeGen/powerpc_types.c (original) +++ cfe/trunk/test/CodeGen/powerpc_types.c Sun Feb 10 18:53:16 2019 @@ -1,4 +1,6 @@ // RUN: %clang_cc1 -triple powerpc-unknown-freebsd -emit-llvm -o - %s| FileCheck -check-prefix=SVR4-CHECK %s +// RUN: %clang_cc1 -triple powerpc-unknown-netbsd -emit-llvm -o - %s| FileCheck -check-prefix=SVR4-CHECK %s +// RUN: %clang_cc1 -triple powerpc-unknown-openbsd -emit-llvm -o - %s| FileCheck -check-prefix=SVR4-CHECK %s #include ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r354721 - Remove sanitizer context workaround no longer necessary
Author: brad Date: Fri Feb 22 22:19:28 2019 New Revision: 354721 URL: http://llvm.org/viewvc/llvm-project?rev=354721&view=rev Log: Remove sanitizer context workaround no longer necessary The base linker is now lld. Modified: cfe/trunk/lib/Driver/ToolChains/OpenBSD.cpp Modified: cfe/trunk/lib/Driver/ToolChains/OpenBSD.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/OpenBSD.cpp?rev=354721&r1=354720&r2=354721&view=diff == --- cfe/trunk/lib/Driver/ToolChains/OpenBSD.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/OpenBSD.cpp Fri Feb 22 22:19:28 2019 @@ -226,9 +226,7 @@ void openbsd::Linker::ConstructJob(Compi CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath(crtend))); } - const char *Exec = Args.MakeArgString( - !NeedsSanitizerDeps ? ToolChain.GetLinkerPath() - : ToolChain.GetProgramPath("ld.lld")); + const char *Exec = Args.MakeArgString(ToolChain.GetLinkerPath()); C.addCommand(llvm::make_unique(JA, *this, Exec, CmdArgs, Inputs)); } ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r354723 - Remove OpenBSD case for old system libstdc++ header path as OpenBSD
Author: brad Date: Fri Feb 22 23:21:19 2019 New Revision: 354723 URL: http://llvm.org/viewvc/llvm-project?rev=354723&view=rev Log: Remove OpenBSD case for old system libstdc++ header path as OpenBSD has switched to libc++. Modified: cfe/trunk/lib/Frontend/InitHeaderSearch.cpp Modified: cfe/trunk/lib/Frontend/InitHeaderSearch.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/InitHeaderSearch.cpp?rev=354723&r1=354722&r2=354723&view=diff == --- cfe/trunk/lib/Frontend/InitHeaderSearch.cpp (original) +++ cfe/trunk/lib/Frontend/InitHeaderSearch.cpp Fri Feb 22 23:21:19 2019 @@ -432,14 +432,6 @@ void InitHeaderSearch::AddDefaultCPlusPl case llvm::Triple::DragonFly: AddPath("/usr/include/c++/5.0", CXXSystem, false); break; - case llvm::Triple::OpenBSD: { -std::string t = triple.getTriple(); -if (t.substr(0, 6) == "x86_64") - t.replace(0, 6, "amd64"); -AddGnuCPlusPlusIncludePaths("/usr/include/g++", -t, "", "", triple); -break; - } case llvm::Triple::Minix: AddGnuCPlusPlusIncludePaths("/usr/gnu/include/c++/4.4.3", "", "", "", triple); ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r364679 - Revert enabling frame pointer elimination on OpenBSD for now.
Author: brad Date: Fri Jun 28 12:57:51 2019 New Revision: 364679 URL: http://llvm.org/viewvc/llvm-project?rev=364679&view=rev Log: Revert enabling frame pointer elimination on OpenBSD for now. Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp cfe/trunk/test/Driver/frame-pointer-elim.c Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Clang.cpp?rev=364679&r1=364678&r2=364679&view=diff == --- cfe/trunk/lib/Driver/ToolChains/Clang.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp Fri Jun 28 12:57:51 2019 @@ -534,19 +534,6 @@ static bool useFramePointerForTargetByDe return !areOptimizationsEnabled(Args); } - if (Triple.isOSOpenBSD()) { -switch (Triple.getArch()) { -case llvm::Triple::mips64: -case llvm::Triple::mips64el: -case llvm::Triple::ppc: -case llvm::Triple::x86: -case llvm::Triple::x86_64: - return !areOptimizationsEnabled(Args); -default: - return true; -} - } - if (Triple.isOSLinux() || Triple.getOS() == llvm::Triple::CloudABI || Triple.isOSHurd()) { switch (Triple.getArch()) { Modified: cfe/trunk/test/Driver/frame-pointer-elim.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/frame-pointer-elim.c?rev=364679&r1=364678&r2=364679&view=diff == --- cfe/trunk/test/Driver/frame-pointer-elim.c (original) +++ cfe/trunk/test/Driver/frame-pointer-elim.c Fri Jun 28 12:57:51 2019 @@ -26,19 +26,6 @@ // RUN: FileCheck --check-prefix=NETBSD %s // NETBSD-NOT: "-momit-leaf-frame-pointer" -// OpenBSD follows the same rules as Linux. -// RUN: %clang -### -target x86_64-unknown-openbsd -S -O1 %s 2>&1 | \ -// RUN: FileCheck --check-prefix=OPENBSD-OPT %s -// RUN: %clang -### -target powerpc-unknown-openbsd -S -O1 %s 2>&1 | \ -// RUN: FileCheck --check-prefix=OPENBSD-OPT %s -// OPENBSD-OPT: "-momit-leaf-frame-pointer" - -// RUN: %clang -### -target x86_64-unknown-openbsd -S %s 2>&1 | \ -// RUN: FileCheck --check-prefix=OPENBSD %s -// RUN: %clang -### -target powerpc-unknown-openbsd -S %s 2>&1 | \ -// RUN: FileCheck --check-prefix=OPENBSD %s -// OPENBSD-NOT: "-momit-leaf-frame-pointer" - // Darwin disables omitting the leaf frame pointer even under optimization // unless the command lines are given. // RUN: %clang -### -target i386-apple-darwin -S %s 2>&1 | \ ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r336004 - [mips][ias] Enable IAS by default for OpenBSD / FreeBSD mips64/mips64el.
Author: brad Date: Fri Jun 29 12:03:03 2018 New Revision: 336004 URL: http://llvm.org/viewvc/llvm-project?rev=336004&view=rev Log: [mips][ias] Enable IAS by default for OpenBSD / FreeBSD mips64/mips64el. Reviewers: atanasyan Differential Revision: https://reviews.llvm.org/D48515 Modified: cfe/trunk/lib/Driver/ToolChains/Gnu.cpp cfe/trunk/test/Driver/freebsd.c cfe/trunk/test/Driver/openbsd.c Modified: cfe/trunk/lib/Driver/ToolChains/Gnu.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Gnu.cpp?rev=336004&r1=336003&r2=336004&view=diff == --- cfe/trunk/lib/Driver/ToolChains/Gnu.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/Gnu.cpp Fri Jun 29 12:03:03 2018 @@ -2412,11 +2412,13 @@ bool Generic_GCC::IsIntegratedAssemblerD return true; case llvm::Triple::mips64: case llvm::Triple::mips64el: -// Enabled for Debian and Android mips64/mipsel, as they can precisely -// identify the ABI in use (Debian) or only use N64 for MIPS64 (Android). -// Other targets are unable to distinguish N32 from N64. +// Enabled for Debian, Android, FreeBSD and OpenBSD mips64/mipsel, as they +// can precisely identify the ABI in use (Debian) or only use N64 for MIPS64 +// (Android). Other targets are unable to distinguish N32 from N64. if (getTriple().getEnvironment() == llvm::Triple::GNUABI64 || -getTriple().isAndroid()) +getTriple().isAndroid() || +getTriple().isOSFreeBSD() || +getTriple().isOSOpenBSD()) return true; return false; default: Modified: cfe/trunk/test/Driver/freebsd.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/freebsd.c?rev=336004&r1=336003&r2=336004&view=diff == --- cfe/trunk/test/Driver/freebsd.c (original) +++ cfe/trunk/test/Driver/freebsd.c Fri Jun 29 12:03:03 2018 @@ -183,3 +183,10 @@ // RUN: %clang -target mips64el-unknown-freebsd -### -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK-MIPS64-CPU %s // CHECK-MIPS64-CPU: "-target-cpu" "mips3" + +// Check that the integrated assembler is enabled for MIPS64 +// RUN: %clang -target mips64-unknown-freebsd -### -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-MIPS64-AS %s +// RUN: %clang -target mips64el-unknown-freebsd -### -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-MIPS64-AS %s +// CHECK-MIPS64-AS-NOT: "-no-integrated-as" Modified: cfe/trunk/test/Driver/openbsd.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/openbsd.c?rev=336004&r1=336003&r2=336004&view=diff == --- cfe/trunk/test/Driver/openbsd.c (original) +++ cfe/trunk/test/Driver/openbsd.c Fri Jun 29 12:03:03 2018 @@ -74,6 +74,13 @@ // CHECK-MIPS64EL: as{{.*}}" "-mabi" "64" "-EL" // CHECK-MIPS64EL-PIC: as{{.*}}" "-mabi" "64" "-EL" "-KPIC" +// Check that the integrated assembler is enabled for MIPS64 +// RUN: %clang -target mips64-unknown-openbsd -### -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-MIPS64-AS %s +// RUN: %clang -target mips64el-unknown-openbsd -### -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-MIPS64-AS %s +// CHECK-MIPS64-AS-NOT: "-no-integrated-as" + // Check linking against correct startup code when (not) using PIE // RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd %s -### 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK-PIE %s ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 3008609 - Hook up OpenBSD 64-bit PowerPC support
Author: Brad Smith Date: 2020-06-18T19:19:45-04:00 New Revision: 3008609d4509c3efc577c0ccbe9d80a8a2eef31a URL: https://github.com/llvm/llvm-project/commit/3008609d4509c3efc577c0ccbe9d80a8a2eef31a DIFF: https://github.com/llvm/llvm-project/commit/3008609d4509c3efc577c0ccbe9d80a8a2eef31a.diff LOG: Hook up OpenBSD 64-bit PowerPC support Added: Modified: clang/lib/Basic/Targets.cpp clang/lib/Basic/Targets/OSTargets.h clang/test/Preprocessor/init.c Removed: diff --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp index 69133ca31fec..e6384ddef38d 100644 --- a/clang/lib/Basic/Targets.cpp +++ b/clang/lib/Basic/Targets.cpp @@ -345,6 +345,8 @@ TargetInfo *AllocateTarget(const llvm::Triple &Triple, return new FreeBSDTargetInfo(Triple, Opts); case llvm::Triple::NetBSD: return new NetBSDTargetInfo(Triple, Opts); +case llvm::Triple::OpenBSD: + return new OpenBSDTargetInfo(Triple, Opts); case llvm::Triple::AIX: return new AIXPPC64TargetInfo(Triple, Opts); default: @@ -357,6 +359,8 @@ TargetInfo *AllocateTarget(const llvm::Triple &Triple, return new LinuxTargetInfo(Triple, Opts); case llvm::Triple::NetBSD: return new NetBSDTargetInfo(Triple, Opts); +case llvm::Triple::OpenBSD: + return new OpenBSDTargetInfo(Triple, Opts); default: return new PPC64TargetInfo(Triple, Opts); } diff --git a/clang/lib/Basic/Targets/OSTargets.h b/clang/lib/Basic/Targets/OSTargets.h index e57ad7b9eeaf..d9e09fbd6937 100644 --- a/clang/lib/Basic/Targets/OSTargets.h +++ b/clang/lib/Basic/Targets/OSTargets.h @@ -476,6 +476,8 @@ class LLVM_LIBRARY_VISIBILITY OpenBSDTargetInfo : public OSTargetInfo { case llvm::Triple::mips64: case llvm::Triple::mips64el: case llvm::Triple::ppc: +case llvm::Triple::ppc64: +case llvm::Triple::ppc64le: case llvm::Triple::sparcv9: this->MCountName = "_mcount"; break; diff --git a/clang/test/Preprocessor/init.c b/clang/test/Preprocessor/init.c index d6f3225bd04b..9e085a8f9fe8 100644 --- a/clang/test/Preprocessor/init.c +++ b/clang/test/Preprocessor/init.c @@ -7321,6 +7321,8 @@ // RUN: %clang_cc1 -E -dM -ffreestanding -triple=arm-unknown-openbsd6.1-gnueabi < /dev/null | FileCheck -match-full-lines -check-prefix OPENBSD %s // RUN: %clang_cc1 -E -dM -ffreestanding -triple=i386-unknown-openbsd6.1 < /dev/null | FileCheck -match-full-lines -check-prefix OPENBSD %s // RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc-unknown-openbsd6.1 < /dev/null | FileCheck -match-full-lines -check-prefix OPENBSD %s +// RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc64-unknown-openbsd6.1 < /dev/null | FileCheck -match-full-lines -check-prefix OPENBSD %s +// RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc64le-unknown-openbsd6.1 < /dev/null | FileCheck -match-full-lines -check-prefix OPENBSD %s // RUN: %clang_cc1 -E -dM -ffreestanding -triple=mips64-unknown-openbsd6.1 < /dev/null | FileCheck -match-full-lines -check-prefix OPENBSD %s // RUN: %clang_cc1 -E -dM -ffreestanding -triple=mips64el-unknown-openbsd6.1 < /dev/null | FileCheck -match-full-lines -check-prefix OPENBSD %s // RUN: %clang_cc1 -E -dM -ffreestanding -triple=sparc64-unknown-openbsd6.1 < /dev/null | FileCheck -match-full-lines -check-prefix OPENBSD %s ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 0f92096 - Revert "Hook up OpenBSD 64-bit PowerPC support"
Author: Brad Smith Date: 2020-06-18T20:05:39-04:00 New Revision: 0f92096c0a9aa97a2818a8cc8e23e0bfc5d3831f URL: https://github.com/llvm/llvm-project/commit/0f92096c0a9aa97a2818a8cc8e23e0bfc5d3831f DIFF: https://github.com/llvm/llvm-project/commit/0f92096c0a9aa97a2818a8cc8e23e0bfc5d3831f.diff LOG: Revert "Hook up OpenBSD 64-bit PowerPC support" Added: Modified: clang/lib/Basic/Targets.cpp clang/lib/Basic/Targets/OSTargets.h clang/test/Preprocessor/init.c Removed: diff --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp index e6384ddef38d..69133ca31fec 100644 --- a/clang/lib/Basic/Targets.cpp +++ b/clang/lib/Basic/Targets.cpp @@ -345,8 +345,6 @@ TargetInfo *AllocateTarget(const llvm::Triple &Triple, return new FreeBSDTargetInfo(Triple, Opts); case llvm::Triple::NetBSD: return new NetBSDTargetInfo(Triple, Opts); -case llvm::Triple::OpenBSD: - return new OpenBSDTargetInfo(Triple, Opts); case llvm::Triple::AIX: return new AIXPPC64TargetInfo(Triple, Opts); default: @@ -359,8 +357,6 @@ TargetInfo *AllocateTarget(const llvm::Triple &Triple, return new LinuxTargetInfo(Triple, Opts); case llvm::Triple::NetBSD: return new NetBSDTargetInfo(Triple, Opts); -case llvm::Triple::OpenBSD: - return new OpenBSDTargetInfo(Triple, Opts); default: return new PPC64TargetInfo(Triple, Opts); } diff --git a/clang/lib/Basic/Targets/OSTargets.h b/clang/lib/Basic/Targets/OSTargets.h index d9e09fbd6937..e57ad7b9eeaf 100644 --- a/clang/lib/Basic/Targets/OSTargets.h +++ b/clang/lib/Basic/Targets/OSTargets.h @@ -476,8 +476,6 @@ class LLVM_LIBRARY_VISIBILITY OpenBSDTargetInfo : public OSTargetInfo { case llvm::Triple::mips64: case llvm::Triple::mips64el: case llvm::Triple::ppc: -case llvm::Triple::ppc64: -case llvm::Triple::ppc64le: case llvm::Triple::sparcv9: this->MCountName = "_mcount"; break; diff --git a/clang/test/Preprocessor/init.c b/clang/test/Preprocessor/init.c index 9e085a8f9fe8..d6f3225bd04b 100644 --- a/clang/test/Preprocessor/init.c +++ b/clang/test/Preprocessor/init.c @@ -7321,8 +7321,6 @@ // RUN: %clang_cc1 -E -dM -ffreestanding -triple=arm-unknown-openbsd6.1-gnueabi < /dev/null | FileCheck -match-full-lines -check-prefix OPENBSD %s // RUN: %clang_cc1 -E -dM -ffreestanding -triple=i386-unknown-openbsd6.1 < /dev/null | FileCheck -match-full-lines -check-prefix OPENBSD %s // RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc-unknown-openbsd6.1 < /dev/null | FileCheck -match-full-lines -check-prefix OPENBSD %s -// RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc64-unknown-openbsd6.1 < /dev/null | FileCheck -match-full-lines -check-prefix OPENBSD %s -// RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc64le-unknown-openbsd6.1 < /dev/null | FileCheck -match-full-lines -check-prefix OPENBSD %s // RUN: %clang_cc1 -E -dM -ffreestanding -triple=mips64-unknown-openbsd6.1 < /dev/null | FileCheck -match-full-lines -check-prefix OPENBSD %s // RUN: %clang_cc1 -E -dM -ffreestanding -triple=mips64el-unknown-openbsd6.1 < /dev/null | FileCheck -match-full-lines -check-prefix OPENBSD %s // RUN: %clang_cc1 -E -dM -ffreestanding -triple=sparc64-unknown-openbsd6.1 < /dev/null | FileCheck -match-full-lines -check-prefix OPENBSD %s ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] cd5ab56 - Change the default target CPU for OpenBSD/i386 to i586
Author: Brad Smith Date: 2020-08-08T13:49:45-04:00 New Revision: cd5ab56bc406c3f9a6f593f98c63dafb53547ab1 URL: https://github.com/llvm/llvm-project/commit/cd5ab56bc406c3f9a6f593f98c63dafb53547ab1 DIFF: https://github.com/llvm/llvm-project/commit/cd5ab56bc406c3f9a6f593f98c63dafb53547ab1.diff LOG: Change the default target CPU for OpenBSD/i386 to i586 Added: Modified: clang/lib/Driver/ToolChains/Arch/X86.cpp clang/test/Driver/openbsd.c Removed: diff --git a/clang/lib/Driver/ToolChains/Arch/X86.cpp b/clang/lib/Driver/ToolChains/Arch/X86.cpp index c49aaadc42ae..94a53f9d9e46 100644 --- a/clang/lib/Driver/ToolChains/Arch/X86.cpp +++ b/clang/lib/Driver/ToolChains/Arch/X86.cpp @@ -94,13 +94,13 @@ std::string x86::getX86TargetCPU(const ArgList &Args, return "x86-64"; switch (Triple.getOS()) { - case llvm::Triple::FreeBSD: -return "i686"; case llvm::Triple::NetBSD: - case llvm::Triple::OpenBSD: return "i486"; case llvm::Triple::Haiku: + case llvm::Triple::OpenBSD: return "i586"; + case llvm::Triple::FreeBSD: +return "i686"; default: // Fallback to p4. return "pentium4"; diff --git a/clang/test/Driver/openbsd.c b/clang/test/Driver/openbsd.c index 51a5b4380f45..e17d05dc76da 100644 --- a/clang/test/Driver/openbsd.c +++ b/clang/test/Driver/openbsd.c @@ -14,6 +14,11 @@ // CHECK-PG: clang{{.*}}" "-cc1" "-triple" "i686-pc-openbsd" // CHECK-PG: ld{{.*}}" "-e" "__start" "--eh-frame-hdr" "-Bdynamic" "-dynamic-linker" "{{.*}}ld.so" "-nopie" "-o" "a.out" "{{.*}}gcrt0.o" "{{.*}}crtbegin.o" "{{.*}}.o" "-lcompiler_rt" "-lpthread_p" "-lc_p" "-lcompiler_rt" "{{.*}}crtend.o" +// Check CPU type for i386 +// RUN: %clang -target i386-unknown-openbsd -### -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-i386-CPU %s +// CHECK-i386-CPU: "-target-cpu" "i586" + // Check CPU type for MIPS64 // RUN: %clang -target mips64-unknown-openbsd -### -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK-MIPS64-CPU %s ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 4eb4ebf - Hook up OpenBSD 64-bit PowerPC support
Author: Brad Smith Date: 2020-08-08T17:51:19-04:00 New Revision: 4eb4ebf76a6e26b0632968dd299d1dc6ad07e694 URL: https://github.com/llvm/llvm-project/commit/4eb4ebf76a6e26b0632968dd299d1dc6ad07e694 DIFF: https://github.com/llvm/llvm-project/commit/4eb4ebf76a6e26b0632968dd299d1dc6ad07e694.diff LOG: Hook up OpenBSD 64-bit PowerPC support Added: Modified: clang/lib/Basic/Targets.cpp clang/lib/Basic/Targets/OSTargets.h clang/lib/Basic/Targets/PPC.h clang/lib/Driver/ToolChains/Clang.cpp clang/test/Driver/ppc-abi.c clang/test/Preprocessor/init-ppc64.c clang/test/Preprocessor/init.c Removed: diff --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp index 6bbcafa27dfe..bd3c2d66f958 100644 --- a/clang/lib/Basic/Targets.cpp +++ b/clang/lib/Basic/Targets.cpp @@ -346,6 +346,8 @@ TargetInfo *AllocateTarget(const llvm::Triple &Triple, return new FreeBSDTargetInfo(Triple, Opts); case llvm::Triple::NetBSD: return new NetBSDTargetInfo(Triple, Opts); +case llvm::Triple::OpenBSD: + return new OpenBSDTargetInfo(Triple, Opts); case llvm::Triple::AIX: return new AIXPPC64TargetInfo(Triple, Opts); default: @@ -358,6 +360,8 @@ TargetInfo *AllocateTarget(const llvm::Triple &Triple, return new LinuxTargetInfo(Triple, Opts); case llvm::Triple::NetBSD: return new NetBSDTargetInfo(Triple, Opts); +case llvm::Triple::OpenBSD: + return new OpenBSDTargetInfo(Triple, Opts); default: return new PPC64TargetInfo(Triple, Opts); } diff --git a/clang/lib/Basic/Targets/OSTargets.h b/clang/lib/Basic/Targets/OSTargets.h index 7b3acc335a35..cc726a92a7ca 100644 --- a/clang/lib/Basic/Targets/OSTargets.h +++ b/clang/lib/Basic/Targets/OSTargets.h @@ -476,6 +476,8 @@ class LLVM_LIBRARY_VISIBILITY OpenBSDTargetInfo : public OSTargetInfo { case llvm::Triple::mips64: case llvm::Triple::mips64el: case llvm::Triple::ppc: +case llvm::Triple::ppc64: +case llvm::Triple::ppc64le: case llvm::Triple::sparcv9: this->MCountName = "_mcount"; break; diff --git a/clang/lib/Basic/Targets/PPC.h b/clang/lib/Basic/Targets/PPC.h index da4d37bbdcfc..88523279a6ee 100644 --- a/clang/lib/Basic/Targets/PPC.h +++ b/clang/lib/Basic/Targets/PPC.h @@ -418,7 +418,7 @@ class LLVM_LIBRARY_VISIBILITY PPC64TargetInfo : public PPCTargetInfo { ABI = "elfv1"; } -if (Triple.isOSFreeBSD() || Triple.isMusl()) { +if (Triple.isOSFreeBSD() || Triple.isOSOpenBSD() || Triple.isMusl()) { LongDoubleWidth = LongDoubleAlign = 64; LongDoubleFormat = &llvm::APFloat::IEEEdouble(); } diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index 68e4eb0eedda..b4a8ce8e95ce 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -1883,7 +1883,8 @@ void Clang::AddPPCTargetArgs(const ArgList &Args, if (T.isOSBinFormatELF()) { switch (getToolChain().getArch()) { case llvm::Triple::ppc64: { - if (T.isMusl() || (T.isOSFreeBSD() && T.getOSMajorVersion() >= 13)) + if ((T.isOSFreeBSD() && T.getOSMajorVersion() >= 13) || + T.isOSOpenBSD() || T.isMusl() ABIName = "elfv2"; else ABIName = "elfv1"; diff --git a/clang/test/Driver/ppc-abi.c b/clang/test/Driver/ppc-abi.c index 2b5cc463e7c3..9415b4c020ab 100644 --- a/clang/test/Driver/ppc-abi.c +++ b/clang/test/Driver/ppc-abi.c @@ -20,6 +20,7 @@ // RUN: %clang -target powerpc64-unknown-freebsd12 %s -### 2>&1 | FileCheck --check-prefix=CHECK-ELFv1 %s // RUN: %clang -target powerpc64-unknown-freebsd13 %s -### 2>&1 | FileCheck --check-prefix=CHECK-ELFv2-BE %s // RUN: %clang -target powerpc64-unknown-freebsd14 %s -### 2>&1 | FileCheck --check-prefix=CHECK-ELFv2-BE %s +// RUN: %clang -target powerpc64-unknown-openbsd %s -### 2>&1 | FileCheck --check-prefix=CHECK-ELFv2-BE-PIE % // RUN: %clang -target powerpc64-linux-musl %s -### 2>&1 | FileCheck --check-prefix=CHECK-ELFv2-BE-PIE %s // CHECK-ELFv1: "-mrelocation-model" "static" diff --git a/clang/test/Preprocessor/init-ppc64.c b/clang/test/Preprocessor/init-ppc64.c index 48d35c95aa57..3550af3b680b 100644 --- a/clang/test/Preprocessor/init-ppc64.c +++ b/clang/test/Preprocessor/init-ppc64.c @@ -1062,6 +1062,7 @@ // RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc64-unknown-freebsd11 -target-abi elfv1 -xc /dev/null | FileCheck --check-prefix=PPC64-ELFv1 %s // RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc64-unknown-freebsd12 -target-abi elfv1 -xc /dev/null | FileCheck --check-prefix=PPC64-ELFv1 %s // RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc64-unknown-freebsd13 -target-abi elfv2 -xc /dev/null | FileCheck --check-prefix=PPC64-ELFv2 %s +// RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc64-unknown-openbsd -target-abi elfv2 -xc /dev/nul
[clang] 430db35 - fix typo
Author: Brad Smith Date: 2020-08-08T17:58:13-04:00 New Revision: 430db35bf21505015c618e292e98793e2ed49169 URL: https://github.com/llvm/llvm-project/commit/430db35bf21505015c618e292e98793e2ed49169 DIFF: https://github.com/llvm/llvm-project/commit/430db35bf21505015c618e292e98793e2ed49169.diff LOG: fix typo Added: Modified: clang/lib/Driver/ToolChains/Clang.cpp Removed: diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index b4a8ce8e95ce..d35d7d808084 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -1884,7 +1884,7 @@ void Clang::AddPPCTargetArgs(const ArgList &Args, switch (getToolChain().getArch()) { case llvm::Triple::ppc64: { if ((T.isOSFreeBSD() && T.getOSMajorVersion() >= 13) || - T.isOSOpenBSD() || T.isMusl() + T.isOSOpenBSD() || T.isMusl()) ABIName = "elfv2"; else ABIName = "elfv1"; ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] f4aba9d - Backout a test that is dependent on an uncommited diff. Fix another.
Author: Brad Smith Date: 2020-08-08T18:39:43-04:00 New Revision: f4aba9d76c61cc4c87b45e4edb57b1968eb7194c URL: https://github.com/llvm/llvm-project/commit/f4aba9d76c61cc4c87b45e4edb57b1968eb7194c DIFF: https://github.com/llvm/llvm-project/commit/f4aba9d76c61cc4c87b45e4edb57b1968eb7194c.diff LOG: Backout a test that is dependent on an uncommited diff. Fix another. Added: Modified: clang/test/Driver/ppc-abi.c clang/test/Preprocessor/init.c Removed: diff --git a/clang/test/Driver/ppc-abi.c b/clang/test/Driver/ppc-abi.c index 9415b4c020ab..491f9336a5c3 100644 --- a/clang/test/Driver/ppc-abi.c +++ b/clang/test/Driver/ppc-abi.c @@ -20,7 +20,7 @@ // RUN: %clang -target powerpc64-unknown-freebsd12 %s -### 2>&1 | FileCheck --check-prefix=CHECK-ELFv1 %s // RUN: %clang -target powerpc64-unknown-freebsd13 %s -### 2>&1 | FileCheck --check-prefix=CHECK-ELFv2-BE %s // RUN: %clang -target powerpc64-unknown-freebsd14 %s -### 2>&1 | FileCheck --check-prefix=CHECK-ELFv2-BE %s -// RUN: %clang -target powerpc64-unknown-openbsd %s -### 2>&1 | FileCheck --check-prefix=CHECK-ELFv2-BE-PIE % +// RUN: %clang -target powerpc64-unknown-openbsd %s -### 2>&1 | FileCheck --check-prefix=CHECK-ELFv2-BE-PIE %s // RUN: %clang -target powerpc64-linux-musl %s -### 2>&1 | FileCheck --check-prefix=CHECK-ELFv2-BE-PIE %s // CHECK-ELFv1: "-mrelocation-model" "static" diff --git a/clang/test/Preprocessor/init.c b/clang/test/Preprocessor/init.c index 9e085a8f9fe8..d6f3225bd04b 100644 --- a/clang/test/Preprocessor/init.c +++ b/clang/test/Preprocessor/init.c @@ -7321,8 +7321,6 @@ // RUN: %clang_cc1 -E -dM -ffreestanding -triple=arm-unknown-openbsd6.1-gnueabi < /dev/null | FileCheck -match-full-lines -check-prefix OPENBSD %s // RUN: %clang_cc1 -E -dM -ffreestanding -triple=i386-unknown-openbsd6.1 < /dev/null | FileCheck -match-full-lines -check-prefix OPENBSD %s // RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc-unknown-openbsd6.1 < /dev/null | FileCheck -match-full-lines -check-prefix OPENBSD %s -// RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc64-unknown-openbsd6.1 < /dev/null | FileCheck -match-full-lines -check-prefix OPENBSD %s -// RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc64le-unknown-openbsd6.1 < /dev/null | FileCheck -match-full-lines -check-prefix OPENBSD %s // RUN: %clang_cc1 -E -dM -ffreestanding -triple=mips64-unknown-openbsd6.1 < /dev/null | FileCheck -match-full-lines -check-prefix OPENBSD %s // RUN: %clang_cc1 -E -dM -ffreestanding -triple=mips64el-unknown-openbsd6.1 < /dev/null | FileCheck -match-full-lines -check-prefix OPENBSD %s // RUN: %clang_cc1 -E -dM -ffreestanding -triple=sparc64-unknown-openbsd6.1 < /dev/null | FileCheck -match-full-lines -check-prefix OPENBSD %s ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 92e82a2 - int64_t and intmax_t are always (signed) long long on OpenBSD.
Author: Brad Smith Date: 2020-08-09T19:43:16-04:00 New Revision: 92e82a2890c38bbb158cbf9dd592328b4c383696 URL: https://github.com/llvm/llvm-project/commit/92e82a2890c38bbb158cbf9dd592328b4c383696 DIFF: https://github.com/llvm/llvm-project/commit/92e82a2890c38bbb158cbf9dd592328b4c383696.diff LOG: int64_t and intmax_t are always (signed) long long on OpenBSD. Added: Modified: clang/lib/Basic/Targets/OSTargets.h Removed: diff --git a/clang/lib/Basic/Targets/OSTargets.h b/clang/lib/Basic/Targets/OSTargets.h index cc726a92a7ca..f89eb0add553 100644 --- a/clang/lib/Basic/Targets/OSTargets.h +++ b/clang/lib/Basic/Targets/OSTargets.h @@ -465,6 +465,8 @@ class LLVM_LIBRARY_VISIBILITY OpenBSDTargetInfo : public OSTargetInfo { public: OpenBSDTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts) : OSTargetInfo(Triple, Opts) { +this->IntMaxType = TargetInfo::SignedLongLong; +this->Int64Type = TargetInfo::SignedLongLong; switch (Triple.getArch()) { case llvm::Triple::x86: case llvm::Triple::x86_64: ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] f5fdb61 - Re-enable OpenBSD PowerPC64 tests.
Author: Brad Smith Date: 2020-08-09T20:52:43-04:00 New Revision: f5fdb6141c5e7a76a10ea702d6fc046692827c43 URL: https://github.com/llvm/llvm-project/commit/f5fdb6141c5e7a76a10ea702d6fc046692827c43 DIFF: https://github.com/llvm/llvm-project/commit/f5fdb6141c5e7a76a10ea702d6fc046692827c43.diff LOG: Re-enable OpenBSD PowerPC64 tests. Added: Modified: clang/test/Preprocessor/init.c Removed: diff --git a/clang/test/Preprocessor/init.c b/clang/test/Preprocessor/init.c index d6f3225bd04b..9e085a8f9fe8 100644 --- a/clang/test/Preprocessor/init.c +++ b/clang/test/Preprocessor/init.c @@ -7321,6 +7321,8 @@ // RUN: %clang_cc1 -E -dM -ffreestanding -triple=arm-unknown-openbsd6.1-gnueabi < /dev/null | FileCheck -match-full-lines -check-prefix OPENBSD %s // RUN: %clang_cc1 -E -dM -ffreestanding -triple=i386-unknown-openbsd6.1 < /dev/null | FileCheck -match-full-lines -check-prefix OPENBSD %s // RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc-unknown-openbsd6.1 < /dev/null | FileCheck -match-full-lines -check-prefix OPENBSD %s +// RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc64-unknown-openbsd6.1 < /dev/null | FileCheck -match-full-lines -check-prefix OPENBSD %s +// RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc64le-unknown-openbsd6.1 < /dev/null | FileCheck -match-full-lines -check-prefix OPENBSD %s // RUN: %clang_cc1 -E -dM -ffreestanding -triple=mips64-unknown-openbsd6.1 < /dev/null | FileCheck -match-full-lines -check-prefix OPENBSD %s // RUN: %clang_cc1 -E -dM -ffreestanding -triple=mips64el-unknown-openbsd6.1 < /dev/null | FileCheck -match-full-lines -check-prefix OPENBSD %s // RUN: %clang_cc1 -E -dM -ffreestanding -triple=sparc64-unknown-openbsd6.1 < /dev/null | FileCheck -match-full-lines -check-prefix OPENBSD %s ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 5fe1713 - [Sparc] Define __GCC_HAVE_SYNC_COMPARE_AND_SWAP macros on SPARCv9
Author: Brad Smith Date: 2020-08-11T00:04:24-04:00 New Revision: 5fe171321c018a811debc306a776dbdf27a306dd URL: https://github.com/llvm/llvm-project/commit/5fe171321c018a811debc306a776dbdf27a306dd DIFF: https://github.com/llvm/llvm-project/commit/5fe171321c018a811debc306a776dbdf27a306dd.diff LOG: [Sparc] Define __GCC_HAVE_SYNC_COMPARE_AND_SWAP macros on SPARCv9 Added: Modified: clang/lib/Basic/Targets/Sparc.cpp clang/test/Preprocessor/predefined-arch-macros.c Removed: diff --git a/clang/lib/Basic/Targets/Sparc.cpp b/clang/lib/Basic/Targets/Sparc.cpp index 13aa964d4716..48f36c5ba1c6 100644 --- a/clang/lib/Basic/Targets/Sparc.cpp +++ b/clang/lib/Basic/Targets/Sparc.cpp @@ -240,6 +240,11 @@ void SparcV9TargetInfo::getTargetDefines(const LangOptions &Opts, Builder.defineMacro("__sparc_v9__"); Builder.defineMacro("__sparcv9__"); } + + Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1"); + Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2"); + Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4"); + Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8"); } void SparcV9TargetInfo::fillValidCPUList( diff --git a/clang/test/Preprocessor/predefined-arch-macros.c b/clang/test/Preprocessor/predefined-arch-macros.c index e457a0479b33..abab9274ffbb 100644 --- a/clang/test/Preprocessor/predefined-arch-macros.c +++ b/clang/test/Preprocessor/predefined-arch-macros.c @@ -3174,6 +3174,14 @@ // CHECK_SPARCV9: #define __sparcv9 1 // CHECK_SPARCV9: #define __sparcv9__ 1 +// RUN: %clang -E -dM %s -o - 2>&1 \ +// RUN: -target sparcv9-unknown-linux \ +// RUN: | FileCheck -match-full-lines %s -check-prefix=CHECK_SPARCV9_GCC_ATOMICS +// CHECK_SPARCV9_GCC_ATOMICS: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1 +// CHECK_SPARCV9_GCC_ATOMICS: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 1 +// CHECK_SPARCV9_GCC_ATOMICS: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 1 +// CHECK_SPARCV9_GCC_ATOMICS: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 1 + // Begin SystemZ/GCC/Linux tests // RUN: %clang -march=arch8 -E -dM %s -o - 2>&1 \ ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 44613bb - Create strict aligned code for OpenBSD/arm64.
Author: Brad Smith Date: 2020-08-16T07:14:34-04:00 New Revision: 44613bbec88be9e86b8c52c4f40bb1b1ab48d84c URL: https://github.com/llvm/llvm-project/commit/44613bbec88be9e86b8c52c4f40bb1b1ab48d84c DIFF: https://github.com/llvm/llvm-project/commit/44613bbec88be9e86b8c52c4f40bb1b1ab48d84c.diff LOG: Create strict aligned code for OpenBSD/arm64. Added: Modified: clang/lib/Driver/ToolChains/Arch/AArch64.cpp clang/test/Driver/arm-alignment.c Removed: diff --git a/clang/lib/Driver/ToolChains/Arch/AArch64.cpp b/clang/lib/Driver/ToolChains/Arch/AArch64.cpp index 43959f5abe43..ce7c5348a4d5 100644 --- a/clang/lib/Driver/ToolChains/Arch/AArch64.cpp +++ b/clang/lib/Driver/ToolChains/Arch/AArch64.cpp @@ -376,9 +376,11 @@ void aarch64::getAArch64TargetFeatures(const Driver &D, D.Diag(diag::err_drv_invalid_sve_vector_bits); if (Arg *A = Args.getLastArg(options::OPT_mno_unaligned_access, - options::OPT_munaligned_access)) + options::OPT_munaligned_access)) { if (A->getOption().matches(options::OPT_mno_unaligned_access)) Features.push_back("+strict-align"); + } else if (Triple.isOSOpenBSD()) +Features.push_back("+strict-align"); if (Args.hasArg(options::OPT_ffixed_x1)) Features.push_back("+reserve-x1"); diff --git a/clang/test/Driver/arm-alignment.c b/clang/test/Driver/arm-alignment.c index e0b4946d0a4b..b2bc8a35dfc6 100644 --- a/clang/test/Driver/arm-alignment.c +++ b/clang/test/Driver/arm-alignment.c @@ -80,6 +80,9 @@ // RUN: %clang -target aarch64-none-gnueabi -mkernel -mno-unaligned-access -### %s 2> %t // RUN: FileCheck --check-prefix=CHECK-ALIGNED-AARCH64 < %t %s +// RUN: %clang -target aarch64-unknown-openbsd -### %s 2> %t +// RUN: FileCheck --check-prefix=CHECK-ALIGNED-AARCH64 < %t %s + // CHECK-ALIGNED-ARM: "-target-feature" "+strict-align" // CHECK-ALIGNED-AARCH64: "-target-feature" "+strict-align" ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D22130: Link static PIE programs against rcrt0.o on OpenBSD
On 09/10/16 05:27, Stefan Kempf via cfe-commits wrote: Ed Maste wrote: emaste added a comment. Seems fine to me, but I'm not particularly knowledgeable about OpenBSD's toolchain. Could you commit it please if it looks ok? This diff is what OpenBSD has in its tree. We'd like to get it upstream. ping. ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: r284256 - Link static PIE programs against rcrt0.o on OpenBSD
On Fri, Oct 14, 2016 at 05:59:54PM -, Ed Maste via cfe-commits wrote: > Author: emaste > Date: Fri Oct 14 12:59:53 2016 > New Revision: 284256 > > URL: http://llvm.org/viewvc/llvm-project?rev=284256&view=rev > Log: > Link static PIE programs against rcrt0.o on OpenBSD > > Patch by Stefan Kempf. > > Differential Revision:https://reviews.llvm.org/D22130 > > Modified: > cfe/trunk/lib/Driver/Tools.cpp > cfe/trunk/test/Driver/openbsd.c > > Modified: cfe/trunk/lib/Driver/Tools.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=284256&r1=284255&r2=284256&view=diff > == > --- cfe/trunk/lib/Driver/Tools.cpp (original) > +++ cfe/trunk/lib/Driver/Tools.cpp Fri Oct 14 12:59:53 2016 > @@ -8519,6 +8519,10 @@ void openbsd::Linker::ConstructJob(Compi >if (Args.hasArg(options::OPT_pg)) > CmdArgs.push_back( > Args.MakeArgString(getToolChain().GetFilePath("gcrt0.o"))); > + else if (Args.hasArg(options::OPT_static) && > + !Args.hasArg(options::OPT_nopie)) > +CmdArgs.push_back( > +Args.MakeArgString(getToolChain().GetFilePath("rcrt0.o"))); >else > CmdArgs.push_back( > Args.MakeArgString(getToolChain().GetFilePath("crt0.o"))); > > Modified: cfe/trunk/test/Driver/openbsd.c > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/openbsd.c?rev=284256&r1=284255&r2=284256&view=diff > == > --- cfe/trunk/test/Driver/openbsd.c (original) > +++ cfe/trunk/test/Driver/openbsd.c Fri Oct 14 12:59:53 2016 > @@ -67,3 +67,26 @@ > // CHECK-MIPS64-PIC: as{{.*}}" "-mabi" "64" "-EB" "-KPIC" > // CHECK-MIPS64EL: as{{.*}}" "-mabi" "64" "-EL" > // CHECK-MIPS64EL-PIC: as{{.*}}" "-mabi" "64" "-EL" "-KPIC" > + > +// Check linking against correct startup code when (not) using PIE > +// RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd %s -### 2>&1 \ > +// RUN: | FileCheck -check-prefix=CHECK-PIE %s > +// RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd %s -fno-pie %s > -### 2>&1 \ > +// RUN: | FileCheck -check-prefix=CHECK-PIE %s > +// RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd -static %s > -### 2>&1 \ > +// RUN: | FileCheck -check-prefix=CHECK-STATIC-PIE %s > +// RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd -static > -fno-pie %s -### 2>&1 \ > +// RUN: | FileCheck -check-prefix=CHECK-STATIC-PIE %s > +// RUN: %clang -no-canonical-prefix -target i868-pc-openbsd -nopie %s -### > 2>&1 \ > +// RUN: | FileCheck -check-prefix=CHECK-NOPIE %s > +// RUN: %clang -no-canonical-prefix -target i868-pc-openbsd -fno-pie -nopie > %s -### 2>&1 \ > +// RUN: | FileCheck -check-prefix=CHECK-NOPIE %s > +// RUN: %clang -no-canonical-prefix -target i868-pc-openbsd -static -nopie > %s -### 2>&1 \ > +// RUN: | FileCheck -check-prefix=CHECK-NOPIE %s > +// RUN: %clang -no-canonical-prefix -target i868-pc-openbsd -fno-pie -static > -nopie %s -### 2>&1 \ > +// RUN: | FileCheck -check-prefix=CHECK-NOPIE %s > +// CHECK-PIE: "/usr/lib/crt0.o" > +// CHECK-PIE-NOT: "-nopie" > +// CHECK-STATIC-PIE: "/usr/lib/rcrt0.o" > +// CHECK-STATIC-PIE-NOT: "-nopie" > +// CHECK-NOPIE: "-nopie" {{.*}}"/usr/lib/crt0.o" Ok, I see the obvious issue with -no-canonical-prefix vs -no-canonical-prefixes and fix the typo with the target triples. Index: lib/Driver/Tools.cpp === --- lib/Driver/Tools.cpp(revision 284299) +++ lib/Driver/Tools.cpp(working copy) @@ -8519,6 +8519,10 @@ if (Args.hasArg(options::OPT_pg)) CmdArgs.push_back( Args.MakeArgString(getToolChain().GetFilePath("gcrt0.o"))); + else if (Args.hasArg(options::OPT_static) && + !Args.hasArg(options::OPT_nopie)) +CmdArgs.push_back( +Args.MakeArgString(getToolChain().GetFilePath("rcrt0.o"))); else CmdArgs.push_back( Args.MakeArgString(getToolChain().GetFilePath("crt0.o"))); Index: test/Driver/openbsd.c === --- test/Driver/openbsd.c (revision 284299) +++ test/Driver/openbsd.c (working copy) @@ -67,3 +67,26 @@ // CHECK-MIPS64-PIC: as{{.*}}" "-mabi" "64" "-EB" "-KPIC" // CHECK-MIPS64EL: as{{.*}}" "-mabi" "64" "-EL" // CHECK-MIPS64EL-PIC: as{{.*}}" "-mabi" "64" "-EL" "-KPIC" + +// Check linking against correct startup code when (not) using PIE +// RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd %s -### 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-PIE %s +// RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd %s -fno-pie %s -### 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-PIE %s +// RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd -static %s -### 2>&1 \ +// RUN: | FileChe
[llvm] [clang] [PowerPC] Add an alias for -mregnames so that full register names used in assembly. (PR #70255)
brad0 wrote: Thanks. https://github.com/llvm/llvm-project/pull/70255 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libunwind] MIPS/libunwind: Use -mfp64 if compiler is FPXX (PR #68521)
brad0 wrote: Probably not the best person to ask. Let's see what MaskRay says. @MaskRay https://github.com/llvm/llvm-project/pull/68521 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] aebd232 - [Driver][FreeBSD][NFC] A bit of clean up
Author: Brad Smith Date: 2023-11-11T20:42:37-05:00 New Revision: aebd23204b305c86e8e8d2cd0a072f9df4dc55d5 URL: https://github.com/llvm/llvm-project/commit/aebd23204b305c86e8e8d2cd0a072f9df4dc55d5 DIFF: https://github.com/llvm/llvm-project/commit/aebd23204b305c86e8e8d2cd0a072f9df4dc55d5.diff LOG: [Driver][FreeBSD][NFC] A bit of clean up Added: Modified: clang/lib/Driver/ToolChains/FreeBSD.cpp Removed: diff --git a/clang/lib/Driver/ToolChains/FreeBSD.cpp b/clang/lib/Driver/ToolChains/FreeBSD.cpp index 264700acc77bf3b..d46feb3459a6344 100644 --- a/clang/lib/Driver/ToolChains/FreeBSD.cpp +++ b/clang/lib/Driver/ToolChains/FreeBSD.cpp @@ -30,13 +30,16 @@ void freebsd::Assembler::ConstructJob(Compilation &C, const JobAction &JA, const InputInfoList &Inputs, const ArgList &Args, const char *LinkingOutput) const { - claimNoWarnArgs(Args); - ArgStringList CmdArgs; + const auto &ToolChain = static_cast(getToolChain()); const auto &D = getToolChain().getDriver(); + const llvm::Triple &Triple = ToolChain.getTriple(); + ArgStringList CmdArgs; + + claimNoWarnArgs(Args); // When building 32-bit code on FreeBSD/amd64, we have to explicitly // instruct as in the base system to assemble 32-bit code. - switch (getToolChain().getArch()) { + switch (ToolChain.getArch()) { default: break; case llvm::Triple::x86: @@ -52,7 +55,7 @@ void freebsd::Assembler::ConstructJob(Compilation &C, const JobAction &JA, case llvm::Triple::mips64el: { StringRef CPUName; StringRef ABIName; -mips::getMipsCPUAndABI(Args, getToolChain().getTriple(), CPUName, ABIName); +mips::getMipsCPUAndABI(Args, Triple, CPUName, ABIName); CmdArgs.push_back("-march"); CmdArgs.push_back(CPUName.data()); @@ -60,7 +63,7 @@ void freebsd::Assembler::ConstructJob(Compilation &C, const JobAction &JA, CmdArgs.push_back("-mabi"); CmdArgs.push_back(mips::getGnuCompatibleMipsABIName(ABIName).data()); -if (getToolChain().getTriple().isLittleEndian()) +if (Triple.isLittleEndian()) CmdArgs.push_back("-EL"); else CmdArgs.push_back("-EB"); @@ -71,14 +74,14 @@ void freebsd::Assembler::ConstructJob(Compilation &C, const JobAction &JA, A->claim(); } -AddAssemblerKPIC(getToolChain(), Args, CmdArgs); +AddAssemblerKPIC(ToolChain, Args, CmdArgs); break; } case llvm::Triple::arm: case llvm::Triple::armeb: case llvm::Triple::thumb: case llvm::Triple::thumbeb: { -arm::FloatABI ABI = arm::getARMFloatABI(getToolChain(), Args); +arm::FloatABI ABI = arm::getARMFloatABI(ToolChain, Args); if (ABI == arm::FloatABI::Hard) CmdArgs.push_back("-mfpu=vfp"); @@ -89,10 +92,9 @@ void freebsd::Assembler::ConstructJob(Compilation &C, const JobAction &JA, break; } case llvm::Triple::sparcv9: { -std::string CPU = getCPUName(D, Args, getToolChain().getTriple()); -CmdArgs.push_back( -sparc::getSparcAsmModeForCPU(CPU, getToolChain().getTriple())); -AddAssemblerKPIC(getToolChain(), Args, CmdArgs); +std::string CPU = getCPUName(D, Args, Triple); +CmdArgs.push_back(sparc::getSparcAsmModeForCPU(CPU, Triple)); +AddAssemblerKPIC(ToolChain, Args, CmdArgs); break; } } @@ -118,7 +120,7 @@ void freebsd::Assembler::ConstructJob(Compilation &C, const JobAction &JA, for (const auto &II : Inputs) CmdArgs.push_back(II.getFilename()); - const char *Exec = Args.MakeArgString(getToolChain().GetProgramPath("as")); + const char *Exec = Args.MakeArgString(ToolChain.GetProgramPath("as")); C.addCommand(std::make_unique(JA, *this, ResponseFileSupport::AtFileCurCP(), Exec, CmdArgs, Inputs, Output)); @@ -366,10 +368,12 @@ void freebsd::Linker::ConstructJob(Compilation &C, const JobAction &JA, if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles, options::OPT_r)) { +const char *crtend = nullptr; if (Args.hasArg(options::OPT_shared) || IsPIE) - CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath("crtendS.o"))); + crtend = "crtendS.o"; else - CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath("crtend.o"))); + crtend = "crtend.o"; +CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath(crtend))); CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath("crtn.o"))); } ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Driver] Add LTO support for Haiku and OpenBSD (PR #72047)
https://github.com/brad0 created https://github.com/llvm/llvm-project/pull/72047 None >From 9f374ff55cb851534a8c882770d9237f1d40a8b8 Mon Sep 17 00:00:00 2001 From: Brad Smith Date: Sat, 21 Oct 2023 02:18:34 -0400 Subject: [PATCH] [Driver] Add LTO support for Haiku and OpenBSD --- clang/lib/Driver/ToolChains/CommonArgs.cpp | 3 ++- clang/lib/Driver/ToolChains/Haiku.cpp | 14 ++ clang/lib/Driver/ToolChains/OpenBSD.cpp| 14 ++ clang/test/Driver/emulated-tls.cpp | 2 ++ clang/test/Driver/haiku.c | 5 + clang/test/Driver/openbsd.c| 5 + clang/test/Driver/save-stats.c | 5 - 7 files changed, 46 insertions(+), 2 deletions(-) diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp index a81c9b6201f8158..5d2cd1959b06925 100644 --- a/clang/lib/Driver/ToolChains/CommonArgs.cpp +++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp @@ -598,7 +598,8 @@ void tools::addLTOOptions(const ToolChain &ToolChain, const ArgList &Args, const char *Linker = Args.MakeArgString(ToolChain.GetLinkerPath()); const Driver &D = ToolChain.getDriver(); if (llvm::sys::path::filename(Linker) != "ld.lld" && - llvm::sys::path::stem(Linker) != "ld.lld") { + llvm::sys::path::stem(Linker) != "ld.lld" && + !ToolChain.getTriple().isOSOpenBSD()) { // Tell the linker to load the plugin. This has to come before // AddLinkerInputs as gold requires -plugin and AIX ld requires -bplugin to // come before any -plugin-opt/-bplugin_opt that -Wl might forward. diff --git a/clang/lib/Driver/ToolChains/Haiku.cpp b/clang/lib/Driver/ToolChains/Haiku.cpp index 1c2d6bcaf9b457d..e0d94035823fd37 100644 --- a/clang/lib/Driver/ToolChains/Haiku.cpp +++ b/clang/lib/Driver/ToolChains/Haiku.cpp @@ -83,6 +83,20 @@ void haiku::Linker::ConstructJob(Compilation &C, const JobAction &JA, options::OPT_s, options::OPT_t, options::OPT_r}); ToolChain.AddFilePathLibArgs(Args, CmdArgs); + if (D.isUsingLTO()) { +assert(!Inputs.empty() && "Must have at least one input."); +// Find the first filename InputInfo object. +auto Input = llvm::find_if( +Inputs, [](const InputInfo &II) -> bool { return II.isFilename(); }); +if (Input == Inputs.end()) + // For a very rare case, all of the inputs to the linker are + // InputArg. If that happens, just use the first InputInfo. + Input = Inputs.begin(); + +addLTOOptions(ToolChain, Args, CmdArgs, Output, *Input, + D.getLTOMode() == LTOK_Thin); + } + addLinkerCompressDebugSectionsOption(ToolChain, Args, CmdArgs); AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs, JA); diff --git a/clang/lib/Driver/ToolChains/OpenBSD.cpp b/clang/lib/Driver/ToolChains/OpenBSD.cpp index d9f6b20f43ad854..798b39ce86badce 100644 --- a/clang/lib/Driver/ToolChains/OpenBSD.cpp +++ b/clang/lib/Driver/ToolChains/OpenBSD.cpp @@ -195,6 +195,20 @@ void openbsd::Linker::ConstructJob(Compilation &C, const JobAction &JA, Args.addAllArgs(CmdArgs, {options::OPT_T_Group, options::OPT_s, options::OPT_t, options::OPT_r}); + if (D.isUsingLTO()) { +assert(!Inputs.empty() && "Must have at least one input."); +// Find the first filename InputInfo object. +auto Input = llvm::find_if( +Inputs, [](const InputInfo &II) -> bool { return II.isFilename(); }); +if (Input == Inputs.end()) + // For a very rare case, all of the inputs to the linker are + // InputArg. If that happens, just use the first InputInfo. + Input = Inputs.begin(); + +addLTOOptions(ToolChain, Args, CmdArgs, Output, *Input, + D.getLTOMode() == LTOK_Thin); + } + bool NeedsSanitizerDeps = addSanitizerRuntimes(ToolChain, Args, CmdArgs); bool NeedsXRayDeps = addXRayRuntime(ToolChain, Args, CmdArgs); AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs, JA); diff --git a/clang/test/Driver/emulated-tls.cpp b/clang/test/Driver/emulated-tls.cpp index 2044bc89a36634a..3ee901a8358589e 100644 --- a/clang/test/Driver/emulated-tls.cpp +++ b/clang/test/Driver/emulated-tls.cpp @@ -39,6 +39,8 @@ // RUN: | FileCheck %s --check-prefix=LTO_EMUTLS // RUN: %clang -### -flto --target=riscv64-linux-android1 -fno-emulated-tls %s 2>&1 \ // RUN: | FileCheck %s --check-prefix=LTO_NOEMUTLS +// RUN: %clang -### -flto --target=amd64-unknown-openbsd %s 2>&1 \ +// RUN: | FileCheck %s --check-prefix=LTO_EMUTLS // Default without -f[no-]emulated-tls, will be decided by the target triple. // DEFAULT-NOT: "-cc1" {{.*}}"-femulated-tls" diff --git a/clang/test/Driver/haiku.c b/clang/test/Driver/haiku.c index 965d3cf97bc36bf..e907c34b29b9955 100644 --- a/clang/test/Driver/haiku.c +++ b/clang/test/Driver/haiku.c @@ -75,3 +75,8 @@ // RUN: %clang -### %s 2>&1 --target=arm-unknown-haiku \ // RUN: | FileCheck --check-prefix=CHECK-ARM-CPU %s // CHECK-ARM-CPU: "-targe
[clang] [Driver] Add LTO support for Haiku and OpenBSD (PR #72047)
https://github.com/brad0 closed https://github.com/llvm/llvm-project/pull/72047 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] e87633a - [Driver][OpenBSD] Enable kernel address sanitizer on amd64
Author: Brad Smith Date: 2023-11-13T16:47:59-05:00 New Revision: e87633a548a6bf882761e8886804df9064a25fab URL: https://github.com/llvm/llvm-project/commit/e87633a548a6bf882761e8886804df9064a25fab DIFF: https://github.com/llvm/llvm-project/commit/e87633a548a6bf882761e8886804df9064a25fab.diff LOG: [Driver][OpenBSD] Enable kernel address sanitizer on amd64 Added: Modified: clang/lib/Driver/ToolChains/OpenBSD.cpp Removed: diff --git a/clang/lib/Driver/ToolChains/OpenBSD.cpp b/clang/lib/Driver/ToolChains/OpenBSD.cpp index 798b39ce86badce..5d06cd8ab0bad16 100644 --- a/clang/lib/Driver/ToolChains/OpenBSD.cpp +++ b/clang/lib/Driver/ToolChains/OpenBSD.cpp @@ -295,16 +295,15 @@ void openbsd::Linker::ConstructJob(Compilation &C, const JobAction &JA, SanitizerMask OpenBSD::getSupportedSanitizers() const { const bool IsX86 = getTriple().getArch() == llvm::Triple::x86; const bool IsX86_64 = getTriple().getArch() == llvm::Triple::x86_64; - - // For future use, only UBsan at the moment SanitizerMask Res = ToolChain::getSupportedSanitizers(); - if (IsX86 || IsX86_64) { Res |= SanitizerKind::Vptr; Res |= SanitizerKind::Fuzzer; Res |= SanitizerKind::FuzzerNoLink; } - + if (IsX86_64) { +Res |= SanitizerKind::KernelAddress; + } return Res; } ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Driver] Handle Flang in same manner between Gnu and *BSD/Solaris ToolChain (PR #70429)
brad0 wrote: > Seems fine to me once a test is added:) I cannot test as is as the frontend does not support these flags yet. I am just keeping things in sync between the C++ bit above that.. ``` if (D.CCCIsCXX() && !Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs, options::OPT_r)) { ``` and the behavior being the same for the other OS's. But I am working on a patch for the frontend to enable the flags. So I'll just keep this around for a bit and then update it. https://github.com/llvm/llvm-project/pull/70429 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Driver] Make use of AddFilePathLibArgs() on NetBSD. (PR #71371)
brad0 wrote: Ping. https://github.com/llvm/llvm-project/pull/71371 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Driver] Make use of AddFilePathLibArgs() on NetBSD. (PR #71371)
@@ -461,3 +461,8 @@ // DRIVER-PASS-INCLUDES: "-cc1" {{.*}}"-resource-dir" "[[RESOURCE:[^"]+]]" // DRIVER-PASS-INCLUDES-SAME: "-internal-isystem" "[[RESOURCE]]{{/|}}include" // DRIVER-PASS-INCLUDES-SAME: {{^}} "-internal-externc-isystem" "{{.*}}/usr/include" + +// Check that the driver passes the system library path. brad0 wrote: Good points made. I'll take a look at changing the test as well as making sure sysroot is used. https://github.com/llvm/llvm-project/pull/71371 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Driver] Mark -arch as TargetSpecific (PR #74365)
https://github.com/brad0 approved this pull request. https://github.com/llvm/llvm-project/pull/74365 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Driver][LTO] Copy fix empty stats filename to AMDGPU, HIPAMD, MinGW (PR #74178)
brad0 wrote: @MaskRay Any response to what [yxsamliu](https://github.com/yxsamliu) said? https://github.com/llvm/llvm-project/pull/74178 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[llvm] [clang] [llvm] Add support for building on illumos (PR #74930)
https://github.com/brad0 created https://github.com/llvm/llvm-project/pull/74930 illumos has an older version of the Solaris linker that does not support the GNU version script compat nor version scripts and does not support -Bsymbolic-functions. Treat illumos linker separately. The libclang/CMakeLists part lifted from NetBSD's pkgsrc. Build tested on Solaris 11.4 and OpenIndiana. /usr/bin/ld --version ld: Software Generation Utilities - Solaris Link Editors: 5.11-1.3260 ld: Software Generation Utilities - Solaris Link Editors: 5.11-1.1790 (illumos) >From 5b41ec8ab1640e09f0fa29bf2b9f2ec89168d4c4 Mon Sep 17 00:00:00 2001 From: Brad Smith Date: Sat, 9 Dec 2023 01:43:09 -0500 Subject: [PATCH] [llvm] Add support for building on illumos illumos has an older version of the Solaris linker that does not support the GNU version script compat nor version scripts and does not support -Bsymbolic-functions. Treat illumos linker separately. --- clang/tools/clang-shlib/CMakeLists.txt | 2 +- clang/tools/libclang/CMakeLists.txt| 19 +++ llvm/cmake/modules/AddLLVM.cmake | 13 ++--- llvm/tools/llvm-shlib/CMakeLists.txt | 4 ++-- 4 files changed, 28 insertions(+), 10 deletions(-) diff --git a/clang/tools/clang-shlib/CMakeLists.txt b/clang/tools/clang-shlib/CMakeLists.txt index aa7fcd1efed45..298d3a9d18fec 100644 --- a/clang/tools/clang-shlib/CMakeLists.txt +++ b/clang/tools/clang-shlib/CMakeLists.txt @@ -50,7 +50,7 @@ add_clang_library(clang-cpp ${_DEPS}) # Optimize function calls for default visibility definitions to avoid PLT and # reduce dynamic relocations. -if (NOT APPLE AND NOT MINGW) +if (NOT APPLE AND NOT MINGW AND NOT LLVM_LINKER_IS_SOLARISLD_ILLUMOS) target_link_options(clang-cpp PRIVATE LINKER:-Bsymbolic-functions) endif() if (MINGW OR CYGWIN) diff --git a/clang/tools/libclang/CMakeLists.txt b/clang/tools/libclang/CMakeLists.txt index 4f23065a24727..1cfc46eb1a52f 100644 --- a/clang/tools/libclang/CMakeLists.txt +++ b/clang/tools/libclang/CMakeLists.txt @@ -185,11 +185,22 @@ if(ENABLE_SHARED) endif() endif() if (USE_VERSION_SCRIPT) -target_link_options(libclang PRIVATE "-Wl,--version-script,${CMAKE_CURRENT_SOURCE_DIR}/libclang.map") -# The Solaris 11.4 linker supports a subset of GNU ld version scripts, -# but requires a special option to enable it. if (${CMAKE_SYSTEM_NAME} MATCHES "SunOS") - target_link_options(libclang PRIVATE "-Wl,-z,gnu-version-script-compat") + include(CheckLinkerFlag) + # The Solaris 11.4 linker supports a subset of GNU ld version scripts, + # but requires a special option to enable it. + llvm_check_linker_flag(CXX "-Wl,-z,gnu-version-script-compat" + LINKER_SUPPORTS_Z_GNU_VERSION_SCRIPT_COMPAT) + # Older Solaris (and illumos) linker does not support GNU ld version scripts + # and does not support GNU version script compat. + if (LINKER_SUPPORTS_Z_GNU_VERSION_SCRIPT_COMPAT) +target_link_options(libclang PRIVATE "-Wl,--version-script,${CMAKE_CURRENT_SOURCE_DIR}/libclang.map") +target_link_options(libclang PRIVATE "-Wl,-z,gnu-version-script-compat") + else() +target_link_options(libclang PRIVATE "-Wl,-M,${CMAKE_CURRENT_SOURCE_DIR}/libclang.map") + endif() +else() + target_link_options(libclang PRIVATE "-Wl,--version-script,${CMAKE_CURRENT_SOURCE_DIR}/libclang.map") endif() # Ensure that libclang.so gets rebuilt when the linker script changes. set_property(SOURCE ARCMigrate.cpp APPEND PROPERTY diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake index c9bca30c8f33d..ca146ad699ff6 100644 --- a/llvm/cmake/modules/AddLLVM.cmake +++ b/llvm/cmake/modules/AddLLVM.cmake @@ -115,7 +115,7 @@ function(add_llvm_symbol_exports target_name export_file) DEPENDS ${export_file} VERBATIM COMMENT "Creating export file for ${target_name}") -if (${LLVM_LINKER_IS_SOLARISLD}) +if ((${LLVM_LINKER_IS_SOLARISLD}) OR (${LLVM_LINKER_IS_SOLARISLD_ILLUMOS})) set_property(TARGET ${target_name} APPEND_STRING PROPERTY LINK_FLAGS " -Wl,-M,\"${CMAKE_CURRENT_BINARY_DIR}/${native_export_file}\"") else() @@ -241,6 +241,11 @@ if (NOT DEFINED LLVM_LINKER_DETECTED AND NOT WIN32) set(LLVM_LINKER_DETECTED YES CACHE INTERNAL "") set(LLVM_LINKER_IS_GNULD YES CACHE INTERNAL "") message(STATUS "Linker detection: GNU ld") +elseif("${stderr}" MATCHES "(illumos)" OR + "${stdout}" MATCHES "(illumos)") + set(LLVM_LINKER_DETECTED YES CACHE INTERNAL "") + set(LLVM_LINKER_IS_SOLARISLD_ILLUMOS YES CACHE INTERNAL "") + message(STATUS "Linker detection: Solaris ld (illumos)") elseif("${stderr}" MATCHES "Solaris Link Editors" OR "${stdout}" MATCHES "Solaris Link Editors") set(LLVM_LINKER_DETECTED YES CACHE INTERNAL "") @@ -282,11 +287,13 @@ function(add_link
[llvm] [clang] [llvm] Add support for building on illumos (PR #74930)
https://github.com/brad0 updated https://github.com/llvm/llvm-project/pull/74930 >From 58f07d552bb73244e1641078aebdbce64d5219e9 Mon Sep 17 00:00:00 2001 From: Brad Smith Date: Sat, 9 Dec 2023 01:43:09 -0500 Subject: [PATCH] [llvm] Add support for building on illumos illumos has an older version of the Solaris linker that does not support the GNU version script compat nor version scripts and does not support -Bsymbolic-functions. Treat illumos linker separately. The libclang/CMakeLists part lifted from NetBSD's pkgsrc. --- clang/tools/clang-shlib/CMakeLists.txt | 2 +- clang/tools/libclang/CMakeLists.txt| 19 +++ llvm/cmake/modules/AddLLVM.cmake | 13 ++--- llvm/tools/llvm-shlib/CMakeLists.txt | 4 ++-- 4 files changed, 28 insertions(+), 10 deletions(-) diff --git a/clang/tools/clang-shlib/CMakeLists.txt b/clang/tools/clang-shlib/CMakeLists.txt index aa7fcd1efed45b..298d3a9d18fec8 100644 --- a/clang/tools/clang-shlib/CMakeLists.txt +++ b/clang/tools/clang-shlib/CMakeLists.txt @@ -50,7 +50,7 @@ add_clang_library(clang-cpp ${_DEPS}) # Optimize function calls for default visibility definitions to avoid PLT and # reduce dynamic relocations. -if (NOT APPLE AND NOT MINGW) +if (NOT APPLE AND NOT MINGW AND NOT LLVM_LINKER_IS_SOLARISLD_ILLUMOS) target_link_options(clang-cpp PRIVATE LINKER:-Bsymbolic-functions) endif() if (MINGW OR CYGWIN) diff --git a/clang/tools/libclang/CMakeLists.txt b/clang/tools/libclang/CMakeLists.txt index 4f23065a247274..1cfc46eb1a52f6 100644 --- a/clang/tools/libclang/CMakeLists.txt +++ b/clang/tools/libclang/CMakeLists.txt @@ -185,11 +185,22 @@ if(ENABLE_SHARED) endif() endif() if (USE_VERSION_SCRIPT) -target_link_options(libclang PRIVATE "-Wl,--version-script,${CMAKE_CURRENT_SOURCE_DIR}/libclang.map") -# The Solaris 11.4 linker supports a subset of GNU ld version scripts, -# but requires a special option to enable it. if (${CMAKE_SYSTEM_NAME} MATCHES "SunOS") - target_link_options(libclang PRIVATE "-Wl,-z,gnu-version-script-compat") + include(CheckLinkerFlag) + # The Solaris 11.4 linker supports a subset of GNU ld version scripts, + # but requires a special option to enable it. + llvm_check_linker_flag(CXX "-Wl,-z,gnu-version-script-compat" + LINKER_SUPPORTS_Z_GNU_VERSION_SCRIPT_COMPAT) + # Older Solaris (and illumos) linker does not support GNU ld version scripts + # and does not support GNU version script compat. + if (LINKER_SUPPORTS_Z_GNU_VERSION_SCRIPT_COMPAT) +target_link_options(libclang PRIVATE "-Wl,--version-script,${CMAKE_CURRENT_SOURCE_DIR}/libclang.map") +target_link_options(libclang PRIVATE "-Wl,-z,gnu-version-script-compat") + else() +target_link_options(libclang PRIVATE "-Wl,-M,${CMAKE_CURRENT_SOURCE_DIR}/libclang.map") + endif() +else() + target_link_options(libclang PRIVATE "-Wl,--version-script,${CMAKE_CURRENT_SOURCE_DIR}/libclang.map") endif() # Ensure that libclang.so gets rebuilt when the linker script changes. set_property(SOURCE ARCMigrate.cpp APPEND PROPERTY diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake index c9bca30c8f33d1..ca146ad699ff6c 100644 --- a/llvm/cmake/modules/AddLLVM.cmake +++ b/llvm/cmake/modules/AddLLVM.cmake @@ -115,7 +115,7 @@ function(add_llvm_symbol_exports target_name export_file) DEPENDS ${export_file} VERBATIM COMMENT "Creating export file for ${target_name}") -if (${LLVM_LINKER_IS_SOLARISLD}) +if ((${LLVM_LINKER_IS_SOLARISLD}) OR (${LLVM_LINKER_IS_SOLARISLD_ILLUMOS})) set_property(TARGET ${target_name} APPEND_STRING PROPERTY LINK_FLAGS " -Wl,-M,\"${CMAKE_CURRENT_BINARY_DIR}/${native_export_file}\"") else() @@ -241,6 +241,11 @@ if (NOT DEFINED LLVM_LINKER_DETECTED AND NOT WIN32) set(LLVM_LINKER_DETECTED YES CACHE INTERNAL "") set(LLVM_LINKER_IS_GNULD YES CACHE INTERNAL "") message(STATUS "Linker detection: GNU ld") +elseif("${stderr}" MATCHES "(illumos)" OR + "${stdout}" MATCHES "(illumos)") + set(LLVM_LINKER_DETECTED YES CACHE INTERNAL "") + set(LLVM_LINKER_IS_SOLARISLD_ILLUMOS YES CACHE INTERNAL "") + message(STATUS "Linker detection: Solaris ld (illumos)") elseif("${stderr}" MATCHES "Solaris Link Editors" OR "${stdout}" MATCHES "Solaris Link Editors") set(LLVM_LINKER_DETECTED YES CACHE INTERNAL "") @@ -282,11 +287,13 @@ function(add_link_opts target_name) # ld64's implementation of -dead_strip breaks tools that use plugins. set_property(TARGET ${target_name} APPEND_STRING PROPERTY LINK_FLAGS " -Wl,-dead_strip") - elseif(${CMAKE_SYSTEM_NAME} MATCHES "SunOS" AND LLVM_LINKER_IS_SOLARISLD) + elseif(${CMAKE_SYSTEM_NAME} MATCHES "SunOS" AND (LLVM_LINKER_IS_SOLARISLD OR + LLVM_LINKER_IS_SO
[clang] [Cygwin] Cygwin driver (PR #74933)
=?utf-8?b?5b6Q5oyB5oGS?= Xu Chiheng,=?utf-8?b?5b6Q5oyB5oGS?= Xu Chiheng, =?utf-8?b?5b6Q5oyB5oGS?= Xu Chiheng,=?utf-8?b?5b6Q5oyB5oGS?= Xu Chiheng Message-ID: In-Reply-To: @@ -310,10 +291,7 @@ bool InitHeaderSearch::ShouldAddDefaultIncludePaths( return false; case llvm::Triple::Win32: -if (triple.getEnvironment() != llvm::Triple::Cygnus || -triple.isOSBinFormatMachO()) - return false; -break; brad0 wrote: Add Win32 to the list just above this. https://github.com/llvm/llvm-project/pull/74933 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Cygwin] Cygwin driver (PR #74933)
=?utf-8?b?5b6Q5oyB5oGS?= Xu Chiheng,=?utf-8?b?5b6Q5oyB5oGS?= Xu Chiheng, =?utf-8?b?5b6Q5oyB5oGS?= Xu Chiheng,=?utf-8?b?5b6Q5oyB5oGS?= Xu Chiheng Message-ID: In-Reply-To: @@ -205,9 +205,7 @@ void InitHeaderSearch::AddDefaultCIncludePaths(const llvm::Triple &triple, if (HSOpts.UseStandardSystemIncludes) { switch (os) { case llvm::Triple::Win32: - if (triple.getEnvironment() != llvm::Triple::Cygnus) -break; - [[fallthrough]]; brad0 wrote: Just remove the Win32 switch case. https://github.com/llvm/llvm-project/pull/74933 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Cygwin] Cygwin driver (PR #74933)
=?utf-8?b?5b6Q5oyB5oGS?= Xu Chiheng,=?utf-8?b?5b6Q5oyB5oGS?= Xu Chiheng, =?utf-8?b?5b6Q5oyB5oGS?= Xu Chiheng,=?utf-8?b?5b6Q5oyB5oGS?= Xu Chiheng Message-ID: In-Reply-To: @@ -268,17 +259,7 @@ void InitHeaderSearch::AddDefaultCPlusPlusIncludePaths( llvm::Triple::OSType os = triple.getOS(); switch (os) { case llvm::Triple::Win32: -switch (triple.getEnvironment()) { -default: llvm_unreachable("Include management is handled in the driver."); -case llvm::Triple::Cygnus: - // Cygwin-1.7 - AddMinGWCPlusPlusIncludePaths("/usr/lib/gcc", "i686-pc-cygwin", "4.7.3"); - AddMinGWCPlusPlusIncludePaths("/usr/lib/gcc", "i686-pc-cygwin", "4.5.3"); - AddMinGWCPlusPlusIncludePaths("/usr/lib/gcc", "i686-pc-cygwin", "4.3.4"); - // g++-4 / Cygwin-1.5 - AddMinGWCPlusPlusIncludePaths("/usr/lib/gcc", "i686-pc-cygwin", "4.3.2"); - break; -} +llvm_unreachable("Include management is handled in the driver."); brad0 wrote: You should be able to remove AddDefaultCPlusPlusIncludePaths(). https://github.com/llvm/llvm-project/pull/74933 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Cygwin] Cygwin driver (PR #74933)
=?utf-8?b?5b6Q5oyB5oGS?= Xu Chiheng,=?utf-8?b?5b6Q5oyB5oGS?= Xu Chiheng, =?utf-8?b?5b6Q5oyB5oGS?= Xu Chiheng,=?utf-8?b?5b6Q5oyB5oGS?= Xu Chiheng Message-ID: In-Reply-To: @@ -242,14 +240,7 @@ void InitHeaderSearch::AddDefaultCIncludePaths(const llvm::Triple &triple, switch (os) { case llvm::Triple::Win32: -switch (triple.getEnvironment()) { -default: llvm_unreachable("Include management is handled in the driver."); -case llvm::Triple::Cygnus: - AddPath("/usr/include/w32api", System, false); - break; -case llvm::Triple::GNU: - break; -} +llvm_unreachable("Include management is handled in the driver."); brad0 wrote: Just remove the switch statement all together. https://github.com/llvm/llvm-project/pull/74933 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Preprocessor] Define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 for AArch64 (PR #74954)
https://github.com/brad0 approved this pull request. https://github.com/llvm/llvm-project/pull/74954 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Cygwin] Reduced number of inline elements of CallArgList. (PR #74977)
brad0 wrote: Just FYI submitting lots of PRs with all of them having commits with a commit message of 1 is not going to go anywhere. They need to be revised with proper meaningful commit messages. https://github.com/llvm/llvm-project/pull/74977 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[llvm] [clang] [llvm] Add support for building on illumos (PR #74930)
https://github.com/brad0 edited https://github.com/llvm/llvm-project/pull/74930 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[llvm] [clang] [llvm] Add support for building on illumos (PR #74930)
https://github.com/brad0 edited https://github.com/llvm/llvm-project/pull/74930 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Driver] Make use of AddFilePathLibArgs() on NetBSD. (PR #71371)
https://github.com/brad0 updated https://github.com/llvm/llvm-project/pull/71371 >From c68ad2b274974de0899813c4b58cea21bcc04913 Mon Sep 17 00:00:00 2001 From: Brad Smith Date: Sun, 5 Nov 2023 23:05:29 -0500 Subject: [PATCH] [Driver] Make use of AddFilePathLibArgs() on NetBSD. This will help using lld or mold as a linker. --- clang/lib/Driver/ToolChains/NetBSD.cpp | 1 + clang/test/Driver/netbsd.c | 4 2 files changed, 5 insertions(+) diff --git a/clang/lib/Driver/ToolChains/NetBSD.cpp b/clang/lib/Driver/ToolChains/NetBSD.cpp index cfde8d40a77ae16..90b195a007caa78 100644 --- a/clang/lib/Driver/ToolChains/NetBSD.cpp +++ b/clang/lib/Driver/ToolChains/NetBSD.cpp @@ -269,6 +269,7 @@ void netbsd::Linker::ConstructJob(Compilation &C, const JobAction &JA, Args.addAllArgs(CmdArgs, {options::OPT_L, options::OPT_T_Group, options::OPT_s, options::OPT_t, options::OPT_r}); + ToolChain.AddFilePathLibArgs(Args, CmdArgs); bool NeedsSanitizerDeps = addSanitizerRuntimes(ToolChain, Args, CmdArgs); bool NeedsXRayDeps = addXRayRuntime(ToolChain, Args, CmdArgs); diff --git a/clang/test/Driver/netbsd.c b/clang/test/Driver/netbsd.c index 760cba4ac4e0c9f..1452e9e2dc6e3c0 100644 --- a/clang/test/Driver/netbsd.c +++ b/clang/test/Driver/netbsd.c @@ -134,6 +134,7 @@ // STATIC-NOT: "-shared" // STATIC: "{{.*}}/usr/lib{{/|}}crt0.o" // STATIC: "{{.*}}/usr/lib{{/|}}crti.o" "{{.*}}/usr/lib{{/|}}crtbegin.o" +// STATIC: "-L{{.*}}/usr/lib" // STATIC: "{{.*}}/usr/lib{{/|}}crtend.o" "{{.*}}/usr/lib{{/|}}crtn.o" // STATIC-PIE: ld{{.*}}" "--eh-frame-hdr" @@ -144,6 +145,7 @@ // STATIC-PIE-NOT: "-shared" // STATIC-PIE: "{{.*}}/usr/lib{{/|}}crt0.o" // STATIC-PIE: "{{.*}}/usr/lib{{/|}}crti.o" "{{.*}}/usr/lib{{/|}}crtbeginS.o" +// STATIC-PIE: "-L{{.*}}/usr/lib" // STATIC-PIE: "{{.*}}/usr/lib{{/|}}crtendS.o" "{{.*}}/usr/lib{{/|}}crtn.o" // SHARED: ld{{.*}}" "--eh-frame-hdr" @@ -151,6 +153,7 @@ // SHARED-NOT: "-dynamic-linker" // SHARED-NOT: "{{.*}}/usr/lib{{/|}}crt0.o" // SHARED: "{{.*}}/usr/lib{{/|}}crti.o" "{{.*}}/usr/lib{{/|}}crtbeginS.o" +// SHARED: "-L{{.*}}/usr/lib" // SHARED: "{{.*}}/usr/lib{{/|}}crtendS.o" "{{.*}}/usr/lib{{/|}}crtn.o" // PIE: ld{{.*}}" "--eh-frame-hdr" @@ -159,6 +162,7 @@ // PIE-NOT: "-shared" // PIE: "{{.*}}/usr/lib{{/|}}crt0.o" "{{.*}}/usr/lib{{/|}}crti.o" // PIE: "{{.*}}/usr/lib{{/|}}crtbeginS.o" +// PIE: "-L{{.*}}/usr/lib" // PIE: "{{.*}}/usr/lib{{/|}}crtendS.o" // PIE: "{{.*}}/usr/lib{{/|}}crtn.o" ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Driver] Make use of AddFilePathLibArgs() on NetBSD. (PR #71371)
https://github.com/brad0 closed https://github.com/llvm/llvm-project/pull/71371 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Driver] Make ELF -nopie specific to OpenBSD (PR #72578)
brad0 wrote: -nopie is for the linker. We only use -fno-pie for the compiler. https://github.com/llvm/llvm-project/pull/72578 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 49795d2 - [Driver][NFC] A bit more const for OpenBSD and DragonFly
Author: Brad Smith Date: 2023-11-15T19:36:56-05:00 New Revision: 49795d27761b9f398302354acd30980a319b1502 URL: https://github.com/llvm/llvm-project/commit/49795d27761b9f398302354acd30980a319b1502 DIFF: https://github.com/llvm/llvm-project/commit/49795d27761b9f398302354acd30980a319b1502.diff LOG: [Driver][NFC] A bit more const for OpenBSD and DragonFly Added: Modified: clang/lib/Driver/ToolChains/DragonFly.cpp clang/lib/Driver/ToolChains/OpenBSD.cpp Removed: diff --git a/clang/lib/Driver/ToolChains/DragonFly.cpp b/clang/lib/Driver/ToolChains/DragonFly.cpp index b13449bf778fa9f..9942fc632e0a917 100644 --- a/clang/lib/Driver/ToolChains/DragonFly.cpp +++ b/clang/lib/Driver/ToolChains/DragonFly.cpp @@ -57,11 +57,11 @@ void dragonfly::Linker::ConstructJob(Compilation &C, const JobAction &JA, const auto &ToolChain = static_cast(getToolChain()); const Driver &D = ToolChain.getDriver(); const llvm::Triple::ArchType Arch = ToolChain.getArch(); + const bool Static = Args.hasArg(options::OPT_static); + const bool Shared = Args.hasArg(options::OPT_shared); + const bool Profiling = Args.hasArg(options::OPT_pg); + const bool Pie = Args.hasArg(options::OPT_pie); ArgStringList CmdArgs; - bool Static = Args.hasArg(options::OPT_static); - bool Shared = Args.hasArg(options::OPT_shared); - bool Profiling = Args.hasArg(options::OPT_pg); - bool Pie = Args.hasArg(options::OPT_pie); if (!D.SysRoot.empty()) CmdArgs.push_back(Args.MakeArgString("--sysroot=" + D.SysRoot)); diff --git a/clang/lib/Driver/ToolChains/OpenBSD.cpp b/clang/lib/Driver/ToolChains/OpenBSD.cpp index 5d06cd8ab0bad16..c8f02161d8311e3 100644 --- a/clang/lib/Driver/ToolChains/OpenBSD.cpp +++ b/clang/lib/Driver/ToolChains/OpenBSD.cpp @@ -33,9 +33,9 @@ void openbsd::Assembler::ConstructJob(Compilation &C, const JobAction &JA, const auto &ToolChain = static_cast(getToolChain()); const Driver &D = ToolChain.getDriver(); const llvm::Triple &Triple = ToolChain.getTriple(); + ArgStringList CmdArgs; claimNoWarnArgs(Args); - ArgStringList CmdArgs; switch (ToolChain.getArch()) { case llvm::Triple::x86: @@ -112,13 +112,13 @@ void openbsd::Linker::ConstructJob(Compilation &C, const JobAction &JA, const auto &ToolChain = static_cast(getToolChain()); const Driver &D = ToolChain.getDriver(); const llvm::Triple::ArchType Arch = ToolChain.getArch(); - ArgStringList CmdArgs; - bool Static = Args.hasArg(options::OPT_static); - bool Shared = Args.hasArg(options::OPT_shared); - bool Profiling = Args.hasArg(options::OPT_pg); - bool Pie = Args.hasArg(options::OPT_pie); - bool Nopie = Args.hasArg(options::OPT_nopie); + const bool Static = Args.hasArg(options::OPT_static); + const bool Shared = Args.hasArg(options::OPT_shared); + const bool Profiling = Args.hasArg(options::OPT_pg); + const bool Pie = Args.hasArg(options::OPT_pie); + const bool Nopie = Args.hasArg(options::OPT_nopie); const bool Relocatable = Args.hasArg(options::OPT_r); + ArgStringList CmdArgs; // Silence warning for "clang -g foo.o -o foo" Args.ClaimAllArgs(options::OPT_g_Group); ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [flang] [flang][Driver] Support -nodefaultlibs, -nostartfiles and -nostdlib (PR #72601)
https://github.com/brad0 created https://github.com/llvm/llvm-project/pull/72601 None >From b4ab77671af5b073b0335ba212b7c8b105367c1d Mon Sep 17 00:00:00 2001 From: Brad Smith Date: Wed, 15 Nov 2023 14:24:11 -0500 Subject: [PATCH] [flang][Driver] Support -nodefaultlibs, -nostartfiles and -nostdlib --- clang/include/clang/Driver/Options.td | 9 --- flang/test/Driver/dynamic-linker.f90 | 36 +-- 2 files changed, 40 insertions(+), 5 deletions(-) diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index 811550416110b3d..a0eb04a5cd9c6a7 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -5131,7 +5131,8 @@ def : Flag<["-"], "nocudalib">, Alias; def gpulibc : Flag<["-"], "gpulibc">, Visibility<[ClangOption, CC1Option]>, HelpText<"Link the LLVM C Library for GPUs">; def nogpulibc : Flag<["-"], "nogpulibc">, Visibility<[ClangOption, CC1Option]>; -def nodefaultlibs : Flag<["-"], "nodefaultlibs">; +def nodefaultlibs : Flag<["-"], "nodefaultlibs">, + Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>; def nodriverkitlib : Flag<["-"], "nodriverkitlib">; def nofixprebinding : Flag<["-"], "nofixprebinding">; def nolibc : Flag<["-"], "nolibc">; @@ -5141,7 +5142,8 @@ def no_pie : Flag<["-"], "no-pie">, Visibility<[ClangOption, FlangOption]>, Alia def noprebind : Flag<["-"], "noprebind">; def noprofilelib : Flag<["-"], "noprofilelib">; def noseglinkedit : Flag<["-"], "noseglinkedit">; -def nostartfiles : Flag<["-"], "nostartfiles">, Group; +def nostartfiles : Flag<["-"], "nostartfiles">, Group, + Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>; def nostdinc : Flag<["-"], "nostdinc">, Visibility<[ClangOption, CLOption, DXCOption]>, Group; def nostdlibinc : Flag<["-"], "nostdlibinc">, Group; @@ -5149,7 +5151,8 @@ def nostdincxx : Flag<["-"], "nostdinc++">, Visibility<[ClangOption, CC1Option]> Group, HelpText<"Disable standard #include directories for the C++ standard library">, MarshallingInfoNegativeFlag>; -def nostdlib : Flag<["-"], "nostdlib">, Group; +def nostdlib : Flag<["-"], "nostdlib">, Group, + Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>; def nostdlibxx : Flag<["-"], "nostdlib++">; def object : Flag<["-"], "object">; def o : JoinedOrSeparate<["-"], "o">, diff --git a/flang/test/Driver/dynamic-linker.f90 b/flang/test/Driver/dynamic-linker.f90 index 2745822dc107769..432e0cd586f1118 100644 --- a/flang/test/Driver/dynamic-linker.f90 +++ b/flang/test/Driver/dynamic-linker.f90 @@ -1,5 +1,5 @@ -! Verify that certain linker flags are known to the frontend and are passed on -! to the linker. +! Verify that certain linker flags are known to the frontend and are passed or +! not passed on to the linker. ! RUN: %flang -### --target=x86_64-linux-gnu -rpath /path/to/dir -shared \ ! RUN: -static %s 2>&1 | FileCheck \ @@ -18,3 +18,35 @@ ! MSVC-LINKER-OPTIONS: "{{.*}}link.exe" ! MSVC-LINKER-OPTIONS-SAME: "-dll" ! MSVC-LINKER-OPTIONS-SAME: "-rpath" "/path/to/dir" + +! RUN: %flang -### --target=x86_64-unknown-freebsd -nostdlib %s 2>&1 | FileCheck \ +! RUN: --check-prefixes=NOSTDLIB %s +! RUN: %flang -### --target=x86_64-unknown-netbsd -nostdlib %s 2>&1 | FileCheck \ +! RUN: --check-prefixes=NOSTDLIB %s +! RUN: %flang -### --target=i386-pc-solaris2.11 -nostdlib %s 2>&1 | FileCheck \ +! RUN: --check-prefixes=NOSTDLIB %s + +! NOSTDLIB: "{{.*}}ld{{(.exe)?}}" +! NOSTDLIB-NOT: crt* +! NOSTDLIB-NOT: "-lFortran_main" "-lFortranRuntime" "-lFortranDecimal" "-lm" + +! RUN: %flang -### --target=x86_64-unknown-freebsd -nodefaultlibs %s 2>&1 | FileCheck \ +! RUN: --check-prefixes=NODEFAULTLIBS %s +! RUN: %flang -### --target=x86_64-unknown-netbsd -nodefaultlibs %s 2>&1 | FileCheck \ +! RUN: --check-prefixes=NODEFAULTLIBS %s +! RUN: %flang -### --target=i386-pc-solaris2.11 -nodefaultlibs %s 2>&1 | FileCheck \ +! RUN: --check-prefixes=NODEFAULTLIBS %s + +! NODEFAULTLIBS: "{{.*}}ld{{(.exe)?}}" +! NODEFAULTLIBS-NOT: "-lFortran_main" "-lFortranRuntime" "-lFortranDecimal" "-lm" + +! RUN: %flang -### --target=x86_64-unknown-freebsd -nostartfiles %s 2>&1 | FileCheck \ +! RUN: --check-prefixes=NOSTARTFILES %s +! RUN: %flang -### --target=x86_64-unknown-netbsd -nostartfiles %s 2>&1 | FileCheck \ +! RUN: --check-prefixes=NOSTARTFILES %s +! RUN: %flang -### --target=i386-pc-solaris2.11 -nostartfiles %s 2>&1 | FileCheck \ +! RUN: --check-prefixes=NOSTARTFILES %s + +! NOSTARTFILES: "{{.*}}ld{{(.exe)?}}" +! NOSTARTFILES-NOT: crt* +! NOSTARTFILES: "-lFortran_main" "-lFortranRuntime" "-lFortranDecimal" "-lm" ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Driver] Handle Flang in same manner between Gnu and *BSD/Solaris ToolChain (PR #70429)
brad0 wrote: So with https://github.com/llvm/llvm-project/pull/72601, once that goes in I can update this with RUN line updates to test. It fails as expected without this. https://github.com/llvm/llvm-project/pull/70429 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[flang] [clang] [flang][Driver] Support -nodefaultlibs, -nostartfiles and -nostdlib (PR #72601)
brad0 wrote: Looking at this again I am not sure if ```CLOption, DXCOption``` should be specified or not. I noticed this in the previous commit for the Flang driver. https://github.com/llvm/llvm-project/pull/72601 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Driver] Make ELF -nopie specific to OpenBSD (PR #72578)
brad0 wrote: > > -nopie is for the linker. We only use -fno-pie for the compiler. > > OK. Then it seems that the driver option `-nopie` for linking should be > removed even for OpenBSD? Let me check something before I say anything further. https://github.com/llvm/llvm-project/pull/72578 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [flang] [flang][Driver] Support -nodefaultlibs, -nostartfiles and -nostdlib (PR #72601)
https://github.com/brad0 updated https://github.com/llvm/llvm-project/pull/72601 >From 8d478b98effa8b6bb5d59605034ce35086cc0112 Mon Sep 17 00:00:00 2001 From: Brad Smith Date: Wed, 15 Nov 2023 14:24:11 -0500 Subject: [PATCH] [flang][Driver] Support -nodefaultlibs, -nostartfiles and -nostdlib --- clang/include/clang/Driver/Options.td | 9 --- flang/test/Driver/dynamic-linker.f90 | 36 +-- 2 files changed, 40 insertions(+), 5 deletions(-) diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index 811550416110b3d..a0eb04a5cd9c6a7 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -5131,7 +5131,8 @@ def : Flag<["-"], "nocudalib">, Alias; def gpulibc : Flag<["-"], "gpulibc">, Visibility<[ClangOption, CC1Option]>, HelpText<"Link the LLVM C Library for GPUs">; def nogpulibc : Flag<["-"], "nogpulibc">, Visibility<[ClangOption, CC1Option]>; -def nodefaultlibs : Flag<["-"], "nodefaultlibs">; +def nodefaultlibs : Flag<["-"], "nodefaultlibs">, + Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>; def nodriverkitlib : Flag<["-"], "nodriverkitlib">; def nofixprebinding : Flag<["-"], "nofixprebinding">; def nolibc : Flag<["-"], "nolibc">; @@ -5141,7 +5142,8 @@ def no_pie : Flag<["-"], "no-pie">, Visibility<[ClangOption, FlangOption]>, Alia def noprebind : Flag<["-"], "noprebind">; def noprofilelib : Flag<["-"], "noprofilelib">; def noseglinkedit : Flag<["-"], "noseglinkedit">; -def nostartfiles : Flag<["-"], "nostartfiles">, Group; +def nostartfiles : Flag<["-"], "nostartfiles">, Group, + Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>; def nostdinc : Flag<["-"], "nostdinc">, Visibility<[ClangOption, CLOption, DXCOption]>, Group; def nostdlibinc : Flag<["-"], "nostdlibinc">, Group; @@ -5149,7 +5151,8 @@ def nostdincxx : Flag<["-"], "nostdinc++">, Visibility<[ClangOption, CC1Option]> Group, HelpText<"Disable standard #include directories for the C++ standard library">, MarshallingInfoNegativeFlag>; -def nostdlib : Flag<["-"], "nostdlib">, Group; +def nostdlib : Flag<["-"], "nostdlib">, Group, + Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>; def nostdlibxx : Flag<["-"], "nostdlib++">; def object : Flag<["-"], "object">; def o : JoinedOrSeparate<["-"], "o">, diff --git a/flang/test/Driver/dynamic-linker.f90 b/flang/test/Driver/dynamic-linker.f90 index 2745822dc107769..e7e00f637858edf 100644 --- a/flang/test/Driver/dynamic-linker.f90 +++ b/flang/test/Driver/dynamic-linker.f90 @@ -1,5 +1,5 @@ -! Verify that certain linker flags are known to the frontend and are passed on -! to the linker. +! Verify that certain linker flags are known to the frontend and are passed or +! not passed on to the linker. ! RUN: %flang -### --target=x86_64-linux-gnu -rpath /path/to/dir -shared \ ! RUN: -static %s 2>&1 | FileCheck \ @@ -18,3 +18,35 @@ ! MSVC-LINKER-OPTIONS: "{{.*}}link.exe" ! MSVC-LINKER-OPTIONS-SAME: "-dll" ! MSVC-LINKER-OPTIONS-SAME: "-rpath" "/path/to/dir" + +! RUN: %flang -### --target=x86_64-unknown-freebsd -nostdlib %s 2>&1 | FileCheck \ +! RUN: --check-prefixes=NOSTDLIB %s +! RUN: %flang -### --target=x86_64-unknown-netbsd -nostdlib %s 2>&1 | FileCheck \ +! RUN: --check-prefixes=NOSTDLIB %s +! RUN: %flang -### --target=i386-pc-solaris2.11 -nostdlib %s 2>&1 | FileCheck \ +! RUN: --check-prefixes=NOSTDLIB %s + +! NOSTDLIB: "{{.*}}ld{{(.exe)?}}" +! NOSTDLIB-NOT: crt{{[^.]+}}.o +! NOSTDLIB-NOT: "-lFortran_main" "-lFortranRuntime" "-lFortranDecimal" "-lm" + +! RUN: %flang -### --target=x86_64-unknown-freebsd -nodefaultlibs %s 2>&1 | FileCheck \ +! RUN: --check-prefixes=NODEFAULTLIBS %s +! RUN: %flang -### --target=x86_64-unknown-netbsd -nodefaultlibs %s 2>&1 | FileCheck \ +! RUN: --check-prefixes=NODEFAULTLIBS %s +! RUN: %flang -### --target=i386-pc-solaris2.11 -nodefaultlibs %s 2>&1 | FileCheck \ +! RUN: --check-prefixes=NODEFAULTLIBS %s + +! NODEFAULTLIBS: "{{.*}}ld{{(.exe)?}}" +! NODEFAULTLIBS-NOT: "-lFortran_main" "-lFortranRuntime" "-lFortranDecimal" "-lm" + +! RUN: %flang -### --target=x86_64-unknown-freebsd -nostartfiles %s 2>&1 | FileCheck \ +! RUN: --check-prefixes=NOSTARTFILES %s +! RUN: %flang -### --target=x86_64-unknown-netbsd -nostartfiles %s 2>&1 | FileCheck \ +! RUN: --check-prefixes=NOSTARTFILES %s +! RUN: %flang -### --target=i386-pc-solaris2.11 -nostartfiles %s 2>&1 | FileCheck \ +! RUN: --check-prefixes=NOSTARTFILES %s + +! NOSTARTFILES: "{{.*}}ld{{(.exe)?}}" +! NOSTARTFILES-NOT: crt{{[^.]+}}.o +! NOSTARTFILES: "-lFortran_main" "-lFortranRuntime" "-lFortranDecimal" "-lm" ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Driver] Enable __float128 support on X86 and PowerPC64le on FreeBSD … (PR #72788)
https://github.com/brad0 created https://github.com/llvm/llvm-project/pull/72788 …/ NetBSD >From 96f280aa636c9858887d383d4cce7ee542d0b058 Mon Sep 17 00:00:00 2001 From: Brad Smith Date: Sat, 18 Nov 2023 22:04:19 -0500 Subject: [PATCH] [Driver] Enable __float128 support on X86 and PowerPC64le on FreeBSD / NetBSD --- clang/lib/Basic/Targets/OSTargets.h | 20 +-- .../test/CodeGenCXX/float128-declarations.cpp | 14 +++-- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/clang/lib/Basic/Targets/OSTargets.h b/clang/lib/Basic/Targets/OSTargets.h index 23799d8a4ae17bc..7cb4110921b9e62 100644 --- a/clang/lib/Basic/Targets/OSTargets.h +++ b/clang/lib/Basic/Targets/OSTargets.h @@ -187,6 +187,8 @@ class LLVM_LIBRARY_VISIBILITY FreeBSDTargetInfo : public OSTargetInfo { Builder.defineMacro("__FreeBSD_cc_version", Twine(CCVersion)); Builder.defineMacro("__KPRINTF_ATTRIBUTE__"); DefineStd(Builder, "unix", Opts); +if (this->HasFloat128) + Builder.defineMacro("__FLOAT128__"); // On FreeBSD, wchar_t contains the number of the code point as // used by the character set of the locale. These character sets are @@ -204,17 +206,21 @@ class LLVM_LIBRARY_VISIBILITY FreeBSDTargetInfo : public OSTargetInfo { FreeBSDTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts) : OSTargetInfo(Triple, Opts) { switch (Triple.getArch()) { -default: case llvm::Triple::x86: case llvm::Triple::x86_64: + this->HasFloat128 = true; + [[fallthrough]]; +default: this->MCountName = ".mcount"; break; +case llvm::Triple::ppc64le: + this->HasFloat128 = true; + [[fallthrough]]; case llvm::Triple::mips: case llvm::Triple::mipsel: case llvm::Triple::ppc: case llvm::Triple::ppcle: case llvm::Triple::ppc64: -case llvm::Triple::ppc64le: this->MCountName = "_mcount"; break; case llvm::Triple::arm: @@ -372,12 +378,22 @@ class LLVM_LIBRARY_VISIBILITY NetBSDTargetInfo : public OSTargetInfo { Builder.defineMacro("__unix__"); if (Opts.POSIXThreads) Builder.defineMacro("_REENTRANT"); +if (this->HasFloat128) + Builder.defineMacro("__FLOAT128__"); } public: NetBSDTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts) : OSTargetInfo(Triple, Opts) { this->MCountName = "__mcount"; +switch (Triple.getArch()) { +default: + break; +case llvm::Triple::x86: +case llvm::Triple::x86_64: + this->HasFloat128 = true; + break; +} } }; diff --git a/clang/test/CodeGenCXX/float128-declarations.cpp b/clang/test/CodeGenCXX/float128-declarations.cpp index ddfe9dce109c81e..fd6c98fc4ba3d0b 100644 --- a/clang/test/CodeGenCXX/float128-declarations.cpp +++ b/clang/test/CodeGenCXX/float128-declarations.cpp @@ -2,13 +2,23 @@ // RUN: -target-feature +float128 -std=c++11 %s -o - | FileCheck %s // RUN: %clang_cc1 -emit-llvm -triple powerpc64le-unknown-unknown \ // RUN: -target-feature +float128 -std=c++11 %s -o - | FileCheck %s +// RUN: %clang_cc1 -emit-llvm -triple powerpc64le-unknown-freebsd \ +// RUN: -target-feature +float128 -std=c++11 %s -o - | FileCheck %s // RUN: %clang_cc1 -emit-llvm -triple i386-unknown-linux-gnu -std=c++11 \ // RUN: %s -o - | FileCheck %s -check-prefix=CHECK-X86 // RUN: %clang_cc1 -emit-llvm -triple x86_64-unknown-linux-gnu -std=c++11 \ // RUN: %s -o - | FileCheck %s -check-prefix=CHECK-X86 -// RUN: %clang_cc1 -emit-llvm -triple i686-pc-openbsd -std=c++11 \ +// RUN: %clang_cc1 -emit-llvm -triple i386-unknown-freebsd -std=c++11 \ +// RUN: %s -o - | FileCheck %s -check-prefix=CHECK-X86 +// RUN: %clang_cc1 -emit-llvm -triple amd64-unknown-freebsd -std=c++11 \ +// RUN: %s -o - | FileCheck %s -check-prefix=CHECK-X86 +// RUN: %clang_cc1 -emit-llvm -triple i386-unknown-netbsd -std=c++11 \ +// RUN: %s -o - | FileCheck %s -check-prefix=CHECK-X86 +// RUN: %clang_cc1 -emit-llvm -triple amd64-unknown-netbsd -std=c++11 \ +// RUN: %s -o - | FileCheck %s -check-prefix=CHECK-X86 +// RUN: %clang_cc1 -emit-llvm -triple i386-unknown-openbsd -std=c++11 \ // RUN: %s -o - | FileCheck %s -check-prefix=CHECK-X86 -// RUN: %clang_cc1 -emit-llvm -triple amd64-pc-openbsd -std=c++11 \ +// RUN: %clang_cc1 -emit-llvm -triple amd64-unknown-openbsd -std=c++11 \ // RUN: %s -o - | FileCheck %s -check-prefix=CHECK-X86 // RUN: %clang_cc1 -emit-llvm -triple i386-pc-solaris2.11 -std=c++11 \ // RUN: %s -o - | FileCheck %s -check-prefix=CHECK-X86 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Driver] Enable __float128 support on X86 and PowerPC64le on FreeBSD … (PR #72788)
https://github.com/brad0 updated https://github.com/llvm/llvm-project/pull/72788 >From 851adf14958e9dac3d9143ca2e667cd9b4de2d8b Mon Sep 17 00:00:00 2001 From: Brad Smith Date: Sat, 18 Nov 2023 22:04:19 -0500 Subject: [PATCH] [Driver] Enable __float128 support on X86 and PPC64le on FreeBSD / NetBSD --- clang/lib/Basic/Targets/OSTargets.h | 20 +-- .../test/CodeGenCXX/float128-declarations.cpp | 14 +++-- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/clang/lib/Basic/Targets/OSTargets.h b/clang/lib/Basic/Targets/OSTargets.h index 23799d8a4ae17bc..7cb4110921b9e62 100644 --- a/clang/lib/Basic/Targets/OSTargets.h +++ b/clang/lib/Basic/Targets/OSTargets.h @@ -187,6 +187,8 @@ class LLVM_LIBRARY_VISIBILITY FreeBSDTargetInfo : public OSTargetInfo { Builder.defineMacro("__FreeBSD_cc_version", Twine(CCVersion)); Builder.defineMacro("__KPRINTF_ATTRIBUTE__"); DefineStd(Builder, "unix", Opts); +if (this->HasFloat128) + Builder.defineMacro("__FLOAT128__"); // On FreeBSD, wchar_t contains the number of the code point as // used by the character set of the locale. These character sets are @@ -204,17 +206,21 @@ class LLVM_LIBRARY_VISIBILITY FreeBSDTargetInfo : public OSTargetInfo { FreeBSDTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts) : OSTargetInfo(Triple, Opts) { switch (Triple.getArch()) { -default: case llvm::Triple::x86: case llvm::Triple::x86_64: + this->HasFloat128 = true; + [[fallthrough]]; +default: this->MCountName = ".mcount"; break; +case llvm::Triple::ppc64le: + this->HasFloat128 = true; + [[fallthrough]]; case llvm::Triple::mips: case llvm::Triple::mipsel: case llvm::Triple::ppc: case llvm::Triple::ppcle: case llvm::Triple::ppc64: -case llvm::Triple::ppc64le: this->MCountName = "_mcount"; break; case llvm::Triple::arm: @@ -372,12 +378,22 @@ class LLVM_LIBRARY_VISIBILITY NetBSDTargetInfo : public OSTargetInfo { Builder.defineMacro("__unix__"); if (Opts.POSIXThreads) Builder.defineMacro("_REENTRANT"); +if (this->HasFloat128) + Builder.defineMacro("__FLOAT128__"); } public: NetBSDTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts) : OSTargetInfo(Triple, Opts) { this->MCountName = "__mcount"; +switch (Triple.getArch()) { +default: + break; +case llvm::Triple::x86: +case llvm::Triple::x86_64: + this->HasFloat128 = true; + break; +} } }; diff --git a/clang/test/CodeGenCXX/float128-declarations.cpp b/clang/test/CodeGenCXX/float128-declarations.cpp index ddfe9dce109c81e..fd6c98fc4ba3d0b 100644 --- a/clang/test/CodeGenCXX/float128-declarations.cpp +++ b/clang/test/CodeGenCXX/float128-declarations.cpp @@ -2,13 +2,23 @@ // RUN: -target-feature +float128 -std=c++11 %s -o - | FileCheck %s // RUN: %clang_cc1 -emit-llvm -triple powerpc64le-unknown-unknown \ // RUN: -target-feature +float128 -std=c++11 %s -o - | FileCheck %s +// RUN: %clang_cc1 -emit-llvm -triple powerpc64le-unknown-freebsd \ +// RUN: -target-feature +float128 -std=c++11 %s -o - | FileCheck %s // RUN: %clang_cc1 -emit-llvm -triple i386-unknown-linux-gnu -std=c++11 \ // RUN: %s -o - | FileCheck %s -check-prefix=CHECK-X86 // RUN: %clang_cc1 -emit-llvm -triple x86_64-unknown-linux-gnu -std=c++11 \ // RUN: %s -o - | FileCheck %s -check-prefix=CHECK-X86 -// RUN: %clang_cc1 -emit-llvm -triple i686-pc-openbsd -std=c++11 \ +// RUN: %clang_cc1 -emit-llvm -triple i386-unknown-freebsd -std=c++11 \ +// RUN: %s -o - | FileCheck %s -check-prefix=CHECK-X86 +// RUN: %clang_cc1 -emit-llvm -triple amd64-unknown-freebsd -std=c++11 \ +// RUN: %s -o - | FileCheck %s -check-prefix=CHECK-X86 +// RUN: %clang_cc1 -emit-llvm -triple i386-unknown-netbsd -std=c++11 \ +// RUN: %s -o - | FileCheck %s -check-prefix=CHECK-X86 +// RUN: %clang_cc1 -emit-llvm -triple amd64-unknown-netbsd -std=c++11 \ +// RUN: %s -o - | FileCheck %s -check-prefix=CHECK-X86 +// RUN: %clang_cc1 -emit-llvm -triple i386-unknown-openbsd -std=c++11 \ // RUN: %s -o - | FileCheck %s -check-prefix=CHECK-X86 -// RUN: %clang_cc1 -emit-llvm -triple amd64-pc-openbsd -std=c++11 \ +// RUN: %clang_cc1 -emit-llvm -triple amd64-unknown-openbsd -std=c++11 \ // RUN: %s -o - | FileCheck %s -check-prefix=CHECK-X86 // RUN: %clang_cc1 -emit-llvm -triple i386-pc-solaris2.11 -std=c++11 \ // RUN: %s -o - | FileCheck %s -check-prefix=CHECK-X86 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Driver] Enable __float128 support on X86 and PowerPC64le on FreeBSD … (PR #72788)
https://github.com/brad0 edited https://github.com/llvm/llvm-project/pull/72788 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Driver] Enable __float128 support on X86 and PPC64le on FreeBSD / NetBSD (PR #72788)
https://github.com/brad0 edited https://github.com/llvm/llvm-project/pull/72788 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Driver] Enable __float128 support on X86 and PPC64le on FreeBSD / NetBSD (PR #72788)
brad0 wrote: > Linux ppc64le does not support `__float128`. Should *BSD support it? There was another patch floating around to add support for the driver. I'll remove it for now. https://github.com/llvm/llvm-project/pull/72788 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Driver] Enable __float128 support on X86 and PPC64le on FreeBSD / NetBSD (PR #72788)
https://github.com/brad0 updated https://github.com/llvm/llvm-project/pull/72788 >From bde98ba852c456d95be75df7e9ecfa31b7d964ff Mon Sep 17 00:00:00 2001 From: Brad Smith Date: Sat, 18 Nov 2023 22:04:19 -0500 Subject: [PATCH] [Driver] Enable __float128 support on X86 on FreeBSD / NetBSD --- clang/lib/Basic/Targets/OSTargets.h | 16 +++- clang/test/CodeGenCXX/float128-declarations.cpp | 12 ++-- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/clang/lib/Basic/Targets/OSTargets.h b/clang/lib/Basic/Targets/OSTargets.h index 23799d8a4ae17bc..342af4bbc42b7bc 100644 --- a/clang/lib/Basic/Targets/OSTargets.h +++ b/clang/lib/Basic/Targets/OSTargets.h @@ -187,6 +187,8 @@ class LLVM_LIBRARY_VISIBILITY FreeBSDTargetInfo : public OSTargetInfo { Builder.defineMacro("__FreeBSD_cc_version", Twine(CCVersion)); Builder.defineMacro("__KPRINTF_ATTRIBUTE__"); DefineStd(Builder, "unix", Opts); +if (this->HasFloat128) + Builder.defineMacro("__FLOAT128__"); // On FreeBSD, wchar_t contains the number of the code point as // used by the character set of the locale. These character sets are @@ -204,9 +206,11 @@ class LLVM_LIBRARY_VISIBILITY FreeBSDTargetInfo : public OSTargetInfo { FreeBSDTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts) : OSTargetInfo(Triple, Opts) { switch (Triple.getArch()) { -default: case llvm::Triple::x86: case llvm::Triple::x86_64: + this->HasFloat128 = true; + [[fallthrough]]; +default: this->MCountName = ".mcount"; break; case llvm::Triple::mips: @@ -372,12 +376,22 @@ class LLVM_LIBRARY_VISIBILITY NetBSDTargetInfo : public OSTargetInfo { Builder.defineMacro("__unix__"); if (Opts.POSIXThreads) Builder.defineMacro("_REENTRANT"); +if (this->HasFloat128) + Builder.defineMacro("__FLOAT128__"); } public: NetBSDTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts) : OSTargetInfo(Triple, Opts) { this->MCountName = "__mcount"; +switch (Triple.getArch()) { +default: + break; +case llvm::Triple::x86: +case llvm::Triple::x86_64: + this->HasFloat128 = true; + break; +} } }; diff --git a/clang/test/CodeGenCXX/float128-declarations.cpp b/clang/test/CodeGenCXX/float128-declarations.cpp index ddfe9dce109c81e..84b8f7f33036b59 100644 --- a/clang/test/CodeGenCXX/float128-declarations.cpp +++ b/clang/test/CodeGenCXX/float128-declarations.cpp @@ -6,9 +6,17 @@ // RUN: %s -o - | FileCheck %s -check-prefix=CHECK-X86 // RUN: %clang_cc1 -emit-llvm -triple x86_64-unknown-linux-gnu -std=c++11 \ // RUN: %s -o - | FileCheck %s -check-prefix=CHECK-X86 -// RUN: %clang_cc1 -emit-llvm -triple i686-pc-openbsd -std=c++11 \ +// RUN: %clang_cc1 -emit-llvm -triple i386-unknown-freebsd -std=c++11 \ // RUN: %s -o - | FileCheck %s -check-prefix=CHECK-X86 -// RUN: %clang_cc1 -emit-llvm -triple amd64-pc-openbsd -std=c++11 \ +// RUN: %clang_cc1 -emit-llvm -triple amd64-unknown-freebsd -std=c++11 \ +// RUN: %s -o - | FileCheck %s -check-prefix=CHECK-X86 +// RUN: %clang_cc1 -emit-llvm -triple i386-unknown-netbsd -std=c++11 \ +// RUN: %s -o - | FileCheck %s -check-prefix=CHECK-X86 +// RUN: %clang_cc1 -emit-llvm -triple amd64-unknown-netbsd -std=c++11 \ +// RUN: %s -o - | FileCheck %s -check-prefix=CHECK-X86 +// RUN: %clang_cc1 -emit-llvm -triple i386-unknown-openbsd -std=c++11 \ +// RUN: %s -o - | FileCheck %s -check-prefix=CHECK-X86 +// RUN: %clang_cc1 -emit-llvm -triple amd64-unknown-openbsd -std=c++11 \ // RUN: %s -o - | FileCheck %s -check-prefix=CHECK-X86 // RUN: %clang_cc1 -emit-llvm -triple i386-pc-solaris2.11 -std=c++11 \ // RUN: %s -o - | FileCheck %s -check-prefix=CHECK-X86 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Driver] Enable __float128 support on X86 on FreeBSD / NetBSD (PR #72788)
https://github.com/brad0 edited https://github.com/llvm/llvm-project/pull/72788 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[flang] [clang] [flang][Driver] Support -nodefaultlibs, -nostartfiles and -nostdlib (PR #72601)
brad0 wrote: @MaskRay ? https://github.com/llvm/llvm-project/pull/72601 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Driver] Enable __float128 support on X86 on FreeBSD / NetBSD (PR #72788)
https://github.com/brad0 closed https://github.com/llvm/llvm-project/pull/72788 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Driver] Make ELF -nopie specific to OpenBSD (PR #72578)
brad0 wrote: Continue with this as is. https://github.com/llvm/llvm-project/pull/72578 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Driver] Make ELF -nopie specific to OpenBSD (PR #72578)
https://github.com/brad0 approved this pull request. https://github.com/llvm/llvm-project/pull/72578 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Driver] Add support for -export-dynamic which can match GCC behavior. (PR #72781)
brad0 wrote: I have never seen such usage before. You're supposed to use ```-rdynamic```. https://github.com/llvm/llvm-project/pull/72781 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [flang] [flang][Driver] Support -nodefaultlibs, -nostartfiles and -nostdlib (PR #72601)
brad0 wrote: Ping. https://github.com/llvm/llvm-project/pull/72601 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[flang] [clang] [flang][Driver] Support -nodefaultlibs, -nostartfiles and -nostdlib (PR #72601)
https://github.com/brad0 updated https://github.com/llvm/llvm-project/pull/72601 >From da17459071b039e9da0f53ae5e68ab1c3aaa13e4 Mon Sep 17 00:00:00 2001 From: Brad Smith Date: Wed, 15 Nov 2023 14:24:11 -0500 Subject: [PATCH] [flang][Driver] Support -nodefaultlibs, -nostartfiles and -nostdlib --- clang/include/clang/Driver/Options.td | 9 --- flang/test/Driver/dynamic-linker.f90 | 35 +++ 2 files changed, 41 insertions(+), 3 deletions(-) diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index b2f2bcb6ac37910..bc04c53d7c76b9d 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -5152,7 +5152,8 @@ def : Flag<["-"], "nocudalib">, Alias; def gpulibc : Flag<["-"], "gpulibc">, Visibility<[ClangOption, CC1Option]>, HelpText<"Link the LLVM C Library for GPUs">; def nogpulibc : Flag<["-"], "nogpulibc">, Visibility<[ClangOption, CC1Option]>; -def nodefaultlibs : Flag<["-"], "nodefaultlibs">; +def nodefaultlibs : Flag<["-"], "nodefaultlibs">, + Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>; def nodriverkitlib : Flag<["-"], "nodriverkitlib">; def nofixprebinding : Flag<["-"], "nofixprebinding">; def nolibc : Flag<["-"], "nolibc">; @@ -5162,7 +5163,8 @@ def no_pie : Flag<["-"], "no-pie">, Visibility<[ClangOption, FlangOption]>; def noprebind : Flag<["-"], "noprebind">; def noprofilelib : Flag<["-"], "noprofilelib">; def noseglinkedit : Flag<["-"], "noseglinkedit">; -def nostartfiles : Flag<["-"], "nostartfiles">, Group; +def nostartfiles : Flag<["-"], "nostartfiles">, Group, + Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>; def nostdinc : Flag<["-"], "nostdinc">, Visibility<[ClangOption, CLOption, DXCOption]>, Group; def nostdlibinc : Flag<["-"], "nostdlibinc">, Group; @@ -5170,7 +5172,8 @@ def nostdincxx : Flag<["-"], "nostdinc++">, Visibility<[ClangOption, CC1Option]> Group, HelpText<"Disable standard #include directories for the C++ standard library">, MarshallingInfoNegativeFlag>; -def nostdlib : Flag<["-"], "nostdlib">, Group; +def nostdlib : Flag<["-"], "nostdlib">, Group, + Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>; def nostdlibxx : Flag<["-"], "nostdlib++">; def object : Flag<["-"], "object">; def o : JoinedOrSeparate<["-"], "o">, diff --git a/flang/test/Driver/dynamic-linker.f90 b/flang/test/Driver/dynamic-linker.f90 index df119c22a2ea516..aa90be5ac196e0e 100644 --- a/flang/test/Driver/dynamic-linker.f90 +++ b/flang/test/Driver/dynamic-linker.f90 @@ -18,3 +18,38 @@ ! MSVC-LINKER-OPTIONS: "{{.*}}link{{(.exe)?}}" ! MSVC-LINKER-OPTIONS-SAME: "-dll" ! MSVC-LINKER-OPTIONS-SAME: "-rpath" "/path/to/dir" + +! Verify that certain linker flags are known to the frontend and are not passed on +! to the linker. + +! RUN: %flang -### --target=x86_64-unknown-freebsd -nostdlib %s 2>&1 | FileCheck \ +! RUN: --check-prefixes=NOSTDLIB %s +! RUN: %flang -### --target=x86_64-unknown-netbsd -nostdlib %s 2>&1 | FileCheck \ +! RUN: --check-prefixes=NOSTDLIB %s +! RUN: %flang -### --target=i386-pc-solaris2.11 -nostdlib %s 2>&1 | FileCheck \ +! RUN: --check-prefixes=NOSTDLIB %s + +! NOSTDLIB: "{{.*}}ld{{(.exe)?}}" +! NOSTDLIB-NOT: crt{{[^.]+}}.o +! NOSTDLIB-NOT: "-lFortran_main" "-lFortranRuntime" "-lFortranDecimal" "-lm" + +! RUN: %flang -### --target=x86_64-unknown-freebsd -nodefaultlibs %s 2>&1 | FileCheck \ +! RUN: --check-prefixes=NODEFAULTLIBS %s +! RUN: %flang -### --target=x86_64-unknown-netbsd -nodefaultlibs %s 2>&1 | FileCheck \ +! RUN: --check-prefixes=NODEFAULTLIBS %s +! RUN: %flang -### --target=i386-pc-solaris2.11 -nodefaultlibs %s 2>&1 | FileCheck \ +! RUN: --check-prefixes=NODEFAULTLIBS %s + +! NODEFAULTLIBS: "{{.*}}ld{{(.exe)?}}" +! NODEFAULTLIBS-NOT: "-lFortran_main" "-lFortranRuntime" "-lFortranDecimal" "-lm" + +! RUN: %flang -### --target=x86_64-unknown-freebsd -nostartfiles %s 2>&1 | FileCheck \ +! RUN: --check-prefixes=NOSTARTFILES %s +! RUN: %flang -### --target=x86_64-unknown-netbsd -nostartfiles %s 2>&1 | FileCheck \ +! RUN: --check-prefixes=NOSTARTFILES %s +! RUN: %flang -### --target=i386-pc-solaris2.11 -nostartfiles %s 2>&1 | FileCheck \ +! RUN: --check-prefixes=NOSTARTFILES %s + +! NOSTARTFILES: "{{.*}}ld{{(.exe)?}}" +! NOSTARTFILES-NOT: crt{{[^.]+}}.o +! NOSTARTFILES: "-lFortran_main" "-lFortranRuntime" "-lFortranDecimal" "-lm" ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[flang] [clang] [flang][Driver] Support -nodefaultlibs, -nostartfiles and -nostdlib (PR #72601)
brad0 wrote: > It would be helpful if you could clearly distinguish between the two opposite > cases that are currently being tested in "dynamic-linker.f90". Ok, done. https://github.com/llvm/llvm-project/pull/72601 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[flang] [clang] [flang][Driver] Support -nodefaultlibs, -nostartfiles and -nostdlib (PR #72601)
brad0 wrote: @MaskRay Still could use some input about the ```CLOption, DXCOption``` part. Same with 34e4e5eb70818fca90574beb8f5617e27bfac138. https://github.com/llvm/llvm-project/pull/72601 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Driver][NFC] Make some derived classes of Tool final (PR #70416)
https://github.com/brad0 closed https://github.com/llvm/llvm-project/pull/70416 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] a8e0acf - [Driver][NFC] Fix a typo in the function name
Author: Brad Smith Date: 2023-10-27T22:10:05-04:00 New Revision: a8e0acf660639078a7e5341dd6ec82326d3b796b URL: https://github.com/llvm/llvm-project/commit/a8e0acf660639078a7e5341dd6ec82326d3b796b DIFF: https://github.com/llvm/llvm-project/commit/a8e0acf660639078a7e5341dd6ec82326d3b796b.diff LOG: [Driver][NFC] Fix a typo in the function name Added: Modified: clang/lib/Driver/ToolChains/DragonFly.cpp clang/lib/Driver/ToolChains/FreeBSD.cpp clang/lib/Driver/ToolChains/Gnu.cpp clang/lib/Driver/ToolChains/Haiku.cpp clang/lib/Driver/ToolChains/NetBSD.cpp clang/lib/Driver/ToolChains/OpenBSD.cpp Removed: diff --git a/clang/lib/Driver/ToolChains/DragonFly.cpp b/clang/lib/Driver/ToolChains/DragonFly.cpp index 500dd98665075b1..ed7f751adc0efaf 100644 --- a/clang/lib/Driver/ToolChains/DragonFly.cpp +++ b/clang/lib/Driver/ToolChains/DragonFly.cpp @@ -147,7 +147,7 @@ void dragonfly::Linker::ConstructJob(Compilation &C, const JobAction &JA, // Additional linker set-up and flags for Fortran. This is required in order // to generate executables. As Fortran runtime depends on the C runtime, // these dependencies need to be listed before the C runtime below (i.e. -// AddRuntTimeLibs). +// AddRunTimeLibs). if (D.IsFlangMode()) { addFortranRuntimeLibraryPath(ToolChain, Args, CmdArgs); addFortranRuntimeLibs(ToolChain, CmdArgs); diff --git a/clang/lib/Driver/ToolChains/FreeBSD.cpp b/clang/lib/Driver/ToolChains/FreeBSD.cpp index a5be32b4a2f07fd..e7d9e9fc4c8 100644 --- a/clang/lib/Driver/ToolChains/FreeBSD.cpp +++ b/clang/lib/Driver/ToolChains/FreeBSD.cpp @@ -294,7 +294,7 @@ void freebsd::Linker::ConstructJob(Compilation &C, const JobAction &JA, // Additional linker set-up and flags for Fortran. This is required in order // to generate executables. As Fortran runtime depends on the C runtime, // these dependencies need to be listed before the C runtime below (i.e. -// AddRuntTimeLibs). +// AddRunTimeLibs). if (D.IsFlangMode()) { addFortranRuntimeLibraryPath(ToolChain, Args, CmdArgs); addFortranRuntimeLibs(ToolChain, CmdArgs); diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp index 2515f85432d7542..5237951f84cce03 100644 --- a/clang/lib/Driver/ToolChains/Gnu.cpp +++ b/clang/lib/Driver/ToolChains/Gnu.cpp @@ -573,7 +573,7 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA, // Additional linker set-up and flags for Fortran. This is required in order // to generate executables. As Fortran runtime depends on the C runtime, // these dependencies need to be listed before the C runtime below (i.e. - // AddRuntTimeLibs). + // AddRunTimeLibs). if (D.IsFlangMode()) { addFortranRuntimeLibraryPath(ToolChain, Args, CmdArgs); addFortranRuntimeLibs(ToolChain, CmdArgs); diff --git a/clang/lib/Driver/ToolChains/Haiku.cpp b/clang/lib/Driver/ToolChains/Haiku.cpp index 172f16cc46e328e..b940150788f65c7 100644 --- a/clang/lib/Driver/ToolChains/Haiku.cpp +++ b/clang/lib/Driver/ToolChains/Haiku.cpp @@ -98,7 +98,7 @@ void haiku::Linker::ConstructJob(Compilation &C, const JobAction &JA, // Additional linker set-up and flags for Fortran. This is required in order // to generate executables. As Fortran runtime depends on the C runtime, // these dependencies need to be listed before the C runtime below (i.e. -// AddRuntTimeLibs). +// AddRunTimeLibs). if (D.IsFlangMode()) { addFortranRuntimeLibraryPath(ToolChain, Args, CmdArgs); addFortranRuntimeLibs(ToolChain, CmdArgs); diff --git a/clang/lib/Driver/ToolChains/NetBSD.cpp b/clang/lib/Driver/ToolChains/NetBSD.cpp index 245553d46055a27..7a1d4561c6f2f4f 100644 --- a/clang/lib/Driver/ToolChains/NetBSD.cpp +++ b/clang/lib/Driver/ToolChains/NetBSD.cpp @@ -318,7 +318,7 @@ void netbsd::Linker::ConstructJob(Compilation &C, const JobAction &JA, // Additional linker set-up and flags for Fortran. This is required in order // to generate executables. As Fortran runtime depends on the C runtime, // these dependencies need to be listed before the C runtime below (i.e. -// AddRuntTimeLibs). +// AddRunTimeLibs). if (D.IsFlangMode()) { addFortranRuntimeLibraryPath(ToolChain, Args, CmdArgs); addFortranRuntimeLibs(ToolChain, CmdArgs); diff --git a/clang/lib/Driver/ToolChains/OpenBSD.cpp b/clang/lib/Driver/ToolChains/OpenBSD.cpp index 4e14c3d140a1da2..16a311be31be7bc 100644 --- a/clang/lib/Driver/ToolChains/OpenBSD.cpp +++ b/clang/lib/Driver/ToolChains/OpenBSD.cpp @@ -217,7 +217,7 @@ void openbsd::Linker::ConstructJob(Compilation &C, const JobAction &JA, // Additional linker set-up and flags for Fortran. This is required in order // to generate executables. As Fortran runtime depends on the C runtime, // th
[clang] [Driver] Silence stdlib warning when linking C on *BSD / Solaris / Haiku (PR #70434)
https://github.com/brad0 updated https://github.com/llvm/llvm-project/pull/70434 >From 7b884f2d1bc366d20f553b54aaca5c7dd8afe487 Mon Sep 17 00:00:00 2001 From: Brad Smith Date: Fri, 27 Oct 2023 05:13:59 -0400 Subject: [PATCH] [Driver] Silence stdlib warning when linking C on *BSD / Solaris / Haiku Same as 12b87f6ef720080fab1e2d48ca2d8c5ba478ee5d --- clang/lib/Driver/ToolChains/DragonFly.cpp | 3 +++ clang/lib/Driver/ToolChains/FreeBSD.cpp | 6 +++--- clang/lib/Driver/ToolChains/Haiku.cpp | 3 +++ clang/lib/Driver/ToolChains/NetBSD.cpp| 3 +++ clang/lib/Driver/ToolChains/OpenBSD.cpp | 3 +++ clang/lib/Driver/ToolChains/Solaris.cpp | 3 +++ 6 files changed, 18 insertions(+), 3 deletions(-) diff --git a/clang/lib/Driver/ToolChains/DragonFly.cpp b/clang/lib/Driver/ToolChains/DragonFly.cpp index ed7f751adc0efaf..cced977bf029256 100644 --- a/clang/lib/Driver/ToolChains/DragonFly.cpp +++ b/clang/lib/Driver/ToolChains/DragonFly.cpp @@ -144,6 +144,9 @@ void dragonfly::Linker::ConstructJob(Compilation &C, const JobAction &JA, CmdArgs.push_back("-lm"); } +// Silence warnings when linking C code with a C++ '-stdlib' argument. +Args.ClaimAllArgs(options::OPT_stdlib_EQ); + // Additional linker set-up and flags for Fortran. This is required in order // to generate executables. As Fortran runtime depends on the C runtime, // these dependencies need to be listed before the C runtime below (i.e. diff --git a/clang/lib/Driver/ToolChains/FreeBSD.cpp b/clang/lib/Driver/ToolChains/FreeBSD.cpp index e7d9e9fc4c8..0b70ac7b76e6765 100644 --- a/clang/lib/Driver/ToolChains/FreeBSD.cpp +++ b/clang/lib/Driver/ToolChains/FreeBSD.cpp @@ -291,6 +291,9 @@ void freebsd::Linker::ConstructJob(Compilation &C, const JobAction &JA, CmdArgs.push_back("-lm"); } +// Silence warnings when linking C code with a C++ '-stdlib' argument. +Args.ClaimAllArgs(options::OPT_stdlib_EQ); + // Additional linker set-up and flags for Fortran. This is required in order // to generate executables. As Fortran runtime depends on the C runtime, // these dependencies need to be listed before the C runtime below (i.e. @@ -364,9 +367,6 @@ void freebsd::Linker::ConstructJob(Compilation &C, const JobAction &JA, ToolChain.addProfileRTLibs(Args, CmdArgs); - // Silence warnings when linking C code with a C++ '-stdlib' argument. - Args.ClaimAllArgs(options::OPT_stdlib_EQ); - const char *Exec = Args.MakeArgString(getToolChain().GetLinkerPath()); C.addCommand(std::make_unique(JA, *this, ResponseFileSupport::AtFileCurCP(), diff --git a/clang/lib/Driver/ToolChains/Haiku.cpp b/clang/lib/Driver/ToolChains/Haiku.cpp index b940150788f65c7..1df9c7b08879e45 100644 --- a/clang/lib/Driver/ToolChains/Haiku.cpp +++ b/clang/lib/Driver/ToolChains/Haiku.cpp @@ -95,6 +95,9 @@ void haiku::Linker::ConstructJob(Compilation &C, const JobAction &JA, if (D.CCCIsCXX() && ToolChain.ShouldLinkCXXStdlib(Args)) ToolChain.AddCXXStdlibLibArgs(Args, CmdArgs); +// Silence warnings when linking C code with a C++ '-stdlib' argument. +Args.ClaimAllArgs(options::OPT_stdlib_EQ); + // Additional linker set-up and flags for Fortran. This is required in order // to generate executables. As Fortran runtime depends on the C runtime, // these dependencies need to be listed before the C runtime below (i.e. diff --git a/clang/lib/Driver/ToolChains/NetBSD.cpp b/clang/lib/Driver/ToolChains/NetBSD.cpp index 7a1d4561c6f2f4f..cfde8d40a77ae16 100644 --- a/clang/lib/Driver/ToolChains/NetBSD.cpp +++ b/clang/lib/Driver/ToolChains/NetBSD.cpp @@ -315,6 +315,9 @@ void netbsd::Linker::ConstructJob(Compilation &C, const JobAction &JA, CmdArgs.push_back("-lm"); } +// Silence warnings when linking C code with a C++ '-stdlib' argument. +Args.ClaimAllArgs(options::OPT_stdlib_EQ); + // Additional linker set-up and flags for Fortran. This is required in order // to generate executables. As Fortran runtime depends on the C runtime, // these dependencies need to be listed before the C runtime below (i.e. diff --git a/clang/lib/Driver/ToolChains/OpenBSD.cpp b/clang/lib/Driver/ToolChains/OpenBSD.cpp index 16a311be31be7bc..c5255573baf3ca5 100644 --- a/clang/lib/Driver/ToolChains/OpenBSD.cpp +++ b/clang/lib/Driver/ToolChains/OpenBSD.cpp @@ -214,6 +214,9 @@ void openbsd::Linker::ConstructJob(Compilation &C, const JobAction &JA, CmdArgs.push_back("-lm"); } +// Silence warnings when linking C code with a C++ '-stdlib' argument. +Args.ClaimAllArgs(options::OPT_stdlib_EQ); + // Additional linker set-up and flags for Fortran. This is required in order // to generate executables. As Fortran runtime depends on the C runtime, // these dependencies need to be listed before the C runtime below (i.e. diff --git a/clang/lib/Driver/ToolChains/Solaris.cpp b/clang/lib/Driver/ToolCh
[clang] [Driver] Silence stdlib warning when linking C on *BSD / Solaris / Haiku (PR #70434)
https://github.com/brad0 updated https://github.com/llvm/llvm-project/pull/70434 >From ae7bf5b42a62f0c20592e07af2f9e746aaa2231c Mon Sep 17 00:00:00 2001 From: Brad Smith Date: Fri, 27 Oct 2023 05:13:59 -0400 Subject: [PATCH] [Driver] Silence stdlib warning when linking C on *BSD / Solaris / Haiku Same as 12b87f6ef720080fab1e2d48ca2d8c5ba478ee5d --- clang/lib/Driver/ToolChains/DragonFly.cpp | 3 +++ clang/lib/Driver/ToolChains/FreeBSD.cpp | 6 +++--- clang/lib/Driver/ToolChains/Haiku.cpp | 3 +++ clang/lib/Driver/ToolChains/NetBSD.cpp| 3 +++ clang/lib/Driver/ToolChains/OpenBSD.cpp | 3 +++ clang/lib/Driver/ToolChains/Solaris.cpp | 2 ++ 6 files changed, 17 insertions(+), 3 deletions(-) diff --git a/clang/lib/Driver/ToolChains/DragonFly.cpp b/clang/lib/Driver/ToolChains/DragonFly.cpp index ed7f751adc0efaf..cced977bf029256 100644 --- a/clang/lib/Driver/ToolChains/DragonFly.cpp +++ b/clang/lib/Driver/ToolChains/DragonFly.cpp @@ -144,6 +144,9 @@ void dragonfly::Linker::ConstructJob(Compilation &C, const JobAction &JA, CmdArgs.push_back("-lm"); } +// Silence warnings when linking C code with a C++ '-stdlib' argument. +Args.ClaimAllArgs(options::OPT_stdlib_EQ); + // Additional linker set-up and flags for Fortran. This is required in order // to generate executables. As Fortran runtime depends on the C runtime, // these dependencies need to be listed before the C runtime below (i.e. diff --git a/clang/lib/Driver/ToolChains/FreeBSD.cpp b/clang/lib/Driver/ToolChains/FreeBSD.cpp index e7d9e9fc4c8..0b70ac7b76e6765 100644 --- a/clang/lib/Driver/ToolChains/FreeBSD.cpp +++ b/clang/lib/Driver/ToolChains/FreeBSD.cpp @@ -291,6 +291,9 @@ void freebsd::Linker::ConstructJob(Compilation &C, const JobAction &JA, CmdArgs.push_back("-lm"); } +// Silence warnings when linking C code with a C++ '-stdlib' argument. +Args.ClaimAllArgs(options::OPT_stdlib_EQ); + // Additional linker set-up and flags for Fortran. This is required in order // to generate executables. As Fortran runtime depends on the C runtime, // these dependencies need to be listed before the C runtime below (i.e. @@ -364,9 +367,6 @@ void freebsd::Linker::ConstructJob(Compilation &C, const JobAction &JA, ToolChain.addProfileRTLibs(Args, CmdArgs); - // Silence warnings when linking C code with a C++ '-stdlib' argument. - Args.ClaimAllArgs(options::OPT_stdlib_EQ); - const char *Exec = Args.MakeArgString(getToolChain().GetLinkerPath()); C.addCommand(std::make_unique(JA, *this, ResponseFileSupport::AtFileCurCP(), diff --git a/clang/lib/Driver/ToolChains/Haiku.cpp b/clang/lib/Driver/ToolChains/Haiku.cpp index b940150788f65c7..1df9c7b08879e45 100644 --- a/clang/lib/Driver/ToolChains/Haiku.cpp +++ b/clang/lib/Driver/ToolChains/Haiku.cpp @@ -95,6 +95,9 @@ void haiku::Linker::ConstructJob(Compilation &C, const JobAction &JA, if (D.CCCIsCXX() && ToolChain.ShouldLinkCXXStdlib(Args)) ToolChain.AddCXXStdlibLibArgs(Args, CmdArgs); +// Silence warnings when linking C code with a C++ '-stdlib' argument. +Args.ClaimAllArgs(options::OPT_stdlib_EQ); + // Additional linker set-up and flags for Fortran. This is required in order // to generate executables. As Fortran runtime depends on the C runtime, // these dependencies need to be listed before the C runtime below (i.e. diff --git a/clang/lib/Driver/ToolChains/NetBSD.cpp b/clang/lib/Driver/ToolChains/NetBSD.cpp index 7a1d4561c6f2f4f..cfde8d40a77ae16 100644 --- a/clang/lib/Driver/ToolChains/NetBSD.cpp +++ b/clang/lib/Driver/ToolChains/NetBSD.cpp @@ -315,6 +315,9 @@ void netbsd::Linker::ConstructJob(Compilation &C, const JobAction &JA, CmdArgs.push_back("-lm"); } +// Silence warnings when linking C code with a C++ '-stdlib' argument. +Args.ClaimAllArgs(options::OPT_stdlib_EQ); + // Additional linker set-up and flags for Fortran. This is required in order // to generate executables. As Fortran runtime depends on the C runtime, // these dependencies need to be listed before the C runtime below (i.e. diff --git a/clang/lib/Driver/ToolChains/OpenBSD.cpp b/clang/lib/Driver/ToolChains/OpenBSD.cpp index 16a311be31be7bc..c5255573baf3ca5 100644 --- a/clang/lib/Driver/ToolChains/OpenBSD.cpp +++ b/clang/lib/Driver/ToolChains/OpenBSD.cpp @@ -214,6 +214,9 @@ void openbsd::Linker::ConstructJob(Compilation &C, const JobAction &JA, CmdArgs.push_back("-lm"); } +// Silence warnings when linking C code with a C++ '-stdlib' argument. +Args.ClaimAllArgs(options::OPT_stdlib_EQ); + // Additional linker set-up and flags for Fortran. This is required in order // to generate executables. As Fortran runtime depends on the C runtime, // these dependencies need to be listed before the C runtime below (i.e. diff --git a/clang/lib/Driver/ToolChains/Solaris.cpp b/clang/lib/Driver/ToolCha
[clang] [Driver] Silence stdlib warning when linking C on *BSD / Solaris / Haiku (PR #70434)
https://github.com/brad0 updated https://github.com/llvm/llvm-project/pull/70434 >From 2aa78e266b76286c38a071999274f496722a56f0 Mon Sep 17 00:00:00 2001 From: Brad Smith Date: Fri, 27 Oct 2023 05:13:59 -0400 Subject: [PATCH] [Driver] Silence stdlib warning when linking C on *BSD / Solaris / Haiku Same as 12b87f6ef720080fab1e2d48ca2d8c5ba478ee5d and the addition to Gnu. --- clang/lib/Driver/ToolChains/DragonFly.cpp | 3 +++ clang/lib/Driver/ToolChains/FreeBSD.cpp | 6 +++--- clang/lib/Driver/ToolChains/Haiku.cpp | 3 +++ clang/lib/Driver/ToolChains/NetBSD.cpp| 3 +++ clang/lib/Driver/ToolChains/OpenBSD.cpp | 3 +++ clang/lib/Driver/ToolChains/Solaris.cpp | 2 ++ 6 files changed, 17 insertions(+), 3 deletions(-) diff --git a/clang/lib/Driver/ToolChains/DragonFly.cpp b/clang/lib/Driver/ToolChains/DragonFly.cpp index ed7f751adc0efaf..cced977bf029256 100644 --- a/clang/lib/Driver/ToolChains/DragonFly.cpp +++ b/clang/lib/Driver/ToolChains/DragonFly.cpp @@ -144,6 +144,9 @@ void dragonfly::Linker::ConstructJob(Compilation &C, const JobAction &JA, CmdArgs.push_back("-lm"); } +// Silence warnings when linking C code with a C++ '-stdlib' argument. +Args.ClaimAllArgs(options::OPT_stdlib_EQ); + // Additional linker set-up and flags for Fortran. This is required in order // to generate executables. As Fortran runtime depends on the C runtime, // these dependencies need to be listed before the C runtime below (i.e. diff --git a/clang/lib/Driver/ToolChains/FreeBSD.cpp b/clang/lib/Driver/ToolChains/FreeBSD.cpp index e7d9e9fc4c8..0b70ac7b76e6765 100644 --- a/clang/lib/Driver/ToolChains/FreeBSD.cpp +++ b/clang/lib/Driver/ToolChains/FreeBSD.cpp @@ -291,6 +291,9 @@ void freebsd::Linker::ConstructJob(Compilation &C, const JobAction &JA, CmdArgs.push_back("-lm"); } +// Silence warnings when linking C code with a C++ '-stdlib' argument. +Args.ClaimAllArgs(options::OPT_stdlib_EQ); + // Additional linker set-up and flags for Fortran. This is required in order // to generate executables. As Fortran runtime depends on the C runtime, // these dependencies need to be listed before the C runtime below (i.e. @@ -364,9 +367,6 @@ void freebsd::Linker::ConstructJob(Compilation &C, const JobAction &JA, ToolChain.addProfileRTLibs(Args, CmdArgs); - // Silence warnings when linking C code with a C++ '-stdlib' argument. - Args.ClaimAllArgs(options::OPT_stdlib_EQ); - const char *Exec = Args.MakeArgString(getToolChain().GetLinkerPath()); C.addCommand(std::make_unique(JA, *this, ResponseFileSupport::AtFileCurCP(), diff --git a/clang/lib/Driver/ToolChains/Haiku.cpp b/clang/lib/Driver/ToolChains/Haiku.cpp index b940150788f65c7..1df9c7b08879e45 100644 --- a/clang/lib/Driver/ToolChains/Haiku.cpp +++ b/clang/lib/Driver/ToolChains/Haiku.cpp @@ -95,6 +95,9 @@ void haiku::Linker::ConstructJob(Compilation &C, const JobAction &JA, if (D.CCCIsCXX() && ToolChain.ShouldLinkCXXStdlib(Args)) ToolChain.AddCXXStdlibLibArgs(Args, CmdArgs); +// Silence warnings when linking C code with a C++ '-stdlib' argument. +Args.ClaimAllArgs(options::OPT_stdlib_EQ); + // Additional linker set-up and flags for Fortran. This is required in order // to generate executables. As Fortran runtime depends on the C runtime, // these dependencies need to be listed before the C runtime below (i.e. diff --git a/clang/lib/Driver/ToolChains/NetBSD.cpp b/clang/lib/Driver/ToolChains/NetBSD.cpp index 7a1d4561c6f2f4f..cfde8d40a77ae16 100644 --- a/clang/lib/Driver/ToolChains/NetBSD.cpp +++ b/clang/lib/Driver/ToolChains/NetBSD.cpp @@ -315,6 +315,9 @@ void netbsd::Linker::ConstructJob(Compilation &C, const JobAction &JA, CmdArgs.push_back("-lm"); } +// Silence warnings when linking C code with a C++ '-stdlib' argument. +Args.ClaimAllArgs(options::OPT_stdlib_EQ); + // Additional linker set-up and flags for Fortran. This is required in order // to generate executables. As Fortran runtime depends on the C runtime, // these dependencies need to be listed before the C runtime below (i.e. diff --git a/clang/lib/Driver/ToolChains/OpenBSD.cpp b/clang/lib/Driver/ToolChains/OpenBSD.cpp index 16a311be31be7bc..c5255573baf3ca5 100644 --- a/clang/lib/Driver/ToolChains/OpenBSD.cpp +++ b/clang/lib/Driver/ToolChains/OpenBSD.cpp @@ -214,6 +214,9 @@ void openbsd::Linker::ConstructJob(Compilation &C, const JobAction &JA, CmdArgs.push_back("-lm"); } +// Silence warnings when linking C code with a C++ '-stdlib' argument. +Args.ClaimAllArgs(options::OPT_stdlib_EQ); + // Additional linker set-up and flags for Fortran. This is required in order // to generate executables. As Fortran runtime depends on the C runtime, // these dependencies need to be listed before the C runtime below (i.e. diff --git a/clang/lib/Driver/ToolChains/Solaris.cpp b
[clang] [Driver] Silence stdlib warning when linking C on *BSD / Solaris / Haiku (PR #70434)
https://github.com/brad0 edited https://github.com/llvm/llvm-project/pull/70434 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Driver] Handle Flang in same manner between Gnu and *BSD/Solaris ToolChain (PR #70429)
https://github.com/brad0 updated https://github.com/llvm/llvm-project/pull/70429 >From 8e3e053c7b8048387efb39808429cef9802ea68f Mon Sep 17 00:00:00 2001 From: Brad Smith Date: Fri, 27 Oct 2023 04:53:19 -0400 Subject: [PATCH] [Driver] Handle Flang in same manner between Gnu and *BSD/Solaris ToolChain --- clang/lib/Driver/ToolChains/Gnu.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp index 5237951f84cce03..f19107f2374ce9e 100644 --- a/clang/lib/Driver/ToolChains/Gnu.cpp +++ b/clang/lib/Driver/ToolChains/Gnu.cpp @@ -574,7 +574,9 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA, // to generate executables. As Fortran runtime depends on the C runtime, // these dependencies need to be listed before the C runtime below (i.e. // AddRunTimeLibs). - if (D.IsFlangMode()) { + if (D.IsFlangMode() && + !Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs, + options::OPT_r)) { addFortranRuntimeLibraryPath(ToolChain, Args, CmdArgs); addFortranRuntimeLibs(ToolChain, CmdArgs); CmdArgs.push_back("-lm"); ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [OpenMP] Add support for Solaris (PR #70593)
https://github.com/brad0 created https://github.com/llvm/llvm-project/pull/70593 Tested on `amd64-pc-solaris2.11`. >From 808764675f3cc37f9b2e0f3f31372be93ada6b84 Mon Sep 17 00:00:00 2001 From: Brad Smith Date: Sun, 29 Oct 2023 09:02:12 -0400 Subject: [PATCH] [OpenMP] Add support for Solaris Tested on `amd64-pc-solaris2.11`. --- clang/lib/Driver/ToolChains/Solaris.cpp | 5 + clang/test/Driver/fopenmp.c | 19 ++- openmp/runtime/src/kmp.h| 8 ++-- openmp/runtime/src/kmp_ftn_entry.h | 2 +- openmp/runtime/src/kmp_platform.h | 11 +-- openmp/runtime/src/kmp_runtime.cpp | 8 +--- openmp/runtime/src/z_Linux_util.cpp | 21 +++-- 7 files changed, 59 insertions(+), 15 deletions(-) diff --git a/clang/lib/Driver/ToolChains/Solaris.cpp b/clang/lib/Driver/ToolChains/Solaris.cpp index 3d5a710842eca44..958ed99c482ed22 100644 --- a/clang/lib/Driver/ToolChains/Solaris.cpp +++ b/clang/lib/Driver/ToolChains/Solaris.cpp @@ -215,6 +215,11 @@ void solaris::Linker::ConstructJob(Compilation &C, const JobAction &JA, if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs, options::OPT_r)) { +// Use the static OpenMP runtime with -static-openmp +bool StaticOpenMP = Args.hasArg(options::OPT_static_openmp) && +!Args.hasArg(options::OPT_static); +addOpenMPRuntime(CmdArgs, getToolChain(), Args, StaticOpenMP); + if (D.CCCIsCXX()) { if (getToolChain().ShouldLinkCXXStdlib(Args)) getToolChain().AddCXXStdlibLibArgs(Args, CmdArgs); diff --git a/clang/test/Driver/fopenmp.c b/clang/test/Driver/fopenmp.c index cf04340ebc06ac6..2003fdbafe02760 100644 --- a/clang/test/Driver/fopenmp.c +++ b/clang/test/Driver/fopenmp.c @@ -16,6 +16,9 @@ // RUN: %clang -target x86_64-dragonfly -fopenmp=libomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP // RUN: %clang -target x86_64-dragonfly -fopenmp=libgomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-NO-OPENMP // RUN: %clang -target x86_64-dragonfly -fopenmp=libiomp5 -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP +// RUN: %clang -target sparc-sun-solaris2.11 -fopenmp=libomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP +// RUN: %clang -target sparc-sun-solaris2.11 -fopenmp=libgomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-NO-OPENMP +// RUN: %clang -target sparc-sun-solaris2.11 -fopenmp=libiomp5 -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP // RUN: %clang -target x86_64-windows-gnu -fopenmp=libomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP // RUN: %clang -target x86_64-windows-gnu -fopenmp=libgomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-NO-OPENMP // RUN: %clang -target x86_64-windows-gnu -fopenmp=libiomp5 -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP @@ -106,6 +109,19 @@ // RUN: %clang -nostdlib -target x86_64-dragonfly -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-GOMP // RUN: %clang -nostdlib -target x86_64-dragonfly -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-IOMP5 // +// RUN: %clang -target sparc-sun-solaris2.11 -fopenmp=libomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-OMP +// RUN: %clang -target sparc-sun-solaris2.11 -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-GOMP --check-prefix=CHECK-LD-GOMP-NO-RT +// RUN: %clang -target sparc-sun-solaris2.11 -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-IOMP5 +// +// RUN: %clang -target sparc-sun-solaris2.11 -fopenmp=libomp -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-OMP +// RUN: %clang -target sparc-sun-solaris2.11 -fopenmp=libgomp -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-GOMP --check-prefix=CHECK-LD-STATIC-GOMP-NO-RT +// RUN: %clang -target sparc-sun-solaris2.11 -fopenmp=libiomp5 -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-IOMP5 +// RUN: %clang -target sparc-sun-solaris2.11 -fopenmp=libiomp5 -static -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-IOMP5-NO-BDYNAMIC +// +// RUN: %clang -nostdlib -target sparc-sun-solaris2.11 -fopenmp=libomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-OMP +// RUN: %clang -nostdlib -target sparc-sun-solaris2.11 -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-GOMP +// RUN: %clang -nostdlib -target sparc-sun-solaris2.11 -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-IOMP5 +// // RUN: %clang -target x86_64-windows-gnu -fopenmp=libomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-OMP // RUN: %clang -target x86_64-windows-gnu -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-GOMP --ch
[clang] [OpenMP] Add support for Solaris (PR #70593)
https://github.com/brad0 updated https://github.com/llvm/llvm-project/pull/70593 >From 80c900b380de3b6b536084e680bcffbd2b94962d Mon Sep 17 00:00:00 2001 From: Brad Smith Date: Sun, 29 Oct 2023 09:02:12 -0400 Subject: [PATCH] [OpenMP] Add support for Solaris Tested on `amd64-pc-solaris2.11`. --- clang/lib/Driver/ToolChains/Solaris.cpp | 5 + clang/test/Driver/fopenmp.c | 19 ++- openmp/runtime/src/kmp.h| 8 ++-- openmp/runtime/src/kmp_ftn_entry.h | 2 +- openmp/runtime/src/kmp_platform.h | 11 +-- openmp/runtime/src/kmp_runtime.cpp | 8 +--- openmp/runtime/src/z_Linux_util.cpp | 22 -- 7 files changed, 60 insertions(+), 15 deletions(-) diff --git a/clang/lib/Driver/ToolChains/Solaris.cpp b/clang/lib/Driver/ToolChains/Solaris.cpp index 3d5a710842eca44..958ed99c482ed22 100644 --- a/clang/lib/Driver/ToolChains/Solaris.cpp +++ b/clang/lib/Driver/ToolChains/Solaris.cpp @@ -215,6 +215,11 @@ void solaris::Linker::ConstructJob(Compilation &C, const JobAction &JA, if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs, options::OPT_r)) { +// Use the static OpenMP runtime with -static-openmp +bool StaticOpenMP = Args.hasArg(options::OPT_static_openmp) && +!Args.hasArg(options::OPT_static); +addOpenMPRuntime(CmdArgs, getToolChain(), Args, StaticOpenMP); + if (D.CCCIsCXX()) { if (getToolChain().ShouldLinkCXXStdlib(Args)) getToolChain().AddCXXStdlibLibArgs(Args, CmdArgs); diff --git a/clang/test/Driver/fopenmp.c b/clang/test/Driver/fopenmp.c index cf04340ebc06ac6..2003fdbafe02760 100644 --- a/clang/test/Driver/fopenmp.c +++ b/clang/test/Driver/fopenmp.c @@ -16,6 +16,9 @@ // RUN: %clang -target x86_64-dragonfly -fopenmp=libomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP // RUN: %clang -target x86_64-dragonfly -fopenmp=libgomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-NO-OPENMP // RUN: %clang -target x86_64-dragonfly -fopenmp=libiomp5 -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP +// RUN: %clang -target sparc-sun-solaris2.11 -fopenmp=libomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP +// RUN: %clang -target sparc-sun-solaris2.11 -fopenmp=libgomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-NO-OPENMP +// RUN: %clang -target sparc-sun-solaris2.11 -fopenmp=libiomp5 -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP // RUN: %clang -target x86_64-windows-gnu -fopenmp=libomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP // RUN: %clang -target x86_64-windows-gnu -fopenmp=libgomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-NO-OPENMP // RUN: %clang -target x86_64-windows-gnu -fopenmp=libiomp5 -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP @@ -106,6 +109,19 @@ // RUN: %clang -nostdlib -target x86_64-dragonfly -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-GOMP // RUN: %clang -nostdlib -target x86_64-dragonfly -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-IOMP5 // +// RUN: %clang -target sparc-sun-solaris2.11 -fopenmp=libomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-OMP +// RUN: %clang -target sparc-sun-solaris2.11 -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-GOMP --check-prefix=CHECK-LD-GOMP-NO-RT +// RUN: %clang -target sparc-sun-solaris2.11 -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-IOMP5 +// +// RUN: %clang -target sparc-sun-solaris2.11 -fopenmp=libomp -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-OMP +// RUN: %clang -target sparc-sun-solaris2.11 -fopenmp=libgomp -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-GOMP --check-prefix=CHECK-LD-STATIC-GOMP-NO-RT +// RUN: %clang -target sparc-sun-solaris2.11 -fopenmp=libiomp5 -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-IOMP5 +// RUN: %clang -target sparc-sun-solaris2.11 -fopenmp=libiomp5 -static -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-IOMP5-NO-BDYNAMIC +// +// RUN: %clang -nostdlib -target sparc-sun-solaris2.11 -fopenmp=libomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-OMP +// RUN: %clang -nostdlib -target sparc-sun-solaris2.11 -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-GOMP +// RUN: %clang -nostdlib -target sparc-sun-solaris2.11 -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-IOMP5 +// // RUN: %clang -target x86_64-windows-gnu -fopenmp=libomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-OMP // RUN: %clang -target x86_64-windows-gnu -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-GOMP --check-prefix=CHECK-LD-GOMP-NO-RT //
[clang] [OpenMP] Add support for Solaris (PR #70593)
https://github.com/brad0 updated https://github.com/llvm/llvm-project/pull/70593 >From 0933677259d446875c25898383c1c206b0c6efd8 Mon Sep 17 00:00:00 2001 From: Brad Smith Date: Sun, 29 Oct 2023 09:02:12 -0400 Subject: [PATCH] [OpenMP] Add support for Solaris Tested on `amd64-pc-solaris2.11`. --- clang/lib/Driver/ToolChains/Solaris.cpp | 5 + clang/test/Driver/fopenmp.c | 19 ++- openmp/runtime/src/kmp.h| 8 ++-- openmp/runtime/src/kmp_ftn_entry.h | 2 +- openmp/runtime/src/kmp_platform.h | 11 +-- openmp/runtime/src/kmp_runtime.cpp | 8 +--- openmp/runtime/src/z_Linux_util.cpp | 20 +++- 7 files changed, 59 insertions(+), 14 deletions(-) diff --git a/clang/lib/Driver/ToolChains/Solaris.cpp b/clang/lib/Driver/ToolChains/Solaris.cpp index 3d5a710842eca44..958ed99c482ed22 100644 --- a/clang/lib/Driver/ToolChains/Solaris.cpp +++ b/clang/lib/Driver/ToolChains/Solaris.cpp @@ -215,6 +215,11 @@ void solaris::Linker::ConstructJob(Compilation &C, const JobAction &JA, if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs, options::OPT_r)) { +// Use the static OpenMP runtime with -static-openmp +bool StaticOpenMP = Args.hasArg(options::OPT_static_openmp) && +!Args.hasArg(options::OPT_static); +addOpenMPRuntime(CmdArgs, getToolChain(), Args, StaticOpenMP); + if (D.CCCIsCXX()) { if (getToolChain().ShouldLinkCXXStdlib(Args)) getToolChain().AddCXXStdlibLibArgs(Args, CmdArgs); diff --git a/clang/test/Driver/fopenmp.c b/clang/test/Driver/fopenmp.c index cf04340ebc06ac6..291946923b3ea3d 100644 --- a/clang/test/Driver/fopenmp.c +++ b/clang/test/Driver/fopenmp.c @@ -16,6 +16,9 @@ // RUN: %clang -target x86_64-dragonfly -fopenmp=libomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP // RUN: %clang -target x86_64-dragonfly -fopenmp=libgomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-NO-OPENMP // RUN: %clang -target x86_64-dragonfly -fopenmp=libiomp5 -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP +// RUN: %clang -target i386-pc-solaris2.11 -fopenmp=libomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP +// RUN: %clang -target i386-pc-solaris2.11 -fopenmp=libgomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-NO-OPENMP +// RUN: %clang -target i386-pc-solaris2.11 -fopenmp=libiomp5 -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP // RUN: %clang -target x86_64-windows-gnu -fopenmp=libomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP // RUN: %clang -target x86_64-windows-gnu -fopenmp=libgomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-NO-OPENMP // RUN: %clang -target x86_64-windows-gnu -fopenmp=libiomp5 -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP @@ -106,6 +109,19 @@ // RUN: %clang -nostdlib -target x86_64-dragonfly -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-GOMP // RUN: %clang -nostdlib -target x86_64-dragonfly -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-IOMP5 // +// RUN: %clang -target i386-pc-solaris2.11 -fopenmp=libomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-OMP +// RUN: %clang -target i386-pc-solaris2.11 -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-GOMP --check-prefix=CHECK-LD-GOMP-NO-RT +// RUN: %clang -target i386-pc-solaris2.11 -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-IOMP5 +// +// RUN: %clang -target i386-pc-solaris2.11 -fopenmp=libomp -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-OMP +// RUN: %clang -target i386-pc-solaris2.11 -fopenmp=libgomp -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-GOMP --check-prefix=CHECK-LD-STATIC-GOMP-NO-RT +// RUN: %clang -target i386-pc-solaris2.11 -fopenmp=libiomp5 -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-IOMP5 +// RUN: %clang -target i386-pc-solaris2.11 -fopenmp=libiomp5 -static -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-IOMP5-NO-BDYNAMIC +// +// RUN: %clang -nostdlib -target i386-pc-solaris2.11 -fopenmp=libomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-OMP +// RUN: %clang -nostdlib -target i386-pc-solaris2.11 -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-GOMP +// RUN: %clang -nostdlib -target i386-pc-solaris2.11 -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-IOMP5 +// // RUN: %clang -target x86_64-windows-gnu -fopenmp=libomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-OMP // RUN: %clang -target x86_64-windows-gnu -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-GOMP --check-prefix=CHECK-LD-GOMP-NO-RT // RUN: %clang -target x86_64-w
[clang] [OpenMP] Add support for Solaris (PR #70593)
https://github.com/brad0 updated https://github.com/llvm/llvm-project/pull/70593 >From e4482f4e77f8ed3de5e3aedbfb8662f2deccef2b Mon Sep 17 00:00:00 2001 From: Brad Smith Date: Sun, 29 Oct 2023 09:02:12 -0400 Subject: [PATCH] [OpenMP] Add support for Solaris Tested on `amd64-pc-solaris2.11`. --- clang/lib/Driver/ToolChains/Solaris.cpp | 5 + clang/test/Driver/fopenmp.c | 19 ++- openmp/runtime/src/kmp.h| 8 ++-- openmp/runtime/src/kmp_ftn_entry.h | 2 +- openmp/runtime/src/kmp_platform.h | 11 +-- openmp/runtime/src/kmp_runtime.cpp | 8 +--- openmp/runtime/src/z_Linux_util.cpp | 21 - 7 files changed, 60 insertions(+), 14 deletions(-) diff --git a/clang/lib/Driver/ToolChains/Solaris.cpp b/clang/lib/Driver/ToolChains/Solaris.cpp index 3d5a710842eca44..958ed99c482ed22 100644 --- a/clang/lib/Driver/ToolChains/Solaris.cpp +++ b/clang/lib/Driver/ToolChains/Solaris.cpp @@ -215,6 +215,11 @@ void solaris::Linker::ConstructJob(Compilation &C, const JobAction &JA, if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs, options::OPT_r)) { +// Use the static OpenMP runtime with -static-openmp +bool StaticOpenMP = Args.hasArg(options::OPT_static_openmp) && +!Args.hasArg(options::OPT_static); +addOpenMPRuntime(CmdArgs, getToolChain(), Args, StaticOpenMP); + if (D.CCCIsCXX()) { if (getToolChain().ShouldLinkCXXStdlib(Args)) getToolChain().AddCXXStdlibLibArgs(Args, CmdArgs); diff --git a/clang/test/Driver/fopenmp.c b/clang/test/Driver/fopenmp.c index cf04340ebc06ac6..291946923b3ea3d 100644 --- a/clang/test/Driver/fopenmp.c +++ b/clang/test/Driver/fopenmp.c @@ -16,6 +16,9 @@ // RUN: %clang -target x86_64-dragonfly -fopenmp=libomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP // RUN: %clang -target x86_64-dragonfly -fopenmp=libgomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-NO-OPENMP // RUN: %clang -target x86_64-dragonfly -fopenmp=libiomp5 -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP +// RUN: %clang -target i386-pc-solaris2.11 -fopenmp=libomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP +// RUN: %clang -target i386-pc-solaris2.11 -fopenmp=libgomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-NO-OPENMP +// RUN: %clang -target i386-pc-solaris2.11 -fopenmp=libiomp5 -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP // RUN: %clang -target x86_64-windows-gnu -fopenmp=libomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP // RUN: %clang -target x86_64-windows-gnu -fopenmp=libgomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-NO-OPENMP // RUN: %clang -target x86_64-windows-gnu -fopenmp=libiomp5 -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP @@ -106,6 +109,19 @@ // RUN: %clang -nostdlib -target x86_64-dragonfly -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-GOMP // RUN: %clang -nostdlib -target x86_64-dragonfly -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-IOMP5 // +// RUN: %clang -target i386-pc-solaris2.11 -fopenmp=libomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-OMP +// RUN: %clang -target i386-pc-solaris2.11 -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-GOMP --check-prefix=CHECK-LD-GOMP-NO-RT +// RUN: %clang -target i386-pc-solaris2.11 -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-IOMP5 +// +// RUN: %clang -target i386-pc-solaris2.11 -fopenmp=libomp -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-OMP +// RUN: %clang -target i386-pc-solaris2.11 -fopenmp=libgomp -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-GOMP --check-prefix=CHECK-LD-STATIC-GOMP-NO-RT +// RUN: %clang -target i386-pc-solaris2.11 -fopenmp=libiomp5 -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-IOMP5 +// RUN: %clang -target i386-pc-solaris2.11 -fopenmp=libiomp5 -static -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-IOMP5-NO-BDYNAMIC +// +// RUN: %clang -nostdlib -target i386-pc-solaris2.11 -fopenmp=libomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-OMP +// RUN: %clang -nostdlib -target i386-pc-solaris2.11 -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-GOMP +// RUN: %clang -nostdlib -target i386-pc-solaris2.11 -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-IOMP5 +// // RUN: %clang -target x86_64-windows-gnu -fopenmp=libomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-OMP // RUN: %clang -target x86_64-windows-gnu -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-GOMP --check-prefix=CHECK-LD-GOMP-NO-RT // RUN: %clang -target x86_64-
[clang] [OpenMP] Add support for Solaris (PR #70593)
https://github.com/brad0 updated https://github.com/llvm/llvm-project/pull/70593 >From e59311bf2d895ebd5c031d01113d5de879c9c542 Mon Sep 17 00:00:00 2001 From: Brad Smith Date: Sun, 29 Oct 2023 09:02:12 -0400 Subject: [PATCH] [OpenMP] Add support for Solaris/x86_64 Tested on `amd64-pc-solaris2.11`. --- clang/lib/Driver/ToolChains/Solaris.cpp | 5 + clang/test/Driver/fopenmp.c | 19 ++- openmp/runtime/src/kmp.h| 8 ++-- openmp/runtime/src/kmp_ftn_entry.h | 2 +- openmp/runtime/src/kmp_platform.h | 11 +-- openmp/runtime/src/kmp_runtime.cpp | 8 +--- openmp/runtime/src/z_Linux_util.cpp | 21 - 7 files changed, 60 insertions(+), 14 deletions(-) diff --git a/clang/lib/Driver/ToolChains/Solaris.cpp b/clang/lib/Driver/ToolChains/Solaris.cpp index 3d5a710842eca44..958ed99c482ed22 100644 --- a/clang/lib/Driver/ToolChains/Solaris.cpp +++ b/clang/lib/Driver/ToolChains/Solaris.cpp @@ -215,6 +215,11 @@ void solaris::Linker::ConstructJob(Compilation &C, const JobAction &JA, if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs, options::OPT_r)) { +// Use the static OpenMP runtime with -static-openmp +bool StaticOpenMP = Args.hasArg(options::OPT_static_openmp) && +!Args.hasArg(options::OPT_static); +addOpenMPRuntime(CmdArgs, getToolChain(), Args, StaticOpenMP); + if (D.CCCIsCXX()) { if (getToolChain().ShouldLinkCXXStdlib(Args)) getToolChain().AddCXXStdlibLibArgs(Args, CmdArgs); diff --git a/clang/test/Driver/fopenmp.c b/clang/test/Driver/fopenmp.c index cf04340ebc06ac6..291946923b3ea3d 100644 --- a/clang/test/Driver/fopenmp.c +++ b/clang/test/Driver/fopenmp.c @@ -16,6 +16,9 @@ // RUN: %clang -target x86_64-dragonfly -fopenmp=libomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP // RUN: %clang -target x86_64-dragonfly -fopenmp=libgomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-NO-OPENMP // RUN: %clang -target x86_64-dragonfly -fopenmp=libiomp5 -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP +// RUN: %clang -target i386-pc-solaris2.11 -fopenmp=libomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP +// RUN: %clang -target i386-pc-solaris2.11 -fopenmp=libgomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-NO-OPENMP +// RUN: %clang -target i386-pc-solaris2.11 -fopenmp=libiomp5 -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP // RUN: %clang -target x86_64-windows-gnu -fopenmp=libomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP // RUN: %clang -target x86_64-windows-gnu -fopenmp=libgomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-NO-OPENMP // RUN: %clang -target x86_64-windows-gnu -fopenmp=libiomp5 -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP @@ -106,6 +109,19 @@ // RUN: %clang -nostdlib -target x86_64-dragonfly -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-GOMP // RUN: %clang -nostdlib -target x86_64-dragonfly -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-IOMP5 // +// RUN: %clang -target i386-pc-solaris2.11 -fopenmp=libomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-OMP +// RUN: %clang -target i386-pc-solaris2.11 -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-GOMP --check-prefix=CHECK-LD-GOMP-NO-RT +// RUN: %clang -target i386-pc-solaris2.11 -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-IOMP5 +// +// RUN: %clang -target i386-pc-solaris2.11 -fopenmp=libomp -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-OMP +// RUN: %clang -target i386-pc-solaris2.11 -fopenmp=libgomp -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-GOMP --check-prefix=CHECK-LD-STATIC-GOMP-NO-RT +// RUN: %clang -target i386-pc-solaris2.11 -fopenmp=libiomp5 -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-IOMP5 +// RUN: %clang -target i386-pc-solaris2.11 -fopenmp=libiomp5 -static -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-IOMP5-NO-BDYNAMIC +// +// RUN: %clang -nostdlib -target i386-pc-solaris2.11 -fopenmp=libomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-OMP +// RUN: %clang -nostdlib -target i386-pc-solaris2.11 -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-GOMP +// RUN: %clang -nostdlib -target i386-pc-solaris2.11 -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-IOMP5 +// // RUN: %clang -target x86_64-windows-gnu -fopenmp=libomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-OMP // RUN: %clang -target x86_64-windows-gnu -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-GOMP --check-prefix=CHECK-LD-GOMP-NO-RT // RUN: %clang -target
[clang] [OpenMP] Add support for Solaris/x86_64 (PR #70593)
https://github.com/brad0 edited https://github.com/llvm/llvm-project/pull/70593 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [OpenMP] Add support for Solaris/x86_64 (PR #70593)
https://github.com/brad0 updated https://github.com/llvm/llvm-project/pull/70593 >From fcb4794f8f27357b456f6c99a51e593c8410477d Mon Sep 17 00:00:00 2001 From: Brad Smith Date: Sun, 29 Oct 2023 09:02:12 -0400 Subject: [PATCH] [OpenMP] Add support for Solaris/x86_64 Tested on `amd64-pc-solaris2.11`. --- clang/lib/Driver/ToolChains/Solaris.cpp | 5 + clang/test/Driver/fopenmp.c | 19 +- openmp/runtime/cmake/LibompHandleFlags.cmake | 2 +- openmp/runtime/src/kmp.h | 8 ++-- openmp/runtime/src/kmp_ftn_entry.h | 2 +- openmp/runtime/src/kmp_platform.h| 11 -- openmp/runtime/src/kmp_runtime.cpp | 8 +--- openmp/runtime/src/z_Linux_util.cpp | 21 +++- 8 files changed, 61 insertions(+), 15 deletions(-) diff --git a/clang/lib/Driver/ToolChains/Solaris.cpp b/clang/lib/Driver/ToolChains/Solaris.cpp index 3d5a710842eca44..958ed99c482ed22 100644 --- a/clang/lib/Driver/ToolChains/Solaris.cpp +++ b/clang/lib/Driver/ToolChains/Solaris.cpp @@ -215,6 +215,11 @@ void solaris::Linker::ConstructJob(Compilation &C, const JobAction &JA, if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs, options::OPT_r)) { +// Use the static OpenMP runtime with -static-openmp +bool StaticOpenMP = Args.hasArg(options::OPT_static_openmp) && +!Args.hasArg(options::OPT_static); +addOpenMPRuntime(CmdArgs, getToolChain(), Args, StaticOpenMP); + if (D.CCCIsCXX()) { if (getToolChain().ShouldLinkCXXStdlib(Args)) getToolChain().AddCXXStdlibLibArgs(Args, CmdArgs); diff --git a/clang/test/Driver/fopenmp.c b/clang/test/Driver/fopenmp.c index cf04340ebc06ac6..291946923b3ea3d 100644 --- a/clang/test/Driver/fopenmp.c +++ b/clang/test/Driver/fopenmp.c @@ -16,6 +16,9 @@ // RUN: %clang -target x86_64-dragonfly -fopenmp=libomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP // RUN: %clang -target x86_64-dragonfly -fopenmp=libgomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-NO-OPENMP // RUN: %clang -target x86_64-dragonfly -fopenmp=libiomp5 -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP +// RUN: %clang -target i386-pc-solaris2.11 -fopenmp=libomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP +// RUN: %clang -target i386-pc-solaris2.11 -fopenmp=libgomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-NO-OPENMP +// RUN: %clang -target i386-pc-solaris2.11 -fopenmp=libiomp5 -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP // RUN: %clang -target x86_64-windows-gnu -fopenmp=libomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP // RUN: %clang -target x86_64-windows-gnu -fopenmp=libgomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-NO-OPENMP // RUN: %clang -target x86_64-windows-gnu -fopenmp=libiomp5 -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP @@ -106,6 +109,19 @@ // RUN: %clang -nostdlib -target x86_64-dragonfly -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-GOMP // RUN: %clang -nostdlib -target x86_64-dragonfly -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-IOMP5 // +// RUN: %clang -target i386-pc-solaris2.11 -fopenmp=libomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-OMP +// RUN: %clang -target i386-pc-solaris2.11 -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-GOMP --check-prefix=CHECK-LD-GOMP-NO-RT +// RUN: %clang -target i386-pc-solaris2.11 -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-IOMP5 +// +// RUN: %clang -target i386-pc-solaris2.11 -fopenmp=libomp -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-OMP +// RUN: %clang -target i386-pc-solaris2.11 -fopenmp=libgomp -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-GOMP --check-prefix=CHECK-LD-STATIC-GOMP-NO-RT +// RUN: %clang -target i386-pc-solaris2.11 -fopenmp=libiomp5 -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-IOMP5 +// RUN: %clang -target i386-pc-solaris2.11 -fopenmp=libiomp5 -static -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-IOMP5-NO-BDYNAMIC +// +// RUN: %clang -nostdlib -target i386-pc-solaris2.11 -fopenmp=libomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-OMP +// RUN: %clang -nostdlib -target i386-pc-solaris2.11 -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-GOMP +// RUN: %clang -nostdlib -target i386-pc-solaris2.11 -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-IOMP5 +// // RUN: %clang -target x86_64-windows-gnu -fopenmp=libomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-OMP // RUN: %clang -target x86_64-windows-gnu -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --
[clang] [OpenMP] Add support for Solaris/x86_64 (PR #70593)
brad0 wrote: > I'm not familiar with Solaris but does it need dedicated implementation of > the function invocation written in ASM? Can you point out what you're referring to? Looking at the patches for adding support for OpenBSD and other OS's I don't see any ASM additions. https://github.com/llvm/llvm-project/pull/70593 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 9925801 - [Preprocessor][test] Add Haiku
Author: Brad Smith Date: 2023-10-30T02:37:05-04:00 New Revision: 9925801c7efec8c70a6e2c1da99ee0e558586e16 URL: https://github.com/llvm/llvm-project/commit/9925801c7efec8c70a6e2c1da99ee0e558586e16 DIFF: https://github.com/llvm/llvm-project/commit/9925801c7efec8c70a6e2c1da99ee0e558586e16.diff LOG: [Preprocessor][test] Add Haiku Added: Modified: clang/test/Preprocessor/init.c Removed: diff --git a/clang/test/Preprocessor/init.c b/clang/test/Preprocessor/init.c index 59c5122afe1e4c3..a0a2879cb58c7fc 100644 --- a/clang/test/Preprocessor/init.c +++ b/clang/test/Preprocessor/init.c @@ -1454,6 +1454,13 @@ // RUN: %clang_cc1 -triple lanai-unknown-unknown -E -dM < /dev/null | FileCheck -match-full-lines -check-prefix LANAI %s // LANAI: #define __lanai__ 1 // +// RUN: %clang_cc1 -triple=aarch64-unknown-haiku -E -dM < /dev/null | FileCheck -match-full-lines -check-prefix HAIKU %s +// RUN: %clang_cc1 -triple=arm-unknown-haiku -E -dM < /dev/null | FileCheck -match-full-lines -check-prefix HAIKU %s +// RUN: %clang_cc1 -triple=riscv64-unknown-haiku -E -dM < /dev/null | FileCheck -match-full-lines -check-prefix HAIKU %s +// RUN: %clang_cc1 -triple=x86_64-unknown-haiku -E -dM < /dev/null | FileCheck -match-full-lines -check-prefix HAIKU %s +// RUN: %clang_cc1 -triple=i386-unknown-haiku -E -dM < /dev/null | FileCheck -match-full-lines -check-prefix HAIKU %s +// HAIKU: #define __HAIKU__ 1 +// // RUN: %clang_cc1 -E -dM -ffreestanding -triple=amd64-unknown-openbsd6.1 < /dev/null | FileCheck -match-full-lines -check-prefix OPENBSD %s // RUN: %clang_cc1 -E -dM -ffreestanding -triple=aarch64-unknown-openbsd6.1 < /dev/null | FileCheck -match-full-lines -check-prefix OPENBSD %s // RUN: %clang_cc1 -E -dM -ffreestanding -triple=arm-unknown-openbsd6.1-gnueabi < /dev/null | FileCheck -match-full-lines -check-prefix OPENBSD %s ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Driver] Silence stdlib warning when linking C on *BSD / Solaris / Haiku (PR #70434)
brad0 wrote: ping. https://github.com/llvm/llvm-project/pull/70434 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Driver] Silence stdlib warning when linking C on *BSD / Solaris / Haiku (PR #70434)
https://github.com/brad0 closed https://github.com/llvm/llvm-project/pull/70434 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[openmp] [clang] [OpenMP] Add support for Solaris/x86_64 (PR #70593)
https://github.com/brad0 updated https://github.com/llvm/llvm-project/pull/70593 >From 261f571d28b8398be221f3928f93bcee211e26ae Mon Sep 17 00:00:00 2001 From: Brad Smith Date: Sun, 29 Oct 2023 09:02:12 -0400 Subject: [PATCH] [OpenMP] Add support for Solaris/x86_64 Tested on `amd64-pc-solaris2.11`. --- clang/lib/Driver/ToolChains/Solaris.cpp | 5 + clang/test/Driver/fopenmp.c | 19 +++- openmp/runtime/cmake/LibompHandleFlags.cmake | 2 +- openmp/runtime/src/kmp.h | 8 +-- openmp/runtime/src/kmp_ftn_entry.h | 2 +- openmp/runtime/src/kmp_platform.h| 11 -- openmp/runtime/src/kmp_runtime.cpp | 8 --- openmp/runtime/src/z_Linux_util.cpp | 23 +++- 8 files changed, 62 insertions(+), 16 deletions(-) diff --git a/clang/lib/Driver/ToolChains/Solaris.cpp b/clang/lib/Driver/ToolChains/Solaris.cpp index 3d5a710842eca44..958ed99c482ed22 100644 --- a/clang/lib/Driver/ToolChains/Solaris.cpp +++ b/clang/lib/Driver/ToolChains/Solaris.cpp @@ -215,6 +215,11 @@ void solaris::Linker::ConstructJob(Compilation &C, const JobAction &JA, if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs, options::OPT_r)) { +// Use the static OpenMP runtime with -static-openmp +bool StaticOpenMP = Args.hasArg(options::OPT_static_openmp) && +!Args.hasArg(options::OPT_static); +addOpenMPRuntime(CmdArgs, getToolChain(), Args, StaticOpenMP); + if (D.CCCIsCXX()) { if (getToolChain().ShouldLinkCXXStdlib(Args)) getToolChain().AddCXXStdlibLibArgs(Args, CmdArgs); diff --git a/clang/test/Driver/fopenmp.c b/clang/test/Driver/fopenmp.c index cf04340ebc06ac6..291946923b3ea3d 100644 --- a/clang/test/Driver/fopenmp.c +++ b/clang/test/Driver/fopenmp.c @@ -16,6 +16,9 @@ // RUN: %clang -target x86_64-dragonfly -fopenmp=libomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP // RUN: %clang -target x86_64-dragonfly -fopenmp=libgomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-NO-OPENMP // RUN: %clang -target x86_64-dragonfly -fopenmp=libiomp5 -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP +// RUN: %clang -target i386-pc-solaris2.11 -fopenmp=libomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP +// RUN: %clang -target i386-pc-solaris2.11 -fopenmp=libgomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-NO-OPENMP +// RUN: %clang -target i386-pc-solaris2.11 -fopenmp=libiomp5 -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP // RUN: %clang -target x86_64-windows-gnu -fopenmp=libomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP // RUN: %clang -target x86_64-windows-gnu -fopenmp=libgomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-NO-OPENMP // RUN: %clang -target x86_64-windows-gnu -fopenmp=libiomp5 -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP @@ -106,6 +109,19 @@ // RUN: %clang -nostdlib -target x86_64-dragonfly -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-GOMP // RUN: %clang -nostdlib -target x86_64-dragonfly -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-IOMP5 // +// RUN: %clang -target i386-pc-solaris2.11 -fopenmp=libomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-OMP +// RUN: %clang -target i386-pc-solaris2.11 -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-GOMP --check-prefix=CHECK-LD-GOMP-NO-RT +// RUN: %clang -target i386-pc-solaris2.11 -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-IOMP5 +// +// RUN: %clang -target i386-pc-solaris2.11 -fopenmp=libomp -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-OMP +// RUN: %clang -target i386-pc-solaris2.11 -fopenmp=libgomp -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-GOMP --check-prefix=CHECK-LD-STATIC-GOMP-NO-RT +// RUN: %clang -target i386-pc-solaris2.11 -fopenmp=libiomp5 -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-IOMP5 +// RUN: %clang -target i386-pc-solaris2.11 -fopenmp=libiomp5 -static -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-IOMP5-NO-BDYNAMIC +// +// RUN: %clang -nostdlib -target i386-pc-solaris2.11 -fopenmp=libomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-OMP +// RUN: %clang -nostdlib -target i386-pc-solaris2.11 -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-GOMP +// RUN: %clang -nostdlib -target i386-pc-solaris2.11 -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-IOMP5 +// // RUN: %clang -target x86_64-windows-gnu -fopenmp=libomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-OMP // RUN: %clang -target x86_64-windows-gnu -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --chec
[openmp] [clang] [OpenMP] Add support for Solaris/x86_64 (PR #70593)
brad0 wrote: I'd like to get this in. https://github.com/llvm/llvm-project/pull/70593 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits