From 0672748ac053cc4f8159af0d21ca88ae8b3778e6 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Fri, 30 Apr 2010 18:27:32 +0000 Subject: Remove relocation against discarded sections for relocatable link. bfd/ 2010-04-30 H.J. Lu PR ld/11542 * elf-bfd.h (RELOC_AGAINST_DISCARDED_SECTION): New. * elf32-i386.c (elf_i386_relocate_section): Use it. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. ld/testsuite/ 2010-04-30 H.J. Lu PR ld/11542 * ld-elf/discard.ld: New. * ld-elf/discard1.d: Likewise. * ld-elf/discard1.s: Likewise. * ld-elf/discard2.d: Likewise. * ld-elf/discard2.s: Likewise. * ld-elf/discard3.d: Likewise. --- ld/testsuite/ChangeLog | 10 ++++++++++ ld/testsuite/ld-elf/discard.ld | 3 +++ ld/testsuite/ld-elf/discard1.d | 9 +++++++++ ld/testsuite/ld-elf/discard1.s | 11 +++++++++++ ld/testsuite/ld-elf/discard2.d | 9 +++++++++ ld/testsuite/ld-elf/discard2.s | 12 ++++++++++++ ld/testsuite/ld-elf/discard3.d | 11 +++++++++++ 7 files changed, 65 insertions(+) create mode 100644 ld/testsuite/ld-elf/discard.ld create mode 100644 ld/testsuite/ld-elf/discard1.d create mode 100644 ld/testsuite/ld-elf/discard1.s create mode 100644 ld/testsuite/ld-elf/discard2.d create mode 100644 ld/testsuite/ld-elf/discard2.s create mode 100644 ld/testsuite/ld-elf/discard3.d (limited to 'ld') diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index 2239cf6..34666d9 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,13 @@ +2010-04-30 H.J. Lu + + PR ld/11542 + * ld-elf/discard.ld: New. + * ld-elf/discard1.d: Likewise. + * ld-elf/discard1.s: Likewise. + * ld-elf/discard2.d: Likewise. + * ld-elf/discard2.s: Likewise. + * ld-elf/discard3.d: Likewise. + 2010-04-22 Alan Modra * ld-elf/extract-symbol-1sec.d: Update lma. diff --git a/ld/testsuite/ld-elf/discard.ld b/ld/testsuite/ld-elf/discard.ld new file mode 100644 index 0000000..bd094f2 --- /dev/null +++ b/ld/testsuite/ld-elf/discard.ld @@ -0,0 +1,3 @@ +SECTIONS { + /DISCARD/ : { *(.discard) } +} diff --git a/ld/testsuite/ld-elf/discard1.d b/ld/testsuite/ld-elf/discard1.d new file mode 100644 index 0000000..b80fbf0 --- /dev/null +++ b/ld/testsuite/ld-elf/discard1.d @@ -0,0 +1,9 @@ +#source: discard1.s +#ld: -r -T discard.ld +#readelf: -r +#target: x86_64-*-linux-gnu i?86-*-linux-gnu + +Relocation section '.rel.*.debug_info' at offset 0x[0-9a-z]+ contains 1 entries: +[ \t]+Offset[ \t]+Info[ \t]+Type[ \t]+Sym.* +[0-9a-f]+[ \t]+[0-9a-f]+[ \t]+R_.*[ \t]+[0-9a-f]+[ \t]+bar.* +#pass diff --git a/ld/testsuite/ld-elf/discard1.s b/ld/testsuite/ld-elf/discard1.s new file mode 100644 index 0000000..ac3b92f --- /dev/null +++ b/ld/testsuite/ld-elf/discard1.s @@ -0,0 +1,11 @@ + .globl bar + .data +bar: + .long 1 + .section .discard,"aw",%progbits + .align 4 +there: + .long 2 + .section .debug_info,"",%progbits + .long bar + .long there diff --git a/ld/testsuite/ld-elf/discard2.d b/ld/testsuite/ld-elf/discard2.d new file mode 100644 index 0000000..65a3abe --- /dev/null +++ b/ld/testsuite/ld-elf/discard2.d @@ -0,0 +1,9 @@ +#source: discard2.s +#ld: -r -T discard.ld +#readelf: -r +#target: x86_64-*-linux-gnu i?86-*-linux-gnu + +Relocation section '.rel.*.debug_info' at offset 0x[0-9a-z]+ contains 1 entries: +[ \t]+Offset[ \t]+Info[ \t]+Type[ \t]+Sym.* +[0-9a-f]+[ \t]+[0-9a-f]+[ \t]+R_.*[ \t]+[0-9a-f]+[ \t]+here.* +#pass diff --git a/ld/testsuite/ld-elf/discard2.s b/ld/testsuite/ld-elf/discard2.s new file mode 100644 index 0000000..27b66f4 --- /dev/null +++ b/ld/testsuite/ld-elf/discard2.s @@ -0,0 +1,12 @@ + .globl here + .data +here: + .long 1 + .globl there + .section .discard,"aw",%progbits + .align 4 +there: + .long 2 + .section .debug_info,"",%progbits + .long here + .long there diff --git a/ld/testsuite/ld-elf/discard3.d b/ld/testsuite/ld-elf/discard3.d new file mode 100644 index 0000000..07962b5 --- /dev/null +++ b/ld/testsuite/ld-elf/discard3.d @@ -0,0 +1,11 @@ +#source: discard1.s +#source: discard2.s +#ld: -r -T discard.ld +#readelf: -r +#target: x86_64-*-linux-gnu i?86-*-linux-gnu + +Relocation section '.rel.*.debug_info' at offset 0x[0-9a-z]+ contains 2 entries: +[ \t]+Offset[ \t]+Info[ \t]+Type[ \t]+Sym.* +[0-9a-f]+[ \t]+[0-9a-f]+[ \t]+R_.*[ \t]+[0-9a-f]+[ \t]+bar.* +[0-9a-f]+[ \t]+[0-9a-f]+[ \t]+R_.*[ \t]+[0-9a-f]+[ \t]+here.* +#pass -- cgit v1.1