binutils-gdb/ld/testsuite/ld-elf/pr23162b.c
H.J. Lu 9bc935ef33 x86: Mark __bss_start, _end and _edata locally defined
__bss_start, _end and _edata are defined by linker to mark regions
within executables and shared libraries.  All references within
executables should be locally resolved.

This patch doesn't change how their references within shared libraries
are resolved.

bfd/

	PR ld/23162
	* elfxx-x86.c (elf_x86_linker_defined): New function.
	(_bfd_x86_elf_link_check_relocs): Use it to mark __bss_start,
	_end and _edata locally defined within executables.

ld/

	PR ld/23162
	* testsuite/ld-elf/pr23162.map: New file.
	* testsuite/ld-elf/pr23162.rd: Likewise.
	* testsuite/ld-elf/pr23162a.c: Likewise.
	* testsuite/ld-elf/pr23162b.c: Likewise.
	* testsuite/ld-elf/shared.exp: Run PR ld/23162 tests.
2018-05-14 03:48:02 -07:00

21 lines
285 B
C

static char *_edata_p;
static char *_end_p;
static char *__bss_start_p;
extern char *_end;
extern char *_edata;
extern char *__bss_start;
void
bar (void)
{
_edata_p = (char*) &_edata;
_end_p = (char*) &_end;
__bss_start_p = (char*) &__bss_start;
}
void
_start ()
{
bar ();
}