Comments (5)
One thing to note is that we are executing /usr/llvm-gcc-4.2/libexec/gcc/i686-apple-darwin11/4.2.1/ld instead of /usr/bin/ld. But that seems to be a link to /usr/bin/ld.
I made an additional change:
--- a/lib/Driver/ToolChains.cpp
+++ b/lib/Driver/ToolChains.cpp
@@ -54,6 +54,8 @@ Darwin::Darwin(const Driver &D, const llvm::Triple& Triple)
llvm::raw_string_ostream(MacosxVersionMin)
<< Major << '.' << Minor << '.' << Micro;
+ getFilePaths().push_back(getDriver().Dir + "/../lib");
+
// FIXME: DarwinVersion is only used to find GCC's libexec directory.
// It should be removed when we stop supporting that.
DarwinVersion[0] = Minor + 4;
With above change and additional changes to the Tools.cpp:
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
index 9086505..07c8c0b 100644
--- a/lib/Driver/Tools.cpp
+++ b/lib/Driver/Tools.cpp
@@ -4074,6 +4074,9 @@ void darwin::Link::ConstructJob(Compilation &C, const JobAction &JA,
const InputInfoList &Inputs,
const ArgList &Args,
const char *LinkingOutput) const {
+ const toolchains::Darwin& ToolChain = getDarwinToolChain();
+ const Driver &D = ToolChain.getDriver();
+
assert(Output.getType() == types::TY_Image && "Invalid linker output type.");
// The logic here is derived from gcc's behavior; most of which
@@ -4189,6 +4192,16 @@ void darwin::Link::ConstructJob(Compilation &C, const JobAction &JA,
}
}
}
+ if (D.CCCIsUPC) {
+ const char *upc_crtbegin;
+ if (Args.hasArg(options::OPT_static))
+ upc_crtbegin = "upc-crtbeginT.o";
+ else if (Args.hasArg(options::OPT_shared) || Args.hasArg(options::OPT_pie))
+ upc_crtbegin = "upc-crtbeginS.o";
+ else
+ upc_crtbegin = "upc-crtbegin.o";
+ CmdArgs.push_back(Args.MakeArgString(getToolChain().GetFilePath(upc_crtbegin)));
+ }
}
if (!getDarwinToolChain().isTargetIPhoneOS() &&
@@ -4202,6 +4215,12 @@ void darwin::Link::ConstructJob(Compilation &C, const JobAction &JA,
Args.AddAllArgs(CmdArgs, options::OPT_L);
+ const ToolChain::path_list Paths = ToolChain.getFilePaths();
+
+ for (ToolChain::path_list::const_iterator i = Paths.begin(), e = Paths.end();
+ i != e; ++i)
+ CmdArgs.push_back(Args.MakeArgString(StringRef("-L") + *i));
+
// If we're building a dynamic lib with -faddress-sanitizer, unresolved
// symbols may appear. Mark all of them as dynamic_lookup.
// Linking executables is handled in lib/Driver/ToolChains.cpp.
@@ -4218,6 +4237,42 @@ void darwin::Link::ConstructJob(Compilation &C, const JobAction &JA,
// This is more complicated in gcc...
CmdArgs.push_back("-lgomp");
+ if (D.CCCIsUPC && !Args.hasArg(options::OPT_nostdlib)) {
+ llvm::SmallString<32> Buf("-lupc");
+ if (Args.getLastArgValue(options::OPT_fupc_pts_EQ, "packed") == "struct") {
+ Buf += "-s";
+ }
+ if (Args.getLastArgValue(options::OPT_fupc_pts_vaddr_order_EQ, "first") == "last") {
+ Buf += "-l";
+ }
+ if (Arg * A = Args.getLastArg(options::OPT_fupc_packed_bits_EQ)) {
+ llvm::SmallVector<llvm::StringRef, 3> Bits;
+ StringRef(A->getValue(Args)).split(Bits, ",");
+ bool okay = true;
+ int Values[3];
+ if (Bits.size() == 3) {
+ for (int i = 0; i < 3; ++i)
+ if (Bits[i].getAsInteger(10, Values[i]) || Values[i] <= 0)
+ okay = false;
+ if (Values[0] + Values[1] + Values[2] != 64)
+ okay = false;
+ } else {
+ okay = false;
+ }
+ if (okay) {
+ if(Values[0] != 20 || Values[1] != 10 || Values[2] != 34) {
+ Buf += "-";
+ Buf += Bits[0];
+ Buf += "-";
+ Buf += Bits[1];
+ Buf += "-";
+ Buf += Bits[2];
+ }
+ }
+ }
+ CmdArgs.push_back(Args.MakeArgString(Buf));
+ }
+
getDarwinToolChain().AddLinkSearchPathArgs(Args, CmdArgs);
if (isObjCRuntimeLinked(Args)) {
@@ -4265,7 +4320,17 @@ void darwin::Link::ConstructJob(Compilation &C, const JobAction &JA,
if (!Args.hasArg(options::OPT_A) &&
!Args.hasArg(options::OPT_nostdlib) &&
!Args.hasArg(options::OPT_nostartfiles)) {
- // endfile_spec is empty.
+
+ if (D.CCCIsUPC) {
+ const char *upc_crtend;
+ if (Args.hasArg(options::OPT_static))
+ upc_crtend = "upc-crtendT.o";
+ else if (Args.hasArg(options::OPT_shared) || Args.hasArg(options::OPT_pie))
+ upc_crtend = "upc-crtendS.o";
+ else
+ upc_crtend = "upc-crtend.o";
+ CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath(upc_crtend)));
+ }
}
Args.AddAllArgs(CmdArgs, options::OPT_T_Group);
I am am able to run the clang tests.
160 tests passed, 4 tests failed
Tests ended at: Thu Mar 7 14:45:37 PST 2013
The failing tests are related to:
/usr/local/clang-upc/bin/clangupc -I. -O3 -Wall -Wextra -Wwrite-strings -Werror -fupc-threads-8 -g compound_test1.upc -o c
ompound_test1
fatal error: error in backend: Global variable '__upc_init_array' has an invalid section specifier 'upc_init_array': mach-o
section specifier requires a segment and section separated by a comma.
[...]
test: barrier_neg opt: -O3 threads: static elapsed: 0.631 user: 0.003 sys: 0.024
./barrier_neg: UPC error: Two successive upc_notify statements executed without an intervening upc_wait
thread 5 terminated with signal: 'Abort trap'
/usr/local/bin/timeout: line 54: 16553 Terminated: 15 "$@"
from clang-upc.
Note that above change to add "../lib" to the file paths was tailored on some other tool chains that have a comment like this: "tool chain which can call as(1) and ld(1) directly".
from clang-upc.
With and additional change under #8 bug, I was able to pass the clang tests. Well, all except one in upc-semantics test suite that generated a different line number for the note:
-:152:28: note: expanded from macro 'UPC_MAX_BLOCK_SIZE'
+:159:28: note: expanded from macro 'UPC_MAX_BLOCK_SIZE'
from clang-upc.
These changes look good. (Although the -lupc logic should probably be factored out into a separate function). Please commit this.
from clang-upc.
Fixed in c85d44e
from clang-upc.
Related Issues (20)
- warning on void * - discrad qualifiers HOT 1
- 3.8.0 - build failure on x86_64 HOT 2
- 3.8 - Intrepid's test04 fails to compile with 'struct' configuration HOT 4
- "ld: cannot find -lupc" on OpenBSD HOT 3
- 3.8 update: no link script build fails HOT 1
- 3.8 update: Linking on Mac OS X fails
- 3.8 merge: "ld: cannot find -lupc" on OpenBSD/i386 HOT 1
- 3.8 merge: "ld: cannot find -lupc" on Solaris HOT 1
- Clang-upc ICE on user's example code HOT 3
- MIPS "n32" ABI support HOT 1
- MIPS64 barrier failures HOT 7
- Crash in UPCR's TLD initialization when compiled with clang HOT 5
- 3.9.1 merge - Shared static initialization does not work with optimizations HOT 2
- ppc64 LE - bug3198 gets assertion error in Struct-Debug branch HOT 1
- freebsd 386 - test_int_precision tests fail HOT 7
- Gasnet testslice fails after 4.0.1 update
- [CG]UPC should not place upc_*.h headers in the include path for UPCR mode
- Build failures with recent clang HOT 2
- apple m1 cargo build failed: LLVM ERROR: Global variable '_ZN12node_runtime1_16SECTION_CONTENTS17h28c19e8d9889aa72E' has an invalid section specifier 'runtime_version': mach-o section specifier requires a segment and section separated by a comma.
- Build errors with gcc 10 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from clang-upc.