Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[AIX] Fix libc++ Symbol Visibility on AIX
The AIX linker does not support linking against libc++ if it exports symbols are redefined within compiled code. Differential Revision: https://reviews.llvm.org/D140675
- Loading branch information
1 parent
42cd38c
commit e0ecc32
Showing
2 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
// REQUIRES: target={{powerpc.*-ibm-aix.*}} | ||
// ADDITIONAL_COMPILE_FLAGS: -fvisibility-inlines-hidden | ||
|
||
// When there is a weak hidden symbol in user code and a strong definition | ||
// in the library, we test that the linker relies on the library version, | ||
// as the default weak resolution semantics don't favour weak local definitions | ||
// for XCOFF. This creates a conflict on std::bad_function_call, which is used | ||
// by the std::function template instantiated in main. | ||
#include <functional> | ||
#include "test_macros.h" | ||
#include "assert.h" | ||
|
||
void foo() {} | ||
|
||
void test_call() { | ||
std::function<void()> r(foo); | ||
r(); | ||
} | ||
|
||
void test_throw() { | ||
#ifndef TEST_HAS_NO_EXCEPTIONS | ||
std::function<int()> f; | ||
try { | ||
f(); | ||
assert(false); | ||
} catch (const std::bad_function_call&) { | ||
return; | ||
} | ||
assert(false); | ||
#endif // TEST_HAS_NO_EXCEPTIONS | ||
} | ||
|
||
int main(int, char**) { | ||
test_call(); | ||
test_throw(); | ||
return 0; | ||
} |