Update riscv-gnu-toolchain to 1b80cbe
Signed-off-by: Clifford Wolf <clifford@clifford.at>
This commit is contained in:
parent
f9d4a5dc0c
commit
f52f36762e
2
Makefile
2
Makefile
|
@ -1,5 +1,5 @@
|
|||
|
||||
RISCV_GNU_TOOLCHAIN_GIT_REVISION = bf5697a
|
||||
RISCV_GNU_TOOLCHAIN_GIT_REVISION = 1b80cbe
|
||||
RISCV_GNU_TOOLCHAIN_INSTALL_PREFIX = /opt/riscv32
|
||||
|
||||
SHELL = bash
|
||||
|
|
|
@ -359,9 +359,9 @@ any other ALU operation.
|
|||
The following dhrystone benchmark results are for a core with enabled
|
||||
`ENABLE_FAST_MUL`, `ENABLE_DIV`, and `BARREL_SHIFTER` options.
|
||||
|
||||
Dhrystone benchmark results: 0.521 DMIPS/MHz (916 Dhrystones/Second/MHz)
|
||||
Dhrystone benchmark results: 0.516 DMIPS/MHz (908 Dhrystones/Second/MHz)
|
||||
|
||||
For the Dhrystone benchmark the average CPI is 4.081.
|
||||
For the Dhrystone benchmark the average CPI is 4.100.
|
||||
|
||||
Without using the look-ahead memory interface (usually required for max
|
||||
clock speed), this results drop to 0.305 DMIPS/MHz and 5.232 CPI.
|
||||
|
@ -632,7 +632,7 @@ pure RV32I target, and install it in `/opt/riscv32i`:
|
|||
|
||||
git clone https://github.com/riscv/riscv-gnu-toolchain riscv-gnu-toolchain-rv32i
|
||||
cd riscv-gnu-toolchain-rv32i
|
||||
git checkout bf5697a
|
||||
git checkout 1b80cbe
|
||||
git submodule update --init --recursive
|
||||
|
||||
mkdir build; cd build
|
||||
|
@ -661,7 +661,7 @@ By default calling any of those make targets will (re-)download the toolchain
|
|||
sources. Run `make download-tools` to download the sources to `/var/cache/distfiles/`
|
||||
once in advance.
|
||||
|
||||
*Note: This instructions are for git rev bf5697a (2017-11-18) of riscv-gnu-toolchain.*
|
||||
*Note: This instructions are for git rev 1b80cbe (2010-04-01) of riscv-gnu-toolchain.*
|
||||
|
||||
|
||||
Linking binaries with newlib for PicoRV32
|
||||
|
|
|
@ -11,31 +11,31 @@
|
|||
asm (
|
||||
".text\n"
|
||||
".align 2\n"
|
||||
UNIMPL_FUNC(open)
|
||||
UNIMPL_FUNC(openat)
|
||||
UNIMPL_FUNC(lseek)
|
||||
UNIMPL_FUNC(stat)
|
||||
UNIMPL_FUNC(lstat)
|
||||
UNIMPL_FUNC(fstatat)
|
||||
UNIMPL_FUNC(isatty)
|
||||
UNIMPL_FUNC(access)
|
||||
UNIMPL_FUNC(faccessat)
|
||||
UNIMPL_FUNC(link)
|
||||
UNIMPL_FUNC(unlink)
|
||||
UNIMPL_FUNC(execve)
|
||||
UNIMPL_FUNC(getpid)
|
||||
UNIMPL_FUNC(fork)
|
||||
UNIMPL_FUNC(kill)
|
||||
UNIMPL_FUNC(wait)
|
||||
UNIMPL_FUNC(times)
|
||||
UNIMPL_FUNC(gettimeofday)
|
||||
UNIMPL_FUNC(ftime)
|
||||
UNIMPL_FUNC(utime)
|
||||
UNIMPL_FUNC(chown)
|
||||
UNIMPL_FUNC(chmod)
|
||||
UNIMPL_FUNC(chdir)
|
||||
UNIMPL_FUNC(getcwd)
|
||||
UNIMPL_FUNC(sysconf)
|
||||
UNIMPL_FUNC(_open)
|
||||
UNIMPL_FUNC(_openat)
|
||||
UNIMPL_FUNC(_lseek)
|
||||
UNIMPL_FUNC(_stat)
|
||||
UNIMPL_FUNC(_lstat)
|
||||
UNIMPL_FUNC(_fstatat)
|
||||
UNIMPL_FUNC(_isatty)
|
||||
UNIMPL_FUNC(_access)
|
||||
UNIMPL_FUNC(_faccessat)
|
||||
UNIMPL_FUNC(_link)
|
||||
UNIMPL_FUNC(_unlink)
|
||||
UNIMPL_FUNC(_execve)
|
||||
UNIMPL_FUNC(_getpid)
|
||||
UNIMPL_FUNC(_fork)
|
||||
UNIMPL_FUNC(_kill)
|
||||
UNIMPL_FUNC(_wait)
|
||||
UNIMPL_FUNC(_times)
|
||||
UNIMPL_FUNC(_gettimeofday)
|
||||
UNIMPL_FUNC(_ftime)
|
||||
UNIMPL_FUNC(_utime)
|
||||
UNIMPL_FUNC(_chown)
|
||||
UNIMPL_FUNC(_chmod)
|
||||
UNIMPL_FUNC(_chdir)
|
||||
UNIMPL_FUNC(_getcwd)
|
||||
UNIMPL_FUNC(_sysconf)
|
||||
"j unimplemented_syscall\n"
|
||||
);
|
||||
|
||||
|
@ -48,13 +48,13 @@ void unimplemented_syscall()
|
|||
__builtin_unreachable();
|
||||
}
|
||||
|
||||
ssize_t read(int file, void *ptr, size_t len)
|
||||
ssize_t _read(int file, void *ptr, size_t len)
|
||||
{
|
||||
// always EOF
|
||||
return 0;
|
||||
}
|
||||
|
||||
ssize_t write(int file, const void *ptr, size_t len)
|
||||
ssize_t _write(int file, const void *ptr, size_t len)
|
||||
{
|
||||
const void *eptr = ptr + len;
|
||||
while (ptr != eptr)
|
||||
|
@ -62,20 +62,20 @@ ssize_t write(int file, const void *ptr, size_t len)
|
|||
return len;
|
||||
}
|
||||
|
||||
int close(int file)
|
||||
int _close(int file)
|
||||
{
|
||||
// close is called before _exit()
|
||||
return 0;
|
||||
}
|
||||
|
||||
int fstat(int file, struct stat *st)
|
||||
int _fstat(int file, struct stat *st)
|
||||
{
|
||||
// fstat is called during libc startup
|
||||
errno = ENOENT;
|
||||
return -1;
|
||||
}
|
||||
|
||||
void *sbrk(ptrdiff_t incr)
|
||||
void *_sbrk(ptrdiff_t incr)
|
||||
{
|
||||
extern unsigned char _end[]; // Defined by linker
|
||||
static unsigned long heap_end;
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/* ---- Original Script: /opt/riscv32i/riscv32-unknown-elf/lib/ldscripts/elf32lriscv.x ---- */
|
||||
/* Default linker script, for normal executables */
|
||||
/* Copyright (C) 2014-2017 Free Software Foundation, Inc.
|
||||
Copying and distribution of this script, with or without modification,
|
||||
|
@ -197,4 +198,3 @@ SECTIONS
|
|||
.gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
|
||||
/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,236 @@
|
|||
/* ---- Original Script: /opt/riscv32i/riscv32-unknown-elf/lib/ldscripts/elf32lriscv.x ---- */
|
||||
/* Default linker script, for normal executables */
|
||||
/* Copyright (C) 2014-2017 Free Software Foundation, Inc.
|
||||
Copying and distribution of this script, with or without modification,
|
||||
are permitted in any medium without royalty provided the copyright
|
||||
notice and this notice are preserved. */
|
||||
OUTPUT_FORMAT("elf32-littleriscv", "elf32-littleriscv",
|
||||
"elf32-littleriscv")
|
||||
OUTPUT_ARCH(riscv)
|
||||
ENTRY(_start)
|
||||
SEARCH_DIR("/opt/riscv32i/riscv32-unknown-elf/lib");
|
||||
SECTIONS
|
||||
{
|
||||
/* Read-only sections, merged into text segment: */
|
||||
PROVIDE (__executable_start = SEGMENT_START("text-segment", 0x10000)); . = SEGMENT_START("text-segment", 0x10000) + SIZEOF_HEADERS;
|
||||
.interp : { *(.interp) }
|
||||
.note.gnu.build-id : { *(.note.gnu.build-id) }
|
||||
.hash : { *(.hash) }
|
||||
.gnu.hash : { *(.gnu.hash) }
|
||||
.dynsym : { *(.dynsym) }
|
||||
.dynstr : { *(.dynstr) }
|
||||
.gnu.version : { *(.gnu.version) }
|
||||
.gnu.version_d : { *(.gnu.version_d) }
|
||||
.gnu.version_r : { *(.gnu.version_r) }
|
||||
.rela.init : { *(.rela.init) }
|
||||
.rela.text : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) }
|
||||
.rela.fini : { *(.rela.fini) }
|
||||
.rela.rodata : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) }
|
||||
.rela.data.rel.ro : { *(.rela.data.rel.ro .rela.data.rel.ro.* .rela.gnu.linkonce.d.rel.ro.*) }
|
||||
.rela.data : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) }
|
||||
.rela.tdata : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) }
|
||||
.rela.tbss : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) }
|
||||
.rela.ctors : { *(.rela.ctors) }
|
||||
.rela.dtors : { *(.rela.dtors) }
|
||||
.rela.got : { *(.rela.got) }
|
||||
.rela.sdata : { *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*) }
|
||||
.rela.sbss : { *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*) }
|
||||
.rela.sdata2 : { *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*) }
|
||||
.rela.sbss2 : { *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*) }
|
||||
.rela.bss : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) }
|
||||
.rela.iplt :
|
||||
{
|
||||
PROVIDE_HIDDEN (__rela_iplt_start = .);
|
||||
*(.rela.iplt)
|
||||
PROVIDE_HIDDEN (__rela_iplt_end = .);
|
||||
}
|
||||
.rela.plt :
|
||||
{
|
||||
*(.rela.plt)
|
||||
}
|
||||
.init :
|
||||
{
|
||||
KEEP (*(SORT_NONE(.init)))
|
||||
}
|
||||
.plt : { *(.plt) }
|
||||
.iplt : { *(.iplt) }
|
||||
.text :
|
||||
{
|
||||
*(.text.unlikely .text.*_unlikely .text.unlikely.*)
|
||||
*(.text.exit .text.exit.*)
|
||||
*(.text.startup .text.startup.*)
|
||||
*(.text.hot .text.hot.*)
|
||||
*(.text .stub .text.* .gnu.linkonce.t.*)
|
||||
/* .gnu.warning sections are handled specially by elf32.em. */
|
||||
*(.gnu.warning)
|
||||
}
|
||||
.fini :
|
||||
{
|
||||
KEEP (*(SORT_NONE(.fini)))
|
||||
}
|
||||
PROVIDE (__etext = .);
|
||||
PROVIDE (_etext = .);
|
||||
PROVIDE (etext = .);
|
||||
.rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
|
||||
.rodata1 : { *(.rodata1) }
|
||||
.sdata2 :
|
||||
{
|
||||
*(.sdata2 .sdata2.* .gnu.linkonce.s2.*)
|
||||
}
|
||||
.sbss2 : { *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) }
|
||||
.eh_frame_hdr : { *(.eh_frame_hdr) *(.eh_frame_entry .eh_frame_entry.*) }
|
||||
.eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) *(.eh_frame.*) }
|
||||
.gcc_except_table : ONLY_IF_RO { *(.gcc_except_table
|
||||
.gcc_except_table.*) }
|
||||
.gnu_extab : ONLY_IF_RO { *(.gnu_extab*) }
|
||||
/* These sections are generated by the Sun/Oracle C++ compiler. */
|
||||
.exception_ranges : ONLY_IF_RO { *(.exception_ranges
|
||||
.exception_ranges*) }
|
||||
/* Adjust the address for the data segment. We want to adjust up to
|
||||
the same address within the page on the next page up. */
|
||||
. = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
|
||||
/* Exception handling */
|
||||
.eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) *(.eh_frame.*) }
|
||||
.gnu_extab : ONLY_IF_RW { *(.gnu_extab) }
|
||||
.gcc_except_table : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
|
||||
.exception_ranges : ONLY_IF_RW { *(.exception_ranges .exception_ranges*) }
|
||||
/* Thread Local Storage sections */
|
||||
.tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
|
||||
.tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
|
||||
.preinit_array :
|
||||
{
|
||||
PROVIDE_HIDDEN (__preinit_array_start = .);
|
||||
KEEP (*(.preinit_array))
|
||||
PROVIDE_HIDDEN (__preinit_array_end = .);
|
||||
}
|
||||
.init_array :
|
||||
{
|
||||
PROVIDE_HIDDEN (__init_array_start = .);
|
||||
KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*)))
|
||||
KEEP (*(.init_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .ctors))
|
||||
PROVIDE_HIDDEN (__init_array_end = .);
|
||||
}
|
||||
.fini_array :
|
||||
{
|
||||
PROVIDE_HIDDEN (__fini_array_start = .);
|
||||
KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*)))
|
||||
KEEP (*(.fini_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .dtors))
|
||||
PROVIDE_HIDDEN (__fini_array_end = .);
|
||||
}
|
||||
.ctors :
|
||||
{
|
||||
/* gcc uses crtbegin.o to find the start of
|
||||
the constructors, so we make sure it is
|
||||
first. Because this is a wildcard, it
|
||||
doesn't matter if the user does not
|
||||
actually link against crtbegin.o; the
|
||||
linker won't look for a file to match a
|
||||
wildcard. The wildcard also means that it
|
||||
doesn't matter which directory crtbegin.o
|
||||
is in. */
|
||||
KEEP (*crtbegin.o(.ctors))
|
||||
KEEP (*crtbegin?.o(.ctors))
|
||||
/* We don't want to include the .ctor section from
|
||||
the crtend.o file until after the sorted ctors.
|
||||
The .ctor section from the crtend file contains the
|
||||
end of ctors marker and it must be last */
|
||||
KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
|
||||
KEEP (*(SORT(.ctors.*)))
|
||||
KEEP (*(.ctors))
|
||||
}
|
||||
.dtors :
|
||||
{
|
||||
KEEP (*crtbegin.o(.dtors))
|
||||
KEEP (*crtbegin?.o(.dtors))
|
||||
KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
|
||||
KEEP (*(SORT(.dtors.*)))
|
||||
KEEP (*(.dtors))
|
||||
}
|
||||
.jcr : { KEEP (*(.jcr)) }
|
||||
.data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro .data.rel.ro.* .gnu.linkonce.d.rel.ro.*) }
|
||||
.dynamic : { *(.dynamic) }
|
||||
. = DATA_SEGMENT_RELRO_END (0, .);
|
||||
.data :
|
||||
{
|
||||
*(.data .data.* .gnu.linkonce.d.*)
|
||||
SORT(CONSTRUCTORS)
|
||||
}
|
||||
.data1 : { *(.data1) }
|
||||
.got : { *(.got.plt) *(.igot.plt) *(.got) *(.igot) }
|
||||
/* We want the small data sections together, so single-instruction offsets
|
||||
can access them all, and initialized data all before uninitialized, so
|
||||
we can shorten the on-disk segment size. */
|
||||
.sdata :
|
||||
{
|
||||
__global_pointer$ = . + 0x800;
|
||||
*(.srodata.cst16) *(.srodata.cst8) *(.srodata.cst4) *(.srodata.cst2) *(.srodata .srodata.*)
|
||||
*(.sdata .sdata.* .gnu.linkonce.s.*)
|
||||
}
|
||||
_edata = .; PROVIDE (edata = .);
|
||||
. = .;
|
||||
__bss_start = .;
|
||||
.sbss :
|
||||
{
|
||||
*(.dynsbss)
|
||||
*(.sbss .sbss.* .gnu.linkonce.sb.*)
|
||||
*(.scommon)
|
||||
}
|
||||
.bss :
|
||||
{
|
||||
*(.dynbss)
|
||||
*(.bss .bss.* .gnu.linkonce.b.*)
|
||||
*(COMMON)
|
||||
/* Align here to ensure that the .bss section occupies space up to
|
||||
_end. Align after .bss to ensure correct alignment even if the
|
||||
.bss section disappears because there are no input sections.
|
||||
FIXME: Why do we need it? When there is no .bss section, we don't
|
||||
pad the .data section. */
|
||||
. = ALIGN(. != 0 ? 32 / 8 : 1);
|
||||
}
|
||||
. = ALIGN(32 / 8);
|
||||
. = SEGMENT_START("ldata-segment", .);
|
||||
. = ALIGN(32 / 8);
|
||||
_end = .; PROVIDE (end = .);
|
||||
. = DATA_SEGMENT_END (.);
|
||||
/* Stabs debugging sections. */
|
||||
.stab 0 : { *(.stab) }
|
||||
.stabstr 0 : { *(.stabstr) }
|
||||
.stab.excl 0 : { *(.stab.excl) }
|
||||
.stab.exclstr 0 : { *(.stab.exclstr) }
|
||||
.stab.index 0 : { *(.stab.index) }
|
||||
.stab.indexstr 0 : { *(.stab.indexstr) }
|
||||
.comment 0 : { *(.comment) }
|
||||
/* DWARF debug sections.
|
||||
Symbols in the DWARF debugging sections are relative to the beginning
|
||||
of the section so we begin them at 0. */
|
||||
/* DWARF 1 */
|
||||
.debug 0 : { *(.debug) }
|
||||
.line 0 : { *(.line) }
|
||||
/* GNU DWARF 1 extensions */
|
||||
.debug_srcinfo 0 : { *(.debug_srcinfo) }
|
||||
.debug_sfnames 0 : { *(.debug_sfnames) }
|
||||
/* DWARF 1.1 and DWARF 2 */
|
||||
.debug_aranges 0 : { *(.debug_aranges) }
|
||||
.debug_pubnames 0 : { *(.debug_pubnames) }
|
||||
/* DWARF 2 */
|
||||
.debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
|
||||
.debug_abbrev 0 : { *(.debug_abbrev) }
|
||||
.debug_line 0 : { *(.debug_line .debug_line.* .debug_line_end ) }
|
||||
.debug_frame 0 : { *(.debug_frame) }
|
||||
.debug_str 0 : { *(.debug_str) }
|
||||
.debug_loc 0 : { *(.debug_loc) }
|
||||
.debug_macinfo 0 : { *(.debug_macinfo) }
|
||||
/* SGI/MIPS DWARF 2 extensions */
|
||||
.debug_weaknames 0 : { *(.debug_weaknames) }
|
||||
.debug_funcnames 0 : { *(.debug_funcnames) }
|
||||
.debug_typenames 0 : { *(.debug_typenames) }
|
||||
.debug_varnames 0 : { *(.debug_varnames) }
|
||||
/* DWARF 3 */
|
||||
.debug_pubtypes 0 : { *(.debug_pubtypes) }
|
||||
.debug_ranges 0 : { *(.debug_ranges) }
|
||||
/* DWARF Extension. */
|
||||
.debug_macro 0 : { *(.debug_macro) }
|
||||
.debug_addr 0 : { *(.debug_addr) }
|
||||
.gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
|
||||
/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }
|
||||
}
|
|
@ -1,90 +0,0 @@
|
|||
--- <(riscv32-unknown-elf-ld -z nocombreloc -verbose)
|
||||
+++ riscv.ld
|
||||
@@ -1,9 +1,3 @@
|
||||
-GNU ld (GNU Binutils) 2.28.0.20170322
|
||||
- Supported emulations:
|
||||
- elf32lriscv
|
||||
- elf64lriscv
|
||||
-using internal linker script:
|
||||
-==================================================
|
||||
/* Default linker script, for normal executables */
|
||||
/* Copyright (C) 2014-2017 Free Software Foundation, Inc.
|
||||
Copying and distribution of this script, with or without modification,
|
||||
@@ -13,62 +7,26 @@
|
||||
"elf32-littleriscv")
|
||||
OUTPUT_ARCH(riscv)
|
||||
ENTRY(_start)
|
||||
-SEARCH_DIR("/opt/riscv32i/riscv32-unknown-elf/lib");
|
||||
SECTIONS
|
||||
{
|
||||
- /* Read-only sections, merged into text segment: */
|
||||
- PROVIDE (__executable_start = SEGMENT_START("text-segment", 0x10000)); . = SEGMENT_START("text-segment", 0x10000) + SIZEOF_HEADERS;
|
||||
- .interp : { *(.interp) }
|
||||
- .note.gnu.build-id : { *(.note.gnu.build-id) }
|
||||
- .hash : { *(.hash) }
|
||||
- .gnu.hash : { *(.gnu.hash) }
|
||||
- .dynsym : { *(.dynsym) }
|
||||
- .dynstr : { *(.dynstr) }
|
||||
- .gnu.version : { *(.gnu.version) }
|
||||
- .gnu.version_d : { *(.gnu.version_d) }
|
||||
- .gnu.version_r : { *(.gnu.version_r) }
|
||||
- .rela.init : { *(.rela.init) }
|
||||
- .rela.text : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) }
|
||||
- .rela.fini : { *(.rela.fini) }
|
||||
- .rela.rodata : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) }
|
||||
- .rela.data.rel.ro : { *(.rela.data.rel.ro .rela.data.rel.ro.* .rela.gnu.linkonce.d.rel.ro.*) }
|
||||
- .rela.data : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) }
|
||||
- .rela.tdata : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) }
|
||||
- .rela.tbss : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) }
|
||||
- .rela.ctors : { *(.rela.ctors) }
|
||||
- .rela.dtors : { *(.rela.dtors) }
|
||||
- .rela.got : { *(.rela.got) }
|
||||
- .rela.sdata : { *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*) }
|
||||
- .rela.sbss : { *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*) }
|
||||
- .rela.sdata2 : { *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*) }
|
||||
- .rela.sbss2 : { *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*) }
|
||||
- .rela.bss : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) }
|
||||
- .rela.iplt :
|
||||
- {
|
||||
- PROVIDE_HIDDEN (__rela_iplt_start = .);
|
||||
- *(.rela.iplt)
|
||||
- PROVIDE_HIDDEN (__rela_iplt_end = .);
|
||||
- }
|
||||
- .rela.plt :
|
||||
- {
|
||||
- *(.rela.plt)
|
||||
- }
|
||||
- .init :
|
||||
- {
|
||||
- KEEP (*(SORT_NONE(.init)))
|
||||
- }
|
||||
- .plt : { *(.plt) }
|
||||
- .iplt : { *(.iplt) }
|
||||
+ . = 0x00010000;
|
||||
.text :
|
||||
{
|
||||
+ *(.text)
|
||||
*(.text.unlikely .text.*_unlikely .text.unlikely.*)
|
||||
*(.text.exit .text.exit.*)
|
||||
*(.text.startup .text.startup.*)
|
||||
*(.text.hot .text.hot.*)
|
||||
- *(.text .stub .text.* .gnu.linkonce.t.*)
|
||||
+ *(.stub .text.* .gnu.linkonce.t.*)
|
||||
/* .gnu.warning sections are handled specially by elf32.em. */
|
||||
*(.gnu.warning)
|
||||
}
|
||||
+ .init :
|
||||
+ {
|
||||
+ KEEP (*(SORT_NONE(.init)))
|
||||
+ }
|
||||
+ .plt : { *(.plt) }
|
||||
+ .iplt : { *(.iplt) }
|
||||
.fini :
|
||||
{
|
||||
KEEP (*(SORT_NONE(.fini)))
|
||||
@@ -240,5 +198,3 @@
|
||||
/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }
|
||||
}
|
||||
|
||||
-
|
||||
-==================================================
|
|
@ -1,5 +1,5 @@
|
|||
// An extremely minimalist syscalls.c for newlib
|
||||
// Based on riscv newlib libgloss/riscv/machine/syscall.h
|
||||
// Based on riscv newlib libgloss/riscv/sys_*.c
|
||||
// Written by Clifford Wolf.
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
@ -11,31 +11,31 @@
|
|||
asm (
|
||||
".text\n"
|
||||
".align 2\n"
|
||||
UNIMPL_FUNC(open)
|
||||
UNIMPL_FUNC(openat)
|
||||
UNIMPL_FUNC(lseek)
|
||||
UNIMPL_FUNC(stat)
|
||||
UNIMPL_FUNC(lstat)
|
||||
UNIMPL_FUNC(fstatat)
|
||||
UNIMPL_FUNC(isatty)
|
||||
UNIMPL_FUNC(access)
|
||||
UNIMPL_FUNC(faccessat)
|
||||
UNIMPL_FUNC(link)
|
||||
UNIMPL_FUNC(unlink)
|
||||
UNIMPL_FUNC(execve)
|
||||
UNIMPL_FUNC(getpid)
|
||||
UNIMPL_FUNC(fork)
|
||||
UNIMPL_FUNC(kill)
|
||||
UNIMPL_FUNC(wait)
|
||||
UNIMPL_FUNC(times)
|
||||
UNIMPL_FUNC(gettimeofday)
|
||||
UNIMPL_FUNC(ftime)
|
||||
UNIMPL_FUNC(utime)
|
||||
UNIMPL_FUNC(chown)
|
||||
UNIMPL_FUNC(chmod)
|
||||
UNIMPL_FUNC(chdir)
|
||||
UNIMPL_FUNC(getcwd)
|
||||
UNIMPL_FUNC(sysconf)
|
||||
UNIMPL_FUNC(_open)
|
||||
UNIMPL_FUNC(_openat)
|
||||
UNIMPL_FUNC(_lseek)
|
||||
UNIMPL_FUNC(_stat)
|
||||
UNIMPL_FUNC(_lstat)
|
||||
UNIMPL_FUNC(_fstatat)
|
||||
UNIMPL_FUNC(_isatty)
|
||||
UNIMPL_FUNC(_access)
|
||||
UNIMPL_FUNC(_faccessat)
|
||||
UNIMPL_FUNC(_link)
|
||||
UNIMPL_FUNC(_unlink)
|
||||
UNIMPL_FUNC(_execve)
|
||||
UNIMPL_FUNC(_getpid)
|
||||
UNIMPL_FUNC(_fork)
|
||||
UNIMPL_FUNC(_kill)
|
||||
UNIMPL_FUNC(_wait)
|
||||
UNIMPL_FUNC(_times)
|
||||
UNIMPL_FUNC(_gettimeofday)
|
||||
UNIMPL_FUNC(_ftime)
|
||||
UNIMPL_FUNC(_utime)
|
||||
UNIMPL_FUNC(_chown)
|
||||
UNIMPL_FUNC(_chmod)
|
||||
UNIMPL_FUNC(_chdir)
|
||||
UNIMPL_FUNC(_getcwd)
|
||||
UNIMPL_FUNC(_sysconf)
|
||||
"j unimplemented_syscall\n"
|
||||
);
|
||||
|
||||
|
@ -48,13 +48,13 @@ void unimplemented_syscall()
|
|||
__builtin_unreachable();
|
||||
}
|
||||
|
||||
ssize_t read(int file, void *ptr, size_t len)
|
||||
ssize_t _read(int file, void *ptr, size_t len)
|
||||
{
|
||||
// always EOF
|
||||
return 0;
|
||||
}
|
||||
|
||||
ssize_t write(int file, const void *ptr, size_t len)
|
||||
ssize_t _write(int file, const void *ptr, size_t len)
|
||||
{
|
||||
const void *eptr = ptr + len;
|
||||
while (ptr != eptr)
|
||||
|
@ -62,20 +62,20 @@ ssize_t write(int file, const void *ptr, size_t len)
|
|||
return len;
|
||||
}
|
||||
|
||||
int close(int file)
|
||||
int _close(int file)
|
||||
{
|
||||
// close is called before _exit()
|
||||
return 0;
|
||||
}
|
||||
|
||||
int fstat(int file, struct stat *st)
|
||||
int _fstat(int file, struct stat *st)
|
||||
{
|
||||
// fstat is called during libc startup
|
||||
errno = ENOENT;
|
||||
return -1;
|
||||
}
|
||||
|
||||
void *sbrk(ptrdiff_t incr)
|
||||
void *_sbrk(ptrdiff_t incr)
|
||||
{
|
||||
extern unsigned char _end[]; // Defined by linker
|
||||
static unsigned long heap_end;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// An extremely minimalist syscalls.c for newlib
|
||||
// Based on riscv newlib libgloss/riscv/machine/syscall.h
|
||||
// Based on riscv newlib libgloss/riscv/sys_*.c
|
||||
// Written by Clifford Wolf.
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
@ -11,31 +11,31 @@
|
|||
asm (
|
||||
".text\n"
|
||||
".align 2\n"
|
||||
UNIMPL_FUNC(open)
|
||||
UNIMPL_FUNC(openat)
|
||||
UNIMPL_FUNC(lseek)
|
||||
UNIMPL_FUNC(stat)
|
||||
UNIMPL_FUNC(lstat)
|
||||
UNIMPL_FUNC(fstatat)
|
||||
UNIMPL_FUNC(isatty)
|
||||
UNIMPL_FUNC(access)
|
||||
UNIMPL_FUNC(faccessat)
|
||||
UNIMPL_FUNC(link)
|
||||
UNIMPL_FUNC(unlink)
|
||||
UNIMPL_FUNC(execve)
|
||||
UNIMPL_FUNC(getpid)
|
||||
UNIMPL_FUNC(fork)
|
||||
UNIMPL_FUNC(kill)
|
||||
UNIMPL_FUNC(wait)
|
||||
UNIMPL_FUNC(times)
|
||||
UNIMPL_FUNC(gettimeofday)
|
||||
UNIMPL_FUNC(ftime)
|
||||
UNIMPL_FUNC(utime)
|
||||
UNIMPL_FUNC(chown)
|
||||
UNIMPL_FUNC(chmod)
|
||||
UNIMPL_FUNC(chdir)
|
||||
UNIMPL_FUNC(getcwd)
|
||||
UNIMPL_FUNC(sysconf)
|
||||
UNIMPL_FUNC(_open)
|
||||
UNIMPL_FUNC(_openat)
|
||||
UNIMPL_FUNC(_lseek)
|
||||
UNIMPL_FUNC(_stat)
|
||||
UNIMPL_FUNC(_lstat)
|
||||
UNIMPL_FUNC(_fstatat)
|
||||
UNIMPL_FUNC(_isatty)
|
||||
UNIMPL_FUNC(_access)
|
||||
UNIMPL_FUNC(_faccessat)
|
||||
UNIMPL_FUNC(_link)
|
||||
UNIMPL_FUNC(_unlink)
|
||||
UNIMPL_FUNC(_execve)
|
||||
UNIMPL_FUNC(_getpid)
|
||||
UNIMPL_FUNC(_fork)
|
||||
UNIMPL_FUNC(_kill)
|
||||
UNIMPL_FUNC(_wait)
|
||||
UNIMPL_FUNC(_times)
|
||||
UNIMPL_FUNC(_gettimeofday)
|
||||
UNIMPL_FUNC(_ftime)
|
||||
UNIMPL_FUNC(_utime)
|
||||
UNIMPL_FUNC(_chown)
|
||||
UNIMPL_FUNC(_chmod)
|
||||
UNIMPL_FUNC(_chdir)
|
||||
UNIMPL_FUNC(_getcwd)
|
||||
UNIMPL_FUNC(_sysconf)
|
||||
"j unimplemented_syscall\n"
|
||||
);
|
||||
|
||||
|
@ -48,13 +48,13 @@ void unimplemented_syscall()
|
|||
__builtin_unreachable();
|
||||
}
|
||||
|
||||
ssize_t read(int file, void *ptr, size_t len)
|
||||
ssize_t _read(int file, void *ptr, size_t len)
|
||||
{
|
||||
// always EOF
|
||||
return 0;
|
||||
}
|
||||
|
||||
ssize_t write(int file, const void *ptr, size_t len)
|
||||
ssize_t _write(int file, const void *ptr, size_t len)
|
||||
{
|
||||
const void *eptr = ptr + len;
|
||||
while (ptr != eptr)
|
||||
|
@ -62,20 +62,20 @@ ssize_t write(int file, const void *ptr, size_t len)
|
|||
return len;
|
||||
}
|
||||
|
||||
int close(int file)
|
||||
int _close(int file)
|
||||
{
|
||||
// close is called before _exit()
|
||||
return 0;
|
||||
}
|
||||
|
||||
int fstat(int file, struct stat *st)
|
||||
int _fstat(int file, struct stat *st)
|
||||
{
|
||||
// fstat is called during libc startup
|
||||
errno = ENOENT;
|
||||
return -1;
|
||||
}
|
||||
|
||||
void *sbrk(ptrdiff_t incr)
|
||||
void *_sbrk(ptrdiff_t incr)
|
||||
{
|
||||
extern unsigned char _end[]; // Defined by linker
|
||||
static unsigned long heap_end;
|
||||
|
|
Loading…
Reference in New Issue