[RFC PATCH 2/5] riscv: Address differences in the linkerscript between GNU LD and LLVM/LLD

Sebastian Huber sebastian.huber at embedded-brains.de
Thu Oct 24 10:39:20 UTC 2019


On 24/10/2019 11:15, Hesham Almatary wrote:
> On Thu, 24 Oct 2019 at 09:58, Sebastian Huber
> <sebastian.huber at embedded-brains.de>  wrote:
>> On 23/10/2019 15:44, Hesham Almatary wrote:
>>> 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.
>>> ---
>>>    bsps/riscv/shared/start/linkcmds.base.in  | 102 +++++++++++-----------
>>>    c/src/lib/libbsp/riscv/riscv/configure.ac |  13 +++
>>>    2 files changed, 64 insertions(+), 51 deletions(-)
>>>
>>> diff --git a/bsps/riscv/shared/start/linkcmds.base.in b/bsps/riscv/shared/start/linkcmds.base.in
>>> index 7d889ab38c..857bf2dabd 100644
>>> --- a/bsps/riscv/shared/start/linkcmds.base.in
>>> +++ b/bsps/riscv/shared/start/linkcmds.base.in
>>> @@ -33,7 +33,7 @@
>>>
>>>    OUTPUT_ARCH(riscv)
>>>    ENTRY(_start)
>>> -STARTUP(start.o)
>>> + at RISCV_LINKER_START_DIRECTIVE@(start.o)
>> Works INPUT() instead of STARTUP() with GNU ld as well?
>>
> Unfortunately not. It complains about undefined references in start.o
> (because of the un(order) the libs and start.o are linked)

Ok, the change is fine.

Maybe the LLVM linker could be improved to support STARTUP() and also 
ALIGN_WITH_INPUT(). I added ALIGN_WITH_INPUT() to GNU ld specifically to 
support the RTEMS linkcmds.base. It is important for systems without a 
bootloader which move data in start.o, e.g. from a read-only flash to a RAM.

-- 
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber at embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.


More information about the devel mailing list