-x link flag causing link errors on Mac OSX 10.9 (error?)

According to the ld man pages, the -x flag links the suppression of non-global characters to the character table of the output file. These characters are useful for debugging but are not used at run time. But this flag causes communication errors for me on Mavericks. For example, the following source file:

struct Yo { Yo() {} }; void useYo() { Yo yo; } 

Compiled / linked as follows:

 c++ -arch x86_64 -bundle -Wl,-x -o tc.so tc.cpp 

It produces the following output:

 ld: internal error: atom not found in symbolIndex(__ZN2YoC1Ev) for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) 

Yo :: Yo () constructor - problem:

 c++filt __ZN2YoC1Ev Yo::Yo() 

Removing the -x link flag fixes the problem. The problem with moving the constructor implementation outside the structure declaration has been fixed. This code compiles / links perfectly:

 struct Yo { Yo(); }; Yo::Yo() {} void useYo() { Yo yo; } 

Here is my compiler info:

 Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn) Target: x86_64-apple-darwin13.3.0 Thread model: posix 

Is this a bug in clang or linker, or is there some reason why I shouldn't use the -x link flag?

+7
c ++ clang ld macos
source share

No one has answered this question yet.

See similar questions:

4
Error installing Pyccen JCC on OSX
2
premote c ++ hello world error
2
Install Freeswitch 1.6 for python ESL
0
How to create Python with Clang on Mac OS X Mavericks

or similar:

99
Ruby Gem install Json does not work on Mavericks and Xcode 5.1 - unknown argument: '-multiply_definedsuppress'
24
link to clang ++ on OS X generates many characters, no errors found
twenty
How to suppress the "-arch", "x86_64" flags when compiling an OpenGL / SDL application using Waf on OSX?
4
g ++: cannot be linked to main executable
3
Failed to install GDAL in python 3 using pip (clang failed with exit status 1)
one
CMAKE MAC OSX library linking problem: compiles on Linux but on Mac
one
opencv compiles with clang ok, with gcc not ok os x 10.9
0
clan binding error: linker command worked with exit code 1 (use -v to see the call)
0
Runtime Error - dydld: Symbol not found: __ZNSsD1Ev
0
Swig architecture error while exchanging python interface

All Articles