Skip to content

Commit

Permalink
libmicrokit: fix to successfully link on LLD
Browse files Browse the repository at this point in the history
LLD does not recognise the STARTUP directive which works with the
GNU linker. Given that the crt0.s entry point is already specified
to be at the start of the _text section when linking with libmicrokit,
all we need to do is slightly change the Makefile to also include
crt0.o when linking to produce libmicrokit.a

Signed-off-by: Ivan Velickovic <[email protected]>
  • Loading branch information
Ivan-Velickovic committed Jan 5, 2024
1 parent ff8d4a8 commit e7a496c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
5 changes: 2 additions & 3 deletions libmicrokit/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ TOOLCHAIN := aarch64-none-elf-
CFLAGS := -std=gnu11 -g3 -O3 -nostdlib -ffreestanding -mcpu=$(GCC_CPU) -Wall -Wno-maybe-uninitialized -Wno-unused-function -Werror -Iinclude -I$(SEL4_SDK)/include

LIBS := libmicrokit.a
OBJS := main.o dbg.o
OTHER_OBJS := crt0.o
OBJS := main.o crt0.o dbg.o

$(BUILD_DIR)/%.o : src/%.S
$(TOOLCHAIN)gcc -x assembler-with-cpp -c -g3 -mcpu=$(GCC_CPU) $< -o $@
Expand All @@ -29,7 +28,7 @@ $(BUILD_DIR)/%.o : src/%.c

LIB = $(addprefix $(BUILD_DIR)/, $(LIBS))

all: $(LIB) $(addprefix $(BUILD_DIR)/, $(OTHER_OBJS))
all: $(LIB)

$(LIB): $(addprefix $(BUILD_DIR)/, $(OBJS))
$(TOOLCHAIN)ar -rv $@ $^
2 changes: 0 additions & 2 deletions libmicrokit/microkit.ld
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ PHDRS

ENTRY(_start);

STARTUP(crt0.o);

SECTIONS
{
. = 0x200000;
Expand Down

0 comments on commit e7a496c

Please sign in to comment.