diff options
author | Jan Beulich <jbeulich@suse.com> | 2019-07-04 10:35:47 +0200 |
---|---|---|
committer | Jan Beulich <jbeulich@suse.com> | 2019-07-04 10:35:47 +0200 |
commit | f2d4ba38f5723a207c40a288036af2f38b70e837 (patch) | |
tree | 4f864465aad8dfadd14c3ee62cc9f0ca7c743045 /gas/testsuite | |
parent | db7fbcbeb749c0d4ea19284438d62b253648c58a (diff) | |
download | gdb-f2d4ba38f5723a207c40a288036af2f38b70e837.zip gdb-f2d4ba38f5723a207c40a288036af2f38b70e837.tar.gz gdb-f2d4ba38f5723a207c40a288036af2f38b70e837.tar.bz2 |
gas/ELF: don't accumulate .type settings
Recently a patch was submitted for a Xen Project test harness binary to
override the compiler specified @object to @func (see [1]). In a reply I
suggested we shouldn't make ourselves dependent on currently unspecified
behavior of gas here: It accumulates all requests, and then
bfd/elf.c:swap_out_syms(), in an apparently ad hoc manner, prioritizes
certain flags over others.
Make the behavior predictable: Generally the last .type is what counts.
Exceptions are directives which set multiple bits (TLS, IFUNC, and
UNIQUE): Subsequent directives requesting just the more generic bit
(i.e. FUNC following IFUNC) won't clear the more specific one. Warn
about incompatible changes, except from/to STT_NOTYPE.
Also add a new target hook, which hppa wants to use right away afaict.
In the course of adding the warning I ran into two ld testsuite
failures. I can only assume that it was a copy-and-paste mistake that
lead to the same symbol having its type set twice.
[1] https://lists.xenproject.org/archives/html/xen-devel/2019-05/msg01980.html
Diffstat (limited to 'gas/testsuite')
-rw-r--r-- | gas/testsuite/gas/elf/elf.exp | 1 | ||||
-rw-r--r-- | gas/testsuite/gas/elf/type-2.e | 10 | ||||
-rw-r--r-- | gas/testsuite/gas/elf/type-2.l | 3 | ||||
-rw-r--r-- | gas/testsuite/gas/elf/type-2.s | 49 |
4 files changed, 63 insertions, 0 deletions
diff --git a/gas/testsuite/gas/elf/elf.exp b/gas/testsuite/gas/elf/elf.exp index eb9bd9c..b27a7ec 100644 --- a/gas/testsuite/gas/elf/elf.exp +++ b/gas/testsuite/gas/elf/elf.exp @@ -229,6 +229,7 @@ if { [is_elf_format] } then { } else { run_dump_test ifunc-1 run_elf_list_test "type" "" "" "-s" "| grep \"1 *\\\[FIONTCU\\\]\"" + run_elf_list_test "type-2" "" "--warn" "-s" "| grep \"0 *\\\[FIONT\\\]\"" } run_dump_test "section6" diff --git a/gas/testsuite/gas/elf/type-2.e b/gas/testsuite/gas/elf/type-2.e new file mode 100644 index 0000000..684727c --- /dev/null +++ b/gas/testsuite/gas/elf/type-2.e @@ -0,0 +1,10 @@ + +.+: 0+0 +0 +NOTYPE +LOCAL +DEFAULT +UND * + +.+: 0+0 +0 +OBJECT +LOCAL +DEFAULT +. test1 + +.+: 0+1 +0 +FUNC +LOCAL +DEFAULT +. test2 + +.+: 0+2 +0 +NOTYPE +LOCAL +DEFAULT +. test3 + +.+: 0+3 +0 +NOTYPE +LOCAL +DEFAULT +. test4 + +.+: 0+4 +0 +NOTYPE +LOCAL +DEFAULT +. test5 + +.+: 0+5 +0 +NOTYPE +LOCAL +DEFAULT +. test6 + +.+: 0+6 +0 +OBJECT +LOCAL +DEFAULT +. test7 + +.+: 0+7 +0 +TLS +LOCAL +DEFAULT +. test8 + +.+: 0+8 +0 +IFUNC +LOCAL +DEFAULT +. test9 diff --git a/gas/testsuite/gas/elf/type-2.l b/gas/testsuite/gas/elf/type-2.l new file mode 100644 index 0000000..f4c626e --- /dev/null +++ b/gas/testsuite/gas/elf/type-2.l @@ -0,0 +1,3 @@ +.*: Assembler messages: +.*:4: Warning: .* +.*:9: Warning: .* diff --git a/gas/testsuite/gas/elf/type-2.s b/gas/testsuite/gas/elf/type-2.s new file mode 100644 index 0000000..c0a28eb --- /dev/null +++ b/gas/testsuite/gas/elf/type-2.s @@ -0,0 +1,49 @@ + .text + + .type test1,%function + .type test1,%object +test1: + .byte 0x0 + + .type test2,%object + .type test2,%function +test2: + .byte 0x0 + + .type test3,%object + .type test3,%notype +test3: + .byte 0x0 + + .type test4,%function + .type test4,%notype +test4: + .byte 0x0 + + .type test5,%tls_object + .type test5,%notype +test5: + .byte 0x0 + + .type test6,%gnu_indirect_function + .type test6,%notype +test6: + .byte 0x0 + + .type test7,%function + .type test7,%notype + .type test7,%object +test7: + .byte 0x0 + + .type test8,%object + .type test8,%tls_object + .type test8,%object +test8: + .byte 0x0 + + .type test9,%function + .type test9,%gnu_indirect_function + .type test9,%function +test9: + .byte 0x0 |