[LLVM] Add exported visibility style for XCOFF
authorDavid Tenty <daltenty@ibm.com>
Tue, 5 Apr 2022 21:27:00 +0000 (17:27 -0400)
committerDavid Tenty <daltenty@ibm.com>
Thu, 28 Apr 2022 18:56:00 +0000 (14:56 -0400)
commit8042699a3088280292066a2fb1869f372369301f
tree10f757349f608e6db0fcd8ad10e38ec50c0401d5
parentded8187e353f7c6c5bb70239c07110eccc38a579
[LLVM] Add exported visibility style for XCOFF

For the AIX linker, under default options, global or weak symbols which
have no visibility bits set to zero (i.e. no visibility, similar to ELF
default) are only exported if specified on an export list provided to
the linker. So AIX has an additional visibility style called
"exported" which indicates to the linker that the symbol should
be explicitly globally exported.

This change maps "dllexport" in the LLVM IR to correspond to XCOFF
exported as we feel this best models the intended semantic (discussion
on the discourse RFC thread: https://discourse.llvm.org/t/rfc-adding-exported-visibility-style-to-the-ir-to-model-xcoff-exported-visibility/61853)
and allows us to enable writing this visibility for the AIX target
in the assembly path.

Reviewed By: DiggerLin

Differential Revision: https://reviews.llvm.org/D123951
llvm/docs/LangRef.rst
llvm/include/llvm/MC/MCAsmInfo.h
llvm/include/llvm/MC/MCDirectives.h
llvm/lib/MC/MCAsmStreamer.cpp
llvm/lib/MC/MCELFStreamer.cpp
llvm/lib/MC/MCMachOStreamer.cpp
llvm/lib/MC/MCWasmStreamer.cpp
llvm/lib/MC/MCXCOFFStreamer.cpp
llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
llvm/test/CodeGen/PowerPC/aix-xcoff-exported-nondefault.ll [new file with mode: 0644]
llvm/test/CodeGen/PowerPC/aix-xcoff-visibility.ll