Skip to content
This repository was archived by the owner on Nov 23, 2025. It is now read-only.

Commit 4f10bbf

Browse files
committed
Fix RISCV TLS test.
1 parent bae6624 commit 4f10bbf

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/arch/riscv/test.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ fn load_pie_elf() {
105105
#[test]
106106
fn check_nopie() {
107107
init();
108-
let binary_blob = fs::read("test/test_nopie.aarch64").expect("Can't read binary");
108+
let binary_blob = fs::read("test/test_nopie.riscv64").expect("Can't read binary");
109109
let binary = ElfBinary::new(binary_blob.as_slice()).expect("Got proper ELF file");
110110

111111
assert!(!binary.is_pie());
@@ -115,18 +115,19 @@ fn check_nopie() {
115115
fn check_tls() {
116116
init();
117117

118-
let binary_blob = fs::read("test/tls.aarch64").expect("Can't read binary");
118+
let binary_blob = fs::read("test/tls.riscv64").expect("Can't read binary");
119119
let binary = ElfBinary::new(binary_blob.as_slice()).expect("Got proper ELF file");
120120
let mut loader = TestLoader::new(0x1000_0000);
121121
binary.load(&mut loader).expect("Can't load?");
122122
/*
123+
readelf -l test/tls.riscv64
123124
TLS produces entries of this form:
124125
pheader = Program header:
125126
type: Ok(Tls)
126127
flags: R
127-
offset: 0xdb4
128-
virtual address: 0x200db4
129-
physical address: 0x200db4
128+
offset: 0xe20
129+
virtual address: 0x1e0c
130+
physical address: 0x1e0c
130131
file size: 0x4
131132
memory size: 0x8
132133
align: 0x4
@@ -139,6 +140,6 @@ fn check_tls() {
139140
assert!(loader
140141
.actions
141142
.iter()
142-
.find(|&&x| x == LoaderAction::Tls(VAddr::from(0x10d8cu64), 0x4, 0x8, 0x4))
143+
.find(|&&x| x == LoaderAction::Tls(VAddr::from(0x1e0cu64), 0x4, 0x8, 0x4))
143144
.is_some());
144145
}

src/arch/test.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ impl ElfLoader for TestLoader {
7575
x86(R_386_NONE) => Ok(()),
7676
// RISCV
7777
RiscV(R_RISCV_64) => Ok(()),
78+
RiscV(R_RISCV_NONE) => Ok(()),
7879
RiscV(R_RISCV_RELATIVE) => {
7980
// This type requires addend to be present
8081
let addend = entry

0 commit comments

Comments
 (0)