[lld] bee5bc9 - [ELF] #undef PPC to support GCC powerpc32 build

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 20 10:12:56 PST 2021


Author: Fangrui Song
Date: 2021-12-20T10:12:51-08:00
New Revision: bee5bc9075a44ae74f57a956ebe6d7ce7aa7524b

URL: https://github.com/llvm/llvm-project/commit/bee5bc9075a44ae74f57a956ebe6d7ce7aa7524b
DIFF: https://github.com/llvm/llvm-project/commit/bee5bc9075a44ae74f57a956ebe6d7ce7aa7524b.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

Added: 
    

Modified: 
    lld/ELF/Arch/PPC.cpp

Removed: 
    


################################################################################
diff  --git a/lld/ELF/Arch/PPC.cpp b/lld/ELF/Arch/PPC.cpp
index 0dda9a40eef77..3a7d3f477e02b 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-commits mailing list