Bug 19317 - plugin needed to handle lto object should not be output for plugin generated files when doing incremental link
Summary: plugin needed to handle lto object should not be output for plugin generated ...
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: ld (show other bugs)
Version: 2.27
: P2 normal
Target Milestone: 2.27
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks: 18178
  Show dependency treegraph
 
Reported: 2015-12-01 04:10 UTC by Jan Hubicka
Modified: 2023-06-05 03:02 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments
A patch (1.20 KB, patch)
2015-12-09 23:29 UTC, H.J. Lu
Details | Diff
A patch for ld and gold (462 bytes, patch)
2015-12-10 01:00 UTC, H.J. Lu
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Hubicka 2015-12-01 04:10:41 UTC
Hi,
the implementation of IL linking in GCC is currently blocked by this. When compiling with gcc -r the linker plugin claims the LTO files and uses GCC to merge them into one LTO file which is then streamed.  It would be great to fix ld and gold to not complain about this.

Honza
Comment 1 H.J. Lu 2015-12-03 13:26:43 UTC
A testcase?
Comment 2 Jan Hubicka 2015-12-09 18:26:55 UTC
Apply patch https://gcc.gnu.org/ml/gcc-patches/2015-11/msg03530.html and try to incremental link LTO files.
Comment 3 H.J. Lu 2015-12-09 23:29:42 UTC
Created attachment 8838 [details]
A patch

Try this.
Comment 4 H.J. Lu 2015-12-10 00:53:43 UTC
A simple testcase with GCC 5:

[hjl@gnu-6 bin]$ cat /tmp/x.c
#include <stdio.h>

int
main ()
{
  printf ("hello\n");
  return 0;
}
[hjl@gnu-6 bin]$ gcc -flto -c /tmp/x.c
[hjl@gnu-6 bin]$ ld.bfd -r x.o -o reloc.o
ld.bfd: x.o: plugin needed to handle lto object
[hjl@gnu-6 bin]$ ld.gold -r x.o -o reloc.o
x.o: plugin needed to handle lto object
[hjl@gnu-6 bin]$
Comment 5 H.J. Lu 2015-12-10 01:00:56 UTC
Created attachment 8839 [details]
A patch for ld and gold
Comment 6 Sourceware Commits 2015-12-10 19:31:28 UTC
The master branch has been updated by H.J. Lu <hjl@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=bebf4942b083027860539b7c5e0649714b92e401

commit bebf4942b083027860539b7c5e0649714b92e401
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Thu Dec 10 11:28:48 2015 -0800

    ld -r doesn't need plugin for slim lto object
    
    Plugin isn't required on slim lto object for relocatable link.
    
    	PR ld/19317
    	* symtab.cc (Symbol_table::add_from_relobj): Don't complain
    	plugin needed to handle slim lto object for relocatable link.
Comment 7 Sourceware Commits 2015-12-10 20:41:45 UTC
The master branch has been updated by H.J. Lu <hjl@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=c5847ba7267b6eedd4b750f5eeece3ec037a27fd

commit c5847ba7267b6eedd4b750f5eeece3ec037a27fd
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Thu Dec 10 12:35:35 2015 -0800

    ld -r doesn't need plugin for slim lto object
    
    Plugin isn't required on slim lto object for relocatable link.
    
    bfd/
    
    	PR ld/19317
    	* linker.c (_bfd_generic_link_add_one_symbol): Don't complain
    	plugin needed to handle slim lto object for relocatable link.
    
    ld/testsuite/
    
    	PR ld/19317
    	* ld-plugin/lto.exp (lto_no_fat): New.
    	(lto_link_tests): Add a test for PR ld/19317.
    	(lto_run_tests): Likewise.
    	(run_ld_link_tests): Likewise.
Comment 8 H.J. Lu 2015-12-10 20:43:19 UTC
Fixed for 2.27.
Comment 9 Sourceware Commits 2023-06-05 03:02:13 UTC
The master branch has been updated by YunQiang Su <syq@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=a0631c1501c113c04891c9a24a9ff5276257f28d

commit a0631c1501c113c04891c9a24a9ff5276257f28d
Author: YunQiang Su <yunqiang.su@cipunited.com>
Date:   Tue May 16 09:46:46 2023 +0800

    MIPS: fix some ld testcases with compiler
    
    1. config/default.exp:
            use -mabi=32 not for -gnuabi64
            xfail_from_runlist: remove an element and mark it xfail.
    2. ld-elf/indirect.exp: xfail
            indirect5a indirect5b indirect6a indirect6b
            indirect5c indirect5d indirect6c indirect6d
    3. ld-elf/pr23658-2: mips output is not common
    4. ld-elf/shared.exp: non-run on mips: Build libpr16496b.so
    5. ld-elfvers/vers.exp:
            xfail vers4, vers4b
            no-run on mips: vers24a, vers24b, vers24c
    6. ld-gc/gc.exp: add -KPIC into asflags for pr13683, pr14265, pr19161
    7. ld-mips-elf/mips-elf.exp:
            use noarch for mips16-local-stubs-1, since it use -mips4
    8. ld-plugin/lto.exp:
            no-run on mips/linux: PR ld/12982
            add -KPIC into asflags for lto-3r, lto-5r, PR ld/19317 (2)
            xfail PR ld/15323 (4), PR ld/19317 (3)
    9. ld-plugin/plugin.exp: xfail
            plugin claimfile lost symbol
            plugin claimfile replace symbol
            plugin claimfile replace symbol
            plugin claimfile lost symbol with source
            plugin claimfile replace symbol with source
            plugin claimfile resolve symbol with source
            plugin 2 with source lib
            load plugin 2 with source
            plugin 3 with source lib
            load plugin 3 with source
    11. ld-selective/selective.exp: add -fno-PIC, which is needed for -mno-abicalls
    12. ld-shared/shared.exp: xfail shared (non PIC), shared (PIC main, non PIC so)