[llvm-branch-commits] [lld] 5b2990a - [ELF] #undef PPC to support GCC powerpc32 build

Tom Stellard via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Dec 20 22:18:45 PST 2021


Author: Fangrui Song
Date: 2021-12-20T22:18:21-08:00
New Revision: 5b2990a6ff77d8026258fc51c5767e9ee0662f1a

URL: https://github.com/llvm/llvm-project/commit/5b2990a6ff77d8026258fc51c5767e9ee0662f1a
DIFF: https://github.com/llvm/llvm-project/commit/5b2990a6ff77d8026258fc51c5767e9ee0662f1a.diff

LOG: [ELF] #undef PPC to support GCC powerpc32 build

GCC's powerpc32 port predefines `PPC` as a macro in GNU C++ mode in some configurations (Linux,
FreeBSD, and some others. See `builtin_define_std ("PPC"); ` in gcc/config/rs6000).

```
% powerpc-linux-gnu-g++ -E -dM -xc++ /dev/null -o - | grep -w PPC
#define PPC 1
```

Fixes https://bugs.gentoo.org/829599

Reviewed By: thesamesam

Differential Revision: https://reviews.llvm.org/D116017

(cherry picked from commit bee5bc9075a44ae74f57a956ebe6d7ce7aa7524b)

Added: 
    

Modified: 
    lld/ELF/Arch/PPC.cpp

Removed: 
    


################################################################################
diff  --git a/lld/ELF/Arch/PPC.cpp b/lld/ELF/Arch/PPC.cpp
index aaecef6ee94fc..d9334d5bf8538 100644
--- a/lld/ELF/Arch/PPC.cpp
+++ b/lld/ELF/Arch/PPC.cpp
@@ -20,6 +20,9 @@ using namespace llvm::ELF;
 using namespace lld;
 using namespace lld::elf;
 
+// Undefine the macro predefined by GCC powerpc32.
+#undef PPC
+
 namespace {
 class PPC final : public TargetInfo {
 public:


        


More information about the llvm-branch-commits mailing list