gas/ELF: don't accumulate .type settings
authorJan Beulich <jbeulich@suse.com>
Thu, 4 Jul 2019 08:35:47 +0000 (10:35 +0200)
committerJan Beulich <jbeulich@suse.com>
Thu, 4 Jul 2019 08:35:47 +0000 (10:35 +0200)
commitf2d4ba38f5723a207c40a288036af2f38b70e837
tree4f864465aad8dfadd14c3ee62cc9f0ca7c743045
parentdb7fbcbeb749c0d4ea19284438d62b253648c58a
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
gas/ChangeLog
gas/config/obj-elf.c
gas/config/tc-hppa.h
gas/doc/as.texi
gas/testsuite/gas/elf/elf.exp
gas/testsuite/gas/elf/type-2.e [new file with mode: 0644]
gas/testsuite/gas/elf/type-2.l [new file with mode: 0644]
gas/testsuite/gas/elf/type-2.s [new file with mode: 0644]
ld/ChangeLog
ld/testsuite/ld-elf/group9.s
This page took 0.025022 seconds and 4 git commands to generate.