diff options
author | Yonghong Song <yhs@fb.com> | 2021-10-19 15:29:12 -0700 |
---|---|---|
committer | Yonghong Song <yhs@fb.com> | 2021-10-19 16:26:01 -0700 |
commit | cd40b5a71290bab313cc431fb9a90ac3f9f3fa02 (patch) | |
tree | 28345fc660b18108ee2f894cfa877bdb16e76124 /clang/lib/CodeGen/CodeGenAction.cpp | |
parent | b6b7fe60a444e03387b0e8be31bc1742ead36b25 (diff) | |
download | llvm-cd40b5a71290bab313cc431fb9a90ac3f9f3fa02.zip llvm-cd40b5a71290bab313cc431fb9a90ac3f9f3fa02.tar.gz llvm-cd40b5a71290bab313cc431fb9a90ac3f9f3fa02.tar.bz2 |
BPF: set .BTF and .BTF.ext section alignment to 4
Currently, .BTF and .BTF.ext has default alignment of 1.
For example,
$ cat t.c
int foo() { return 0; }
$ clang -target bpf -O2 -c -g t.c
$ llvm-readelf -S t.o
...
Section Headers:
[Nr] Name Type Address Off Size ES Flg Lk Inf Al
...
[ 7] .BTF PROGBITS 0000000000000000 000167 00008b 00 0 0 1
[ 8] .BTF.ext PROGBITS 0000000000000000 0001f2 000050 00 0 0 1
But to have no misaligned data access, .BTF and .BTF.ext
actually requires alignment of 4. Misalignment is not an issue
for architecture like x64/arm64 as it can handle it well. But
some architectures like mips may incur a trap if .BTF/.BTF.ext
is not properly aligned.
This patch explicitly forced .BTF and .BTF.ext alignment to be 4.
For the above example, we will have
[ 7] .BTF PROGBITS 0000000000000000 000168 00008b 00 0 0 4
[ 8] .BTF.ext PROGBITS 0000000000000000 0001f4 000050 00 0 0 4
Differential Revision: https://reviews.llvm.org/D112106
Diffstat (limited to 'clang/lib/CodeGen/CodeGenAction.cpp')
0 files changed, 0 insertions, 0 deletions