aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorClément Chigot <clement.chigot@atos.net>2021-11-16 14:02:16 +0100
committerClément Chigot <clement.chigot@atos.net>2022-01-12 09:08:11 +0100
commitadd588a8ef53a5f77f2abda08a5de643923c4cce (patch)
treef5b85c033c265d175ec30c4de2d7568ac9751f8e /bfd
parentc4f5871457222f2c4a99e662dfa16b7c662f750a (diff)
downloadbinutils-add588a8ef53a5f77f2abda08a5de643923c4cce.zip
binutils-add588a8ef53a5f77f2abda08a5de643923c4cce.tar.gz
binutils-add588a8ef53a5f77f2abda08a5de643923c4cce.tar.bz2
gas: add visibility support for XCOFF
XCOFF assembly defines the visibility using an additional argument on several pseudo-ops: .globl, .weak, .extern and .comm. This implies that .globl and .weak syntax is different than the usual GNU syntax. But we want to provide compatibility with AIX assembler, especially because GCC is generating the visibility using this XCOFF syntax. PR 22085 bfd/ChangeLog: * coffcode.h (coff_write_object_contents): Change XCOFF header vstamp field to 2. * coffgen.c (coff_print_symbol): Increase the size for n_type. gas/ChangeLog: * config/tc-ppc.c (ppc_xcoff_get_visibility): New function. (ppc_globl): New function. (ppc_weak): New function. (ppc_comm): Add visibility field support. (ppc_extern): Likewise. * testsuite/gas/all/cofftag.d: Adjust to new n_type size providing by objdump. * testsuite/gas/ppc/test1xcoff32.d: Likewise. * testsuite/gas/ppc/aix.exp: Add new tests. * testsuite/gas/ppc/xcoff-visibility-1-32.d: New test. * testsuite/gas/ppc/xcoff-visibility-1-64.d: New test. * testsuite/gas/ppc/xcoff-visibility-1.s: New test. include/ChangeLog: * coff/internal.h (SYM_V_INTERNAL, SYM_V_HIDDEN, SYM_V_PROTECTED, SYM_V_EXPORTED, SYM_V_MASK): New defines. * coff/xcoff.h (struct xcoff_link_hash_entry): Add visibility field. ld/ChangeLog: * testsuite/ld-pe/pr19803.d: Adjust to new n_type size providing by objdump.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/coffcode.h7
-rw-r--r--bfd/coffgen.c2
2 files changed, 7 insertions, 2 deletions
diff --git a/bfd/coffcode.h b/bfd/coffcode.h
index d45b37d..31bd975 100644
--- a/bfd/coffcode.h
+++ b/bfd/coffcode.h
@@ -3994,8 +3994,13 @@ coff_write_object_contents (bfd * abfd)
#endif
}
+#ifdef RS6000COFF_C
+ /* XCOFF 32bit needs this to have new behaviour for n_type field. */
+ internal_a.vstamp = 2;
+#else
/* FIXME: Does anybody ever set this to another value? */
internal_a.vstamp = 0;
+#endif
/* Now should write relocs, strings, syms. */
obj_sym_filepos (abfd) = sym_base;
@@ -4070,7 +4075,7 @@ coff_write_object_contents (bfd * abfd)
bfd_vma toc;
asection *loader_sec;
- internal_a.vstamp = 1;
+ internal_a.vstamp = 2;
internal_a.o_snentry = xcoff_data (abfd)->snentry;
if (internal_a.o_snentry == 0)
diff --git a/bfd/coffgen.c b/bfd/coffgen.c
index 6087a95..293fce2 100644
--- a/bfd/coffgen.c
+++ b/bfd/coffgen.c
@@ -2185,7 +2185,7 @@ coff_print_symbol (bfd *abfd,
- (bfd_hostptr_t) root)
/ sizeof (combined_entry_type));
- fprintf (file, "(sec %2d)(fl 0x%02x)(ty %3x)(scl %3d) (nx %d) 0x",
+ fprintf (file, "(sec %2d)(fl 0x%02x)(ty %4x)(scl %3d) (nx %d) 0x",
combined->u.syment.n_scnum,
combined->u.syment.n_flags,
combined->u.syment.n_type,