forked from qmonnet/rbpf
-
Notifications
You must be signed in to change notification settings - Fork 165
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
elf: add support for rodata sections already aligned to MM_PROGRAM_ST…
…ART (#301) When config.enable_elf_vaddr=true, allow for sections to be already aligned to MM_PROGRAM_START at link time. This is a pre-requisite for entirely disabling relocations down the line. In addition to logic changes in parse_ro_section() to relax the previous sh_addr = sh_offset assumption, fix relocations involving addresses above the 32bit address space (MM_PROGRAM_START = 1 << 32). See anza-xyz/llvm-project#35. Finally, this adds end to end tests for R_BPF_64_64 and R_BPF_64_RELATIVE relocations.
- Loading branch information
1 parent
97488d2
commit 792fb1e
Showing
16 changed files
with
525 additions
and
95 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
File renamed without changes.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/** | ||
* @brief a program to test R_BPF_64_RELATIVE relocation handling | ||
*/ | ||
|
||
typedef unsigned long int uint64_t; | ||
typedef unsigned char uint8_t; | ||
|
||
extern uint64_t entrypoint(const uint8_t *input) { | ||
return (uint64_t) __func__; | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/** | ||
* @brief a program to test R_BPF_64_RELATIVE relocation handling | ||
*/ | ||
|
||
typedef unsigned long int uint64_t; | ||
typedef unsigned char uint8_t; | ||
|
||
// this will store __FILE__ and generate a relocation for FILE to refer to it | ||
volatile const uint64_t FILE = (uint64_t) __FILE__; | ||
|
||
extern uint64_t entrypoint(const uint8_t *input) { | ||
return FILE; | ||
} |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters