[PATCH 2/5] ld: Add lto and none-lto input support for ld -r

Alan Modra amodra@gmail.com
Tue Oct 27 00:24:06 GMT 2020


On Mon, Oct 26, 2020 at 07:13:26AM -0700, H.J. Lu wrote:
> On Mon, Oct 26, 2020 at 6:48 AM H.J. Lu <hjl.tools@gmail.com> wrote:
> >
> > On Sun, Oct 25, 2020 at 5:43 PM Alan Modra <amodra@gmail.com> wrote:
> > >
> > > On Wed, Oct 21, 2020 at 04:35:08AM -0700, H.J. Lu via Binutils wrote:
> > > >       (cmdline_emit_object_only_section): Likewise.
> > >
> > > This is really "run the linker again to produce another output" isn't
> > > it?  So, why not actually run the linker again rather than duplicating
> > > (and complicating) a whole lot of code.  See for example spuelf.em
> > > spu_elf_relink.
> > >
> >
> > For a relocatable link, I scan all input files, objects and archives, to build
> > 2 lists, cmdline_object_only_file_list and cmdline_object_only_archive_list.
> > They are used to determine which object files at the command line and
> > archive members in archives at the command line should be extracted to
> > the object only output.  To relink, I need to pass these 2 lists to the linker
> > to rebuild these 2 lists.  I will do it if my patches will be approved after it.
> 
> These 2 lists can be quite long and require special handling.  I prefer
> the current approach if possible.

Long lists of objects can be passed by file, ie. by generating a
linker script with INPUT commands.

I know I'm asking for you to reimplement quite a lot of your patch.
I'm not doing so to be difficult.  Duplicating much of lang_process is
just wrong from a maintenance perspective.  And it is difficult to get
right, as evidenced by quite a lot of fails after applying your patch. 

alpha-linux  +FAIL: PR ld/15323 (2)
alpha-linux  +FAIL: PR ld/15323 (4)
arm-linuxeabi  +FAIL: PR ld/15323 (2)
arm-linuxeabi  +FAIL: PR ld/15323 (4)
h8300-elf  +FAIL: section flags (for GNU lto sections)
h8300-linux  +FAIL: section flags (for GNU lto sections)
hppa-linux  +FAIL: PR ld/15323 (2)
hppa-linux  +FAIL: PR ld/15323 (4)
i386-bsd  +FAIL: --gc-sections -r without -e
i386-bsd  +FAIL: -l: test (preparation)
i386-bsd  +FAIL: -l: test
i386-msdos  +FAIL: --gc-sections -r without -e
i386-msdos  +FAIL: -l: test (preparation)
mips64-linux  +FAIL: ld-plugin/lto-4r-a
mips64-linux  +FAIL: ld-plugin/lto-4r-b
mips64-linux  +FAIL: ld-plugin/lto-4r-c
mips64-linux  +FAIL: ld-plugin/lto-4r-d
mips64-linux  +FAIL: ld-plugin/lto-10r
mips64-linux  +FAIL: LTO 5 symbol
mips64-linux  +FAIL: LTO 3b
mips64-linux  +FAIL: LTO 5
mips-linux  +FAIL: ld-plugin/lto-4r-a
mips-linux  +FAIL: ld-plugin/lto-4r-b
mips-linux  +FAIL: ld-plugin/lto-4r-c
mips-linux  +FAIL: ld-plugin/lto-4r-d
mips-linux  +FAIL: ld-plugin/lto-10r
mips-linux  +FAIL: LTO 5 symbol
mips-linux  +FAIL: LTO 3b
mips-linux  +FAIL: LTO 5
ns32k-netbsd  +FAIL: --gc-sections -r without -e
ns32k-netbsd  +FAIL: -l: test (preparation)
ns32k-netbsd  +FAIL: -l: test
ns32k-pc532-mach  +FAIL: --gc-sections -r without -e
ns32k-pc532-mach  +FAIL: -l: test (preparation)
ns32k-pc532-mach  +FAIL: -l: test
pdp11-dec-aout  +FAIL: --gc-sections -r without -e
pdp11-dec-aout  +FAIL: -l: test (preparation)
pdp11-dec-aout  +FAIL: -l: test
powerpc64-linux  +FAIL: nm mixed object
powerpc-aix5.1  +FAIL: --gc-sections -r without -e
powerpc-aix5.1  +FAIL: -l: test (preparation)
powerpc-aix5.1  +FAIL: -l: test
powerpc-aix5.2  +FAIL: --gc-sections -r without -e
powerpc-aix5.2  +FAIL: -l: test (preparation)
powerpc-aix5.2  +FAIL: -l: test
powerpc-aix5.2  +FAIL: Duplicate symbol check 1 (rel) (32-bit)
powerpc-aix5.2  +FAIL: Duplicate symbol check 1 (rel) (64-bit)
powerpc-aix5.2  +FAIL: Export test 1 (object) (32-bit)
powerpc-aix5.2  +FAIL: Export test 1 (object) (64-bit)
powerpc-aix5.2  +FAIL: Export test 1 (-bexpall) (32-bit)
powerpc-aix5.2  +FAIL: Export test 1 (-bexpall) (64-bit)
powerpc-aix5.2  +FAIL: Export test 1 (-bexpfull) (32-bit)
powerpc-aix5.2  +FAIL: Export test 1 (-bexpfull) (64-bit)
powerpc-aix5.2  +FAIL: Glink test 2 (part b) (32-bit)
powerpc-aix5.2  +FAIL: Glink test 2 (part b) (64-bit)
powerpc-aix5.2  +FAIL: Glink test 2 (32-bit)
powerpc-aix5.2  +FAIL: Glink test 2 (64-bit)
powerpc-aix5.2  +FAIL: Relocatable test 1 (32-bit)
powerpc-aix5.2  +FAIL: Relocatable test 1 (64-bit)
powerpc-aix5.2  +FAIL: Weak test 1 (rel) (32-bit)
powerpc-aix5.2  +FAIL: Weak test 1 (rel) (64-bit)
powerpc-linux  +FAIL: PR ld/15323 (2)
powerpc-linux  +FAIL: PR ld/15323 (4)
rs6000-aix4.3.3  +FAIL: --gc-sections -r without -e
rs6000-aix4.3.3  +FAIL: -l: test (preparation)
rs6000-aix4.3.3  +FAIL: -l: test
rs6000-aix5.1  +FAIL: --gc-sections -r without -e
rs6000-aix5.1  +FAIL: -l: test (preparation)
rs6000-aix5.1  +FAIL: -l: test
rs6000-aix5.2  +FAIL: --gc-sections -r without -e
rs6000-aix5.2  +FAIL: -l: test (preparation)
rs6000-aix5.2  +FAIL: -l: test
rs6000-aix5.2  +FAIL: Duplicate symbol check 1 (rel) (32-bit)
rs6000-aix5.2  +FAIL: Duplicate symbol check 1 (rel) (64-bit)
rs6000-aix5.2  +FAIL: Export test 1 (object) (32-bit)
rs6000-aix5.2  +FAIL: Export test 1 (object) (64-bit)
rs6000-aix5.2  +FAIL: Export test 1 (-bexpall) (32-bit)
rs6000-aix5.2  +FAIL: Export test 1 (-bexpall) (64-bit)
rs6000-aix5.2  +FAIL: Export test 1 (-bexpfull) (32-bit)
rs6000-aix5.2  +FAIL: Export test 1 (-bexpfull) (64-bit)
rs6000-aix5.2  +FAIL: Glink test 2 (part b) (32-bit)
rs6000-aix5.2  +FAIL: Glink test 2 (part b) (64-bit)
rs6000-aix5.2  +FAIL: Glink test 2 (32-bit)
rs6000-aix5.2  +FAIL: Glink test 2 (64-bit)
rs6000-aix5.2  +FAIL: Relocatable test 1 (32-bit)
rs6000-aix5.2  +FAIL: Relocatable test 1 (64-bit)
rs6000-aix5.2  +FAIL: Weak test 1 (rel) (32-bit)
rs6000-aix5.2  +FAIL: Weak test 1 (rel) (64-bit)
sparc64-linux  +FAIL: PR ld/15323 (2)
sparc64-linux  +FAIL: PR ld/15323 (4)
x86_64-w64-mingw32  +FAIL: ld-plugin/lto-3r
x86_64-w64-mingw32  +FAIL: ld-plugin/lto-4r-a
x86_64-w64-mingw32  +FAIL: ld-plugin/lto-4r-b
x86_64-w64-mingw32  +FAIL: ld-plugin/lto-4r-c
x86_64-w64-mingw32  +FAIL: ld-plugin/lto-4r-d
x86_64-w64-mingw32  +FAIL: ld-plugin/lto-5r
x86_64-w64-mingw32  +FAIL: ld-plugin/lto-10r
x86_64-w64-mingw32  +FAIL: nm mixed object
x86_64-w64-mingw32  +FAIL: PR ld/19317 (2)
x86_64-w64-mingw32  +FAIL: LTO 4a
x86_64-w64-mingw32  +FAIL: LTO 4c
x86_64-w64-mingw32  +FAIL: LTO 4d
x86_64-w64-mingw32  +FAIL: LTO 10

-- 
Alan Modra
Australia Development Lab, IBM


More information about the Binutils mailing list