[cfe-dev] equivalent option in clang for gcc --exclude-libs

Peng Cheng gm4cheng at gmail.com
Wed Jun 26 09:10:14 PDT 2013


I did compile using -Wl,--exclude-libs,ALL.  it passed on linux, but failed
on maci.  the linker command on maci is:

   xcrun -sdk macosx10.7 clang++ ... -Wl,--exclude-libs,ALL

error message:

  ld: unknown option: --exclude-libs

seems like that is not because clang is missing the option, but because
maci xcode linker does not support the option?

any suggestions?



On Wed, Jun 26, 2013 at 11:57 AM, Reid Kleckner <rnk at google.com> wrote:

> --exclude-libs is a linker option.  gcc just happens to pass it through
> for you.  Clang will do the same if you escape it with something like
> -Wl,--exclude-libs,ALL.
>
>
> On Wed, Jun 26, 2013 at 11:50 AM, Peng Cheng <gm4cheng at gmail.com> wrote:
>
>>  Hi,
>>
>> I am creating a shared libary from some objs and a static libary ( e.g.,
>> llvm, a 3rd party static lib ).  the static library is only used by
>> functions in the objs, and is not intended to be exposed to shared library
>> clients.  so, I do not want to export symbols in the static library, to
>> avoid potential name conflict when this static library is also linked into
>> other shared libraries.
>>
>> with gcc, I am using --exclude-libs to remove symbols in static library.
>>
>> while with clang, it seems there is no such equivalent option.
>>
>> my questions are that:
>>
>> 1. are there any equivalent options in clang, but with different name?
>>
>> 2. if not, are there any workaround ( besides adding export/import
>> declaration in the source code of the static library, which is out of my
>> control ) ?
>>
>> 3. I am pretty sure that linux is using a common name space for shared
>> library symbols, which tends to cause name conflicts.   what about maci and
>> windows?
>>
>> Your help is really appreciated!
>>
>> Thanks,
>>
>> -Peng
>>
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130626/4af3061a/attachment.html>


More information about the cfe-dev mailing list