[clang] [clang][AIX] Only export libclang.map symbols from libclang (PR #78748)

via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 19 09:27:53 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Jake Egan (jakeegan)

<details>
<summary>Changes</summary>

This will prevent unnecessary symbols being exported in libclang, which could cause issues with non-unique objects.

---
Full diff: https://github.com/llvm/llvm-project/pull/78748.diff


14 Files Affected:

- (modified) clang/test/Index/Core/designated-inits.c (-1) 
- (modified) clang/test/Index/Core/external-source-symbol-attr-cxx.cpp (-1) 
- (modified) clang/test/Index/Core/external-source-symbol-attr.m (-1) 
- (modified) clang/test/Index/Core/index-dependent-source.cpp (-1) 
- (modified) clang/test/Index/Core/index-instantiated-source.cpp (-1) 
- (modified) clang/test/Index/Core/index-source-invalid-name.cpp (-1) 
- (modified) clang/test/Index/Core/index-source.cpp (-1) 
- (modified) clang/test/Index/Core/index-source.m (-1) 
- (modified) clang/test/Index/Core/index-source.mm (-1) 
- (modified) clang/test/Index/Core/index-subkinds.m (-1) 
- (modified) clang/test/Index/Core/index-with-module.m (-1) 
- (modified) clang/test/Index/ms-property.cpp (-1) 
- (modified) clang/test/Index/using_if_exists.cpp (-1) 
- (modified) clang/tools/libclang/CMakeLists.txt (+3-2) 


``````````diff
diff --git a/clang/test/Index/Core/designated-inits.c b/clang/test/Index/Core/designated-inits.c
index 10f48c68915fe4d..a31cb95a4b82db7 100644
--- a/clang/test/Index/Core/designated-inits.c
+++ b/clang/test/Index/Core/designated-inits.c
@@ -1,4 +1,3 @@
-// XFAIL: target={{.*}}-aix{{.*}}
 // RUN: c-index-test core -print-source-symbols -- %s -target x86_64-apple-macosx10.7 | FileCheck %s
 
 struct MyStruct {
diff --git a/clang/test/Index/Core/external-source-symbol-attr-cxx.cpp b/clang/test/Index/Core/external-source-symbol-attr-cxx.cpp
index b3fb31c54a74208..8ccf3c7d69496bd 100644
--- a/clang/test/Index/Core/external-source-symbol-attr-cxx.cpp
+++ b/clang/test/Index/Core/external-source-symbol-attr-cxx.cpp
@@ -1,4 +1,3 @@
-// XFAIL: target={{.*}}-aix{{.*}}
 // RUN: c-index-test core -print-source-symbols -- %s -target x86_64-apple-macosx10.7 | FileCheck %s
 
 #define GEN_DECL_USR(mod_name, usr) __attribute__((external_source_symbol(language="Swift", defined_in=mod_name, USR=usr, generated_declaration)))
diff --git a/clang/test/Index/Core/external-source-symbol-attr.m b/clang/test/Index/Core/external-source-symbol-attr.m
index fee80d3b0fdf6ca..1f907912737b0d7 100644
--- a/clang/test/Index/Core/external-source-symbol-attr.m
+++ b/clang/test/Index/Core/external-source-symbol-attr.m
@@ -1,4 +1,3 @@
-// XFAIL: target={{.*}}-aix{{.*}}
 // RUN: c-index-test core -print-source-symbols -- %s -target x86_64-apple-macosx10.7 | FileCheck %s
 
 #define EXT_DECL(mod_name) __attribute__((external_source_symbol(language="Swift", defined_in=mod_name)))
diff --git a/clang/test/Index/Core/index-dependent-source.cpp b/clang/test/Index/Core/index-dependent-source.cpp
index eabec29a1fd7b30..8fec9abd1e926b9 100644
--- a/clang/test/Index/Core/index-dependent-source.cpp
+++ b/clang/test/Index/Core/index-dependent-source.cpp
@@ -1,4 +1,3 @@
-// XFAIL: target={{.*}}-aix{{.*}}
 // RUN: c-index-test core -print-source-symbols -- %s -std=c++14 -target x86_64-apple-macosx10.7 | FileCheck %s
 
 int invalid;
diff --git a/clang/test/Index/Core/index-instantiated-source.cpp b/clang/test/Index/Core/index-instantiated-source.cpp
index ccb39019ef06741..2a67a3a3c7938e3 100644
--- a/clang/test/Index/Core/index-instantiated-source.cpp
+++ b/clang/test/Index/Core/index-instantiated-source.cpp
@@ -1,4 +1,3 @@
-// XFAIL: target={{.*}}-aix{{.*}}
 // RUN: c-index-test core -print-source-symbols -- %s -std=c++14 -target x86_64-apple-macosx10.7 | FileCheck %s
 // References to declarations in instantiations should be canonicalized:
 
diff --git a/clang/test/Index/Core/index-source-invalid-name.cpp b/clang/test/Index/Core/index-source-invalid-name.cpp
index 034fd6b7009b6b7..1b4b059cd1b36dc 100644
--- a/clang/test/Index/Core/index-source-invalid-name.cpp
+++ b/clang/test/Index/Core/index-source-invalid-name.cpp
@@ -1,4 +1,3 @@
-// XFAIL: target={{.*}}-aix{{.*}}
 // RUN: c-index-test core -print-source-symbols -- %s -std=c++1z -target x86_64-apple-macosx10.7 | FileCheck %s
 
 namespace rdar32474406 {
diff --git a/clang/test/Index/Core/index-source.cpp b/clang/test/Index/Core/index-source.cpp
index ed7474499dc7299..8f9fbc4c8d29c4a 100644
--- a/clang/test/Index/Core/index-source.cpp
+++ b/clang/test/Index/Core/index-source.cpp
@@ -1,4 +1,3 @@
-// XFAIL: target={{.*}}-aix{{.*}}
 // RUN: c-index-test core -print-source-symbols -- %s -std=c++1z -target x86_64-apple-macosx10.7 | FileCheck %s
 // RUN: c-index-test core -print-source-symbols -include-locals -- %s -std=c++1z -target x86_64-apple-macosx10.7 | FileCheck -check-prefix=LOCAL %s
 
diff --git a/clang/test/Index/Core/index-source.m b/clang/test/Index/Core/index-source.m
index a551fe965bb0bd1..07c7d207607cbd8 100644
--- a/clang/test/Index/Core/index-source.m
+++ b/clang/test/Index/Core/index-source.m
@@ -1,4 +1,3 @@
-// XFAIL: target={{.*}}-aix{{.*}}
 // RUN: c-index-test core -print-source-symbols -- %s -target x86_64-apple-macosx10.7 | FileCheck %s
 // RUN: c-index-test core -print-source-symbols -include-locals -- %s -target x86_64-apple-macosx10.7 | FileCheck -check-prefix=LOCAL %s
 
diff --git a/clang/test/Index/Core/index-source.mm b/clang/test/Index/Core/index-source.mm
index 659e16f01329095..049a0bdaf6474ec 100644
--- a/clang/test/Index/Core/index-source.mm
+++ b/clang/test/Index/Core/index-source.mm
@@ -1,4 +1,3 @@
-// XFAIL: target={{.*}}-aix{{.*}}
 // RUN: c-index-test core -print-source-symbols -- %s -target x86_64-apple-macosx10.7 | FileCheck %s
 
 @interface MyCls
diff --git a/clang/test/Index/Core/index-subkinds.m b/clang/test/Index/Core/index-subkinds.m
index d95dfe746b603a1..5eea046721b6c0c 100644
--- a/clang/test/Index/Core/index-subkinds.m
+++ b/clang/test/Index/Core/index-subkinds.m
@@ -1,4 +1,3 @@
-// XFAIL: target={{.*}}-aix{{.*}}
 // RUN: c-index-test core -print-source-symbols -- %s -target x86_64-apple-macosx10.7 | FileCheck %s
 
 // CHECK: [[@LINE+1]]:12 | class/ObjC | XCTestCase | c:objc(cs)XCTestCase | _OBJC_CLASS_$_XCTestCase | Decl | rel: 0
diff --git a/clang/test/Index/Core/index-with-module.m b/clang/test/Index/Core/index-with-module.m
index 5258e64c1941e15..b116768fdb557d1 100644
--- a/clang/test/Index/Core/index-with-module.m
+++ b/clang/test/Index/Core/index-with-module.m
@@ -1,4 +1,3 @@
-// XFAIL: target={{.*}}-aix{{.*}}
 // RUN: rm -rf %t.mcp
 // RUN: c-index-test core -print-source-symbols -dump-imported-module-files -- %s -I %S/Inputs/module -fmodules -fmodules-cache-path=%t.mcp | FileCheck %s
 
diff --git a/clang/test/Index/ms-property.cpp b/clang/test/Index/ms-property.cpp
index d30d30d033d888c..74b5b1399cf501c 100644
--- a/clang/test/Index/ms-property.cpp
+++ b/clang/test/Index/ms-property.cpp
@@ -1,4 +1,3 @@
-// XFAIL: target={{.*}}-aix{{.*}}
 // RUN: c-index-test core -print-source-symbols -- -target x86_64-apple-darwin10 -fms-extensions -fno-ms-compatibility %s | FileCheck %s
 
 // CHECK: [[@LINE+1]]:8 | struct/C++ | Simple | [[Simple_USR:.*]] | <no-cgname> | Def | rel: 0
diff --git a/clang/test/Index/using_if_exists.cpp b/clang/test/Index/using_if_exists.cpp
index 73d1be739e42816..ed13dad9b1f749e 100644
--- a/clang/test/Index/using_if_exists.cpp
+++ b/clang/test/Index/using_if_exists.cpp
@@ -1,4 +1,3 @@
-// XFAIL: target={{.*}}-aix{{.*}}
 // RUN: c-index-test core -print-source-symbols -- %s -target x86_64-unknown-unknown 2>&1 | FileCheck %s
 
 namespace ns {
diff --git a/clang/tools/libclang/CMakeLists.txt b/clang/tools/libclang/CMakeLists.txt
index 1cfc46eb1a52f62..b5b6d2807d714c2 100644
--- a/clang/tools/libclang/CMakeLists.txt
+++ b/clang/tools/libclang/CMakeLists.txt
@@ -97,7 +97,7 @@ if(MSVC)
   set(LLVM_EXPORTED_SYMBOL_FILE)
 endif()
 
-if (UNIX AND NOT APPLE)
+if (UNIX AND NOT APPLE AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "AIX")
   set(LLVM_EXPORTED_SYMBOL_FILE)
   set(USE_VERSION_SCRIPT ${LLVM_HAVE_LINK_VERSION_SCRIPT})
 endif()
@@ -129,8 +129,9 @@ else()
   set(output_name "clang")
 endif()
 
-# libclang requires headers which need _ALL_SOURCE to build on AIX
 if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "AIX")
+    set(CMAKE_AIX_EXPORT_ALL_SYMBOLS OFF)
+    # libclang requires headers which need _ALL_SOURCE to build on AIX
     remove_definitions("-D_XOPEN_SOURCE=700")
 endif()
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/78748


More information about the cfe-commits mailing list