Skip to content

Commit cffd4a4

Browse files
committed
Simplify detection of the powerpc64 ELFv2 ABI
Compilers for 32-bit powerpc may not define _CALL_ELF. Squelches an undefined warning from GCC. Fix the pre-processor check, and in turn fix the symbolize_test on 32-bit powerpc.
1 parent 269ce47 commit cffd4a4

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

absl/debugging/symbolize_elf.inc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,10 @@ namespace {
125125
// Some platforms use a special .opd section to store function pointers.
126126
const char kOpdSectionName[] = ".opd";
127127

128-
#if (defined(__powerpc__) && !(_CALL_ELF > 1)) || defined(__ia64)
128+
// _CALL_ELF is not guaranteed to be defined by the compiler.
129+
#define HAVE_PPC64_ELFV2_ABI (defined(__powerpc64__) && (defined(_CALL_ELF) && (_CALL_ELF == 2)))
130+
131+
#if HAVE_PPC64_ELFV2_ABI || defined(__ia64)
129132
// Use opd section for function descriptors on these platforms, the function
130133
// address is the first word of the descriptor.
131134
enum { kPlatformUsesOPDSections = 1 };
@@ -1451,7 +1454,7 @@ static bool MaybeInitializeObjFile(ObjFile *obj) {
14511454
}
14521455
phoff += phentsize;
14531456

1454-
#if defined(__powerpc__) && !(_CALL_ELF > 1)
1457+
#if HAVE_PPC64_ELFV2_ABI
14551458
// On the PowerPC ELF v1 ABI, function pointers actually point to function
14561459
// descriptors. These descriptors are stored in an .opd section, which is
14571460
// mapped read-only. We thus need to look at all readable segments, not

0 commit comments

Comments
 (0)