Bug 22085 - AIX visibility in .extern, .globl, .weak, .comm not supported
Summary: AIX visibility in .extern, .globl, .weak, .comm not supported
Status: UNCONFIRMED
Alias: None
Product: binutils
Classification: Unclassified
Component: gas (show other bugs)
Version: 2.30 (HEAD)
: P2 enhancement
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-09-05 11:11 UTC by Ådne Hovda
Modified: 2017-10-12 18:11 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ådne Hovda 2017-09-05 11:11:08 UTC
GCC 7 assumes AIX ld support for visibility and outputs code like this when compiling libgcc:
    .comm __gcov_time_profiler_counter,8,3,hidden 

Which gas currently does not understand:
    Error: junk at end of line, first unrecognized character is `,' 

From the XL C/C++ docs: https://www.ibm.com/developerworks/aix/library/au-aix-symbol-visibility-part2/index.html

Listing 14. Syntax for specifying visibility attribute in assembly
   .extern Name [ , Visibility ]
   .globl  Name [ , Visibility ]
   .weak   Name [ , Visibility ]
   .comm   Name, Expression [, Number [, Visibility ] ]
Comment 1 Alan Modra 2017-10-12 05:25:02 UTC
If AIX gcc is even supported using gas and gcc has been configured correctly, this behaviour indicates a gcc bug.  gcc ought to be detecting gas support before using new features.  So even if gas was changed to add this support, gcc would need to cope with older versions of gas that do not support the extended syntax.

Adding this support to gas is not just a matter of parsing the syntax but also teaching the xcoff BFD backend to deal with visibility in symbol n_type (bits 0xF000).  n_type values are

0x1000	SYM_V_INTERNAL
0x2000	SYM_V_HIDDEN
0x3000	SYM_V_PROTECTED
0x4000	SYM_V_EXPORTED