diff options
Diffstat (limited to 'ld')
-rw-r--r-- | ld/ChangeLog | 11 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/pr20828-1.sd | 12 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/pr20828-2a.sd | 9 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/pr20828-2b.sd | 7 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/pr20828.ld | 19 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/pr20828.s | 2 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/pr20828.ver | 1 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/shared.exp | 47 |
8 files changed, 108 insertions, 0 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog index 080697e..da85561 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,5 +1,16 @@ 2017-01-18 Maciej W. Rozycki <macro@imgtec.com> + PR ld/20828 + * testsuite/ld-elf/pr20828-1.sd: New test. + * testsuite/ld-elf/pr20828-2a.sd: New test. + * testsuite/ld-elf/pr20828-2b.sd: New test. + * testsuite/ld-elf/pr20828.ld: New test linker script. + * testsuite/ld-elf/pr20828.ver: New test version script. + * testsuite/ld-elf/pr20828.s: New test source. + * testsuite/ld-elf/shared.exp: Run the new test. + +2017-01-18 Maciej W. Rozycki <macro@imgtec.com> + PR gas/20649 * testsuite/ld-mips-elf/mips-elf.exp: Add PIC comdat GOT16/LO16 relocation pairing link test. diff --git a/ld/testsuite/ld-elf/pr20828-1.sd b/ld/testsuite/ld-elf/pr20828-1.sd new file mode 100644 index 0000000..c47eb1d --- /dev/null +++ b/ld/testsuite/ld-elf/pr20828-1.sd @@ -0,0 +1,12 @@ +# Make sure symbols are global rather than local in the dynamic symbol table, +# e.g.: +# Num: Value Size Type Bind Vis Ndx Name +# 1: 00000000 0 NOTYPE GLOBAL DEFAULT 1 _fdata +# 2: 00000000 0 NOTYPE GLOBAL DEFAULT 1 _edata +# vs: +# 1: 00000000 0 NOTYPE LOCAL DEFAULT 1 _fdata +# 2: 00000000 0 NOTYPE LOCAL DEFAULT 1 _edata +#... + *[0-9]+: +[0-9a-f]+ +0 +NOTYPE +GLOBAL +DEFAULT +[0-9]+ +_fdata + *[0-9]+: +[0-9a-f]+ +0 +NOTYPE +GLOBAL +DEFAULT +[0-9]+ +_edata +#pass diff --git a/ld/testsuite/ld-elf/pr20828-2a.sd b/ld/testsuite/ld-elf/pr20828-2a.sd new file mode 100644 index 0000000..c4b239b --- /dev/null +++ b/ld/testsuite/ld-elf/pr20828-2a.sd @@ -0,0 +1,9 @@ +# Make sure `_edata' is global rather than local in the dynamic symbol table, +# e.g.: +# Num: Value Size Type Bind Vis Ndx Name +# 1: 00000000 0 NOTYPE GLOBAL DEFAULT 1 _edata +# vs: +# 1: 00000000 0 NOTYPE LOCAL DEFAULT 1 _edata +#... + *[0-9]+: +[0-9a-f]+ +0 +NOTYPE +GLOBAL +DEFAULT +[0-9]+ +_edata +#pass diff --git a/ld/testsuite/ld-elf/pr20828-2b.sd b/ld/testsuite/ld-elf/pr20828-2b.sd new file mode 100644 index 0000000..8089c48 --- /dev/null +++ b/ld/testsuite/ld-elf/pr20828-2b.sd @@ -0,0 +1,7 @@ +# Make sure no `_fdata' is present in the dynamic symbol table, e.g.: +# Num: Value Size Type Bind Vis Ndx Name +# 1: 00000000 0 NOTYPE LOCAL DEFAULT 1 _fdata +#failif +#... +.+ +_fdata +#pass diff --git a/ld/testsuite/ld-elf/pr20828.ld b/ld/testsuite/ld-elf/pr20828.ld new file mode 100644 index 0000000..9ca1943 --- /dev/null +++ b/ld/testsuite/ld-elf/pr20828.ld @@ -0,0 +1,19 @@ +SECTIONS +{ + .data : + { + _fdata = .; + *(.data) + _edata = .; + } + .dynamic : { *(.dynamic) } + .hash : { *(.hash) } + .dynsym : { *(.dynsym) } + .dynstr : { *(.dynstr) } + .shstrtab : { *(.shstrtab) } + .symtab : { *(.symtab) } + .strtab : { *(.strtab) } + .got.plt : { *(.got.plt) } + .got : { *(.got) } + /DISCARD/ : { *(*) } +} diff --git a/ld/testsuite/ld-elf/pr20828.s b/ld/testsuite/ld-elf/pr20828.s new file mode 100644 index 0000000..ece49d5 --- /dev/null +++ b/ld/testsuite/ld-elf/pr20828.s @@ -0,0 +1,2 @@ + .data + .byte 0 diff --git a/ld/testsuite/ld-elf/pr20828.ver b/ld/testsuite/ld-elf/pr20828.ver new file mode 100644 index 0000000..7d0fa22 --- /dev/null +++ b/ld/testsuite/ld-elf/pr20828.ver @@ -0,0 +1 @@ +{ global: _edata; local: *; }; diff --git a/ld/testsuite/ld-elf/shared.exp b/ld/testsuite/ld-elf/shared.exp index 3cdac45..dfbf438 100644 --- a/ld/testsuite/ld-elf/shared.exp +++ b/ld/testsuite/ld-elf/shared.exp @@ -32,6 +32,53 @@ if ![is_elf_format] { return } +# This target requires extra GAS options when building code for shared +# libraries. +set AFLAGS_PIC "" +if [istarget "tic6x-*-*"] { + append AFLAGS_PIC " -mpic -mpid=near" +} +# This target requires a non-default emulation for successful shared +# library/executable builds. +set LFLAGS "" +if [istarget "tic6x-*-*"] { + append LFLAGS " -melf32_tic6x_le" +} + +# PR ld/20828 check for correct dynamic symbol table entries where: +# - symbols have been defined with a linker script, +# - the same symbols have been seen in shared library used in the link, +# - the shared library symbols have been swept in section garbage collection. +# Verify that the symbols are global rather than local and that a version +# script adjusts them accordingly. +if { [check_gc_sections_available] } { + run_ld_link_tests [list \ + [list \ + "PR ld/20828 dynamic symbols with section GC\ + (auxiliary shared library)" \ + "$LFLAGS -shared --gc-sections -T pr20828.ld" "" "$AFLAGS_PIC" \ + {pr20828.s} \ + {{readelf --dyn-syms pr20828-1.sd}} \ + "libpr20828.so"] \ + [list \ + "PR ld/20828 dynamic symbols with section GC (plain)" \ + "$LFLAGS -shared --gc-sections -T pr20828.ld" \ + "tmpdir/libpr20828.so" "$AFLAGS_PIC" \ + {pr20828.s} \ + {{readelf --dyn-syms pr20828-1.sd}} \ + "pr20828-1.so"] \ + [list \ + "PR ld/20828 dynamic symbols with section GC (version script)" \ + "$LFLAGS -shared --gc-sections -T pr20828.ld\ + --version-script=pr20828.ver" \ + "tmpdir/libpr20828.so" \ + "$AFLAGS_PIC" \ + {pr20828.s} \ + {{readelf --dyn-syms pr20828-2a.sd} \ + {readelf --dyn-syms pr20828-2b.sd}} \ + "pr20828-2.so"]] +} + # Check to see if the C compiler works if { [which $CC] == 0 } { return |