forked from OSchip/llvm-project
AMDGPU: Default to hidden visibility
Object linking isn't supported, so it's not useful to emit default visibility. Default visibility requires relocations we don't yet support for functions compiled in another translation unit. WebAssembly already does this, although they insert these arguments in a different place for some reason. llvm-svn: 341033
This commit is contained in:
parent
d859668c76
commit
cd5bc7be08
|
@ -98,3 +98,16 @@ AMDGPUToolChain::TranslateArgs(const DerivedArgList &Args, StringRef BoundArch,
|
|||
|
||||
return DAL;
|
||||
}
|
||||
|
||||
void AMDGPUToolChain::addClangTargetOptions(
|
||||
const llvm::opt::ArgList &DriverArgs,
|
||||
llvm::opt::ArgStringList &CC1Args,
|
||||
Action::OffloadKind DeviceOffloadingKind) const {
|
||||
// Default to "hidden" visibility, as object level linking will not be
|
||||
// supported for the forseeable future.
|
||||
if (!DriverArgs.hasArg(options::OPT_fvisibility_EQ,
|
||||
options::OPT_fvisibility_ms_compat)) {
|
||||
CC1Args.push_back("-fvisibility");
|
||||
CC1Args.push_back("hidden");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,6 +61,10 @@ public:
|
|||
llvm::opt::DerivedArgList *
|
||||
TranslateArgs(const llvm::opt::DerivedArgList &Args, StringRef BoundArch,
|
||||
Action::OffloadKind DeviceOffloadKind) const override;
|
||||
|
||||
void addClangTargetOptions(const llvm::opt::ArgList &DriverArgs,
|
||||
llvm::opt::ArgStringList &CC1Args,
|
||||
Action::OffloadKind DeviceOffloadKind) const override;
|
||||
};
|
||||
|
||||
} // end namespace toolchains
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
// RUN: %clang -### -target amdgcn-amd-amdhsa -x cl -c -emit-llvm %s 2>&1 | FileCheck -check-prefix=DEFAULT %s
|
||||
// RUN: %clang -### -target amdgcn-amd-amdhsa -x cl -c -emit-llvm -fvisibility=protected %s 2>&1 | FileCheck -check-prefix=OVERRIDE-PROTECTED %s
|
||||
// RUN: %clang -### -target amdgcn-amd-amdhsa -x cl -c -emit-llvm -fvisibility-ms-compat %s 2>&1 | FileCheck -check-prefix=OVERRIDE-MS %s
|
||||
|
||||
// DEFAULT: "-fvisibility" "hidden"
|
||||
// OVERRIDE-PROTECTED: "-fvisibility" "protected"
|
||||
// OVERRIDE-MS: "-fvisibility" "hidden" "-ftype-visibility" "default"
|
Loading…
Reference in New Issue