This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: 3.4 PATCH: Provide target hook for special handling of collect2 flags


Rainer Orth writes:

> Whether or not to use collect2 depends on the ABI: the native O32 as cannot
> handle named sections, while the N32/N64 as (and gas) can.  To handle both
> situations in a single compiler/collect2, I've chosen the following
> approach:
> 
> * use_collect2=yes is always enabled in config.gcc, but flag_gnu_linker is
>   overridden in override_options (only enabled in a later patch in this
>   series)
> 
> * do_collecting is now overridden in a new hook for collect2
>   (COLLECT_PARSE_FLAG) which parses command line options and may perform
>   special actions depending on them.  One cannot use target flags since
>   they are not available to collect2.
> 
> This patch has currently no effect, since use_collect2 is yet unset in
> config.gcc, so do_collecting already defaults to 0 for the N32/N64 ABIs.

It occurred to me that it may be better/cleaner to explicitly override
collect2's default for do_collecting via a new -collect/-no-collect
command-line switch instead of this hack.  What do people think about this?
I know this comment in collect2.c:

  /* !!! When GCC calls collect2,
     it does not know whether it is calling collect2 or ld.
     So collect2 cannot meaningfully understand any options
     except those ld understands.
     If you propose to make GCC pass some other option,
     just imagine what will happen if ld is really ld!!!  */

but right now, collect2 will always be needed at least for IRIX 6 O32, so
we can guarantee that collect2 is called instead of ld.  And the -debug
flag is already special to collect2 (although it must be passed explicitly
via -Wl,-debug).

	Rainer


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