diff options
| author | Khem Raj <raj.khem@gmail.com> | 2021-03-13 10:26:25 -0800 |
|---|---|---|
| committer | Khem Raj <raj.khem@gmail.com> | 2021-03-13 19:41:07 -0800 |
| commit | eaf1cf83849ccb3addcc789e94321cadac799cf7 (patch) | |
| tree | 5b9c4be0d73ed97f878422cd9456793badb8fc75 | |
| parent | 71668086d0505844961d8f85a80f698b46e9a8f9 (diff) | |
| download | meta-openembedded-eaf1cf83849ccb3addcc789e94321cadac799cf7.tar.gz | |
abseil-cpp: Fix build on musl and ppc64
Signed-off-by: Khem Raj <raj.khem@gmail.com>
| -rw-r--r-- | meta-oe/recipes-devtools/abseil-cpp/abseil-cpp/abseil-ppc-fixes.patch | 94 | ||||
| -rw-r--r-- | meta-oe/recipes-devtools/abseil-cpp/abseil-cpp_git.bb | 1 |
2 files changed, 95 insertions, 0 deletions
diff --git a/meta-oe/recipes-devtools/abseil-cpp/abseil-cpp/abseil-ppc-fixes.patch b/meta-oe/recipes-devtools/abseil-cpp/abseil-cpp/abseil-ppc-fixes.patch new file mode 100644 index 0000000000..ee0c25473b --- /dev/null +++ b/meta-oe/recipes-devtools/abseil-cpp/abseil-cpp/abseil-ppc-fixes.patch | |||
| @@ -0,0 +1,94 @@ | |||
| 1 | An all-in-one patch that fixes several issues: | ||
| 2 | |||
| 3 | 1) UnscaledCycleClock not fully implemented for ppc*-musl (disabled on musl) | ||
| 4 | 2) powerpc stacktrace implementation only works on glibc (disabled on musl) | ||
| 5 | 3) powerpc stacktrace implementation has ppc64 assumptions (fixed) | ||
| 6 | 4) examine_stack.cpp makes glibc assumptions on powerpc (fixed) | ||
| 7 | |||
| 8 | Sourced from void linux | ||
| 9 | |||
| 10 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 11 | |||
| 12 | --- a/absl/base/internal/unscaledcycleclock.cc | ||
| 13 | +++ b/absl/base/internal/unscaledcycleclock.cc | ||
| 14 | @@ -20,7 +20,7 @@ | ||
| 15 | #include <intrin.h> | ||
| 16 | #endif | ||
| 17 | |||
| 18 | -#if defined(__powerpc__) || defined(__ppc__) | ||
| 19 | +#if (defined(__powerpc__) || defined(__ppc__)) && defined(__GLIBC__) | ||
| 20 | #ifdef __GLIBC__ | ||
| 21 | #include <sys/platform/ppc.h> | ||
| 22 | #elif defined(__FreeBSD__) | ||
| 23 | @@ -59,7 +59,7 @@ double UnscaledCycleClock::Frequency() { | ||
| 24 | return base_internal::NominalCPUFrequency(); | ||
| 25 | } | ||
| 26 | |||
| 27 | -#elif defined(__powerpc__) || defined(__ppc__) | ||
| 28 | +#elif (defined(__powerpc__) || defined(__ppc__)) && defined(__GLIBC__) | ||
| 29 | |||
| 30 | int64_t UnscaledCycleClock::Now() { | ||
| 31 | #ifdef __GLIBC__ | ||
| 32 | --- a/absl/base/internal/unscaledcycleclock.h | ||
| 33 | +++ b/absl/base/internal/unscaledcycleclock.h | ||
| 34 | @@ -46,7 +46,7 @@ | ||
| 35 | |||
| 36 | // The following platforms have an implementation of a hardware counter. | ||
| 37 | #if defined(__i386__) || defined(__x86_64__) || defined(__aarch64__) || \ | ||
| 38 | - defined(__powerpc__) || defined(__ppc__) || \ | ||
| 39 | + ((defined(__powerpc__) || defined(__ppc__)) && defined(__GLIBC__)) || \ | ||
| 40 | defined(_M_IX86) || defined(_M_X64) | ||
| 41 | #define ABSL_HAVE_UNSCALED_CYCLECLOCK_IMPLEMENTATION 1 | ||
| 42 | #else | ||
| 43 | --- a/absl/debugging/internal/examine_stack.cc | ||
| 44 | +++ b/absl/debugging/internal/examine_stack.cc | ||
| 45 | @@ -27,6 +27,10 @@ | ||
| 46 | #include <csignal> | ||
| 47 | #include <cstdio> | ||
| 48 | |||
| 49 | +#if defined(__powerpc__) | ||
| 50 | +#include <asm/ptrace.h> | ||
| 51 | +#endif | ||
| 52 | + | ||
| 53 | #include "absl/base/attributes.h" | ||
| 54 | #include "absl/base/internal/raw_logging.h" | ||
| 55 | #include "absl/base/macros.h" | ||
| 56 | @@ -55,8 +59,10 @@ void* GetProgramCounter(void* vuc) { | ||
| 57 | return reinterpret_cast<void*>(context->uc_mcontext.pc); | ||
| 58 | #elif defined(__powerpc64__) | ||
| 59 | return reinterpret_cast<void*>(context->uc_mcontext.gp_regs[32]); | ||
| 60 | -#elif defined(__powerpc__) | ||
| 61 | +#elif defined(__powerpc__) && defined(__GLIBC__) | ||
| 62 | return reinterpret_cast<void*>(context->uc_mcontext.regs->nip); | ||
| 63 | +#elif defined(__powerpc__) | ||
| 64 | + return reinterpret_cast<void*>(((struct pt_regs *)context->uc_regs)->nip); | ||
| 65 | #elif defined(__riscv) | ||
| 66 | return reinterpret_cast<void*>(context->uc_mcontext.__gregs[REG_PC]); | ||
| 67 | #elif defined(__s390__) && !defined(__s390x__) | ||
| 68 | --- a/absl/debugging/internal/stacktrace_config.h | ||
| 69 | +++ b/absl/debugging/internal/stacktrace_config.h | ||
| 70 | @@ -64,7 +64,7 @@ | ||
| 71 | #elif defined(__i386__) || defined(__x86_64__) | ||
| 72 | #define ABSL_STACKTRACE_INL_HEADER \ | ||
| 73 | "absl/debugging/internal/stacktrace_x86-inl.inc" | ||
| 74 | -#elif defined(__ppc__) || defined(__PPC__) | ||
| 75 | +#elif (defined(__ppc__) || defined(__PPC__)) && defined(__GLIBC__) | ||
| 76 | #define ABSL_STACKTRACE_INL_HEADER \ | ||
| 77 | "absl/debugging/internal/stacktrace_powerpc-inl.inc" | ||
| 78 | #elif defined(__aarch64__) | ||
| 79 | --- a/absl/debugging/internal/stacktrace_powerpc-inl.inc | ||
| 80 | +++ b/absl/debugging/internal/stacktrace_powerpc-inl.inc | ||
| 81 | @@ -130,8 +130,13 @@ static void **NextStackFrame(void **old_ | ||
| 82 | StacktracePowerPCGetLR(new_sp) == kernel_sigtramp_rt64_address) { | ||
| 83 | const ucontext_t* signal_context = | ||
| 84 | reinterpret_cast<const ucontext_t*>(uc); | ||
| 85 | +#if defined(__powerpc64__) | ||
| 86 | void **const sp_before_signal = | ||
| 87 | reinterpret_cast<void**>(signal_context->uc_mcontext.gp_regs[PT_R1]); | ||
| 88 | +#else | ||
| 89 | + void **const sp_before_signal = | ||
| 90 | + reinterpret_cast<void**>(signal_context->uc_mcontext.uc_regs->gregs[PT_R1]); | ||
| 91 | +#endif | ||
| 92 | // Check that alleged sp before signal is nonnull and is reasonably | ||
| 93 | // aligned. | ||
| 94 | if (sp_before_signal != nullptr && | ||
diff --git a/meta-oe/recipes-devtools/abseil-cpp/abseil-cpp_git.bb b/meta-oe/recipes-devtools/abseil-cpp/abseil-cpp_git.bb index 6a1a029566..903b7b4b82 100644 --- a/meta-oe/recipes-devtools/abseil-cpp/abseil-cpp_git.bb +++ b/meta-oe/recipes-devtools/abseil-cpp/abseil-cpp_git.bb | |||
| @@ -13,6 +13,7 @@ BRANCH = "lts_2020_09_23" | |||
| 13 | SRC_URI = "git://github.com/abseil/abseil-cpp;branch=${BRANCH} \ | 13 | SRC_URI = "git://github.com/abseil/abseil-cpp;branch=${BRANCH} \ |
| 14 | file://0001-absl-always-use-asm-sgidefs.h.patch \ | 14 | file://0001-absl-always-use-asm-sgidefs.h.patch \ |
| 15 | file://0002-Remove-maes-option-from-cross-compilation.patch \ | 15 | file://0002-Remove-maes-option-from-cross-compilation.patch \ |
| 16 | file://abseil-ppc-fixes.patch \ | ||
| 16 | " | 17 | " |
| 17 | 18 | ||
| 18 | S = "${WORKDIR}/git" | 19 | S = "${WORKDIR}/git" |
