[PATCH] D101336: [LLD][BPF] Add bpf support
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed May 12 12:54:58 PDT 2021
MaskRay added inline comments.
================
Comment at: lld/ELF/Arch/BPF.cpp:49
+
+RelType BPF::getDynRel(RelType type) const { return type; }
+
----------------
`R_NONE` if no dynamic relocation is expected
================
Comment at: lld/ELF/Arch/BPF.cpp:53
+ const uint8_t *loc) const {
+ if (type == R_BPF_NONE)
+ return R_NONE;
----------------
See other `Arch/*.cpp`: add switch in getRelExpr and add `error`
================
Comment at: lld/ELF/LTO.cpp:87
- // Always emit a section per function/datum with LTO.
- c.Options.FunctionSections = true;
- c.Options.DataSections = true;
+ if (config->emitFuncDataSections) {
+ c.Options.FunctionSections = true;
----------------
Remove the abstraction: `emitFuncDataSections`.
Just test `config->emachine` and config->relocatable.
================
Comment at: lld/test/ELF/bpf-basic.s:2
+// REQUIRES: bpf
+// RUN: echo 'define dso_local i32 @foo() local_unnamed_addr { entry: ret i32 0 }' > %t1.ll
+// RUN: echo 'define dso_local i32 @bar() local_unnamed_addr { entry: ret i32 1 }' > %t2.ll
----------------
Use `split-file %s %t`
================
Comment at: lld/test/ELF/bpf-basic.s:4
+// RUN: echo 'define dso_local i32 @bar() local_unnamed_addr { entry: ret i32 1 }' > %t2.ll
+// RUN: llc -filetype=obj -mtriple=bpfel %t1.ll -o %t3
+// RUN: llc -filetype=obj -mtriple=bpfel %t2.ll -o %t4
----------------
See `riscv-*.s` how I organize the little-endian and big-endian RUN lines.
================
Comment at: lld/test/ELF/bpf-basic.s:6
+// RUN: llc -filetype=obj -mtriple=bpfel %t2.ll -o %t4
+// RUN: ld.lld -relocatable %t3 %t4 -o %t5
+// RUN: llvm-objdump -d --no-show-raw-insn %t5 | FileCheck %s
----------------
`-relocatable` => `-r`
================
Comment at: lld/test/ELF/bpf-lto-basic.s:1
+// REQUIRES: bpf
+// RUN: llvm-as %S/Inputs/bpf-lto-basic-1.ll -o %t1
----------------
move to `test/ELF/lto`
Use `.bc` for bitcode file extension.
================
Comment at: lld/test/ELF/bpf-lto-basic.s:10
+// CHECK: <bar>:
+// CHECK: call {{[0-9]+}}
+// CHECK: call -1
----------------
`[[#]]`
================
Comment at: lld/test/ELF/bpf-lto-basic.s:17
+
+// BTF: 9feb0100
+// BTF-NOT: 9feb0100
----------------
Add a comment what the magic value is.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D101336/new/
https://reviews.llvm.org/D101336
More information about the llvm-commits
mailing list