forked from M-Labs/artiq
ld, makefiles: use ld.lld
This commit is contained in:
parent
fc42d053d9
commit
1293e0750e
|
@ -15,12 +15,10 @@ SECTIONS
|
||||||
*(.text .text.*)
|
*(.text .text.*)
|
||||||
} > rom
|
} > rom
|
||||||
|
|
||||||
/*
|
.eh_frame :
|
||||||
* The compiler_builtins crate includes some GOTPC relocations, which require a GOT symbol,
|
{
|
||||||
* but don't actually need a GOT. This really ought to be fixed on rustc level, but I'm afraid
|
*(.eh_frame.*)
|
||||||
* it will add further complications to our build system that aren't pulling their weight.
|
} > rom
|
||||||
*/
|
|
||||||
_GLOBAL_OFFSET_TABLE_ = .;
|
|
||||||
|
|
||||||
.rodata :
|
.rodata :
|
||||||
{
|
{
|
||||||
|
@ -29,13 +27,13 @@ SECTIONS
|
||||||
_end = .;
|
_end = .;
|
||||||
} > rom
|
} > rom
|
||||||
|
|
||||||
.crc ALIGN(4) :
|
.crc (NOLOAD) : ALIGN(4)
|
||||||
{
|
{
|
||||||
_crc = .;
|
_crc = .;
|
||||||
. += 4;
|
. += 4;
|
||||||
}
|
} > rom
|
||||||
|
|
||||||
.bss :
|
.bss (NOLOAD) :
|
||||||
{
|
{
|
||||||
_fbss = .;
|
_fbss = .;
|
||||||
*(.sbss .sbss.* .bss .bss.*);
|
*(.sbss .sbss.* .bss .bss.*);
|
||||||
|
@ -43,11 +41,11 @@ SECTIONS
|
||||||
_ebss = .;
|
_ebss = .;
|
||||||
} > sram
|
} > sram
|
||||||
|
|
||||||
.stack :
|
.stack (NOLOAD) : ALIGN(16)
|
||||||
{
|
{
|
||||||
/* Ensure we have a certain amount of space available for stack. */
|
/* Ensure we have a certain amount of space available for stack. */
|
||||||
/*. = ORIGIN(sram) + LENGTH(sram) - 0x1a00; */
|
/*. = ORIGIN(sram) + LENGTH(sram) - 0x1a00; */
|
||||||
. = ORIGIN(sram) + LENGTH(sram) - 4;
|
. = ORIGIN(sram) + LENGTH(sram) - 16;
|
||||||
_fstack = .;
|
_fstack = .;
|
||||||
} > sram
|
} > sram
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ MEMORY {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Kernel stack is at the end of main RAM. */
|
/* Kernel stack is at the end of main RAM. */
|
||||||
_fstack = ORIGIN(main_ram) + LENGTH(main_ram) - 4;
|
_fstack = ORIGIN(main_ram) + LENGTH(main_ram) - 16;
|
||||||
|
|
||||||
/* Force ld to make the ELF header as loadable. */
|
/* Force ld to make the ELF header as loadable. */
|
||||||
PHDRS
|
PHDRS
|
||||||
|
@ -53,19 +53,19 @@ SECTIONS
|
||||||
.eh_frame :
|
.eh_frame :
|
||||||
{
|
{
|
||||||
KEEP(*(.eh_frame))
|
KEEP(*(.eh_frame))
|
||||||
} :text
|
} > ksupport :text
|
||||||
|
|
||||||
.eh_frame_hdr :
|
.eh_frame_hdr :
|
||||||
{
|
{
|
||||||
KEEP(*(.eh_frame_hdr))
|
KEEP(*(.eh_frame_hdr))
|
||||||
} :text :eh_frame
|
} > ksupport :text :eh_frame
|
||||||
|
|
||||||
.data :
|
.data :
|
||||||
{
|
{
|
||||||
*(.data .data.*)
|
*(.data .data.*)
|
||||||
}
|
}
|
||||||
|
|
||||||
.bss :
|
.bss (NOLOAD) :
|
||||||
{
|
{
|
||||||
_fbss = .;
|
_fbss = .;
|
||||||
*(.bss .bss.*)
|
*(.bss .bss.*)
|
||||||
|
|
|
@ -128,7 +128,6 @@ _abs_start:
|
||||||
Saves caller saved registers ra, t0..6, a0..7, calls exception,
|
Saves caller saved registers ra, t0..6, a0..7, calls exception,
|
||||||
restores caller saved registers and then returns.
|
restores caller saved registers and then returns.
|
||||||
*/
|
*/
|
||||||
.section .trap, "ax"
|
|
||||||
.global _start_trap
|
.global _start_trap
|
||||||
/* Make it .weak so PAC/HAL can provide their own if needed. */
|
/* Make it .weak so PAC/HAL can provide their own if needed. */
|
||||||
.weak _start_trap
|
.weak _start_trap
|
||||||
|
|
|
@ -18,10 +18,10 @@ $(RUSTOUT)/libruntime.a:
|
||||||
|
|
||||||
runtime.elf: $(RUSTOUT)/libruntime.a ksupport_data.o
|
runtime.elf: $(RUSTOUT)/libruntime.a ksupport_data.o
|
||||||
$(link) -T $(RUNTIME_DIRECTORY)/runtime.ld \
|
$(link) -T $(RUNTIME_DIRECTORY)/runtime.ld \
|
||||||
-lunwind-bare
|
-lunwind-bare -m elf32lriscv
|
||||||
|
|
||||||
ksupport_data.o: ../ksupport/ksupport.elf
|
ksupport_data.o: ../ksupport/ksupport.elf
|
||||||
$(LD) -m elf32lriscv -b binary -o $@ $<
|
$(LD) -r -m elf32lriscv -b binary -o $@ $<
|
||||||
|
|
||||||
%.bin: %.elf
|
%.bin: %.elf
|
||||||
$(objcopy) -O binary
|
$(objcopy) -O binary
|
||||||
|
|
|
@ -36,10 +36,14 @@ SECTIONS
|
||||||
__eh_frame_hdr_start = SIZEOF(.eh_frame_hdr) > 0 ? ADDR(.eh_frame_hdr) : 0;
|
__eh_frame_hdr_start = SIZEOF(.eh_frame_hdr) > 0 ? ADDR(.eh_frame_hdr) : 0;
|
||||||
__eh_frame_hdr_end = SIZEOF(.eh_frame_hdr) > 0 ? . : 0;
|
__eh_frame_hdr_end = SIZEOF(.eh_frame_hdr) > 0 ? . : 0;
|
||||||
|
|
||||||
|
.gcc_except_table :
|
||||||
|
{
|
||||||
|
*(.gcc_except_table)
|
||||||
|
} > runtime
|
||||||
|
|
||||||
/* https://sourceware.org/bugzilla/show_bug.cgi?id=20475 */
|
/* https://sourceware.org/bugzilla/show_bug.cgi?id=20475 */
|
||||||
.got :
|
.got :
|
||||||
{
|
{
|
||||||
_GLOBAL_OFFSET_TABLE_ = .;
|
|
||||||
*(.got)
|
*(.got)
|
||||||
} > runtime
|
} > runtime
|
||||||
|
|
||||||
|
@ -58,20 +62,20 @@ SECTIONS
|
||||||
*(.data .data.*)
|
*(.data .data.*)
|
||||||
} > runtime
|
} > runtime
|
||||||
|
|
||||||
.bss ALIGN(4) :
|
.bss (NOLOAD) : ALIGN(4)
|
||||||
{
|
{
|
||||||
_fbss = .;
|
_fbss = .;
|
||||||
*(.sbss .sbss.* .bss .bss.*);
|
*(.sbss .sbss.* .bss .bss.*);
|
||||||
_ebss = .;
|
_ebss = .;
|
||||||
} > runtime
|
} > runtime
|
||||||
|
|
||||||
.stack :
|
.stack (NOLOAD) : ALIGN(16)
|
||||||
{
|
{
|
||||||
. += 0x4000;
|
. += 0x4000;
|
||||||
_fstack = . - 4;
|
_fstack = . - 16;
|
||||||
} > runtime
|
} > runtime
|
||||||
|
|
||||||
.heap :
|
.heap (NOLOAD) :
|
||||||
{
|
{
|
||||||
_fheap = .;
|
_fheap = .;
|
||||||
. = ORIGIN(runtime) + LENGTH(runtime);
|
. = ORIGIN(runtime) + LENGTH(runtime);
|
||||||
|
|
|
@ -14,6 +14,13 @@ SECTIONS
|
||||||
*(.text .text.*)
|
*(.text .text.*)
|
||||||
} > main_ram
|
} > main_ram
|
||||||
|
|
||||||
|
.eh_frame :
|
||||||
|
{
|
||||||
|
__eh_frame_start = .;
|
||||||
|
KEEP(*(.eh_frame))
|
||||||
|
__eh_frame_end = .;
|
||||||
|
} > main_ram
|
||||||
|
|
||||||
/* https://sourceware.org/bugzilla/show_bug.cgi?id=20475 */
|
/* https://sourceware.org/bugzilla/show_bug.cgi?id=20475 */
|
||||||
.got :
|
.got :
|
||||||
{
|
{
|
||||||
|
@ -38,7 +45,12 @@ SECTIONS
|
||||||
*(.data .data.*)
|
*(.data .data.*)
|
||||||
} > main_ram
|
} > main_ram
|
||||||
|
|
||||||
.bss ALIGN(4) :
|
.sdata :
|
||||||
|
{
|
||||||
|
*(.sdata .sdata.*)
|
||||||
|
} > main_ram
|
||||||
|
|
||||||
|
.bss (NOLOAD) : ALIGN(4)
|
||||||
{
|
{
|
||||||
_fbss = .;
|
_fbss = .;
|
||||||
*(.sbss .sbss.* .bss .bss.*);
|
*(.sbss .sbss.* .bss .bss.*);
|
||||||
|
@ -46,10 +58,10 @@ SECTIONS
|
||||||
_ebss = .;
|
_ebss = .;
|
||||||
} > main_ram
|
} > main_ram
|
||||||
|
|
||||||
.stack :
|
.stack (NOLOAD) : ALIGN(16)
|
||||||
{
|
{
|
||||||
_estack = .;
|
_estack = .;
|
||||||
. += 0x10000;
|
. += 0x10000;
|
||||||
_fstack = . - 4;
|
_fstack = . - 16;
|
||||||
} > main_ram
|
} > main_ram
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue