This is the mail archive of the mailing list for the libstdc++ project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: patch to check ld

Jason Merrill <>:
> Phil Edwards <> writes:
> > I could see the linker's -On only being turned on at the compiler's
> > -O(n+delta), but (n+delta) would probably still be used for all the object
> > files, not just the final step.
> > 
> > Maybe gcc needs an -Ofinal to do things that only make good sense when
> > creating a binary (or a library).
> That seems silly.  Under what circumstances would you want to compile
> with optimization but link without or vice versa?  Seems to me that a
> -O on the compiler link command line should pass through to the
> linker, though perhaps only for n>1.

Well, sort of.  My assumption was that when linking, you'd use /at least/
whatever was used when compiling.  Feeding -O1 to gld can be really
expensive, though.

Say, during compiling, one would pass -On, and when linking, one would pass
-On -Ofinal.  The latter would pass on to the linker all those flags that
make sense for linking.  And if -Ofinal were passed during a compile-only
step, it would be ignored.

I suppose this behavior could be built in to the current -On setup, though.

> And perhaps there should be an -flink-gc option that would imply
> -ffunction-sections -fdata-sections -fvtable-gc -Wl,--gc-sections.

I'd go for that.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]