diff options
| author | Ilya Leoshkevich <[email protected]> | 2021-10-26 01:08:27 +0000 |
|---|---|---|
| committer | Andrii Nakryiko <[email protected]> | 2021-10-26 03:39:41 +0000 |
| commit | 3930198dc9a0720a2b6561c67e55859ec51b73f9 (patch) | |
| tree | 1515d8636e9879992791fd5db55d3fd6b5f19f2b /tools/lib/bpf/linker.c | |
| parent | libbpf: Fix endianness detection in BPF_CORE_READ_BITFIELD_PROBED() (diff) | |
| download | kernel-3930198dc9a0720a2b6561c67e55859ec51b73f9.tar.gz kernel-3930198dc9a0720a2b6561c67e55859ec51b73f9.zip | |
libbpf: Use __BYTE_ORDER__
Use the compiler-defined __BYTE_ORDER__ instead of the libc-defined
__BYTE_ORDER for consistency.
Signed-off-by: Ilya Leoshkevich <[email protected]>
Signed-off-by: Andrii Nakryiko <[email protected]>
Link: https://lore.kernel.org/bpf/[email protected]
Diffstat (limited to 'tools/lib/bpf/linker.c')
| -rw-r--r-- | tools/lib/bpf/linker.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/tools/lib/bpf/linker.c b/tools/lib/bpf/linker.c index 7bf658fbda80..ce0800e61dc7 100644 --- a/tools/lib/bpf/linker.c +++ b/tools/lib/bpf/linker.c @@ -323,12 +323,12 @@ static int init_output_elf(struct bpf_linker *linker, const char *file) linker->elf_hdr->e_machine = EM_BPF; linker->elf_hdr->e_type = ET_REL; -#if __BYTE_ORDER == __LITTLE_ENDIAN +#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ linker->elf_hdr->e_ident[EI_DATA] = ELFDATA2LSB; -#elif __BYTE_ORDER == __BIG_ENDIAN +#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ linker->elf_hdr->e_ident[EI_DATA] = ELFDATA2MSB; #else -#error "Unknown __BYTE_ORDER" +#error "Unknown __BYTE_ORDER__" #endif /* STRTAB */ @@ -538,12 +538,12 @@ static int linker_load_obj_file(struct bpf_linker *linker, const char *filename, const struct bpf_linker_file_opts *opts, struct src_obj *obj) { -#if __BYTE_ORDER == __LITTLE_ENDIAN +#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ const int host_endianness = ELFDATA2LSB; -#elif __BYTE_ORDER == __BIG_ENDIAN +#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ const int host_endianness = ELFDATA2MSB; #else -#error "Unknown __BYTE_ORDER" +#error "Unknown __BYTE_ORDER__" #endif int err = 0; Elf_Scn *scn; |
