[PATCH] D158739: AIX: Issue an error when specifying an alias for a common symbol

2023-08-31 Thread Stephen Peckham via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG282da837565f: [XCOFF][AIX] Issue an error when specifying an 
alias for a common symbol (authored by stephenpeckham).

Changed prior to commit:
  https://reviews.llvm.org/D158739?vs=554299=555064#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D158739/new/

https://reviews.llvm.org/D158739

Files:
  clang/include/clang/Basic/DiagnosticFrontendKinds.td
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/test/CodeGen/aix-common.c
  llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
  llvm/test/CodeGen/PowerPC/aix-common.ll

Index: llvm/test/CodeGen/PowerPC/aix-common.ll
===
--- /dev/null
+++ llvm/test/CodeGen/PowerPC/aix-common.ll
@@ -0,0 +1,15 @@
+; RUN: not llc -filetype=obj -mtriple powerpc-ibm-aix-xcoff -o %t.o < %s 2>&1 | FileCheck %s
+; RUN: not llc -filetype=asm -mtriple powerpc-ibm-aix-xcoff -o %t.o < %s 2>&1 | FileCheck %s
+; RUN: not llc -filetype=obj -mtriple powerpc64-ibm-aix-xcoff -o %t.o < %s 2>&1 | FileCheck %s
+; RUN: not llc -filetype=asm -mtriple powerpc64-ibm-aix-xcoff -o %t.o < %s 2>&1 | FileCheck %s
+@x= common global i32 0, align 4
+
+@y= alias i32, ptr @x
+
+; Function Attrs: noinline nounwind optnone
+define ptr @g() #0 {
+entry:
+  ret ptr @y
+}
+; CHECK: LLVM ERROR: Aliases to common variables are not allowed on AIX:
+; CHECK-NEXT:Alias attribute for y is invalid because x is common.
Index: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
===
--- llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
+++ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
@@ -2762,11 +2762,21 @@
 
   // Construct an aliasing list for each GlobalObject.
   for (const auto  : M.aliases()) {
-const GlobalObject *Base = Alias.getAliaseeObject();
-if (!Base)
+const GlobalObject *Aliasee = Alias.getAliaseeObject();
+if (!Aliasee)
   report_fatal_error(
   "alias without a base object is not yet supported on AIX");
-GOAliasMap[Base].push_back();
+
+if (Aliasee->hasCommonLinkage()) {
+  report_fatal_error("Aliases to common variables are not allowed on AIX:"
+ "\n\tAlias attribute for " +
+ Alias.getGlobalIdentifier() +
+ " is invalid because " + Aliasee->getName() +
+ " is common.",
+ false);
+}
+
+GOAliasMap[Aliasee].push_back();
   }
 
   return Result;
Index: clang/test/CodeGen/aix-common.c
===
--- /dev/null
+++ clang/test/CodeGen/aix-common.c
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 -triple powerpc-ibm-aix   -S -fcommon %s -verify -o -
+// RUN: %clang_cc1 -triple powerpc64-ibm-aix -S -fcommon %s -verify -o -
+int xx;
+extern int yy __attribute__((__alias__("xx") )); //expected-error {{alias to a variable in a common section is not allowed}}
+
+void *gg() { return  }
Index: clang/lib/CodeGen/CodeGenModule.cpp
===
--- clang/lib/CodeGen/CodeGenModule.cpp
+++ clang/lib/CodeGen/CodeGenModule.cpp
@@ -563,8 +563,8 @@
 }
 
 static bool checkAliasedGlobal(
-DiagnosticsEngine , SourceLocation Location, bool IsIFunc,
-const llvm::GlobalValue *Alias, const llvm::GlobalValue *,
+const ASTContext , DiagnosticsEngine , SourceLocation Location,
+bool IsIFunc, const llvm::GlobalValue *Alias, const llvm::GlobalValue *,
 const llvm::MapVector ,
 SourceRange AliasRange) {
   GV = getAliasedGlobal(Alias);
@@ -573,6 +573,14 @@
 return false;
   }
 
+  if (GV->hasCommonLinkage()) {
+const llvm::Triple  = Context.getTargetInfo().getTriple();
+if (Triple.getObjectFormat() == llvm::Triple::XCOFF) {
+  Diags.Report(Location, diag::err_alias_to_common);
+  return false;
+}
+  }
+
   if (GV->isDeclaration()) {
 Diags.Report(Location, diag::err_alias_to_undefined) << IsIFunc << IsIFunc;
 Diags.Report(Location, diag::note_alias_requires_mangled_name)
@@ -633,7 +641,7 @@
 StringRef MangledName = getMangledName(GD);
 llvm::GlobalValue *Alias = GetGlobalValue(MangledName);
 const llvm::GlobalValue *GV = nullptr;
-if (!checkAliasedGlobal(Diags, Location, IsIFunc, Alias, GV,
+if (!checkAliasedGlobal(getContext(), Diags, Location, IsIFunc, Alias, GV,
 MangledDeclNames, Range)) {
   Error = true;
   continue;
Index: clang/include/clang/Basic/DiagnosticFrontendKinds.td
===
--- clang/include/clang/Basic/DiagnosticFrontendKinds.td
+++ clang/include/clang/Basic/DiagnosticFrontendKinds.td
@@ -283,6 +283,8 @@
 def err_alias_to_undefined : Error<
   "%select{alias|ifunc}0 must 

[PATCH] D158739: AIX: Issue an error when specifying an alias for a common symbol

2023-08-29 Thread Stephen Peckham via Phabricator via cfe-commits
stephenpeckham updated this revision to Diff 554299.

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D158739/new/

https://reviews.llvm.org/D158739

Files:
  clang/include/clang/Basic/DiagnosticFrontendKinds.td
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/test/CodeGen/aix-common.c
  llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
  llvm/test/CodeGen/PowerPC/aix-common.ll

Index: llvm/test/CodeGen/PowerPC/aix-common.ll
===
--- /dev/null
+++ llvm/test/CodeGen/PowerPC/aix-common.ll
@@ -0,0 +1,15 @@
+; RUN: not llc -filetype=obj -mtriple powerpc-ibm-aix-xcoff -o %t.o < %s 2>&1 | FileCheck %s
+; RUN: not llc -filetype=asm -mtriple powerpc-ibm-aix-xcoff -o %t.o < %s 2>&1 | FileCheck %s
+; RUN: not llc -filetype=obj -mtriple powerpc64-ibm-aix-xcoff -o %t.o < %s 2>&1 | FileCheck %s
+; RUN: not llc -filetype=asm -mtriple powerpc64-ibm-aix-xcoff -o %t.o < %s 2>&1 | FileCheck %s
+@x= common global i32 0, align 4
+
+@y= alias i32, ptr @x
+
+; Function Attrs: noinline nounwind optnone
+define ptr @g() #0 {
+entry:
+  ret ptr @y
+}
+; CHECK: LLVM ERROR: Aliases to common variables are not allowed on AIX:
+; CHECK-NEXT:Alias attribute for y is invalid because x is common.
Index: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
===
--- llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
+++ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
@@ -2762,11 +2762,21 @@
 
   // Construct an aliasing list for each GlobalObject.
   for (const auto  : M.aliases()) {
-const GlobalObject *Base = Alias.getAliaseeObject();
-if (!Base)
+const GlobalObject *Aliasee = Alias.getAliaseeObject();
+if (!Aliasee)
   report_fatal_error(
   "alias without a base object is not yet supported on AIX");
-GOAliasMap[Base].push_back();
+
+if (Aliasee->hasCommonLinkage()) {
+  report_fatal_error("Aliases to common variables are not allowed on AIX:"
+ "\n\tAlias attribute for " +
+ Alias.getGlobalIdentifier() +
+ " is invalid because " + Aliasee->getName() +
+ " is common.",
+ false);
+}
+
+GOAliasMap[Aliasee].push_back();
   }
 
   return Result;
Index: clang/test/CodeGen/aix-common.c
===
--- /dev/null
+++ clang/test/CodeGen/aix-common.c
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -triple powerpc-ibm-aix   -S -fcommon %s -verify -o -
+// RUN: %clang_cc1 -triple powerpc64-ibm-aix -S -fcommon %s -verify -o -
+int xx;
+extern int yy __attribute__((__alias__("xx") )); //expected-error {{alias to a variable in a common section is not allowed}}
+
+void *gg() { return  }
+
Index: clang/lib/CodeGen/CodeGenModule.cpp
===
--- clang/lib/CodeGen/CodeGenModule.cpp
+++ clang/lib/CodeGen/CodeGenModule.cpp
@@ -563,8 +563,8 @@
 }
 
 static bool checkAliasedGlobal(
-DiagnosticsEngine , SourceLocation Location, bool IsIFunc,
-const llvm::GlobalValue *Alias, const llvm::GlobalValue *,
+const ASTContext , DiagnosticsEngine , SourceLocation Location,
+bool IsIFunc, const llvm::GlobalValue *Alias, const llvm::GlobalValue *,
 const llvm::MapVector ,
 SourceRange AliasRange) {
   GV = getAliasedGlobal(Alias);
@@ -573,6 +573,14 @@
 return false;
   }
 
+  if (GV->hasCommonLinkage()) {
+const llvm::Triple  = Context.getTargetInfo().getTriple();
+if (Triple.getObjectFormat() == llvm::Triple::XCOFF) {
+  Diags.Report(Location, diag::err_alias_to_common);
+  return false;
+}
+  }
+
   if (GV->isDeclaration()) {
 Diags.Report(Location, diag::err_alias_to_undefined) << IsIFunc << IsIFunc;
 Diags.Report(Location, diag::note_alias_requires_mangled_name)
@@ -633,7 +641,7 @@
 StringRef MangledName = getMangledName(GD);
 llvm::GlobalValue *Alias = GetGlobalValue(MangledName);
 const llvm::GlobalValue *GV = nullptr;
-if (!checkAliasedGlobal(Diags, Location, IsIFunc, Alias, GV,
+if (!checkAliasedGlobal(getContext(), Diags, Location, IsIFunc, Alias, GV,
 MangledDeclNames, Range)) {
   Error = true;
   continue;
Index: clang/include/clang/Basic/DiagnosticFrontendKinds.td
===
--- clang/include/clang/Basic/DiagnosticFrontendKinds.td
+++ clang/include/clang/Basic/DiagnosticFrontendKinds.td
@@ -283,6 +283,8 @@
 def err_alias_to_undefined : Error<
   "%select{alias|ifunc}0 must point to a defined "
   "%select{variable or |}1function">;
+def err_alias_to_common : Error<
+  "alias to a variable in a common section is not allowed">;
 def note_alias_requires_mangled_name : Note<
   "the %select{function or variable|function}0 specified in an %select{alias|ifunc}1 must refer to its mangled name">;
 def 

[PATCH] D158739: AIX: Issue an error when specifying an alias for a common symbol

2023-08-24 Thread Stephen Peckham via Phabricator via cfe-commits
stephenpeckham created this revision.
stephenpeckham added reviewers: hubert.reinterpretcast, DiggerLin, jhenderson.
Herald added subscribers: jeroen.dobbelaere, kbarton, hiraditya, nemanjai.
Herald added a project: All.
stephenpeckham requested review of this revision.
Herald added projects: clang, LLVM.
Herald added subscribers: llvm-commits, cfe-commits.

There is no support in XCOFF for labels on common symbols.  Therefore, an alias 
for a common symbol is not supported.  Issue an error in the front end when an 
aliasee is a common symbol.  Issue a similar error in the back end in case an 
IR specifies an alias for a common symbol.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D158739

Files:
  clang/include/clang/Basic/DiagnosticFrontendKinds.td
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/test/CodeGen/aix-common.c
  llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
  llvm/test/CodeGen/PowerPC/aix-common.ll

Index: llvm/test/CodeGen/PowerPC/aix-common.ll
===
--- /dev/null
+++ llvm/test/CodeGen/PowerPC/aix-common.ll
@@ -0,0 +1,15 @@
+; RUN: not llc -filetype=obj -mtriple powerpc-ibm-aix-xcoff -o %t.o < %s 2>&1 | FileCheck %s
+; RUN: not llc -filetype=asm -mtriple powerpc-ibm-aix-xcoff -o %t.o < %s 2>&1 | FileCheck %s
+; RUN: not llc -filetype=obj -mtriple powerpc64-ibm-aix-xcoff -o %t.o < %s 2>&1 | FileCheck %s
+; RUN: not llc -filetype=asm -mtriple powerpc64-ibm-aix-xcoff -o %t.o < %s 2>&1 | FileCheck %s
+@x= common global i32 0, align 4
+
+@y= alias i32, ptr @x
+
+; Function Attrs: noinline nounwind optnone
+define ptr @g() #0 {
+entry:
+  ret ptr @y
+}
+; CHECK: LLVM ERROR: Aliases to common variables are not allowed on AIX:
+; CHECK:Alias attribute for y is invalid because x is common.
Index: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
===
--- llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
+++ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
@@ -2762,11 +2762,21 @@
 
   // Construct an aliasing list for each GlobalObject.
   for (const auto  : M.aliases()) {
-const GlobalObject *Base = Alias.getAliaseeObject();
-if (!Base)
+const GlobalObject *Aliasee = Alias.getAliaseeObject();
+if (!Aliasee)
   report_fatal_error(
   "alias without a base object is not yet supported on AIX");
-GOAliasMap[Base].push_back();
+
+if (Aliasee->hasCommonLinkage()) {
+  report_fatal_error("Aliases to common variables are not allowed on AIX:"
+ "\n\tAlias attribute for " +
+ Alias.getGlobalIdentifier() +
+ " is invalid because " + Aliasee->getName() +
+ " is common.",
+ false);
+}
+
+GOAliasMap[Aliasee].push_back();
   }
 
   return Result;
Index: clang/test/CodeGen/aix-common.c
===
--- /dev/null
+++ clang/test/CodeGen/aix-common.c
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -triple powerpc-ibm-aix   -S -fcommon %s -verify -o -
+// RUN: %clang_cc1 -triple powerpc64-ibm-aix -S -fcommon %s -verify -o -
+int xx;
+extern int yy __attribute__((__alias__("xx") )); //expected-error {{alias to a variable in a common section is not allowed}}
+
+void *gg() { return  }
+
Index: clang/lib/CodeGen/CodeGenModule.cpp
===
--- clang/lib/CodeGen/CodeGenModule.cpp
+++ clang/lib/CodeGen/CodeGenModule.cpp
@@ -563,8 +563,8 @@
 }
 
 static bool checkAliasedGlobal(
-DiagnosticsEngine , SourceLocation Location, bool IsIFunc,
-const llvm::GlobalValue *Alias, const llvm::GlobalValue *,
+ASTContext , DiagnosticsEngine , SourceLocation Location,
+bool IsIFunc, const llvm::GlobalValue *Alias, const llvm::GlobalValue *,
 const llvm::MapVector ,
 SourceRange AliasRange) {
   GV = getAliasedGlobal(Alias);
@@ -573,6 +573,14 @@
 return false;
   }
 
+  if (GV->hasCommonLinkage()) {
+const llvm::Triple  = Context.getTargetInfo().getTriple();
+if (Triple.getObjectFormat() == llvm::Triple::XCOFF) {
+  Diags.Report(Location, diag::err_alias_to_common);
+  return false;
+}
+  }
+
   if (GV->isDeclaration()) {
 Diags.Report(Location, diag::err_alias_to_undefined) << IsIFunc << IsIFunc;
 Diags.Report(Location, diag::note_alias_requires_mangled_name)
@@ -633,7 +641,7 @@
 StringRef MangledName = getMangledName(GD);
 llvm::GlobalValue *Alias = GetGlobalValue(MangledName);
 const llvm::GlobalValue *GV = nullptr;
-if (!checkAliasedGlobal(Diags, Location, IsIFunc, Alias, GV,
+if (!checkAliasedGlobal(getContext(), Diags, Location, IsIFunc, Alias, GV,
 MangledDeclNames, Range)) {
   Error = true;
   continue;
Index: clang/include/clang/Basic/DiagnosticFrontendKinds.td

[PATCH] D142660: [AIX] supporting -X options for llvm-ranlib in AIX OS

2023-07-26 Thread Stephen Peckham via Phabricator via cfe-commits
stephenpeckham accepted this revision.
stephenpeckham added a comment.
This revision is now accepted and ready to land.

I don't see any reason to check the OBJECT_MODE environment variable if the -X 
flag is used.  What would the error be:  "You specified a valid -X flag, but by 
the way, OBJECT_MODE is set to an invalid value"?

I think all the commands that examine XCOFF files (llvm-ar, lllvm-ranlib, 
llvm-readobj, llvm-objdump, llvm-nm, etc.) should recognize "32", "64", 
"32_64", and "any".  I don't think it's necessary to recognize "d64", even if 
AIX commands do.  In addition, I wouldn't bother recognizing an XCOFF file with 
the magic number for a discontinued 64-bit object.  That means that "32_64" and 
"any" have the same behavior.   If -X is specified and does not have one of the 
4 specified values, a usage message should be printed.  If -X is not specified 
but OBJECT_MODE is in the environment, a message should be printed if the value 
is not one of the 4 specified values.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D142660/new/

https://reviews.llvm.org/D142660

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D86993: Document Clang's expectations of the C standard library.

2023-07-05 Thread Stephen Peckham via Phabricator via cfe-commits
stephenpeckham added a comment.

Is memmove() expected to perform a lot worse than memcpy()?  Why not just use 
memmove() all the time.  In some library implementations, memcpy() and 
memmove() are the same function.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D86993/new/

https://reviews.llvm.org/D86993

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D153600: Implement -frecord-command-line for XCOFF

2023-07-03 Thread Stephen Peckham via Phabricator via cfe-commits
stephenpeckham added inline comments.



Comment at: llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp:2338
   // Emit bytes for llvm.commandline metadata.
-  emitModuleCommandLines(M);
+  if (!TM.getTargetTriple().isOSBinFormatXCOFF())
+emitModuleCommandLines(M);

I would add a comment explaining that for XCOFF, the command line metadata was 
emitted earlier.



Comment at: llvm/lib/MC/MCAsmStreamer.cpp:981
+
+  // Metadata needs to be padded out to an even word size.
+  size_t MetadataSize = Metadata.size();

There's no requirement to pad the .info section. When you generate assembly 
language, the .info pseudo-op can only generate words of data, so the if the 
data length is not 0(mod 4), the last word will have to be padded with 
low-order 0s.  This means that the length of the .info section will be a 
multiple of 4. The length, on the other hand, should be exact. At link time, 
only "length" bytes will be copied to the output file.

If you emit object code directly, you will not need to emit any padding bytes.



Comment at: llvm/lib/MC/MCAsmStreamer.cpp:987
+  // If there's no metadata, the length is 0.
+  if (MetadataSize == 0) {
+OS << format_hex(uint32_t(0), 10) << ",";

Can this be moved up right after the computation of MetadataSize?  Can't you 
just emit "0,"?  Why call format_hex()? It seems odd to have a literal comma 
here instead of using Separator.



Comment at: llvm/lib/MC/MCAsmStreamer.cpp:994
+  // Emit length of the metadata with padding.
+  OS << format_hex(PaddedSize, 10) << ",";
+

You should use MetadataSize  and Separator here.  In fact, you could emit the 
length before checking for 0, expecially because a length of 0 is a rare case 
(and impossible for this patch).



Comment at: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:2974
+RSOS << "@(#)" << MDS->getString();
+RSOS.write('\0');
+  }

I would use a newline here.  The AIX **what **command looks for @(#) and echos 
subsequent bytes until it sees a double quote, a backslash, a > symbol, 
newline, or null byte.  The @(#) is not echoed, nor is the terminating 
character.  The **what **command prints a newline after it finds a terminating 
character.  This means that if the command line contains any of the special 
characters, the line will be truncated.

Exception:  If the @(#) is followed by "opt " or " opt ", the terminating 
characters are only a newline or null byte. This allows any of the other 
special characters to be part of the command line. It doesn't really matter if 
you use a newline or a null byte, but the legacy XL compiler uses a newline. 
The "opt" keyword should appear if the command line can contain a double quote, 
a > or a backslash.

The legacy compiler also uses other keywords besides "opt", including "version" 
and "cfg".  The **what** command doesn't do anything special with these 
keywords.



Comment at: llvm/test/CodeGen/PowerPC/aix-command-line-metadata.ll:16
+
+; ASM: .info ".GCC.command.line", 0x0030,
+; ASM: .info , 0x40282329, 0x636c616e, 0x67202d63, 0x6f6d6d61, 0x6e64202d, 
0x6c696e65

0x002e:  The actual length should be emitted.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D153600/new/

https://reviews.llvm.org/D153600

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D142660: [AIX] supporting -X options for llvm-ranlib in AIX OS

2023-05-12 Thread Stephen Peckham via Phabricator via cfe-commits
stephenpeckham added a comment.

Do the -U and -D flags have any effect on the behavior of llvm-ranlib?




Comment at: llvm/test/tools/llvm-ranlib/aix-X-option.test:16
+
+## Test OBJECT_MODE environment variable when adding symbol table
+# RUN: env OBJECT_MODE=32 llvm-ranlib t_X32.a

what about OBJECT_MODE= (defined, but empty value)



Comment at: llvm/tools/llvm-ar/llvm-ar.cpp:80
+ << "  -U- Use actual timestamps and uids/gids\n"
+ << "  -X {32|64|32_64}  - Specifies the type of object files"
+"llvm-ranlib should examine (AIX OS only)\n";

I think the AIX documentation for ranlib isn't as helpful as it could be. I 
actually like a variation of the original message better:

"-X {32|64|32_64}  - Specifies which archive symbol tables should be 
generated if they do not already exist (AIX OS only)\n"

This implies that a 32-bit (64-bit) global symbol table is generated by 
examining XCOFF32 (XCOFF64) members.

But this wording doesn't really fit with the command description: Generate an 
//index// for archives. Should this be "Generate an index or symbol tables for 
archives"? Or just "Generate symbol tables for archives"?  The usage message 
for llvm-ar also mixes "index" and "symbol table"



Comment at: llvm/tools/llvm-ar/llvm-ar.cpp:127
   [P] - use full names when matching (implied for thin archives)
   [s] - create an archive index (cf. ranlib)
   [S] - do not build a symbol table

"Index" or "symbol table"?  See the related comment about the usage message for 
"ranlib".  



Comment at: llvm/tools/llvm-ar/llvm-ar.cpp:1278
   return StringSwitch(RawBitMode)
+  .Case("", BitModeTy::Bit32)
   .Case("32", BitModeTy::Bit32)

AIX commands differentiate between OBJECT_MODE='' (an empty string) and 
OBJECT_MODE not defined.  This function treats them the same way.

-X '' (an empty string) should also be an error. I would return Unknown for 
case "".  For the Default case, if RawBitMode is NULL, Bit32 should be returned.



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D142660/new/

https://reviews.llvm.org/D142660

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D144190: [AIX][clang] Storage Locations for Constant Pointers

2023-03-14 Thread Stephen Peckham via Phabricator via cfe-commits
stephenpeckham added inline comments.



Comment at: clang/docs/ReleaseNotes.rst:230
+- Introduced the ``-mroptr`` option to place constant objects with relocatable
+  address values in the read-only data section. This option is intended to
+  be used with the ``-fdata-sections`` option. When ``-mroptr`` is in effect

"intended" is a bit misleading.  It's an error to use -mroptr and 
-fno-data-sections together.



Comment at: clang/include/clang/Driver/Options.td:3896
+def mroptr : Flag<["-"], "mroptr">, Group, Flags<[CC1Option]>,
+  HelpText<"Place constant objects with relocatable address values in the RO 
data section and imply -bforceimprw when specified at link time">;
+def mno_roptr : Flag<["-"], "mno-roptr">, Group;

Should you add "(AIX only)"? Also, I don't think "imply" is a good choice here. 
I would say:  ... and add -bforceimprw to the linker flags."  



Comment at: clang/lib/Frontend/CompilerInvocation.cpp:1960
+
+// Since the stroage mapping class is specified per csect,
+// without using data sections, it is ambiguous what exactly should

typo



Comment at: clang/lib/Frontend/CompilerInvocation.cpp:1961
+// Since the stroage mapping class is specified per csect,
+// without using data sections, it is ambiguous what exactly should
+// be done for the read-only pointers. Using read-only pointers may cause

It's not ambiguous to use -fno-data-sections and -mroptr together, but it would 
be  less effective.  


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D144190/new/

https://reviews.llvm.org/D144190

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D144190: [AIX][clang] Storage Locations for Constant Pointers

2023-02-23 Thread Stephen Peckham via Phabricator via cfe-commits
stephenpeckham accepted this revision.
stephenpeckham added a comment.
This revision is now accepted and ready to land.

I don't have issues with this code.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D144190/new/

https://reviews.llvm.org/D144190

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits