aix: encode function section
AIX XCOFF symbols can be labels or qualnames (names with an appended
mapping class). CSECTs must be declared with a mapping class.
Within an assembler file, the symbol names with and without the mapping
class are unique. An object file symbol table only presents the symbol
name without the mapping class, but the section of the symbol depends on
the mapping class.
The AIX XCOFF assembly language does not support first class aliases.
GCC implements symbol aliases by emitting additional labels for the function
or object. When GCC encodes sections for a DECL, it must distinguish
between the primary definition and the aliases, which don't have a
mapping class encoding.
.globl foo[DS]
.globl .foo
.globl foo1
.globl .foo1
.csect foo[DS]
foo:
foo1:
.long .foo, TOC[tc0] 0
.csect .foo[PR]
.foo:
.foo1:
The CSECT foo[DS] and label foo are distinct. foo1 is another label (alias)
for foo, and .foo1 is another label (alias) for .foo. foo is the function
descriptor and .foo is the code.
This patch adds the [DS] mapping class to the encoding of FUNCTION_DECL
but ensures that mapping class is not added to function aliases.
rs6000_output_mi_thunk is updated to emit the function name that matches
the behavior of GCC final.c for normal functions: get_fnname_from_decl based
on the RTL name, not the DECL name.
* config/rs6000/rs6000-call.c (rs6000_output_mi_thunk): Use
get_fnname_from_decl for name of thunk.
* config/rs6000/rs6000.c (rs6000_declare_alias): Use assemble_name
and ASM_OUTPUT_LABEL.
(rs6000_xcoff_declare_function_name): Use assemble_name and
ASM_OUTPUT_LABEL.
(rs6000_xcoff_declare_object_name): Use ASM_OUTPUT_LABEL.
(rs6000_xcoff_encode_section_info): Don't add mapping class
for aliases. Always add [DS] mapping class to primary
FUNCTION_DECL.
(rs6000_asm_weaken_decl): Don't explicitly add [DS].