[PATCH] D118320: llvm-libunwind build fix for GCC on PPC32

Sam James via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 26 23:36:12 PST 2022


thesamesam created this revision.
thesamesam added a reviewer: MaskRay.
Herald added subscribers: steven.zhang, shchenz.
thesamesam requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Originally reported downstream in Gentoo here <https://bugs.gentoo.org/832140>.

  /var/tmp/portage/sys-libs/llvm-libunwind-13.0.0/work/libunwind/src/libunwind.cpp:77:3: error: #error Architecture not supported
     77 | # error Architecture not supported
        |   ^~~~~
  [...]
  /var/tmp/portage/sys-libs/llvm-libunwind-13.0.0/work/libunwind/src/libunwind.cpp: In function ‘int __unw_init_local(unw_cursor_t*, unw_context_t*)’:
  /var/tmp/portage/sys-libs/llvm-libunwind-13.0.0/work/libunwind/src/libunwind.cpp:80:57: error: ‘REGISTER_KIND’ was not declared in this scope
     80 |   new (reinterpret_cast<UnwindCursor<LocalAddressSpace, REGISTER_KIND> *>(cursor))
        |                                                         ^~~~~~~~~~~~~
  [...]

PPC is actually a supported architecture, but GCC (tested with 11.2.0) on powerpc32 seems to only define:
`__PPC__, _ARCH_PPC, __PPC, __powerpc` and //not// `__ppc__`.

This adds `__PPC__`` which fixes the build.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D118320

Files:
  src/libunwind.cpp


Index: src/libunwind.cpp
===================================================================
--- src/libunwind.cpp
+++ src/libunwind.cpp
@@ -51,7 +51,7 @@
 # define REGISTER_KIND Registers_x86_64
 #elif defined(__powerpc64__)
 # define REGISTER_KIND Registers_ppc64
-#elif defined(__ppc__)
+#elif defined(__ppc__) || defined(__PPC__)
 # define REGISTER_KIND Registers_ppc
 #elif defined(__aarch64__)
 # define REGISTER_KIND Registers_arm64


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D118320.403512.patch
Type: text/x-patch
Size: 440 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220127/6317fcd3/attachment.bin>


More information about the llvm-commits mailing list