bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug gold/18834] Gold does not accept linker-script input only with -T


From: rguenther at suse dot de
Subject: [Bug gold/18834] Gold does not accept linker-script input only with -T
Date: Tue, 18 Aug 2015 08:32:57 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=18834

--- Comment #2 from rguenther at suse dot de ---
On Mon, 17 Aug 2015, ccoutant at gmail dot com wrote:

> https://sourceware.org/bugzilla/show_bug.cgi?id=18834
> 
> Cary Coutant <ccoutant at gmail dot com> changed:
> 
>            What    |Removed                     |Added
> ----------------------------------------------------------------------------
>              Status|NEW                         |ASSIGNED
> 
> --- Comment #1 from Cary Coutant <ccoutant at gmail dot com> ---
> For the broader context, see the discussion at PR ld/18836.
> 
> As far as this specific complaint goes, the behavior is as expected. If the
> script does not specify any input files, gold will complain about no input
> files. If you add an INPUT(foo.o) command to the script (and link it as an
> input file, not with -T), it will correctly read foo.o as an input file.

I see.  Note that GNU ld complains then:

> ld -o x script -r
ld: warning: script contains output sections; did you forget -T?
ld: t.o: plugin needed to handle lto object

but continues anyway (complains about "did you forget -T"?)

Not sure if your comment says that gold handles such input linker scripts
fine (with SECTIONS clause).  For reference the following is what
I used:

INPUT(t.o)
SECTIONS {
  .debug_info 0 : { *(.gnu.lto_.debug_info*) }
  .debug_abbrev 0 : { *(.gnu.lto_.debug_abbrev*) }
  .debug_str 0 : { *(.gnu.lto_.debug_str*) }
  /DISCARD/ : { *(*) }
}

> I think the complaint here is that Gnu ld, if it sees an input section
> specification that names a file without a wildcard, will process that file as
> if it had been named on the command line. That seems like a misfeature to me 
> --
> all other uses of a filename in a SECTIONS clause are as a filter. Without a
> compelling use case, I'd prefer to keep gold's behavior as is. (See the
> aforementioned discussion at PR 18836 for why even the Gnu ld behavior is
> probably not what you're looking for.)

Fair enough - I can easily avoid even the filter names by doing sth
like above and using multiple inputs.

Looks like the /DISCARD/ line is what makes gold crash / complain
in the end :(  So

INPUT(t.o)
SECTIONS {
  .debug_info 0 : { *(.gnu.lto_.debug_info*) }
  .debug_abbrev 0 : { *(.gnu.lto_.debug_abbrev*) }
  .debug_str 0 : { *(.gnu.lto_.debug_str*) }
}

works as input and with INPUT dropped and using -T plus inputs on
the command-line it also works.  I just need all other sections
not explicitely mentioned in SECTIONS to be dropped.

  /DISCARD/ : { *(*) }

is what works for GNU ld here (see 18836 - "/DISCARD/ semantics
unclear).

  /DISCARD/ : { *(.[a-fh-zA-Z]*) }

doesn't help (not sure what kind of regexps we expect here).

-- 
You are receiving this mail because:
You are on the CC list for the bug.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]