add .cc files to libgcc.a

Jonathan Wakely jwakely.gcc@gmail.com
Mon Oct 29 18:48:00 GMT 2012


On 29 October 2012 16:08, Perry Smith wrote:
>
> On Oct 29, 2012, at 9:32 AM, Jonathan Wakely wrote:
>
>> On Oct 29, 2012 1:54 PM, "Perry Smith" wrote:
>>>
>>> My original logic in adding them to libstdc++.a is they are only used (called) by code automatically produced by g++ and not gcc.
>>
>> That doesn't make sense. Both gcc and g++ are just driver programs
>> that invoke the appropriate compiler program, which for C++ is
>> cc1plus. So C++ code can be compiled by gcc, and doesn't necessarily
>> link to libstdc++.
>>
>> Putting the files in libsupc++ might make sense but libstdc++ is
>> definitely wrong.
>
> You've mentioned this before.  I think you are needlessly splitting hairs.

No, I'm not.

>  The construct that produces the code that causes the failure is a c++ construct.

You're apparently still failing to understand the point.

Compiling with gcc does not imply you're not compiling C++.

Compiling C++ does not imply linking to libstdc++.

So basing which library it goes in based on "compiling with gcc versus
g++" is meaningless, and assuming that "compiling C++" implies linking
to libstdc+ is plain wrong.

So putting it in libstdc++ because it's needed by C++ code is plain
wrong.  That's not splitting hairs. You're original logic in adding it
to libstdc++ is flawed.

>The construct that causes the compiler to produce a call to atexit is a static of a variable with a non-trivial destructor declared inside a function.  This program, does not compile with gcc:
[snip]

You're wrong.

It compiles fine with gcc if you put it in a file that ends in .cc or
.C or .cpp or any of the other extensions that tell gcc to run the
cc1plus compiler.  Please read
http://gcc.gnu.org/onlinedocs/gcc/Invoking-G_002b_002b.html

It doesn't *link* with gcc, unless you use -lsupc++

N.B. it does *not* need -lstdc++

> But it compiles just fine with g++.

It links successfully with g++ because that implies -lstdc++ which
implies -lsupc++

But neither g++ nor libstdc+ is required.

I'm trying to help you, really.

Code that is required by C++ programs to provide language support and
basic runtime features should go in libsupc++ not libstdc++, as I
tried to tell you in my last mail.



More information about the Gcc mailing list