mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-11-09 08:37:58 +08:00
riscv: Address differences in the linkerscript between GNU LD and LLVM/LLD
LLVM/LLD does not support STARTUP and ALIGN_WITH_INPUT directives that GNU LD support. INPUT and ALIGN(8) are supported by LLVM/LLD and can replace the unsupported STARTUP/ALIGN_WITH_INPUT directives. The commit conditionally adds the supported directive that linkers can understand depending on the toolchain used to compile RTEMS i.e., clang or gcc. Clang is assumed to use LLD by default.
This commit is contained in:
1 parent
ca82ded785
commit
f462bcbb0a
4 files changed
+84
-52
No files matched your search
File diff suppressed because it is too large.
Load diff
@@ -23,7 +23,7 @@ start.$(OBJEXT): ../../../../../../bsps/riscv/shared/start/start.S
|
||||
project_lib_DATA = start.$(OBJEXT)
|
||||
|
||||
project_lib_DATA += linkcmds
|
||||
project_lib_DATA += ../../../../../../bsps/riscv/shared/start/linkcmds.base
|
||||
project_lib_DATA += linkcmds.base
|
||||
|
||||
###############################################################################
|
||||
# LibBSP #
|
||||
|
||||
@@ -30,11 +30,30 @@ AC_ARG_VAR([$1],[$2])dnl
|
||||
[$1]=[$]{[$1]:-[$3]}
|
||||
])
|
||||
|
||||
case "${RTEMS_BSP}" in
|
||||
*clang)
|
||||
RISCV_LINKER_START_DIRECTIVE_DEFAULT="INPUT"
|
||||
RISCV_LINKER_ALIGN_DIRECTIVE_DEFAULT="ALIGN(8)"
|
||||
;;
|
||||
*)
|
||||
RISCV_LINKER_START_DIRECTIVE_DEFAULT="STARTUP"
|
||||
RISCV_LINKER_ALIGN_DIRECTIVE_DEFAULT="ALIGN_WITH_INPUT"
|
||||
;;
|
||||
esac
|
||||
|
||||
AC_DEFUN([RISCV_LINKCMD],[
|
||||
AC_ARG_VAR([$1],[$2])dnl
|
||||
[$1]=[$]{[$1]:-[$3]}
|
||||
])
|
||||
|
||||
RISCV_LINKCMD([RISCV_RAM_REGION_BEGIN],[begin of the RAM region for linker command file (default is 0x40000000)],[${RISCV_RAM_REGION_BEGIN_DEFAULT}])
|
||||
RISCV_LINKCMD([RISCV_RAM_REGION_SIZE],[size of the RAM region for linker command file (default 16MiB)],[0x01000000])
|
||||
RISCV_LINKCMD([RISCV_LINKER_START_DIRECTIVE],[GNU LD understands STARTUP directive while LLVM/LLD does not and needs INPUT instead],[${RISCV_LINKER_START_DIRECTIVE_DEFAULT}])
|
||||
RISCV_LINKCMD([RISCV_LINKER_ALIGN_DIRECTIVE],[LLD does not support ALIGN_WITH_INPUT directive],[${RISCV_LINKER_ALIGN_DIRECTIVE_DEFAULT}])
|
||||
|
||||
AC_CONFIG_FILES([
|
||||
Makefile
|
||||
linkcmds:../../../../../../bsps/riscv/griscv/start/linkcmds.in
|
||||
linkcmds.base:../../../../../../bsps/riscv/shared/start/linkcmds.base.in
|
||||
])
|
||||
AC_OUTPUT
|
||||
@@ -67,6 +67,17 @@ case "${RTEMS_BSP}" in
|
||||
;;
|
||||
esac
|
||||
|
||||
case "${RTEMS_BSP}" in
|
||||
*clang)
|
||||
RISCV_LINKER_START_DIRECTIVE_DEFAULT="INPUT"
|
||||
RISCV_LINKER_ALIGN_DIRECTIVE_DEFAULT="ALIGN(8)"
|
||||
;;
|
||||
*)
|
||||
RISCV_LINKER_START_DIRECTIVE_DEFAULT="STARTUP"
|
||||
RISCV_LINKER_ALIGN_DIRECTIVE_DEFAULT="ALIGN_WITH_INPUT"
|
||||
;;
|
||||
esac
|
||||
|
||||
AC_DEFUN([RISCV_LINKCMD],[
|
||||
AC_ARG_VAR([$1],[$2])dnl
|
||||
[$1]=[$]{[$1]:-[$3]}
|
||||
@@ -74,6 +85,8 @@ AC_ARG_VAR([$1],[$2])dnl
|
||||
|
||||
RISCV_LINKCMD([RISCV_RAM_REGION_BEGIN],[begin of the RAM region for linker command file (default is 0x70000000 for 64-bit with -mcmodel=medlow and 0x80000000 for all other)],[${RISCV_RAM_REGION_BEGIN_DEFAULT}])
|
||||
RISCV_LINKCMD([RISCV_RAM_REGION_SIZE],[size of the RAM region for linker command file (default is 256 MiB for frdme310arty and 64 MiB for all other)],[${RISCV_RAM_REGION_SIZE_DEFAULT}])
|
||||
RISCV_LINKCMD([RISCV_LINKER_START_DIRECTIVE],[GNU LD understands STARTUP directive while LLVM/LLD does not and needs INPUT instead],[${RISCV_LINKER_START_DIRECTIVE_DEFAULT}])
|
||||
RISCV_LINKCMD([RISCV_LINKER_ALIGN_DIRECTIVE],[LLD does not support ALIGN_WITH_INPUT directive],[${RISCV_LINKER_ALIGN_DIRECTIVE_DEFAULT}])
|
||||
|
||||
AC_CONFIG_FILES([
|
||||
Makefile
|
||||
|
||||
Reference in new issue
Block a user