Skip to content

Commit d3e5834

Browse files
committed
Linker: Use absolute library path
1 parent 7ca7f67 commit d3e5834

File tree

37 files changed

+135
-80
lines changed

37 files changed

+135
-80
lines changed

01_wait_forever/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ ifeq ($(BSP),rpi3)
2828
OBJDUMP_BINARY = aarch64-none-elf-objdump
2929
NM_BINARY = aarch64-none-elf-nm
3030
READELF_BINARY = aarch64-none-elf-readelf
31-
LD_SCRIPT_PATH = src/bsp/raspberrypi
31+
LD_SCRIPT_PATH = $(shell pwd)/src/bsp/raspberrypi
3232
RUSTC_MISC_ARGS = -C target-cpu=cortex-a53
3333
else ifeq ($(BSP),rpi4)
3434
TARGET = aarch64-unknown-none-softfloat
@@ -39,7 +39,7 @@ else ifeq ($(BSP),rpi4)
3939
OBJDUMP_BINARY = aarch64-none-elf-objdump
4040
NM_BINARY = aarch64-none-elf-nm
4141
READELF_BINARY = aarch64-none-elf-readelf
42-
LD_SCRIPT_PATH = src/bsp/raspberrypi
42+
LD_SCRIPT_PATH = $(shell pwd)/src/bsp/raspberrypi
4343
RUSTC_MISC_ARGS = -C target-cpu=cortex-a72
4444
endif
4545

01_wait_forever/build.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
use std::{env, fs};
1+
use std::{env, fs, process};
22

33
fn main() {
4-
let ld_script_path = env::var("LD_SCRIPT_PATH").unwrap_or_default();
4+
let ld_script_path = match env::var("LD_SCRIPT_PATH") {
5+
Ok(var) => var,
6+
_ => process::exit(0),
7+
};
58

69
let files = fs::read_dir(ld_script_path).unwrap();
710
files

02_runtime_init/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ ifeq ($(BSP),rpi3)
2828
OBJDUMP_BINARY = aarch64-none-elf-objdump
2929
NM_BINARY = aarch64-none-elf-nm
3030
READELF_BINARY = aarch64-none-elf-readelf
31-
LD_SCRIPT_PATH = src/bsp/raspberrypi
31+
LD_SCRIPT_PATH = $(shell pwd)/src/bsp/raspberrypi
3232
RUSTC_MISC_ARGS = -C target-cpu=cortex-a53
3333
else ifeq ($(BSP),rpi4)
3434
TARGET = aarch64-unknown-none-softfloat
@@ -39,7 +39,7 @@ else ifeq ($(BSP),rpi4)
3939
OBJDUMP_BINARY = aarch64-none-elf-objdump
4040
NM_BINARY = aarch64-none-elf-nm
4141
READELF_BINARY = aarch64-none-elf-readelf
42-
LD_SCRIPT_PATH = src/bsp/raspberrypi
42+
LD_SCRIPT_PATH = $(shell pwd)/src/bsp/raspberrypi
4343
RUSTC_MISC_ARGS = -C target-cpu=cortex-a72
4444
endif
4545

02_runtime_init/build.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
use std::{env, fs};
1+
use std::{env, fs, process};
22

33
fn main() {
4-
let ld_script_path = env::var("LD_SCRIPT_PATH").unwrap_or_default();
4+
let ld_script_path = match env::var("LD_SCRIPT_PATH") {
5+
Ok(var) => var,
6+
_ => process::exit(0),
7+
};
58

69
let files = fs::read_dir(ld_script_path).unwrap();
710
files

03_hacky_hello_world/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ ifeq ($(BSP),rpi3)
2828
OBJDUMP_BINARY = aarch64-none-elf-objdump
2929
NM_BINARY = aarch64-none-elf-nm
3030
READELF_BINARY = aarch64-none-elf-readelf
31-
LD_SCRIPT_PATH = src/bsp/raspberrypi
31+
LD_SCRIPT_PATH = $(shell pwd)/src/bsp/raspberrypi
3232
RUSTC_MISC_ARGS = -C target-cpu=cortex-a53
3333
else ifeq ($(BSP),rpi4)
3434
TARGET = aarch64-unknown-none-softfloat
@@ -39,7 +39,7 @@ else ifeq ($(BSP),rpi4)
3939
OBJDUMP_BINARY = aarch64-none-elf-objdump
4040
NM_BINARY = aarch64-none-elf-nm
4141
READELF_BINARY = aarch64-none-elf-readelf
42-
LD_SCRIPT_PATH = src/bsp/raspberrypi
42+
LD_SCRIPT_PATH = $(shell pwd)/src/bsp/raspberrypi
4343
RUSTC_MISC_ARGS = -C target-cpu=cortex-a72
4444
endif
4545

03_hacky_hello_world/build.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
use std::{env, fs};
1+
use std::{env, fs, process};
22

33
fn main() {
4-
let ld_script_path = env::var("LD_SCRIPT_PATH").unwrap_or_default();
4+
let ld_script_path = match env::var("LD_SCRIPT_PATH") {
5+
Ok(var) => var,
6+
_ => process::exit(0),
7+
};
58

69
let files = fs::read_dir(ld_script_path).unwrap();
710
files

04_safe_globals/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ ifeq ($(BSP),rpi3)
2828
OBJDUMP_BINARY = aarch64-none-elf-objdump
2929
NM_BINARY = aarch64-none-elf-nm
3030
READELF_BINARY = aarch64-none-elf-readelf
31-
LD_SCRIPT_PATH = src/bsp/raspberrypi
31+
LD_SCRIPT_PATH = $(shell pwd)/src/bsp/raspberrypi
3232
RUSTC_MISC_ARGS = -C target-cpu=cortex-a53
3333
else ifeq ($(BSP),rpi4)
3434
TARGET = aarch64-unknown-none-softfloat
@@ -39,7 +39,7 @@ else ifeq ($(BSP),rpi4)
3939
OBJDUMP_BINARY = aarch64-none-elf-objdump
4040
NM_BINARY = aarch64-none-elf-nm
4141
READELF_BINARY = aarch64-none-elf-readelf
42-
LD_SCRIPT_PATH = src/bsp/raspberrypi
42+
LD_SCRIPT_PATH = $(shell pwd)/src/bsp/raspberrypi
4343
RUSTC_MISC_ARGS = -C target-cpu=cortex-a72
4444
endif
4545

04_safe_globals/build.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
use std::{env, fs};
1+
use std::{env, fs, process};
22

33
fn main() {
4-
let ld_script_path = env::var("LD_SCRIPT_PATH").unwrap_or_default();
4+
let ld_script_path = match env::var("LD_SCRIPT_PATH") {
5+
Ok(var) => var,
6+
_ => process::exit(0),
7+
};
58

69
let files = fs::read_dir(ld_script_path).unwrap();
710
files

05_drivers_gpio_uart/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ ifeq ($(BSP),rpi3)
3131
OBJDUMP_BINARY = aarch64-none-elf-objdump
3232
NM_BINARY = aarch64-none-elf-nm
3333
READELF_BINARY = aarch64-none-elf-readelf
34-
LD_SCRIPT_PATH = src/bsp/raspberrypi
34+
LD_SCRIPT_PATH = $(shell pwd)/src/bsp/raspberrypi
3535
RUSTC_MISC_ARGS = -C target-cpu=cortex-a53
3636
else ifeq ($(BSP),rpi4)
3737
TARGET = aarch64-unknown-none-softfloat
@@ -42,7 +42,7 @@ else ifeq ($(BSP),rpi4)
4242
OBJDUMP_BINARY = aarch64-none-elf-objdump
4343
NM_BINARY = aarch64-none-elf-nm
4444
READELF_BINARY = aarch64-none-elf-readelf
45-
LD_SCRIPT_PATH = src/bsp/raspberrypi
45+
LD_SCRIPT_PATH = $(shell pwd)/src/bsp/raspberrypi
4646
RUSTC_MISC_ARGS = -C target-cpu=cortex-a72
4747
endif
4848

05_drivers_gpio_uart/build.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
use std::{env, fs};
1+
use std::{env, fs, process};
22

33
fn main() {
4-
let ld_script_path = env::var("LD_SCRIPT_PATH").unwrap_or_default();
4+
let ld_script_path = match env::var("LD_SCRIPT_PATH") {
5+
Ok(var) => var,
6+
_ => process::exit(0),
7+
};
58

69
let files = fs::read_dir(ld_script_path).unwrap();
710
files

0 commit comments

Comments
 (0)