[llvm] [clang] [AIX][TOC] Add -mtocdata/-mno-tocdata options on AIX (PR #67999)

via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 31 13:07:00 PDT 2023


================
@@ -622,6 +622,28 @@ static bool checkAliasedGlobal(
   return true;
 }
 
+// Emit a warning if toc-data attribute is requested for global variables that
+// have aliases and remove the toc-data attribute.
+static void checkAliasForTocData(llvm::GlobalVariable *GVar,
+                                 const CodeGenOptions &CodeGenOpts,
+                                 DiagnosticsEngine &Diags,
+                                 SourceLocation Location) {
+  if (GVar->hasAttribute("toc-data")) {
+    auto GVId = GVar->getGlobalIdentifier();
+    // Is this a global variable specified by the user as local?
+    bool UserSpecifiedTOC =
+        llvm::binary_search(CodeGenOpts.TocDataVarsUserSpecified, GVId);
+    if (UserSpecifiedTOC) {
----------------
diggerlin wrote:

we not need to introduce a new variable `UserSpecifiedTOC`

change to 

  `if ((llvm::binary_search(CodeGenOpts.TocDataVarsUserSpecified, GVId))) {`

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


More information about the cfe-commits mailing list