[cfe-users] crtbegin.o/crtend.o search path

邓尧 via cfe-users cfe-users at lists.llvm.org
Mon Sep 28 20:10:21 PDT 2015

On Tue, Sep 29, 2015 at 1:42 AM, Douglas Katzman <dougk at google.com> wrote:

> I have two questions:
>> 1. How can I tell clang that these two files are under directory
>> /opt/extra ? I don't mind write a simple patch to clang, of course,
>> simpler solutions like build time options or command line options are
>> much better.
>> 2. Since crtbegin.o/crtend.o are part of a compiler, why don't clang
>> provide one itself ? Google results showed that these two files seem
>> to be quite simple, are there any patent/copyright issues related ?
> 1. Trying adding "-B/opt/extra" into your clang invocation.
Haven't tried this solution, I'll try it tonight. I figured out one myself:
add -DGCC_INSTALL_PREFIX=/opt/extra to cmake will fix this problem. I'm not
sure whether it's a hack or standard.

> 2. The crt begin/end files are considered part of the standard library,
> not the compiler.
I don't think so, if it's part of the standard, why every GCC installation
has a copy of crtbegin/crtend ? I also tried musl libc (www.musl-libc.org)
it installs files like crt1.o, crti.o, crtn.o but *not* crtbegin.o/crtend.o
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-users/attachments/20150929/a9f030f0/attachment.html>

More information about the cfe-users mailing list