[Skiboot] [PATCH 06/13] Makefile: Use LD to link the final binary
Joel Stanley
joel at jms.id.au
Wed May 2 18:37:46 AEST 2018
We were using gcc instead of ld. This isn't required, as we're disabling
all of the things that gcc could do for us.
This helps enable clang as the compiler, with GNU ld used for the
final linking step.
Signed-off-by: Joel Stanley <joel at jms.id.au>
---
Makefile.main | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/Makefile.main b/Makefile.main
index 584d46df3758..9c9d0b1ac6fb 100644
--- a/Makefile.main
+++ b/Makefile.main
@@ -126,7 +126,8 @@ LDFLAGS += -Wl,-pie
LDFLAGS += -Wl,-Ttext-segment,$(LD_TEXT) -Wl,-N -Wl,--build-id=none
LDFLAGS += -Wl,--no-multi-toc
LDFLAGS += -mcpu=power7 -mbig-endian -Wl,--oformat,elf64-powerpc
-LDFLAGS_FINAL = $(LDFLAGS) -Wl,--whole-archive
+LDFLAGS_FINAL = -EB -m elf64ppc --no-multi-toc -N --build-id=none --whole-archive
+LDFLAGS_FINAL += -static -nostdlib -pie -Ttext-segment=$(LD_TEXT) --oformat=elf64-powerpc
LDRFLAGS=-melf64ppc
# Debug stuff
#LDFLAGS += -Wl,-v -Wl,-Map,foomap
@@ -233,12 +234,12 @@ $(TARGET).tmp.a: $(ALL_OBJS)
$(call Q,AR, $(AR) rcsTPD $@ $(ALL_OBJS), $@)
$(TARGET).tmp.elf: $(ALL_OBJS_1) $(TARGET).lds $(KERNEL)
- $(call Q,LD, $(CC) $(LDFLAGS_FINAL) -o $@ -T $(TARGET).lds $(ALL_OBJS_1), $@)
+ $(call Q,LD, $(LD) $(LDFLAGS_FINAL) -o $@ -T $(TARGET).lds $(ALL_OBJS_1), $@)
asm/real_map.o : $(TARGET).tmp.map
$(TARGET).elf: $(ALL_OBJS_2) $(TARGET).lds $(KERNEL)
- $(call Q,LD, $(CC) $(LDFLAGS_FINAL) -o $@ -T $(TARGET).lds $(ALL_OBJS_2), $@)
+ $(call Q,LD, $(LD) $(LDFLAGS_FINAL) -o $@ -T $(TARGET).lds $(ALL_OBJS_2), $@)
$(SUBDIRS):
$(call Q,MKDIR,mkdir -p $@, $@)
--
2.17.0
More information about the Skiboot
mailing list