| commit | 26df43faebaded77d694161fbdc79d81ad5d5f1c | [log] [tgz] |
|---|---|---|
| author | eddyz87 <eddyz87@gmail.com> | Sat Sep 28 22:58:56 2024 -0700 |
| committer | GitHub <noreply@github.com> | Sun Sep 29 08:58:56 2024 +0300 |
| tree | 3e45332062451d302e16627995b6ab3d1c9cd4b6 | |
| parent | d705bd25eb9f11e100d3e79b65a80d446fd06f30 [diff] |
[BPF] fix print_btf.py test script on bigendian machines (#110332) Make print_btf.py correctly detect endianness of the BTF input. Input endianness is inferred from BTF magic word [2], which is a 2-byte integer at offset 0 of the input: - sequence `EB 9F` signals big-endian input; - sequence `9F EB` signals little-endian input. Before this commit the magic sequence was read using "H" format for `unpack` method of python's `struct` module: - if magic is `0xEB9F` assume little-endian; - if magic is `0x9FEB` assume big-endian. However, format `H` reads data in native endianness. Thus the above logic would only be correct on little endian hosts: - byte sequence `9F EB` read as `0xEB9F` -> little-endian input; - byte sequence `EB 9F` read as `0x9FEB` -> big-endian input. On the big-endian host the relation should be inverse. Fix this by always reading magic in big-endian (format `>H`). This fixes CI error reported for a BPF test using print_btf.py script in [1]. The error happens on a s390 host, which is big-endian. [1] https://lab.llvm.org/buildbot/#/builders/42/builds/1192 [2] https://www.kernel.org/doc/html/latest/bpf/btf.html#btf-type-and-string-encoding
Welcome to the LLVM project!
This repository contains the source code for LLVM, a toolkit for the construction of highly optimized compilers, optimizers, and run-time environments.
The LLVM project has multiple components. The core of the project is itself called “LLVM”. This contains all of the tools, libraries, and header files needed to process intermediate representations and convert them into object files. Tools include an assembler, disassembler, bitcode analyzer, and bitcode optimizer.
C-like languages use the Clang frontend. This component compiles C, C++, Objective-C, and Objective-C++ code into LLVM bitcode -- and from there into object files, using LLVM.
Other components include: the libc++ C++ standard library, the LLD linker, and more.
Consult the Getting Started with LLVM page for information on building and running LLVM.
For information on how to contribute to the LLVM project, please take a look at the Contributing to LLVM guide.
Join the LLVM Discourse forums, Discord chat, LLVM Office Hours or Regular sync-ups.
The LLVM project has adopted a code of conduct for participants to all modes of communication within the project.