aboutsummaryrefslogtreecommitdiff
path: root/gas/config/tc-ppc.c
diff options
context:
space:
mode:
authorClément Chigot <clement.chigot@atos.net>2021-11-17 16:20:48 +0100
committerClément Chigot <clement.chigot@atos.net>2022-01-12 09:08:17 +0100
commit09d4578fd96e7ceb262628cf27d8d9d8b903b529 (patch)
tree9db674614027d6776d73e05bd437048847c786a7 /gas/config/tc-ppc.c
parentadd588a8ef53a5f77f2abda08a5de643923c4cce (diff)
downloadfsf-binutils-gdb-09d4578fd96e7ceb262628cf27d8d9d8b903b529.zip
fsf-binutils-gdb-09d4578fd96e7ceb262628cf27d8d9d8b903b529.tar.gz
fsf-binutils-gdb-09d4578fd96e7ceb262628cf27d8d9d8b903b529.tar.bz2
gas: add visibility support using GNU syntax on XCOFF
In order to ease port of GNU assembly code and especially ld testsuite, this patch allows XCOFF to accept the usual GNU syntax for visibility. PR 22085 gas/ChangeLog: * config/tc-ppc.c (ppc_GNU_visibility): New function. * testsuite/gas/ppc/aix.exp: Add new tests. * testsuite/gas/ppc/xcoff-visibility-2-32.d: New test. * testsuite/gas/ppc/xcoff-visibility-2-64.d: New test. * testsuite/gas/ppc/xcoff-visibility-2.s: New test.
Diffstat (limited to 'gas/config/tc-ppc.c')
-rw-r--r--gas/config/tc-ppc.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/gas/config/tc-ppc.c b/gas/config/tc-ppc.c
index 4a1d394..ac10772 100644
--- a/gas/config/tc-ppc.c
+++ b/gas/config/tc-ppc.c
@@ -121,6 +121,7 @@ static void ppc_toc (int);
static void ppc_xcoff_cons (int);
static void ppc_vbyte (int);
static void ppc_weak (int);
+static void ppc_GNU_visibility (int);
#endif
#ifdef OBJ_ELF
@@ -246,6 +247,11 @@ const pseudo_typeS md_pseudo_table[] =
{ "short", ppc_xcoff_cons, 1 },
{ "vbyte", ppc_vbyte, 0 },
{ "weak", ppc_weak, 0 },
+
+ /* Enable GNU syntax for symbol visibility. */
+ {"internal", ppc_GNU_visibility, SYM_V_INTERNAL},
+ {"hidden", ppc_GNU_visibility, SYM_V_HIDDEN},
+ {"protected", ppc_GNU_visibility, SYM_V_PROTECTED},
#endif
#ifdef OBJ_ELF
@@ -4321,6 +4327,38 @@ ppc_xcoff_get_visibility (void) {
return 0;
}
+/* Retrieve visiblity using GNU syntax. */
+static void ppc_GNU_visibility (int visibility) {
+ int c;
+ char *name;
+ symbolS *symbolP;
+ coff_symbol_type *coffsym;
+
+ do
+ {
+ if ((name = read_symbol_name ()) == NULL)
+ break;
+ symbolP = symbol_find_or_make (name);
+ coffsym = coffsymbol (symbol_get_bfdsym (symbolP));
+
+ coffsym->native->u.syment.n_type &= ~SYM_V_MASK;
+ coffsym->native->u.syment.n_type |= visibility;
+
+ c = *input_line_pointer;
+ if (c == ',')
+ {
+ input_line_pointer ++;
+
+ SKIP_WHITESPACE ();
+
+ if (*input_line_pointer == '\n')
+ c = '\n';
+ }
+ }
+ while (c == ',');
+
+ demand_empty_rest_of_line ();
+}
/* The .comm and .lcomm pseudo-ops for XCOFF. XCOFF puts common
symbols in the .bss segment as though they were local common