Add byteswap and endian destection code to elfpatch
This commit is contained in:
parent
7be1d6a967
commit
891df1803e
@ -30,6 +30,19 @@
|
|||||||
#include <fort.h>
|
#include <fort.h>
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <patchelfcrc/crc-output-struct.h>
|
#include <patchelfcrc/crc-output-struct.h>
|
||||||
|
#include <byteswap.h>
|
||||||
|
|
||||||
|
static const union {
|
||||||
|
uint8_t data[4];
|
||||||
|
uint32_t val;
|
||||||
|
} _endianess_check_union = {{1u, 2u, 3u, 4u}};
|
||||||
|
|
||||||
|
enum endianess {
|
||||||
|
END_LITTLE = 0x04030201ul,
|
||||||
|
END_BIG = 0x01020304ul,
|
||||||
|
};
|
||||||
|
|
||||||
|
#define HOST_ENDIANESS (_endianess_check_union.value)
|
||||||
|
|
||||||
struct elf_section {
|
struct elf_section {
|
||||||
GElf_Shdr section_header;
|
GElf_Shdr section_header;
|
||||||
|
Loading…
Reference in New Issue
Block a user