diff options
author | Jan Beulich <jbeulich@novell.com> | 2015-12-08 10:14:49 +0100 |
---|---|---|
committer | Jan Beulich <jbeulich@suse.com> | 2015-12-08 10:14:49 +0100 |
commit | ec9ab52c3217835113f22431911fda3474598fcd (patch) | |
tree | 834afb66790e7d5b8e49a7d02274a88382c1e960 /gas/testsuite | |
parent | 35c1a4396497a4009c99e5587aa908bb6df4e1e6 (diff) | |
download | gdb-ec9ab52c3217835113f22431911fda3474598fcd.zip gdb-ec9ab52c3217835113f22431911fda3474598fcd.tar.gz gdb-ec9ab52c3217835113f22431911fda3474598fcd.tar.bz2 |
gas: consistently emit diagnostics for non-zero data emission to .bss/.struct
Diffstat (limited to 'gas/testsuite')
-rw-r--r-- | gas/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gas/testsuite/gas/elf/bad-bss.d | 4 | ||||
-rw-r--r-- | gas/testsuite/gas/elf/bad-bss.err | 63 | ||||
-rw-r--r-- | gas/testsuite/gas/elf/bss.d | 24 | ||||
-rw-r--r-- | gas/testsuite/gas/elf/bss.s | 56 | ||||
-rw-r--r-- | gas/testsuite/gas/elf/elf.exp | 2 |
6 files changed, 155 insertions, 0 deletions
diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index bc524e9..a90b0fb 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,5 +1,11 @@ 2015-12-08 Jan Beulich <jbeulich@suse.com> + * gas/elf/bad-bss.d, gas/elf/bad-bss.err: New. + * gas/elf/bss.d, gas/elf/bss.s: New. + * gas/elf/elf.exp: Run new tests. + +2015-12-08 Jan Beulich <jbeulich@suse.com> + * gas/elf/file-2.s, gas/elf/file-2.d: New. * gas/elf/elf.exp: Run new test. * gas/elf/file.d: Adjust expectations. diff --git a/gas/testsuite/gas/elf/bad-bss.d b/gas/testsuite/gas/elf/bad-bss.d new file mode 100644 index 0000000..98721cf --- /dev/null +++ b/gas/testsuite/gas/elf/bad-bss.d @@ -0,0 +1,4 @@ +#name: bad .bss / .struct data allocation directives +#source: bss.s +#error-output: bad-bss.err +#target: i?86-*-* x86_64-*-* ia64-*-* arm-*-* aarch64-*-* diff --git a/gas/testsuite/gas/elf/bad-bss.err b/gas/testsuite/gas/elf/bad-bss.err new file mode 100644 index 0000000..a2eccba --- /dev/null +++ b/gas/testsuite/gas/elf/bad-bss.err @@ -0,0 +1,63 @@ +.*bss\.s: Assembler messages: +.*bss\.s:[1-9][0-9]*: Warning: zero assumed.* +.*bss\.s:[1-9][0-9]*: Warning: zero assumed.* +.*bss\.s:[1-9][0-9]*: Warning: zero assumed.* +.*bss\.s:[1-9][0-9]*: Warning: zero assumed.* +.*bss\.s:[1-9][0-9]*: Error: attempt to store non-zero value in section .\.bss. +.*bss\.s:[1-9][0-9]*: Error: attempt to store non-zero value in section .\.bss. +.*bss\.s:[1-9][0-9]*: Error: attempt to store non-zero value in section .\.bss. +.*bss\.s:[1-9][0-9]*: Error: attempt to store float in section .\.bss. +.*bss\.s:[1-9][0-9]*: Warning: ignoring fill value in section .\.bss. +.*bss\.s:[1-9][0-9]*: Error: attempt to store non-empty string in section .\.bss. +.*bss\.s:[1-9][0-9]*: Error: attempt to store non-empty string in section .\.bss. +.*bss\.s:[1-9][0-9]*: Error: attempt to fill section .\.bss. with non-zero value +.*bss\.s:[1-9][0-9]*: Warning: ignoring fill value in section .\.bss. +.*bss\.s:[1-9][0-9]*: Warning: ignoring fill value in section .\.bss. +.*bss\.s:[1-9][0-9]*: Error: attempt to store non-zero value in section .\.bss. +.*bss\.s:[1-9][0-9]*: Error: attempt to store non-zero value in section .\.bss. +.*bss\.s:[1-9][0-9]*: Warning: zero assumed.* +.*bss\.s:[1-9][0-9]*: Warning: zero assumed.* +.*bss\.s:[1-9][0-9]*: Warning: zero assumed.* +.*bss\.s:[1-9][0-9]*: Warning: zero assumed.* +.*bss\.s:[1-9][0-9]*: Error: attempt to store non-zero value in section .\.bss\.local. +.*bss\.s:[1-9][0-9]*: Error: attempt to store non-zero value in section .\.bss\.local. +.*bss\.s:[1-9][0-9]*: Error: attempt to store non-zero value in section .\.bss\.local. +.*bss\.s:[1-9][0-9]*: Error: attempt to store float in section .\.bss\.local. +.*bss\.s:[1-9][0-9]*: Warning: ignoring fill value in section .\.bss\.local. +.*bss\.s:[1-9][0-9]*: Error: attempt to store non-empty string in section .\.bss\.local. +.*bss\.s:[1-9][0-9]*: Error: attempt to store non-empty string in section .\.bss\.local. +.*bss\.s:[1-9][0-9]*: Error: attempt to fill section .\.bss\.local. with non-zero value +.*bss\.s:[1-9][0-9]*: Warning: ignoring fill value in section .\.bss\.local. +.*bss\.s:[1-9][0-9]*: Warning: ignoring fill value in section .\.bss\.local. +.*bss\.s:[1-9][0-9]*: Error: attempt to store non-zero value in section .\.bss\.local. +.*bss\.s:[1-9][0-9]*: Error: attempt to store non-zero value in section .\.bss\.local. +.*bss\.s:[1-9][0-9]*: Warning: zero assumed.* +.*bss\.s:[1-9][0-9]*: Warning: zero assumed.* +.*bss\.s:[1-9][0-9]*: Warning: zero assumed.* +.*bss\.s:[1-9][0-9]*: Warning: zero assumed.* +.*bss\.s:[1-9][0-9]*: Error: attempt to store non-zero value in section .\.private. +.*bss\.s:[1-9][0-9]*: Error: attempt to store non-zero value in section .\.private. +.*bss\.s:[1-9][0-9]*: Error: attempt to store non-zero value in section .\.private. +.*bss\.s:[1-9][0-9]*: Error: attempt to store float in section .\.private. +.*bss\.s:[1-9][0-9]*: Warning: ignoring fill value in section .\.private. +.*bss\.s:[1-9][0-9]*: Error: attempt to store non-empty string in section .\.private. +.*bss\.s:[1-9][0-9]*: Error: attempt to store non-empty string in section .\.private. +.*bss\.s:[1-9][0-9]*: Error: attempt to fill section .\.private. with non-zero value +.*bss\.s:[1-9][0-9]*: Warning: ignoring fill value in section .\.private. +.*bss\.s:[1-9][0-9]*: Warning: ignoring fill value in section .\.private. +.*bss\.s:[1-9][0-9]*: Error: attempt to store non-zero value in section .\.private. +.*bss\.s:[1-9][0-9]*: Error: attempt to store non-zero value in section .\.private. +.*bss\.s:[1-9][0-9]*: Warning: zero assumed.* +.*bss\.s:[1-9][0-9]*: Warning: zero assumed.* +.*bss\.s:[1-9][0-9]*: Warning: zero assumed.* +.*bss\.s:[1-9][0-9]*: Warning: zero assumed.* +.*bss\.s:[1-9][0-9]*: Error: attempt to store value in absolute section +.*bss\.s:[1-9][0-9]*: Error: attempt to store value in absolute section +.*bss\.s:[1-9][0-9]*: Error: attempt to store value in absolute section +.*bss\.s:[1-9][0-9]*: Error: attempt to store float in absolute section +.*bss\.s:[1-9][0-9]*: Warning: ignoring fill value in absolute section +.*bss\.s:[1-9][0-9]*: Error: attempt to fill absolute section with non-zero value +.*bss\.s:[1-9][0-9]*: Warning: ignoring fill value in absolute section +.*bss\.s:[1-9][0-9]*: Warning: ignoring fill value in absolute section +.*bss\.s:[1-9][0-9]*: Error: attempt to store value in absolute section +.*bss\.s:[1-9][0-9]*: Error: attempt to store value in absolute section diff --git a/gas/testsuite/gas/elf/bss.d b/gas/testsuite/gas/elf/bss.d new file mode 100644 index 0000000..711e74a --- /dev/null +++ b/gas/testsuite/gas/elf/bss.d @@ -0,0 +1,24 @@ +#name: good .bss / .struct data allocation directives +#as: --defsym okay=1 +#warning: Warning: zero assumed +#readelf: -sSW +#target: i?86-*-* x86_64-*-* ia64-*-* arm-*-* aarch64-*-* + +There are [1-9][0-9]* section headers, starting at offset 0x[0-9a-f]*: + +Section Headers: +#... + *\[ [1-9]\] *\.bss +NOBITS +0*0 +0[0-9a-f]* 0*(28|40) +0*0 +WA +0 +0 +32 + *\[ [1-9]\] *\.bss\.local +NOBITS +0*0 +0[0-9a-f]* 0*(28|40) +0*0 +WA +0 +0 +32 + *\[ [1-9]\] *\.private +NOBITS +0*0 +0[0-9a-f]* 0*(28|40) +0*0 +WA +0 +0 +32 +#... +Symbol table '\.symtab' contains [1-9][0-9]* entries: +#... + *[0-9]*: 0*28 *0 NOTYPE *LOCAL *DEFAULT *[1-9] endof_bss +#... + *[0-9]*: 0*28 *0 NOTYPE *LOCAL *DEFAULT *[1-9] endof_bss_local +#... + *[0-9]*: 0*28 *0 NOTYPE *LOCAL *DEFAULT *[1-9] endof_private +#... + *[0-9]*: 0*27 *0 NOTYPE *LOCAL *DEFAULT *ABS endof_struct +#pass diff --git a/gas/testsuite/gas/elf/bss.s b/gas/testsuite/gas/elf/bss.s new file mode 100644 index 0000000..1a666ae --- /dev/null +++ b/gas/testsuite/gas/elf/bss.s @@ -0,0 +1,56 @@ + .macro bss name + + .long 0 + .long , + + .balign 32 + + .ifnes "\name", "struct" + .ascii "" + .asciz "" + .endif + + .fill 1, 1 + .org .+1 + .skip 1 + .sleb128 + .sleb128 0 + .uleb128 + .uleb128 0 + + .ifndef okay + + .long 1 + .long . + .long x + .float 0.0 + + .balign 32, -1 + + .ifnes "\name", "struct" + .ascii "0" + .asciz "0" + .endif + + .fill 1, 1, -1 + .org .+1, -1 + .skip 1, -1 + .sleb128 -1 + .uleb128 1 + + .endif + +endof_\name: + .endm + + .bss + bss bss + + .section .bss.local, "aw" + bss bss_local + + .section .private, "aw", %nobits + bss private + + .struct + bss struct diff --git a/gas/testsuite/gas/elf/elf.exp b/gas/testsuite/gas/elf/elf.exp index 99292d7..f9fc5d4 100644 --- a/gas/testsuite/gas/elf/elf.exp +++ b/gas/testsuite/gas/elf/elf.exp @@ -205,6 +205,8 @@ if { [is_elf_format] } then { run_dump_test "dwarf2-2" run_dump_test "dwarf2-3" run_dump_test "dwarf2-4" + run_dump_test "bss" + run_dump_test "bad-bss" run_dump_test "bad-section-flag" run_dump_test "bad-size" run_dump_test "bad-group" |