From 27d501fdbf0c6932e6170e8dece4d178d912bf94 Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Sat, 10 Jan 2009 21:02:48 +0000 Subject: simple optimizations and style fixes in dynamic loading text data bss dec hex filename - 16709 240 92 17041 4291 lib/ld-uClibc.so + 16634 236 92 16962 4242 lib/ld-uClibc.so - 4602 344 4 4950 1356 lib/libdl-0.9.30-svn.so + 4571 328 4 4903 1327 lib/libdl-0.9.30-svn.so - 4602 344 4 4950 1356 lib/libdl.so + 4571 328 4 4903 1327 lib/libdl.so --- include/elf.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'include/elf.h') diff --git a/include/elf.h b/include/elf.h index 4ebe15c23..3e174bccf 100644 --- a/include/elf.h +++ b/include/elf.h @@ -120,6 +120,13 @@ typedef struct /* Conglomeration of the identification bytes, for easy testing as a word. */ #define ELFMAG "\177ELF" #define SELFMAG 4 +#if __BYTE_ORDER == __LITTLE_ENDIAN +# define ELFMAG_U32 ((uint32_t)(ELFMAG0 + 0x100 * (ELFMAG1 + (0x100 * (ELFMAG2 + 0x100 * ELFMAG3))))) +#elif __BYTE_ORDER == __BIG_ENDIAN +# define ELFMAG_U32 ((uint32_t)((((ELFMAG0 * 0x100) + ELFMAG1) * 0x100 + ELFMAG2) * 0x100 + ELFMAG3)) +#else +# error Unknown host byte order! +#endif #define EI_CLASS 4 /* File class byte index */ #define ELFCLASSNONE 0 /* Invalid class */ -- cgit v1.2.3