forked from chyyuu/os_kernel_lab
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
为 user 部分添加 LinkerScript 手动为不同字段进行对齐 chyyuu#1
- Loading branch information
Showing
4 changed files
with
45 additions
and
2 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
nightly-2020-04-23 | ||
nightly-2020-06-27 |
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 |
---|---|---|
@@ -1,3 +1,9 @@ | ||
# 编译的目标平台 | ||
[build] | ||
target = "riscv64imac-unknown-none-elf" | ||
target = "riscv64imac-unknown-none-elf" | ||
|
||
# 使用我们的 linker script 来进行链接 | ||
[target.riscv64imac-unknown-none-elf] | ||
rustflags = [ | ||
"-C", "link-arg=-Tsrc/linker/linker.ld", | ||
] |
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,33 @@ | ||
/* Linker Script 语法可以参见:http://www.scoberlin.de/content/media/http/informatik/gcc_docs/ld_3.html */ | ||
|
||
/* 目标架构 */ | ||
OUTPUT_ARCH(riscv) | ||
|
||
/* 执行入口 */ | ||
ENTRY(_start) | ||
|
||
/* 数据存放起始地址 */ | ||
BASE_ADDRESS = 0x10000; | ||
|
||
SECTIONS | ||
{ | ||
/* .text 字段 */ | ||
.text : ALIGN(4K) { | ||
*(.text) | ||
} | ||
|
||
/* .rodata 字段 */ | ||
.rodata : ALIGN(4K) { | ||
*(.rodata) | ||
} | ||
|
||
/* .data 字段 */ | ||
.data : ALIGN(4K) { | ||
*(.data) | ||
} | ||
|
||
/* .bss 字段 */ | ||
.bss : ALIGN(4K) { | ||
*(.sbss .bss) | ||
} | ||
} |