binutils-gdb/ld/testsuite/ld-scripts/defined5.d
Alan Modra 89753bbf81 Warn when a script redefines a symbol
Note that we don't even warn if scripts adjust a symbol as in
ld-elf/var1 and ld-scripts/pr14962.

include/
	* bfdlink.h (struct bfd_link_info): Add warn_multiple_definition.
ld/
	* ldexp.c (exp_fold_tree_1): Warn on script defining a symbol
	defined in an object file.
	* ldmain.c (multiple_definition): Heed info->warn_multiple_definition.
	* testsuite/ld-scripts/defined5.d: Expect a warning.
2021-02-21 14:28:16 +10:30

12 lines
295 B
Makefile

#ld: -Tdefined5.t
#warning: .*multiple definition of `defined'.*
#nm: -B
#xfail: [is_xcoff_format]
# xcoff outputs value of "defined" from the object file
# Check that a script can override an object file symbol, if multiple
# definitions are allowed. See pr12356.
#...
0+1000 D defined
#pass