aboutsummaryrefslogtreecommitdiffstats
path: root/lang
diff options
context:
space:
mode:
authorbrooks <brooks@FreeBSD.org>2013-05-23 22:40:26 +0800
committerbrooks <brooks@FreeBSD.org>2013-05-23 22:40:26 +0800
commita5f2c1fb34b9321939a24afbf66c751bb953d0e6 (patch)
tree35d64c8e150cdcad15164a63c1230b5982f2d975 /lang
parent37b03ad751d11e429dd7620a62fc081e2fe6bb94 (diff)
downloadfreebsd-ports-gnome-a5f2c1fb34b9321939a24afbf66c751bb953d0e6.tar.gz
freebsd-ports-gnome-a5f2c1fb34b9321939a24afbf66c751bb953d0e6.tar.zst
freebsd-ports-gnome-a5f2c1fb34b9321939a24afbf66c751bb953d0e6.zip
Actually commit the changes listed in r318799. Due to a wrong path
on the command line, only the Makefile was committed. Correct a plist bug by listing clang-cpp.
Diffstat (limited to 'lang')
-rw-r--r--lang/clang/Makefile4
-rw-r--r--lang/clang/files/patch-svn-r172354203
-rw-r--r--lang/clang/files/patch-svn-r17591966
-rw-r--r--lang/clang/files/patch-tools_clang_lib_Headers_Makefile8
-rw-r--r--lang/clang/pkg-plist13
5 files changed, 288 insertions, 6 deletions
diff --git a/lang/clang/Makefile b/lang/clang/Makefile
index 9f5cbf438aca..570d0b48b51d 100644
--- a/lang/clang/Makefile
+++ b/lang/clang/Makefile
@@ -7,7 +7,7 @@
PORTNAME= clang
PORTVERSION= 3.2
-PORTREVISION= 3
+PORTREVISION= 4
CATEGORIES= lang devel
MASTER_SITES= http://llvm.org/releases/${PORTVERSION}/
DISTNAME= ${PORTNAME}-${PORTVERSION}.src
@@ -140,12 +140,12 @@ regression-test: ${BUILD_COOKIE}
PLIST_FILE_LIST= bin/ccc-analyzer \
bin/c++-analyzer \
+ bin/c-index-test \
bin/clang \
bin/clang++ \
bin/clang-check \
bin/clang-cpp \
bin/clang-tblgen \
- bin/c-index-test \
bin/scan-build \
bin/scan-view \
lib/libclang*
diff --git a/lang/clang/files/patch-svn-r172354 b/lang/clang/files/patch-svn-r172354
new file mode 100644
index 000000000000..68f768a11cb3
--- /dev/null
+++ b/lang/clang/files/patch-svn-r172354
@@ -0,0 +1,203 @@
+$FreeBSD$
+------------------------------------------------------------------------
+r172354 | chandlerc | 2013-01-13 11:46:33 +0000 (Sun, 13 Jan 2013) | 6 lines
+
+Refactor the x86 CPU name logic in the driver and pass -march and -mcpu
+flag information down from the Clang driver into the Gold linker plugin
+for LTO. This allows specifying -march on the linker commandline and
+should hopefully have it pass all the way through to the LTO optimizer.
+
+Fixes PR14697.
+------------------------------------------------------------------------
+Index: test/Driver/gold-lto.c
+===================================================================
+--- tools/clang/test/Driver/gold-lto.c (revision 172353)
++++ tools/clang/test/Driver/gold-lto.c (revision 172354)
+@@ -1,6 +1,21 @@
+ // RUN: touch %t.o
+-// RUN: %clang -target x86_64-pc-linux-gnu -### %t.o -O4 -Wl,-plugin-opt=foo 2> %t.log
+-// RUN: FileCheck %s < %t.log
+-
+-// CHECK: "-plugin" "{{.*}}/LLVMgold.so"
+-// CHECK: "-plugin-opt=foo"
++//
++// RUN: %clang -target x86_64-unknown-linux -### %t.o -flto 2>&1 \
++// RUN: -Wl,-plugin-opt=foo \
++// RUN: | FileCheck %s --check-prefix=CHECK-X86-64-BASIC
++// CHECK-X86-64-BASIC: "-plugin" "{{.*}}/LLVMgold.so"
++// CHECK-X86-64-BASIC: "-plugin-opt=foo"
++//
++// RUN: %clang -target x86_64-unknown-linux -### %t.o -flto 2>&1 \
++// RUN: -march=corei7 -Wl,-plugin-opt=foo \
++// RUN: | FileCheck %s --check-prefix=CHECK-X86-64-COREI7
++// CHECK-X86-64-COREI7: "-plugin" "{{.*}}/LLVMgold.so"
++// CHECK-X86-64-COREI7: "-plugin-opt=mcpu=corei7"
++// CHECK-X86-64-COREI7: "-plugin-opt=foo"
++//
++// RUN: %clang -target arm-unknown-linux -### %t.o -flto 2>&1 \
++// RUN: -march=armv7a -Wl,-plugin-opt=foo \
++// RUN: | FileCheck %s --check-prefix=CHECK-ARM-V7A
++// CHECK-ARM-V7A: "-plugin" "{{.*}}/LLVMgold.so"
++// CHECK-ARM-V7A: "-plugin-opt=mcpu=cortex-a8"
++// CHECK-ARM-V7A: "-plugin-opt=foo"
+Index: lib/Driver/Tools.cpp
+===================================================================
+--- tools/clang/lib/Driver/Tools.cpp (revision 172353)
++++ tools/clang/lib/Driver/Tools.cpp (revision 172354)
+@@ -1126,10 +1126,59 @@
+ }
+ }
+
++static const char *getX86TargetCPU(const ArgList &Args,
++ const llvm::Triple &Triple) {
++ if (const Arg *A = Args.getLastArg(options::OPT_march_EQ)) {
++ if (StringRef(A->getValue()) != "native")
++ return A->getValue();
++
++ // FIXME: Reject attempts to use -march=native unless the target matches
++ // the host.
++ //
++ // FIXME: We should also incorporate the detected target features for use
++ // with -native.
++ std::string CPU = llvm::sys::getHostCPUName();
++ if (!CPU.empty() && CPU != "generic")
++ return Args.MakeArgString(CPU);
++ }
++
++ // Select the default CPU if none was given (or detection failed).
++
++ if (Triple.getArch() != llvm::Triple::x86_64 &&
++ Triple.getArch() != llvm::Triple::x86)
++ return 0; // This routine is only handling x86 targets.
++
++ bool Is64Bit = Triple.getArch() == llvm::Triple::x86_64;
++
++ // FIXME: Need target hooks.
++ if (Triple.isOSDarwin())
++ return Is64Bit ? "core2" : "yonah";
++
++ // Everything else goes to x86-64 in 64-bit mode.
++ if (Is64Bit)
++ return "x86-64";
++
++ if (Triple.getOSName().startswith("haiku"))
++ return "i586";
++ if (Triple.getOSName().startswith("openbsd"))
++ return "i486";
++ if (Triple.getOSName().startswith("bitrig"))
++ return "i686";
++ if (Triple.getOSName().startswith("freebsd"))
++ return "i486";
++ if (Triple.getOSName().startswith("netbsd"))
++ return "i486";
++ // All x86 devices running Android have core2 as their common
++ // denominator. This makes a better choice than pentium4.
++ if (Triple.getEnvironment() == llvm::Triple::Android)
++ return "core2";
++
++ // Fallback to p4.
++ return "pentium4";
++}
++
+ void Clang::AddX86TargetArgs(const ArgList &Args,
+ ArgStringList &CmdArgs) const {
+- const bool isAndroid =
+- getToolChain().getTriple().getEnvironment() == llvm::Triple::Android;
+ if (!Args.hasFlag(options::OPT_mred_zone,
+ options::OPT_mno_red_zone,
+ true) ||
+@@ -1142,65 +1191,7 @@
+ false))
+ CmdArgs.push_back("-no-implicit-float");
+
+- const char *CPUName = 0;
+- if (const Arg *A = Args.getLastArg(options::OPT_march_EQ)) {
+- if (StringRef(A->getValue()) == "native") {
+- // FIXME: Reject attempts to use -march=native unless the target matches
+- // the host.
+- //
+- // FIXME: We should also incorporate the detected target features for use
+- // with -native.
+- std::string CPU = llvm::sys::getHostCPUName();
+- if (!CPU.empty() && CPU != "generic")
+- CPUName = Args.MakeArgString(CPU);
+- } else
+- CPUName = A->getValue();
+- }
+-
+- // Select the default CPU if none was given (or detection failed).
+- if (!CPUName) {
+- // FIXME: Need target hooks.
+- if (getToolChain().getTriple().isOSDarwin()) {
+- if (getToolChain().getArch() == llvm::Triple::x86_64)
+- CPUName = "core2";
+- else if (getToolChain().getArch() == llvm::Triple::x86)
+- CPUName = "yonah";
+- } else if (getToolChain().getOS().startswith("haiku")) {
+- if (getToolChain().getArch() == llvm::Triple::x86_64)
+- CPUName = "x86-64";
+- else if (getToolChain().getArch() == llvm::Triple::x86)
+- CPUName = "i586";
+- } else if (getToolChain().getOS().startswith("openbsd")) {
+- if (getToolChain().getArch() == llvm::Triple::x86_64)
+- CPUName = "x86-64";
+- else if (getToolChain().getArch() == llvm::Triple::x86)
+- CPUName = "i486";
+- } else if (getToolChain().getOS().startswith("bitrig")) {
+- if (getToolChain().getArch() == llvm::Triple::x86_64)
+- CPUName = "x86-64";
+- else if (getToolChain().getArch() == llvm::Triple::x86)
+- CPUName = "i686";
+- } else if (getToolChain().getOS().startswith("freebsd")) {
+- if (getToolChain().getArch() == llvm::Triple::x86_64)
+- CPUName = "x86-64";
+- else if (getToolChain().getArch() == llvm::Triple::x86)
+- CPUName = "i486";
+- } else if (getToolChain().getOS().startswith("netbsd")) {
+- if (getToolChain().getArch() == llvm::Triple::x86_64)
+- CPUName = "x86-64";
+- else if (getToolChain().getArch() == llvm::Triple::x86)
+- CPUName = "i486";
+- } else {
+- if (getToolChain().getArch() == llvm::Triple::x86_64)
+- CPUName = "x86-64";
+- else if (getToolChain().getArch() == llvm::Triple::x86)
+- // All x86 devices running Android have core2 as their common
+- // denominator. This makes a better choice than pentium4.
+- CPUName = isAndroid ? "core2" : "pentium4";
+- }
+- }
+-
+- if (CPUName) {
++ if (const char *CPUName = getX86TargetCPU(Args, getToolChain().getTriple())) {
+ CmdArgs.push_back("-target-cpu");
+ CmdArgs.push_back(CPUName);
+ }
+@@ -5646,8 +5637,27 @@
+ CmdArgs.push_back("-plugin");
+ std::string Plugin = ToolChain.getDriver().Dir + "/../lib/LLVMgold.so";
+ CmdArgs.push_back(Args.MakeArgString(Plugin));
++
++ // Try to pass driver level flags relevant to LTO code generation down to
++ // the plugin.
++
++ // Handle architecture-specific flags for selecting CPU variants.
++ if (ToolChain.getArch() == llvm::Triple::x86 ||
++ ToolChain.getArch() == llvm::Triple::x86_64)
++ CmdArgs.push_back(
++ Args.MakeArgString(Twine("-plugin-opt=mcpu=") +
++ getX86TargetCPU(Args, ToolChain.getTriple())));
++ else if (ToolChain.getArch() == llvm::Triple::arm ||
++ ToolChain.getArch() == llvm::Triple::thumb)
++ CmdArgs.push_back(
++ Args.MakeArgString(Twine("-plugin-opt=mcpu=") +
++ getARMTargetCPU(Args, ToolChain.getTriple())));
++
++ // FIXME: Factor out logic for MIPS, PPC, and other targets to support this
++ // as well.
+ }
+
++
+ if (Args.hasArg(options::OPT_Z_Xlinker__no_demangle))
+ CmdArgs.push_back("--no-demangle");
+
diff --git a/lang/clang/files/patch-svn-r175919 b/lang/clang/files/patch-svn-r175919
new file mode 100644
index 000000000000..5ad39532a999
--- /dev/null
+++ b/lang/clang/files/patch-svn-r175919
@@ -0,0 +1,66 @@
+$FreeBSD$
+------------------------------------------------------------------------
+r175919 | d0k | 2013-02-22 20:55:17 +0000 (Fri, 22 Feb 2013) | 4 lines
+
+Driver: Pass down the -march setting down to -cc1as on x86 too.
+
+The assembler historically didn't make use of any target features, but this has
+changed when support for old CPUs that don't support long nops was added.
+------------------------------------------------------------------------
+Index: test/Driver/target-as.s
+===================================================================
+--- tools/clang/test/Driver/target-as.s (revision 0)
++++ tools/clang/test/Driver/target-as.s (revision 175919)
+@@ -0,0 +1,8 @@
++// REQUIRES: clang-driver
++
++// Make sure the -march is passed down to cc1as.
++// RUN: %clang -target i386-unknown-freebsd -### -c -integrated-as %s \
++// RUN: -march=geode 2>&1 | FileCheck -check-prefix=TARGET %s
++//
++// TARGET: "-cc1as"
++// TARGET: "-target-cpu" "geode"
+Index: lib/Driver/Tools.cpp
+===================================================================
+--- tools/clang/lib/Driver/Tools.cpp (revision 175918)
++++ tools/clang/lib/Driver/Tools.cpp (revision 175919)
+@@ -3325,6 +3325,15 @@
+ addFPMathArgs(D, A, Args, CmdArgs, getARMTargetCPU(Args, Triple));
+ }
+
++void ClangAs::AddX86TargetArgs(const ArgList &Args,
++ ArgStringList &CmdArgs) const {
++ // Set the CPU based on -march=.
++ if (const char *CPUName = getX86TargetCPU(Args, getToolChain().getTriple())) {
++ CmdArgs.push_back("-target-cpu");
++ CmdArgs.push_back(CPUName);
++ }
++}
++
+ /// Add options related to the Objective-C runtime/ABI.
+ ///
+ /// Returns true if the runtime is non-fragile.
+@@ -3500,6 +3509,11 @@
+ case llvm::Triple::thumb:
+ AddARMTargetArgs(Args, CmdArgs);
+ break;
++
++ case llvm::Triple::x86:
++ case llvm::Triple::x86_64:
++ AddX86TargetArgs(Args, CmdArgs);
++ break;
+ }
+
+ // Ignore explicit -force_cpusubtype_ALL option.
+Index: lib/Driver/Tools.h
+===================================================================
+--- tools/clang/lib/Driver/Tools.h (revision 175918)
++++ tools/clang/lib/Driver/Tools.h (revision 175919)
+@@ -77,6 +77,7 @@
+ /// \brief Clang integrated assembler tool.
+ class LLVM_LIBRARY_VISIBILITY ClangAs : public Tool {
+ void AddARMTargetArgs(const ArgList &Args, ArgStringList &CmdArgs) const;
++ void AddX86TargetArgs(const ArgList &Args, ArgStringList &CmdArgs) const;
+ public:
+ ClangAs(const ToolChain &TC) : Tool("clang::as",
+ "clang integrated assembler", TC) {}
diff --git a/lang/clang/files/patch-tools_clang_lib_Headers_Makefile b/lang/clang/files/patch-tools_clang_lib_Headers_Makefile
index 41493c66230c..41f497b100cc 100644
--- a/lang/clang/files/patch-tools_clang_lib_Headers_Makefile
+++ b/lang/clang/files/patch-tools_clang_lib_Headers_Makefile
@@ -3,12 +3,12 @@ $FreeBSD$
--- tools/clang/lib/Headers/Makefile.orig
+++ tools/clang/lib/Headers/Makefile
-@@ -13,7 +13,7 @@
- # FIXME: Get version from a common place.
- HeaderDir := $(PROJ_OBJ_ROOT)/$(BuildMode)/lib/clang/1.0/include
+@@ -19,7 +19,7 @@
+
+ HeaderDir := $(PROJ_OBJ_ROOT)/$(BuildMode)/lib/clang/$(CLANG_VERSION)/include
-HEADERS := $(notdir $(wildcard $(PROJ_SRC_DIR)/*.h))
-+HEADERS := $(notdir $(wildcard $(PROJ_SRC_DIR)/*mm*.h))
++HEADERS := $(notdir $(wildcard $(PROJ_SRC_DIR)/*intrin*.h) mm3dnow.h mm_malloc.h)
OBJHEADERS := $(addprefix $(HeaderDir)/, $(HEADERS))
diff --git a/lang/clang/pkg-plist b/lang/clang/pkg-plist
index af73a506a791..12822d48fe34 100644
--- a/lang/clang/pkg-plist
+++ b/lang/clang/pkg-plist
@@ -4,6 +4,7 @@ bin/ccc-analyzer
bin/clang
bin/clang++
bin/clang-check
+bin/clang-cpp
bin/clang-tblgen
bin/scan-build
bin/scan-view
@@ -391,18 +392,30 @@ lib/clang/%%PORTVERSION%%/include/__wmmintrin_aes.h
lib/clang/%%PORTVERSION%%/include/__wmmintrin_pclmul.h
lib/clang/%%PORTVERSION%%/include/ammintrin.h
lib/clang/%%PORTVERSION%%/include/arm_neon.h
+lib/clang/%%PORTVERSION%%/include/avx2intrin.h
+lib/clang/%%PORTVERSION%%/include/avxintrin.h
+lib/clang/%%PORTVERSION%%/include/bmi2intrin.h
+lib/clang/%%PORTVERSION%%/include/bmiintrin.h
lib/clang/%%PORTVERSION%%/include/emmintrin.h
+lib/clang/%%PORTVERSION%%/include/f16cintrin.h
+lib/clang/%%PORTVERSION%%/include/fma4intrin.h
+lib/clang/%%PORTVERSION%%/include/fmaintrin.h
lib/clang/%%PORTVERSION%%/include/immintrin.h
+lib/clang/%%PORTVERSION%%/include/lzcntintrin.h
lib/clang/%%PORTVERSION%%/include/mm3dnow.h
lib/clang/%%PORTVERSION%%/include/mm_malloc.h
lib/clang/%%PORTVERSION%%/include/mmintrin.h
lib/clang/%%PORTVERSION%%/include/module.map
lib/clang/%%PORTVERSION%%/include/nmmintrin.h
lib/clang/%%PORTVERSION%%/include/pmmintrin.h
+lib/clang/%%PORTVERSION%%/include/popcntintrin.h
+lib/clang/%%PORTVERSION%%/include/rtmintrin.h
lib/clang/%%PORTVERSION%%/include/smmintrin.h
lib/clang/%%PORTVERSION%%/include/tmmintrin.h
lib/clang/%%PORTVERSION%%/include/wmmintrin.h
+lib/clang/%%PORTVERSION%%/include/x86intrin.h
lib/clang/%%PORTVERSION%%/include/xmmintrin.h
+lib/clang/%%PORTVERSION%%/include/xopintrin.h
lib/libclang.a
lib/libclang.so
lib/libclangARCMigrate.a