Bug 12365

Summary: undefined references produced by linker plugin are silently ignored
Product: binutils Reporter: Jan Hubicka <jh>
Component: ldAssignee: Alan Modra <amodra>
Status: RESOLVED FIXED    
Severity: normal CC: amodra, davek, hjl.tools
Priority: P2    
Version: 2.26   
Target Milestone: 2.26   
Host: Target:
Build: Last reconfirmed:

Description Jan Hubicka 2011-01-05 14:56:04 UTC
Compiling memcpy-asm testcase from GCC testsuite with current GCC mainline and -O2 -flto results in call to my_memcpy that is not defined:

./xgcc -B ./ -O2 memops-asm*.c  /abuild/jh/trunk-3/gcc/testsuite/gcc.c-torture/execute/builtins/lib/main.c  -g -O0 -flto --save-temps -fdump-ipa-all-details    -save-temps
evans:/abuild/jh/trunk-3/build-inst2/gcc/:[0]# grep memcpy *.s
ccNd9GvG.ltrans0.s:     .globl  memcpy
ccNd9GvG.ltrans0.s:     .type   memcpy, @function
ccNd9GvG.ltrans0.s:memcpy:
ccNd9GvG.ltrans0.s:     call    my_memcpy.2055
ccNd9GvG.ltrans0.s:     .size   memcpy, .-memcpy
ccNd9GvG.ltrans0.s:     .type   my_memcpy.2055, @function
ccNd9GvG.ltrans0.s:my_memcpy.2055:
ccNd9GvG.ltrans0.s:     .size   my_memcpy.2055, .-my_memcpy.2055
ccNd9GvG.ltrans0.s:     call    my_memcpy
ccNd9GvG.ltrans0.s:     call    my_memcpy
ccNd9GvG.ltrans0.s:     .string "memcpy"
ccNd9GvG.ltrans0.s:     .string "my_memcpy"

this is GCC bug where my_memcpy is once defined as alias and once as normal function and declarations are not merged. 
This however should result in linktime error instead of producing binary.
In the binary the call to my_memcpy is linked to bogus destination:

   400a41:       e8 9c fb ff ff          callq  4005e2 <a>

I assume this is caused by fact that my_memcpy appears in original LTO symbol tables.

Honza
Comment 1 H.J. Lu 2011-01-05 15:19:55 UTC
Please provide a complete testcase.
Comment 2 H.J. Lu 2011-01-05 15:44:18 UTC
Works for me on hjl/lto-mixed branch at

http://git.kernel.org/?p=devel/binutils/hjl/x86.git;a=summary

[hjl@gnu-32 testsuite]$ ../xgcc -B../ /export/gnu/import/git/gcc/gcc/testsuite/gcc.c-torture/execute/builtins/memops-asm*.c /export/gnu/import/git/gcc/gcc/testsuite/gcc.c-torture/execute/builtins/lib/main.c -O2 -fuse-linker-plugin -flto
/tmp/ccUDWDxu.ltrans0.ltrans.o: In function `main':
ccUDWDxu.ltrans0.o:(.text.startup+0x173): undefined reference to `my_bcopy'
collect2: ld returned 1 exit status
[hjl@gnu-32 testsuite]$
Comment 3 Jan Hubicka 2011-01-05 20:23:59 UTC
Hmm, wonder how testcases for linker plugin related bugs should look like.  All I can think of is the GCC version + testcase that is in testsuite anyway.
Comment 4 Sourceware Commits 2011-04-17 23:15:18 UTC
CVSROOT:	/cvs/src
Module name:	src
Changes by:	amodra@sourceware.org	2011-04-17 23:15:13

Modified files:
	bfd            : bfd.c bfd-in2.h elflink.c opncls.c 
	ld             : ldfile.c ldmain.c ldlang.c plugin.h plugin.c 
	ld/testsuite/ld-plugin: plugin-7.d plugin-8.d plugin.exp 
Added files:
	ld/testsuite/ld-plugin: plugin-12.d 

Log message:
	PR ld/12365
	PR ld/12672
	bfd/
	* bfd.c (BFD_PLUGIN): Define.
	(BFD_FLAGS_SAVED, BFD_FLAGS_FOR_BFD_USE_MASK): Add BFD_PLUGIN.
	* bfd-in2.h: Regenerate.
	* elflink.c (elf_link_output_extsym): Strip undefined plugin syms.
	* opncls.c (bfd_make_readable): Don't lose original bfd flags.
	ld/
	* ldfile.c (ldfile_try_open_bfd): Don't attempt any plugin action
	when no_more_claiming.
	* ldmain.c (add_archive_element): Likewise.
	(multiple_definition): Remove plugin_multiple_definition call.
	(notice): Remove plugin_notice call.
	* ldlang.c (lang_list_insert_after, void lang_list_remove_tail): Move.
	Delete prototype.
	(plugin_insert): New static var.
	(open_input_bfds): Only rescan libs after plugin insert point.
	(lang_gc_sections): Omit plugin claimed files.
	(lang_process): Set plugin_insert.  Only rescan when plugin adds
	objects.
	* plugin.h (no_more_claiming): Declare.
	(plugin_notice, plugin_multiple_definition): Don't declare.
	* plugin.c: Formatting.
	(orig_notice_all, orig_allow_multiple_defs, orig_callbacks,
	plugin_callbacks): New static vars.
	(no_more_claiming): Make global.
	(plugin_cached_allow_multiple_defs): Delete.
	(plugin_get_ir_dummy_bfd): Set SEC_EXCLUDE on dummy .text section,
	use newer bfd_make_section variant.  Make COMMON section too.
	Error handling.  Correct setting of gp size.
	(asymbol_from_plugin_symbol): Properly cast last arg of concat.
	(message): Likewise for ACONCAT.
	(asymbol_from_plugin_symbol): Use our COMMON section.
	(get_symbols): When report_plugin_symbols, show visibility too.
	(init_non_ironly_hash): Move.  Don't test non_ironly_hash.
	(plugin_load_plugins): Save state of linker callbacks, set up to
	call plugin_notice instead.  Call init_non_ironly_hash here.
	(plugin_call_all_symbols_read): Set plugin_multiple_definition in
	plugin callbacks.
	(plugin_notice): Rewrite.
	(plugin_multiple_definition): Make static, call original callback.
	ld/testsuite/
	* ld-plugin/plugin-7.d: Adjust for plugin changes.
	* ld-plugin/plugin-8.d: Likewise.
	* ld-plugin/plugin.exp: Pass --verbose=2 for visibility test, and
	compare ld output to..
	* ld-plugin/plugin-12.d: New.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/bfd.c.diff?cvsroot=src&r1=1.115&r2=1.116
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/bfd-in2.h.diff?cvsroot=src&r1=1.532&r2=1.533
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elflink.c.diff?cvsroot=src&r1=1.396&r2=1.397
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/opncls.c.diff?cvsroot=src&r1=1.66&r2=1.67
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/ldfile.c.diff?cvsroot=src&r1=1.61&r2=1.62
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/ldmain.c.diff?cvsroot=src&r1=1.150&r2=1.151
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/ldlang.c.diff?cvsroot=src&r1=1.365&r2=1.366
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/plugin.h.diff?cvsroot=src&r1=1.7&r2=1.8
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/plugin.c.diff?cvsroot=src&r1=1.29&r2=1.30
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ld-plugin/plugin-12.d.diff?cvsroot=src&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ld-plugin/plugin-7.d.diff?cvsroot=src&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ld-plugin/plugin-8.d.diff?cvsroot=src&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ld-plugin/plugin.exp.diff?cvsroot=src&r1=1.6&r2=1.7
Comment 5 Sourceware Commits 2011-04-17 23:18:27 UTC
CVSROOT:	/cvs/src
Module name:	src
Changes by:	amodra@sourceware.org	2011-04-17 23:18:24

Modified files:
	bfd            : ChangeLog 
	ld             : ChangeLog 
	ld/testsuite   : ChangeLog 

Log message:
	PR ld/12365
	PR ld/12672
	missing changelog entries

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/ChangeLog.diff?cvsroot=src&r1=1.5306&r2=1.5307
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/ChangeLog.diff?cvsroot=src&r1=1.2312&r2=1.2313
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ChangeLog.diff?cvsroot=src&r1=1.1387&r2=1.1388
Comment 6 Alan Modra 2011-04-17 23:27:33 UTC
Fixed for anything but common IR-only symbols.  These will require a bit more work in the linker.
Comment 7 Sourceware Commits 2011-04-20 00:11:37 UTC
CVSROOT:	/cvs/src
Module name:	src
Changes by:	amodra@sourceware.org	2011-04-20 00:11:33

Modified files:
	include        : ChangeLog bfdlink.h 
	bfd            : ChangeLog elflink.c linker.c simple.c 
	                 xcofflink.c 
	ld             : ChangeLog ldmain.c plugin.c 

Log message:
	PR ld/12365
	include/
	* bfdlink.h (struct bfd_link_callbacks): Modify multiple_definition
	and multiple_common parameters to pass in a bfd_link_hash_entry
	pointer rather than name,bfd etc. found in the hash entry.
	bfd/
	* elflink.c (_bfd_elf_merge_symbol): Update multiple_common calls.
	* linker.c (_bfd_generic_link_add_one_symbol): Likewise.  Call
	multiple_definition regardless of allow_multiple_definition.
	* simple.c (simple_dummy_multiple_definition): Update.
	* xcofflink.c (xcoff_link_add_symbols): Update multiple_definition
	calls.
	ld/
	* ldmain.c (multiple_definition): Take a bfd_link_hash_entry
	pointer arg rather than "name", "obfd", "osec", "oval".  Add code
	removed from linker.c.  Hack around xcofflink.c oddity in
	passing NULL nbfd.
	(multiple_common): Similarly.
	* plugin.c (orig_allow_multiple_defs): Delete.
	(plugin_call_all_symbols_read): Don't twiddle allow_multiple_definition.
	(plugin_multiple_definition): Update.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/include/ChangeLog.diff?cvsroot=src&r1=1.526&r2=1.527
http://sourceware.org/cgi-bin/cvsweb.cgi/src/include/bfdlink.h.diff?cvsroot=src&r1=1.82&r2=1.83
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/ChangeLog.diff?cvsroot=src&r1=1.5308&r2=1.5309
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elflink.c.diff?cvsroot=src&r1=1.397&r2=1.398
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/linker.c.diff?cvsroot=src&r1=1.78&r2=1.79
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/simple.c.diff?cvsroot=src&r1=1.34&r2=1.35
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/xcofflink.c.diff?cvsroot=src&r1=1.78&r2=1.79
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/ChangeLog.diff?cvsroot=src&r1=1.2316&r2=1.2317
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/ldmain.c.diff?cvsroot=src&r1=1.151&r2=1.152
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/plugin.c.diff?cvsroot=src&r1=1.30&r2=1.31
Comment 8 Sourceware Commits 2011-04-20 00:22:11 UTC
CVSROOT:	/cvs/src
Module name:	src
Changes by:	amodra@sourceware.org	2011-04-20 00:22:09

Modified files:
	bfd            : ChangeLog elfcode.h elflink.c linker.c 
	ld             : ChangeLog ldfile.c ldmain.c plugin.c plugin.h 

Log message:
	PR ld/12365
	bfd/
	* elfcode.h (elf_slurp_symbol_table): Put common plugin IR symbols
	in their own common section.
	* elflink.c (elf_link_add_object_symbols): Likewise.
	* linker.c (generic_link_check_archive_element): Don't lose flags
	if common section is pre-existing.
	(_bfd_generic_link_add_one_symbol): Likewise.
	ld/
	* ldfile.c (ldfile_try_open_bfd): Move code creating and switching
	to plugin IR BFD..
	* ldmain.c (add_archive_element): ..and similar code here..
	* plugin.c (plugin_maybe_claim): ..to here.  New function.
	(plugin_call_claim_file): Make static.
	(asymbol_from_plugin_symbol): Set ELF st_shndx for common syms.
	(plugin_multiple_common): New function.
	(plugin_call_all_symbols_read): Hook in plugin_multiple_common.
	* plugin.h (plugin_call_claim_file): Don't declare.
	(plugin_maybe_claim): Declare.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/ChangeLog.diff?cvsroot=src&r1=1.5309&r2=1.5310
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elfcode.h.diff?cvsroot=src&r1=1.105&r2=1.106
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elflink.c.diff?cvsroot=src&r1=1.398&r2=1.399
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/linker.c.diff?cvsroot=src&r1=1.79&r2=1.80
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/ChangeLog.diff?cvsroot=src&r1=1.2317&r2=1.2318
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/ldfile.c.diff?cvsroot=src&r1=1.62&r2=1.63
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/ldmain.c.diff?cvsroot=src&r1=1.152&r2=1.153
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/plugin.c.diff?cvsroot=src&r1=1.31&r2=1.32
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/plugin.h.diff?cvsroot=src&r1=1.8&r2=1.9
Comment 9 Sourceware Commits 2011-04-24 10:02:19 UTC
CVSROOT:	/cvs/src
Module name:	src
Changes by:	amodra@sourceware.org	2011-04-24 10:02:14

Modified files:
	include        : ChangeLog bfdlink.h 
	bfd            : ChangeLog coff-aux.c linker.c elflink.c 
	ld             : ChangeLog ldmain.c plugin.c 

Log message:
	PR ld/12365
	PR ld/12696
	include/
	* bfdlink.h (ENUM_BITFIELD): Define.
	(struct bfd_link_hash_entry): Make "type" a bitfield.  Add "non_ir_ref".
	(struct bfd_link_callbacks <notice>): Pass bfd_link_hash_entry pointer
	rather than "name".
	bfd/
	* coff-aux.c (coff_m68k_aux_link_add_one_symbol): Update "notice" call.
	* linker.c (_bfd_link_hash_newfunc): Clear bitfields.
	(_bfd_generic_link_add_one_symbol): Update "notice" call.
	* elflink.c (_bfd_elf_merge_symbol): Don't skip weak redefs when
	it is a redef of an IR symbol in a real BFD.
	ld/
	* ldmain.c (notice): Delete "name" param, add "h".
	* plugin.c (plugin_notice): Likewise.  Set non_ir_ref.  Handle
	redefinitions of IR symbols in real BFDs.
	(plugin_multiple_definition, plugin_multiple_common): Delete.
	(non_ironly_hash, init_non_ironly_hash): Delete.
	(is_visible_from_outside): Traverse entry_symbol chain.
	(get_symbols): Use non_ir_ref flag rather than hash lookup.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/include/ChangeLog.diff?cvsroot=src&r1=1.527&r2=1.528
http://sourceware.org/cgi-bin/cvsweb.cgi/src/include/bfdlink.h.diff?cvsroot=src&r1=1.83&r2=1.84
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/ChangeLog.diff?cvsroot=src&r1=1.5318&r2=1.5319
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/coff-aux.c.diff?cvsroot=src&r1=1.10&r2=1.11
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/linker.c.diff?cvsroot=src&r1=1.80&r2=1.81
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elflink.c.diff?cvsroot=src&r1=1.401&r2=1.402
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/ChangeLog.diff?cvsroot=src&r1=1.2321&r2=1.2322
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/ldmain.c.diff?cvsroot=src&r1=1.153&r2=1.154
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/plugin.c.diff?cvsroot=src&r1=1.32&r2=1.33
Comment 10 Sourceware Commits 2011-04-27 07:17:51 UTC
CVSROOT:	/cvs/src
Module name:	src
Branch: 	binutils-2_21-branch
Changes by:	amodra@sourceware.org	2011-04-27 07:17:45

Modified files:
	bfd            : ChangeLog bfd-in2.h bfd.c coff-aux.c elf-bfd.h 
	                 elf.c elf32-i386.c elf32-ppc.c elf32-sparc.c 
	                 elf64-ppc.c elf64-sparc.c elf64-x86-64.c 
	                 elfcode.h elflink.c linker.c opncls.c plugin.c 
	                 simple.c xcofflink.c 
	gas/testsuite  : ChangeLog 
	gas/testsuite/gas/elf: elf.exp 
	include        : ChangeLog bfdlink.h 
	ld             : ChangeLog ld.texinfo ldfile.c ldlang.c ldlang.h 
	                 ldmain.c lexsup.c plugin.c plugin.h 
	ld/testsuite   : ChangeLog 
	ld/testsuite/ld-plugin: plugin-7.d plugin-8.d plugin.exp 
Added files:
	gas/testsuite/gas/elf: section9.d section9.s 
	ld/testsuite/ld-plugin: plugin-12.d 
	ld/testsuite/ld-unique: unique.exp unique.s unique_empty.s 
	                        unique_shared.s 

Log message:
	PR ld/12696
	PR ld/12672
	PR ld/12507
	PR ld/12365
	PR 10549
	Backport fixes for these PRs.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/ChangeLog.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.5180.2.26&r2=1.5180.2.27
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/bfd-in2.h.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.522.2.1&r2=1.522.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/bfd.c.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.114.2.1&r2=1.114.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/coff-aux.c.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.10&r2=1.10.10.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf-bfd.h.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.313.2.1&r2=1.313.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf.c.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.524.2.1&r2=1.524.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-i386.c.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.241&r2=1.241.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-ppc.c.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.290.2.2&r2=1.290.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-sparc.c.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.94&r2=1.94.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf64-ppc.c.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.339.2.7&r2=1.339.2.8
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf64-sparc.c.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.124&r2=1.124.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf64-x86-64.c.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.202&r2=1.202.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elfcode.h.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.103&r2=1.103.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elflink.c.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.388.2.1&r2=1.388.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/linker.c.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.77.2.1&r2=1.77.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/opncls.c.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.66&r2=1.66.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/plugin.c.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.9.2.1&r2=1.9.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/simple.c.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.34&r2=1.34.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/xcofflink.c.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.76.2.1&r2=1.76.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/testsuite/ChangeLog.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.1802.2.8&r2=1.1802.2.9
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/testsuite/gas/elf/section9.d.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=NONE&r2=1.1.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/testsuite/gas/elf/section9.s.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=NONE&r2=1.1.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/testsuite/gas/elf/elf.exp.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.69.2.1&r2=1.69.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/src/include/ChangeLog.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.510.2.1&r2=1.510.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/src/include/bfdlink.h.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.82&r2=1.82.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/ChangeLog.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.2222.2.18&r2=1.2222.2.19
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/ld.texinfo.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.267.2.1&r2=1.267.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/ldfile.c.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.58.2.1&r2=1.58.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/ldlang.c.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.347.2.2&r2=1.347.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/ldlang.h.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.91.2.1&r2=1.91.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/ldmain.c.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.145.2.2&r2=1.145.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/lexsup.c.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.120.2.1&r2=1.120.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/plugin.c.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.7.2.3&r2=1.7.2.4
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/plugin.h.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.2.2.2&r2=1.2.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ChangeLog.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.1322.2.8&r2=1.1322.2.9
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ld-plugin/plugin-12.d.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=NONE&r2=1.1.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ld-plugin/plugin-7.d.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.1&r2=1.1.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ld-plugin/plugin-8.d.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.1&r2=1.1.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ld-plugin/plugin.exp.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.5&r2=1.5.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ld-unique/unique.exp.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=NONE&r2=1.1.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ld-unique/unique.s.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=NONE&r2=1.1.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ld-unique/unique_empty.s.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=NONE&r2=1.1.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ld-unique/unique_shared.s.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=NONE&r2=1.1.2.1
Comment 11 Alan Modra 2011-04-27 07:40:55 UTC
fixed
Comment 12 Sourceware Commits 2011-05-07 14:27:00 UTC
CVSROOT:	/cvs/src
Module name:	src
Changes by:	davek@sourceware.org	2011-05-07 14:26:57

Modified files:
	bfd            : coffgen.c ChangeLog 

Log message:
	PR ld/12365
	* coffgen.c (coff_write_symbol): Assume input section is its own
	output section if output_section member not set.
	(coff_write_alien_symbol): Likewise.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/coffgen.c.diff?cvsroot=src&r1=1.78&r2=1.79
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/ChangeLog.diff?cvsroot=src&r1=1.5333&r2=1.5334
Comment 13 Sourceware Commits 2011-05-07 14:29:13 UTC
CVSROOT:	/cvs/src
Module name:	src
Changes by:	davek@sourceware.org	2011-05-07 14:29:10

Modified files:
	bfd            : cofflink.c ChangeLog 
	ld/scripttempl : pe.sc pep.sc 
	ld             : ChangeLog 
	ld/testsuite/ld-plugin: plugin-7.d plugin-8.d 
	ld/testsuite   : ChangeLog 

Log message:
	bfd/ChangeLog:
	
	PR ld/12365
	* cofflink.c (bfd_coff_link_input_bfd): Check for and warn about
	references to symbols defined in discarded sections.
	
	ld/ChangeLog:
	
	PR ld/12365
	* scripttempl/pe.sc (__rt_psrelocs_start): New symbol definition.
	(__rt_psrelocs_end): Likewise.
	(__rt_psrelocs_size): Likewise difference between the above.
	(__RUNTIME_PSEUDO_RELOC_LIST_END__): Move outside .rdata section
	immediately after end of pseudo-reloc data.
	(___RUNTIME_PSEUDO_RELOC_LIST_END___): Likewise.
	(__RUNTIME_PSEUDO_RELOC_LIST__): Move outside .rdata section and
	calculate backward from list end.
	(___RUNTIME_PSEUDO_RELOC_LIST___): Likewise.
	* scripttempl/pep.sc: Likewise.
	
	ld/testsuite/ChangeLog:
	
	PR ld/12365
	* ld-plugin/plugin-7.d: Allow underscore in error message.
	* ld-plugin/plugin-8.d: Likewise.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/cofflink.c.diff?cvsroot=src&r1=1.75&r2=1.76
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/ChangeLog.diff?cvsroot=src&r1=1.5334&r2=1.5335
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/scripttempl/pe.sc.diff?cvsroot=src&r1=1.25&r2=1.26
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/scripttempl/pep.sc.diff?cvsroot=src&r1=1.14&r2=1.15
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/ChangeLog.diff?cvsroot=src&r1=1.2327&r2=1.2328
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ld-plugin/plugin-7.d.diff?cvsroot=src&r1=1.3&r2=1.4
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ld-plugin/plugin-8.d.diff?cvsroot=src&r1=1.3&r2=1.4
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ChangeLog.diff?cvsroot=src&r1=1.1397&r2=1.1398
Comment 14 Sourceware Commits 2011-05-29 04:52:58 UTC
CVSROOT:	/cvs/src
Module name:	src
Branch: 	binutils-2_21-branch
Changes by:	amodra@sourceware.org	2011-05-29 04:51:53

Modified files:
	bfd            : ChangeLog aoutx.h archive.c bfd-in2.h bfdio.c 
	                 coff-aux.c coffcode.h coffgen.c cofflink.c 
	                 config.in configure configure.in dwarf2.c 
	                 elf-bfd.h elf-m10300.c elf.c elf32-ppc.c 
	                 elf32-rx.c elf64-ppc.c elflink.c elfxx-ia64.c 
	                 libbfd.c linker.c peXXigen.c vms-alpha.c 
	bfd/hosts      : x86-64linux.h 
	binutils       : ChangeLog nm.c objcopy.c 
	binutils/doc   : binutils.texi 
	binutils/testsuite: ChangeLog 
	binutils/testsuite/binutils-all: nm.exp 
	binutils/testsuite/lib: utils-lib.exp 
	gas            : ChangeLog dwarf2dbg.c input-scrub.c messages.c 
	                 read.c 
	gas/config     : obj-elf.h tc-arc.c tc-d10v.h tc-d30v.h 
	                 tc-m32r.h 
	gas/testsuite  : ChangeLog 
	gas/testsuite/gas/i386: inval-equ-2.l 
	gas/testsuite/gas/symver: symver2.l 
	include        : ChangeLog ansidecl.h bfdlink.h 
	ld             : ChangeLog ldexp.c ldlang.c ldlex.l ldmain.c 
	                 plugin.c 
	ld/emultempl   : elf32.em pe.em pep.em 
	ld/scripttempl : pe.sc pep.sc 
	ld/testsuite   : ChangeLog 
	ld/testsuite/ld-cris: tls-e-tpoffcomm1.d 
	ld/testsuite/ld-plugin: plugin-7.d plugin-8.d 

Log message:
	PR 12365
	PR 12613
	PR 12632
	PR 12739
	PR 12753
	PR 12760
	PR 12763
	Apply fix from mainline along with assorted other small fixes.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/ChangeLog.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.5180.2.34&r2=1.5180.2.35
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/aoutx.h.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.84.2.1&r2=1.84.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/archive.c.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.69.2.3&r2=1.69.2.4
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/bfd-in2.h.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.522.2.2&r2=1.522.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/bfdio.c.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.27&r2=1.27.4.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/coff-aux.c.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.10.10.1&r2=1.10.10.2
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/coffcode.h.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.171&r2=1.171.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/coffgen.c.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.78&r2=1.78.4.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/cofflink.c.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.74.2.1&r2=1.74.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/config.in.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.48&r2=1.48.4.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/configure.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.339.2.4&r2=1.339.2.5
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/configure.in.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.287.2.4&r2=1.287.2.5
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/dwarf2.c.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.138&r2=1.138.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf-bfd.h.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.313.2.2&r2=1.313.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf-m10300.c.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.106&r2=1.106.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf.c.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.524.2.2&r2=1.524.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-ppc.c.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.290.2.3&r2=1.290.2.4
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-rx.c.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.5.2.1&r2=1.5.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf64-ppc.c.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.339.2.10&r2=1.339.2.11
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elflink.c.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.388.2.2&r2=1.388.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elfxx-ia64.c.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.228.2.1&r2=1.228.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/libbfd.c.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.53.2.1&r2=1.53.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/linker.c.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.77.2.2&r2=1.77.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/peXXigen.c.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.67&r2=1.67.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/vms-alpha.c.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.37.2.1&r2=1.37.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/hosts/x86-64linux.h.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.2&r2=1.2.4.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/binutils/ChangeLog.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.1708.2.9&r2=1.1708.2.10
http://sourceware.org/cgi-bin/cvsweb.cgi/src/binutils/nm.c.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.65&r2=1.65.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/binutils/objcopy.c.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.147.2.1&r2=1.147.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/src/binutils/doc/binutils.texi.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.173.2.1&r2=1.173.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/src/binutils/testsuite/ChangeLog.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.216.2.2&r2=1.216.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/src/binutils/testsuite/binutils-all/nm.exp.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.5&r2=1.5.4.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/binutils/testsuite/lib/utils-lib.exp.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.20.2.1&r2=1.20.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/ChangeLog.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.4320.2.29&r2=1.4320.2.30
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/dwarf2dbg.c.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.107&r2=1.107.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/input-scrub.c.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.23&r2=1.23.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/messages.c.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.23&r2=1.23.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/read.c.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.167.2.2&r2=1.167.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/config/obj-elf.h.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.38&r2=1.38.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/config/tc-arc.c.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.47&r2=1.47.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/config/tc-d10v.h.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.20&r2=1.20.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/config/tc-d30v.h.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.15&r2=1.15.4.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/config/tc-m32r.h.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.23&r2=1.23.4.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/testsuite/ChangeLog.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.1802.2.11&r2=1.1802.2.12
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/testsuite/gas/i386/inval-equ-2.l.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.1&r2=1.1.12.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/testsuite/gas/symver/symver2.l.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.1&r2=1.1.38.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/include/ChangeLog.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.510.2.2&r2=1.510.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/src/include/ansidecl.h.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.28&r2=1.28.6.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/include/bfdlink.h.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.82.2.1&r2=1.82.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/ChangeLog.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.2222.2.23&r2=1.2222.2.24
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/ldexp.c.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.87.2.2&r2=1.87.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/ldlang.c.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.347.2.5&r2=1.347.2.6
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/ldlex.l.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.47.2.2&r2=1.47.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/ldmain.c.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.145.2.3&r2=1.145.2.4
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/plugin.c.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.7.2.5&r2=1.7.2.6
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/emultempl/elf32.em.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.214.2.1&r2=1.214.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/emultempl/pe.em.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.162.2.2&r2=1.162.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/emultempl/pep.em.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.38.2.1&r2=1.38.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/scripttempl/pe.sc.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.24&r2=1.24.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/scripttempl/pep.sc.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.13&r2=1.13.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ChangeLog.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.1322.2.12&r2=1.1322.2.13
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ld-cris/tls-e-tpoffcomm1.d.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.1&r2=1.1.6.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ld-plugin/plugin-7.d.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.1.2.1&r2=1.1.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ld-plugin/plugin-8.d.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.1.2.1&r2=1.1.2.2
Comment 15 H.J. Lu 2015-02-03 17:03:07 UTC
It is completely fixed. From

https://sourceware.org/bugzilla/show_bug.cgi?id=14272#c18

After the fix, the error message becomes:

Executing on host: sh -c {gcc -B/export/build/gnu/binutils-lto/build-x86_64-linux/ld/tmpdir/gas/ -B/export/build/gnu/binutils-lto/build-x86_64-linux/ld/tmpdir/ld/ -L/usr/local/x86_64-unknown-linux-gnu/lib64 -L/usr/local/lib64 -L/lib64 -L/usr/lib64 -L/usr/local/x86_64-unknown-linux-gnu/lib -L/usr/local/lib -L/lib -L/usr/lib -O2 -flto -fuse-linker-plugin tmpdir/pr12365a.o tmpdir/pr12365b.o tmpdir/pr12365c.o 2>&1}  /dev/null ld.tmp (timeout = 300)
spawn [open ...]^M
/tmp/cc6BNJK9.ltrans0.ltrans.o: In function `main':
cc6BNJK9.ltrans0.o:(.text.startup+0x197): undefined reference to `my_bcopy'
collect2: error: ld returned 1 exit status
/tmp/cc6BNJK9.ltrans0.ltrans.o: In function `main':
cc6BNJK9.ltrans0.o:(.text.startup+0x197): undefined reference to `my_bcopy'
collect2: error: ld returned 1 exit status
PASS: PR ld/12365

The difference is my_bcopy should be simply undefined, not defined in
a discarded section.
Comment 16 Sourceware Commits 2015-02-03 17:07:40 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=60f79275127603876d94da4bf4e3f6212903b407

commit 60f79275127603876d94da4bf4e3f6212903b407
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Tue Feb 3 09:03:23 2015 -0800

    Mark the plugin symbol undefined
    
    LTO may optimize out a plugin symbol, which is also referenced by a
    non-IR file.  When that happens, we should mark the plugin symbol
    undefined.  It isn't the problem since LTO already determined the
    symbols in the non-IR file aren't used.
    
    bfd/
    
    	PR ld/12365
    	PR ld/14272
    	* elflink.c (_bfd_elf_fix_symbol_flags): Mark the plugin symbol
    	undefined if it is referenced from a non-IR file.
    
    ld/testsuite/
    
    	PR ld/12365
    	* ld-plugin/pr12365a.c: New file.
    	* ld-plugin/pr12365b.c: Likewise.
    	* ld-plugin/pr12365c.c: Likewise.
    
    	* ld-plugin/lto.exp (lto_link_tests): Prepare for the PR ld/12365
    	test.
    	Run the PR ld/12365 test.
Comment 17 H.J. Lu 2015-02-03 17:10:30 UTC
Fixed for 2.26.
Comment 18 Sourceware Commits 2015-02-04 12:35:23 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=8962a307ae3dd59166a4a6dc4e60a4da880686cd

commit 8962a307ae3dd59166a4a6dc4e60a4da880686cd
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Wed Feb 4 04:34:11 2015 -0800

    Pass -flto-partition=none to the PR ld/12365 test
    
    	*  ld-plugin/lto.exp: Pass -flto-partition=none to the PR
    	ld/12365 test.
Comment 19 Sourceware Commits 2015-02-06 12:30:18 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=9e2dec471006de3e0489a34fbeb922fee1e302af

commit 9e2dec471006de3e0489a34fbeb922fee1e302af
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Fri Feb 6 04:25:36 2015 -0800

    Properly mark the plugin symbol undefined
    
    Mark the unused plugin defined symbol in elf_link_input_bfd instead of
    _bfd_elf_fix_symbol_flags.  Limit the PR ld/12365 test to x86 targets.
    
    bfd/
    
    	PR ld/12365
    	PR ld/14272
    	* elflink.c (_bfd_elf_fix_symbol_flags): Revert the last change.
    	(elf_link_input_bfd): Mark the plugin symbol undefined if it is
    	referenced from a non-IR file.
    
    ld/testsuite/
    
    	PR ld/12365
    	PR ld/14272
    	* ld-plugin/lto.exp: Run the PR ld/12365 test only for x86 targets.
    	* ld-plugin/plugin-7.d: Updated.
    	* ld-plugin/plugin-8.d: Likewise.
Comment 20 Sourceware Commits 2016-03-01 20:48:19 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=ef621b15e0b14f8fc0dc5940bc6b14a9aaa40ea3

commit ef621b15e0b14f8fc0dc5940bc6b14a9aaa40ea3
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Tue Mar 1 12:39:49 2016 -0800

    Update PR ld/12365 test for GCC 6
    
    PR ld/12365 test is to verify that linker catches the reference to
    undefined symbol error caused by a GCC bug.  Since the GCC bug has
    been fixed in GCC 6, update the test to verify that there is no
    reference to undefined symbol in executable
    
    	* testsuite/ld-plugin/lto.exp: Update PR ld/12365 test for GCC 6.
Comment 21 Sourceware Commits 2016-03-01 21:19:06 UTC
The binutils-2_26-branch branch has been updated by H.J. Lu <hjl@sourceware.org>:

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

commit b468caefb6767850023aaa1ce90d1ee6ec9c8829
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Tue Mar 1 12:39:49 2016 -0800

    Update PR ld/12365 test for GCC 6
    
    PR ld/12365 test is to verify that linker catches the reference to
    undefined symbol error caused by a GCC bug.  Since the GCC bug has
    been fixed in GCC 6, update the test to verify that there is no
    reference to undefined symbol in executable
    
    Backport from master
    
    	* testsuite/ld-plugin/lto.exp: Update PR ld/12365 test for GCC 6.
Comment 22 Sourceware Commits 2023-06-23 11:33:16 UTC
The master branch has been updated by Alan Modra <amodra@sourceware.org>:

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

commit 0ec2cde4f48fbe19c72d0963101888743015041e
Author: Alan Modra <amodra@gmail.com>
Date:   Fri Jun 23 11:36:13 2023 +0930

    lto test fails with -fno-inline in CFLAGS
    
    Putting -fno-inline in CFLAGS results in these failures.
    FAIL: Build liblto-17b.so 1
    FAIL: PR ld/12365
    FAIL: PR ld/13183
    
            * ld-plugin/lto.exp: Add -finline to compiler flags in some tests.