diff options
author | Nick Clifton <nickc@redhat.com> | 2017-08-17 14:49:01 +0100 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2017-08-17 14:51:31 +0100 |
commit | 714da62f64ef5527a22a3e897f7e21f69e442ade (patch) | |
tree | 45c48c8f0b4f5e32642b76aad377379ac4532219 /binutils | |
parent | 545bc2b377db80aa6edd0cf00cde6f963735f8d1 (diff) | |
download | gdb-714da62f64ef5527a22a3e897f7e21f69e442ade.zip gdb-714da62f64ef5527a22a3e897f7e21f69e442ade.tar.gz gdb-714da62f64ef5527a22a3e897f7e21f69e442ade.tar.bz2 |
Add test of V2 GNU build attribute notes.
* testsuite/binutils-all/note-3-64.s: New test. Checks assembly
and decoding of version2 GNU build attribute notes.
* testsuite/binutils-all/note-3-32.s: New test. 32-bit version of
the above test.
* testsuite/binutils-all/note-3-64.d: New test driver.
* testsuite/binutils-all/note-3-32.d: New test driver.
* testsuite/binutils-all/objcopy.exp: Run the new test.
* readelf.c (is_64bit_abs_reloc): Add R_SPARC_64.
Diffstat (limited to 'binutils')
-rw-r--r-- | binutils/ChangeLog | 11 | ||||
-rw-r--r-- | binutils/readelf.c | 3 | ||||
-rw-r--r-- | binutils/testsuite/binutils-all/note-3-32.d | 18 | ||||
-rw-r--r-- | binutils/testsuite/binutils-all/note-3-32.s | 57 | ||||
-rw-r--r-- | binutils/testsuite/binutils-all/note-3-64.d | 18 | ||||
-rw-r--r-- | binutils/testsuite/binutils-all/note-3-64.s | 57 | ||||
-rw-r--r-- | binutils/testsuite/binutils-all/note-3.32.s | 67 | ||||
-rw-r--r-- | binutils/testsuite/binutils-all/objcopy.exp | 2 |
8 files changed, 232 insertions, 1 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 1e37ac6..3467f09 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,14 @@ +2017-08-17 Nick Clifton <nickc@redhat.com> + + * testsuite/binutils-all/note-3-64.s: New test. Checks assembly + and decoding of version2 GNU build attribute notes. + * testsuite/binutils-all/note-3-32.s: New test. 32-bit version of + the above test. + * testsuite/binutils-all/note-3-64.d: New test driver. + * testsuite/binutils-all/note-3-32.d: New test driver. + * testsuite/binutils-all/objcopy.exp: Run the new test. + * readelf.c (is_64bit_abs_reloc): Add R_SPARC_64. + 2017-08-14 Gustavo Romero <gromero@linux.vnet.ibm.com> * readelf.c (get_note_type): Handle PPC note types available diff --git a/binutils/readelf.c b/binutils/readelf.c index 4bd68f2..1992126 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -12296,7 +12296,8 @@ is_64bit_abs_reloc (unsigned int reloc_type) case EM_SPARC32PLUS: case EM_SPARCV9: case EM_SPARC: - return reloc_type == 54; /* R_SPARC_UA64. */ + return reloc_type == 32 /* R_SPARC_64. */ + || reloc_type == 54; /* R_SPARC_UA64. */ case EM_X86_64: case EM_L1OM: case EM_K1OM: diff --git a/binutils/testsuite/binutils-all/note-3-32.d b/binutils/testsuite/binutils-all/note-3-32.d new file mode 100644 index 0000000..fa571b0 --- /dev/null +++ b/binutils/testsuite/binutils-all/note-3-32.d @@ -0,0 +1,18 @@ +#PROG: objcopy +#readelf: --notes --wide +#objcopy: --merge-notes +#name: v2 gnu build attribute notes (32-bit) +#source: note-3-32.s + +#... +Displaying notes found in: .gnu.build.attributes +[ ]+Owner[ ]+Data size[ ]+Description +[ ]+GA\$<version>2p1[ ]+0x0000000.[ ]+NT_GNU_BUILD_ATTRIBUTE_OPEN[ ]+Applies from offset 0x100 \(file: note_1.s\) +[ ]+GA\$<tool>gcc 6.3.1 20161221[ ]+0x00000000[ ]+NT_GNU_BUILD_ATTRIBUTE_OPEN[ ]+Applies from offset 0x100 +[ ]+GA\*GOW:0x700[ ]+0x00000000[ ]+NT_GNU_BUILD_ATTRIBUTE_OPEN[ ]+Applies from offset 0x100 +[ ]+GA\*<stack prot>off[ ]+0x00000000[ ]+NT_GNU_BUILD_ATTRIBUTE_OPEN[ ]+Applies from offset 0x100 +[ ]+GA\*FORTIFY:0xff[ ]+0x00000000[ ]+NT_GNU_BUILD_ATTRIBUTE_OPEN[ ]+Applies from offset 0x100 +[ ]+GA\*<PIC>PIC[ ]+0x00000000[ ]+NT_GNU_BUILD_ATTRIBUTE_OPEN[ ]+Applies from offset 0x100 +[ ]+GA\!<short enum>false[ ]+0x00000000[ ]+NT_GNU_BUILD_ATTRIBUTE_OPEN[ ]+Applies from offset 0x100 +[ ]+GA\*<ABI>0x[0-9a-f]+[ ]+0x00000000[ ]+NT_GNU_BUILD_ATTRIBUTE_OPEN[ ]+Applies from offset 0x100 +#... diff --git a/binutils/testsuite/binutils-all/note-3-32.s b/binutils/testsuite/binutils-all/note-3-32.s new file mode 100644 index 0000000..4dbbebe --- /dev/null +++ b/binutils/testsuite/binutils-all/note-3-32.s @@ -0,0 +1,57 @@ + .text + .org 0x100 + .global note_1.s +note_1.s: + .word 0 + + .pushsection .gnu.build.attributes, "", %note + .balign 4 + + .dc.l 8 + .dc.l 4 + .dc.l 0x100 + .asciz "GA$2p1" + .dc.l note_1.s + + .dc.l 23 + .dc.l 0 + .dc.l 0x100 + .asciz "GA$gcc 6.3.1 20161221" + .dc.b 0 + + .dc.l 10 + .dc.l 0 + .dc.l 0x100 + .dc.b 0x47, 0x41, 0x2a, 0x47, 0x4f, 0x57, 0, 0, 0x7, 0 + .dc.b 0, 0 + + .dc.l 6 + .dc.l 0 + .dc.l 0x100 + .dc.b 0x47, 0x41, 0x2a, 0x2, 0, 0 + .dc.b 0, 0 + + .dc.l 13 + .dc.l 0 + .dc.l 0x100 + .dc.b 0x47, 0x41, 0x2a, 0x46, 0x4f, 0x52, 0x54, 0x49, 0x46, 0x59, 0, 0xff, 0 + .dc.b 0, 0, 0 + + .dc.l 6 + .dc.l 0 + .dc.l 0x100 + .dc.b 0x47, 0x41, 0x2a, 0x7, 0x2, 0 + .dc.b 0, 0 + + .dc.l 5 + .dc.l 0 + .dc.l 0x100 + .dc.b 0x47, 0x41, 0x21, 0x8, 0 + .dc.b 0, 0, 0 + + .dc.l 13 + .dc.l 0 + .dc.l 0x100 + .dc.b 0x47, 0x41, 0x2a, 0x6, 0xf2, 0x3, 0x38, 0xee, 0xce, 0xfa, 0x5e, 0x3c, 0 + .dc.b 0, 0, 0 + .popsection diff --git a/binutils/testsuite/binutils-all/note-3-64.d b/binutils/testsuite/binutils-all/note-3-64.d new file mode 100644 index 0000000..f048e8b --- /dev/null +++ b/binutils/testsuite/binutils-all/note-3-64.d @@ -0,0 +1,18 @@ +#PROG: objcopy +#readelf: --notes --wide +#objcopy: --merge-notes +#name: v2 gnu build attribute notes (64-bit) +#source: note-3-64.s + +#... +Displaying notes found in: .gnu.build.attributes +[ ]+Owner[ ]+Data size[ ]+Description +[ ]+GA\$<version>2p1[ ]+0x0000000.[ ]+NT_GNU_BUILD_ATTRIBUTE_OPEN[ ]+Applies from offset 0x100 \(file: note_1.s\) +[ ]+GA\$<tool>gcc 6.3.1 20161221[ ]+0x00000000[ ]+NT_GNU_BUILD_ATTRIBUTE_OPEN[ ]+Applies from offset 0x100 +[ ]+GA\*GOW:0x700[ ]+0x00000000[ ]+NT_GNU_BUILD_ATTRIBUTE_OPEN[ ]+Applies from offset 0x100 +[ ]+GA\*<stack prot>off[ ]+0x00000000[ ]+NT_GNU_BUILD_ATTRIBUTE_OPEN[ ]+Applies from offset 0x100 +[ ]+GA\*FORTIFY:0xff[ ]+0x00000000[ ]+NT_GNU_BUILD_ATTRIBUTE_OPEN[ ]+Applies from offset 0x100 +[ ]+GA\*<PIC>PIC[ ]+0x00000000[ ]+NT_GNU_BUILD_ATTRIBUTE_OPEN[ ]+Applies from offset 0x100 +[ ]+GA\!<short enum>false[ ]+0x00000000[ ]+NT_GNU_BUILD_ATTRIBUTE_OPEN[ ]+Applies from offset 0x100 +[ ]+GA\*<ABI>0x[0-9a-f]+[ ]+0x00000000[ ]+NT_GNU_BUILD_ATTRIBUTE_OPEN[ ]+Applies from offset 0x100 +#... diff --git a/binutils/testsuite/binutils-all/note-3-64.s b/binutils/testsuite/binutils-all/note-3-64.s new file mode 100644 index 0000000..42f3e48 --- /dev/null +++ b/binutils/testsuite/binutils-all/note-3-64.s @@ -0,0 +1,57 @@ + .text + .org 0x100 + .global note_1.s +note_1.s: + .word 0 + + .pushsection .gnu.build.attributes, "", %note + .balign 4 + + .dc.l 8 + .dc.l 8 + .dc.l 0x100 + .asciz "GA$2p1" + .8byte note_1.s + + .dc.l 23 + .dc.l 0 + .dc.l 0x100 + .asciz "GA$gcc 6.3.1 20161221" + .dc.b 0 + + .dc.l 10 + .dc.l 0 + .dc.l 0x100 + .dc.b 0x47, 0x41, 0x2a, 0x47, 0x4f, 0x57, 0, 0, 0x7, 0 + .dc.b 0, 0 + + .dc.l 6 + .dc.l 0 + .dc.l 0x100 + .dc.b 0x47, 0x41, 0x2a, 0x2, 0, 0 + .dc.b 0, 0 + + .dc.l 13 + .dc.l 0 + .dc.l 0x100 + .dc.b 0x47, 0x41, 0x2a, 0x46, 0x4f, 0x52, 0x54, 0x49, 0x46, 0x59, 0, 0xff, 0 + .dc.b 0, 0, 0 + + .dc.l 6 + .dc.l 0 + .dc.l 0x100 + .dc.b 0x47, 0x41, 0x2a, 0x7, 0x2, 0 + .dc.b 0, 0 + + .dc.l 5 + .dc.l 0 + .dc.l 0x100 + .dc.b 0x47, 0x41, 0x21, 0x8, 0 + .dc.b 0, 0, 0 + + .dc.l 13 + .dc.l 0 + .dc.l 0x100 + .dc.b 0x47, 0x41, 0x2a, 0x6, 0xf2, 0x3, 0x38, 0xee, 0xce, 0xfa, 0x5e, 0x3c, 0 + .dc.b 0, 0, 0 + .popsection diff --git a/binutils/testsuite/binutils-all/note-3.32.s b/binutils/testsuite/binutils-all/note-3.32.s new file mode 100644 index 0000000..84d8c89 --- /dev/null +++ b/binutils/testsuite/binutils-all/note-3.32.s @@ -0,0 +1,67 @@ + .text + .org 0x100 + .global note1.s +note1.s: + .word 0 + + .pushsection .gnu.build.attributes, "", %note + .balign 4 + + .dc.l 8 + .dc.l 8 + .dc.l 0x100 + .asciz "GA$2p1" + .quad note_1.s + + .dc.l 23 + .dc.l 0 + .dc.l 0x100 + .asciz "GA$gcc 6.3.1 20161221" + .dc.b 0 + + .dc.l 10 + .dc.l 0 + .dc.l 0x100 + .dc.b 0x47, 0x41, 0x2a, 0x47, 0x4f, 0x57, 0, 0, 0x7, 0 + .dc.b 0, 0 + + .dc.l 6 + .dc.l 0 + .dc.l 0x100 + .dc.b 0x47, 0x41, 0x2a, 0x2, 0, 0 + .dc.b 0, 0 + + .dc.l 13 + .dc.l 0 + .dc.l 0x100 + .dc.b 0x47, 0x41, 0x2a, 0x46, 0x4f, 0x52, 0x54, 0x49, 0x46, 0x59, 0, 0xff, 0 + .dc.b 0, 0, 0 + + .dc.l 6 + .dc.l 0 + .dc.l 0x100 + .dc.b 0x47, 0x41, 0x2a, 0x7, 0x2, 0 + .dc.b 0, 0 + + .dc.l 5 + .dc.l 0 + .dc.l 0x100 + .dc.b 0x47, 0x41, 0x21, 0x8, 0 + .dc.b 0, 0, 0 + + .dc.l 13 + .dc.l 0 + .dc.l 0x100 + .dc.b 0x47, 0x41, 0x2a, 0x6, 0xf2, 0x3, 0x38, 0xee, 0xce, 0xfa, 0x5e, 0x3c, 0 + .dc.b 0, 0, 0 + + .pushsection .note.gnu.property, "a", %note + .balign 4 + .dc.l 4 + .dc.l 32 + .dc.l 0x5 + .asciz "GNU" + .dc.b 0, 0, 0, 0xc0, 0x4, 0, 0, 0 + .dc.b 0, 0x6, 0, 0, 0, 0, 0, 0 + .dc.b 0x1, 0, 0, 0xc0, 0x4, 0, 0, 0 + .dc.b 0, 0x6, 0, 0, 0, 0, 0, 0 diff --git a/binutils/testsuite/binutils-all/objcopy.exp b/binutils/testsuite/binutils-all/objcopy.exp index 14e8f1d..ef62edf 100644 --- a/binutils/testsuite/binutils-all/objcopy.exp +++ b/binutils/testsuite/binutils-all/objcopy.exp @@ -1056,8 +1056,10 @@ if [is_elf_format] { run_dump_test "note-1" if [is_elf64 tmpdir/bintest.o] { run_dump_test "note-2-64" + run_dump_test "note-3-64" } else { run_dump_test "note-2-32" + run_dump_test "note-3-32" } } |