Control: tags -1 patch

Hi,

On 19/06/17 09:24, Adrian Bunk wrote:
> FAIL: nlist
> ===========
> 
> nlist: nlist.c:70: main: Assertion `rc == 0' failed.
> FAIL nlist (exit status: 134)

I've attached some patches which should fix this for mips64el and
ppc64el (and probably ppc64). As far as I can tell, nlist has never
worked on these architectures.

The ppc64el patch fixes 2 errors in local-elf.h:
* ppc64el defines both __powerpc__ and __powerpc64__ but since the
__powerpc64__ #elif is below the __powerpc__ one, it will never be hit.
* Both assumed that powerpc* was big-endian.

The mips64el patch adds a check for _MIPS_SIM inside the __mips__ #elif
to detect mips64el and use ELFCLASS64 in that case. Note that we can't
use defined(__mips64) here because that is also defined when the n32 ABI
is in use, which uses ELFCLASS32.

Thanks,
James
--- a/src/local-elf.h
+++ b/src/local-elf.h
@@ -140,17 +140,29 @@
 #define ELF_TARG_CLASS	ELFCLASS32
 #define ELF_TARG_DATA	ELFDATA2LSB
 
-#elif defined(__powerpc__)
-
-#define ELF_TARG_MACH	EM_PPC
-#define ELF_TARG_CLASS	ELFCLASS32
-#define ELF_TARG_DATA	ELFDATA2MSB
-
 #elif defined(__powerpc64__)
 
 #define ELF_TARG_MACH	EM_PPC64
 #define ELF_TARG_CLASS	ELFCLASS64
-#define ELF_TARG_DATA	ELFDATA2MSB
+#if defined(__LITTLE_ENDIAN__)
+#define ELF_TARG_DATA	ELFDATA2LSB
+#elif defined(__BIG_ENDIAN__)
+#define ELF_TARG_DATA	ELFDATA2MSB
+#else
+#error Unknown PowerPC64 endianness
+#endif
+
+#elif defined(__powerpc__)
+
+#define ELF_TARG_MACH	EM_PPC
+#define ELF_TARG_CLASS	ELFCLASS32
+#if defined(__LITTLE_ENDIAN__)
+#define ELF_TARG_DATA	ELFDATA2LSB
+#elif defined(__BIG_ENDIAN__)
+#define ELF_TARG_DATA	ELFDATA2MSB
+#else
+#error Unknown PowerPC endianness
+#endif
 
 #elif defined(__riscv)
 
--- a/src/local-elf.h
+++ b/src/local-elf.h
@@ -127,7 +127,11 @@
 #elif defined(__mips__)
 
 #define ELF_TARG_MACH	EM_MIPS
+#if defined(_ABI64) && _MIPS_SIM == _ABI64
+#define ELF_TARG_CLASS	ELFCLASS64
+#else
 #define ELF_TARG_CLASS	ELFCLASS32
+#endif
 #if defined(__MIPSEB__)
 #define ELF_TARG_DATA	ELFDATA2MSB
 #else

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to