diff options
author | Hesham Almatary <Hesham.Almatary@cl.cam.ac.uk> | 2019-10-23 12:43:17 +0100 |
---|---|---|
committer | Hesham Almatary <Hesham.Almatary@cl.cam.ac.uk> | 2019-10-27 10:45:00 +0000 |
commit | f462bcbb0a2cf6030bf2420aae0e083856bf3a53 (patch) | |
tree | fa790631c01d2690abf438634dcb596eedc408fc /c/src/lib/libbsp/riscv/riscv/configure.ac | |
parent | riscv: Generate linkcmds.base from the shared linkcmds.base.in (diff) | |
download | rtems-f462bcbb0a2cf6030bf2420aae0e083856bf3a53.tar.bz2 |
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.
Diffstat (limited to '')
-rw-r--r-- | c/src/lib/libbsp/riscv/riscv/configure.ac | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/c/src/lib/libbsp/riscv/riscv/configure.ac b/c/src/lib/libbsp/riscv/riscv/configure.ac index af501badf2..4494a03536 100644 --- a/c/src/lib/libbsp/riscv/riscv/configure.ac +++ b/c/src/lib/libbsp/riscv/riscv/configure.ac @@ -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 |