binutils-gdb/ld/testsuite
H.J. Lu a4819f54c0 Treat common symbol as undefined for --no-define-common
When --no-define-common is used to build shared library, treat common
symbol as undefined so that common symbols that are referenced from a
shared library to be assigned addresses only in the main program.  This
eliminates the unused duplicate space in the shared library, and also
prevents any possible confusion over resolving to the wrong duplicate
when there are many dynamic modules with specialized search paths for
runtime symbol resolution.

--no-define-common is only allowed when building a shared library.

bfd/

	PR ld/21903:
	* elflink.c (elf_link_add_object_symbols): Treat common symbol
	as undefined for --no-define-common.

include/

	PR ld/21903:
	* bfdlink.h (bfd_link_info): Add inhibit_common_definition.

ld/

	PR ld/21903:
	* ld.h (command_line): Remove inhibit_common_definition.
	* ldgram.y: Replace command_line.inhibit_common_definition with
	link_info.inhibit_common_definition.
	* ldlang.c (lang_common): Likewise.
	* lexsup.c (parse_args): Likewise.
	* ldmain.c (main): Only allow --no-define-common with -shared.
	* testsuite/ld-elf/pr21903.s: New file.
	* testsuite/ld-elf/pr21903a.d: Likewise.
	* testsuite/ld-elf/pr21903b.d: Likewise.
	* testsuite/ld-elf/pr21903c.d: Likewise.
	* testsuite/ld-elf/pr21903d.d: Likewise.
	* testsuite/ld-elf/pr21903e.d: Likewise.
2017-08-06 08:19:04 -07:00
..
config
ld-aarch64 [AArch64] Use "#pass" instead of "#..." to filter multiple lines 2017-07-11 11:29:51 +01:00
ld-alpha
ld-arc [ARC] Fix big-endian ld tests errors. 2017-07-24 10:10:21 +02:00
ld-arm [ARM] Add linker support for ARMv8-R 2017-06-24 10:48:08 +01:00
ld-auto-import
ld-avr This patch introduces support for specifing views in .loc directives, so that the compiler can use the assembler to generate line number information and have the assembler determine view numbers to multiple views at the same program counter. 2017-07-21 10:13:18 +01:00
ld-bootstrap
ld-cdtest
ld-checks
ld-cris
ld-crx
ld-cygwin
ld-d10v
ld-discard
ld-elf Treat common symbol as undefined for --no-define-common 2017-08-06 08:19:04 -07:00
ld-elfcomm Fix spelling typos. 2017-07-18 16:58:14 +01:00
ld-elfvers
ld-elfvsb Pass $NOPIE_CFLAGS to ELF visibility tests 2017-06-22 12:53:39 -07:00
ld-elfweak
ld-fastcall
ld-frv
ld-gc Pass $NOPIE_CFLAGS and $NOPIE_LDFLAGS to more ELF tests 2017-06-22 09:53:33 -07:00
ld-h8300
ld-i386 i386: Add tests for PIE with undefined weak symbol 2017-07-17 12:42:32 -07:00
ld-ia64
ld-ifunc
ld-libs
ld-linkonce
ld-m68hc11
ld-m68k
ld-mep
ld-metag
ld-mips-elf MIPS/LD: Fix a segfault from ELF `e_flags' access with non-ELF output BFD 2017-07-07 17:58:03 +01:00
ld-misc
ld-mmix
ld-mn10300
ld-nds32 Fix address violation when disassembling a corrupt binary. 2017-06-14 16:50:03 +01:00
ld-nios2
ld-pe
ld-pie
ld-plugin
ld-powerpc __tls_get_addr_opt stub eh_frame info 2017-07-25 15:14:39 +09:30
ld-pru
ld-s390
ld-scripts Make some improvements to how SORT_* specifiers and EXCLUDE_FILE specifiers are handled in the linker script grammar. 2017-07-28 13:01:10 +01:00
ld-selective Support single digit GCC version 2017-07-11 08:41:22 -07:00
ld-sh
ld-shared Pass $NOPIE_CFLAGS and $NOPIE_LDFLAGS to more ELF tests 2017-06-22 09:53:33 -07:00
ld-size Pass $NOPIE_LDFLAGS size tests 2017-06-21 14:45:57 -07:00
ld-sparc
ld-spu
ld-srec Pass $NOPIE_LDFLAGS size tests 2017-06-21 14:45:57 -07:00
ld-tic6x
ld-tilegx
ld-tilepro
ld-undefined
ld-unique Don't fail in elf32_hppa_set_gp 2017-08-05 23:28:21 +09:30
ld-v850
ld-vax-elf
ld-versados
ld-visium
ld-vxworks
ld-x86-64 x86-64: Limit PIC check to shared library build 2017-07-17 12:17:59 -07:00
ld-xc16x
ld-xstormy16
ld-xtensa
ld-z8k
lib is_underscore_target for ld-elf tests 2017-06-18 11:56:19 +09:30
ChangeLog-2004
ChangeLog-2005
ChangeLog-2006
ChangeLog-2007
ChangeLog-2008
ChangeLog-2009
ChangeLog-2010
ChangeLog-2011
ChangeLog-2012
ChangeLog-2013
ChangeLog-2014
ChangeLog-2015
ChangeLog-9303