Commit 0be6838a authored by Kai Germaschewski's avatar Kai Germaschewski

kbuild: Put flags for ld into LDFLAGS

Some archs sneaked additional flags for ld into $(LD). This can be done
cleaner now, by just using $(LDFLAGS).
parent bfdca998
......@@ -245,7 +245,7 @@ boot: vmlinux
vmlinux-objs := $(HEAD) $(INIT) $(CORE_FILES) $(LIBS) $(DRIVERS) $(NETWORKS)
quiet_cmd_link_vmlinux = LD $@
cmd_link_vmlinux = $(LD) $(LDFLAGS_$(@F)) $(HEAD) $(INIT) \
cmd_link_vmlinux = $(LD) $(LDFLAGS) $(LDFLAGS_$(@F)) $(HEAD) $(INIT) \
--start-group \
$(CORE_FILES) \
$(LIBS) \
......
......@@ -333,7 +333,7 @@ ifdef O_TARGET
quiet_cmd_link_o_target = LD $(echo_target)
# If the list of objects to link is empty, just create an empty O_TARGET
cmd_link_o_target = $(if $(strip $(obj-y)),\
$(LD) $(EXTRA_LDFLAGS) -r -o $@ $(filter $(obj-y), $^),\
$(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) -r -o $@ $(filter $(obj-y), $^),\
rm -f $@; $(AR) rcs $@)
$(O_TARGET): $(obj-y) FORCE
......@@ -360,7 +360,7 @@ endif
#
quiet_cmd_link_multi = LD $(echo_target)
cmd_link_multi = $(LD) $(EXTRA_LDFLAGS) -r -o $@ $(filter $($(basename $@)-objs),$^)
cmd_link_multi = $(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) -r -o $@ $(filter $($(basename $@)-objs),$^)
# We would rather have a list of rules like
# foo.o: $(foo-objs)
......
......@@ -16,7 +16,7 @@
# Added '-march' and '-mpreferred-stack-boundary' support
#
LD=$(CROSS_COMPILE)ld -m elf_i386
LDFLAGS := -m elf_i386
OBJCOPY=$(CROSS_COMPILE)objcopy -O binary -R .note -R .comment -S
LDFLAGS_vmlinux :=-T arch/i386/vmlinux.lds -e stext
......
......@@ -62,7 +62,7 @@ tools/build: tools/build.c
$(HOSTCC) $(HOSTCFLAGS) -o $@ $< -I$(TOPDIR)/include
bootsect: bootsect.o
$(LD) -Ttext 0x0 -s --oformat binary -o $@ $<
$(LD) $(LDFLAGS) -Ttext 0x0 -s --oformat binary -o $@ $<
bootsect.o: bootsect.s
$(AS) -o $@ $<
......@@ -71,7 +71,7 @@ bootsect.s: bootsect.S Makefile $(BOOT_INCL)
$(CPP) $(CPPFLAGS) -traditional $(SVGA_MODE) $(RAMDISK) $< -o $@
bbootsect: bbootsect.o
$(LD) -Ttext 0x0 -s --oformat binary $< -o $@
$(LD) $(LDFLAGS) -Ttext 0x0 -s --oformat binary $< -o $@
bbootsect.o: bbootsect.s
$(AS) -o $@ $<
......@@ -80,7 +80,7 @@ bbootsect.s: bootsect.S Makefile $(BOOT_INCL)
$(CPP) $(CPPFLAGS) -D__BIG_KERNEL__ -traditional $(SVGA_MODE) $(RAMDISK) $< -o $@
setup: setup.o
$(LD) -Ttext 0x0 -s --oformat binary -e begtext -o $@ $<
$(LD) $(LDFLAGS) -Ttext 0x0 -s --oformat binary -e begtext -o $@ $<
setup.o: setup.s
$(AS) -o $@ $<
......@@ -89,7 +89,7 @@ setup.s: setup.S video.S Makefile $(BOOT_INCL) $(TOPDIR)/include/linux/version.h
$(CPP) $(CPPFLAGS) -D__ASSEMBLY__ -traditional $(SVGA_MODE) $(RAMDISK) $< -o $@
bsetup: bsetup.o
$(LD) -Ttext 0x0 -s --oformat binary -e begtext -o $@ $<
$(LD) $(LDFLAGS) -Ttext 0x0 -s --oformat binary -e begtext -o $@ $<
bsetup.o: bsetup.s
$(AS) -o $@ $<
......
......@@ -24,10 +24,10 @@ BZLINKFLAGS = -Ttext $(BZIMAGE_OFFSET) $(ZLDFLAGS)
all: vmlinux
vmlinux: piggy.o $(OBJECTS)
$(LD) $(ZLINKFLAGS) -o vmlinux $(OBJECTS) piggy.o
$(LD) $(LDFLAGS) $(ZLINKFLAGS) -o vmlinux $(OBJECTS) piggy.o
bvmlinux: piggy.o $(OBJECTS)
$(LD) $(BZLINKFLAGS) -o bvmlinux $(OBJECTS) piggy.o
$(LD) $(LDFLAGS) $(BZLINKFLAGS) -o bvmlinux $(OBJECTS) piggy.o
head.o: head.S
$(CC) $(AFLAGS) -traditional -c head.S
......@@ -43,7 +43,7 @@ piggy.o: $(SYSTEM)
$(OBJCOPY) $(SYSTEM) $$tmppiggy; \
gzip -f -9 < $$tmppiggy > $$tmppiggy.gz; \
echo "SECTIONS { .data : { input_len = .; LONG(input_data_end - input_data) input_data = .; *(.data) input_data_end = .; }}" > $$tmppiggy.lnk; \
$(LD) -r -o piggy.o -b binary $$tmppiggy.gz -b elf32-i386 -T $$tmppiggy.lnk; \
$(LD) $(LDFLAGS) -r -o piggy.o -b binary $$tmppiggy.gz -b elf32-i386 -T $$tmppiggy.lnk; \
rm -f $$tmppiggy $$tmppiggy.gz $$tmppiggy.lnk
clean:
......
......@@ -18,7 +18,7 @@ COMPILE_ARCH = $(shell uname -m)
# override top level makefile
AS += -m68020
LD += -m m68kelf
LDFLAGS := -m m68kelf
ifneq ($(COMPILE_ARCH),$(ARCH))
# prefix for cross-compiling binaries
CROSS_COMPILE = m68k-linux-
......
......@@ -38,7 +38,7 @@ endif
GCCFLAGS := -G 0 -mno-abicalls -fno-pic
LDFLAGS_vmlinux += -static
MODFLAGS += -mlong-calls
LD := $(LD) -G 0
LDFLAGS := -G 0
ifdef CONFIG_REMOTE_DEBUG
CFLAGS := $(CFLAGS) -g
......
......@@ -7,6 +7,6 @@
#
ramdisk.o: ramdisk.gz ld.script
$(LD) -T ld.script -b binary -o $@ ramdisk.gz
$(LD) $(LDFLAGS) -T ld.script -b binary -o $@ ramdisk.gz
include $(TOPDIR)/Rules.make
......@@ -128,7 +128,7 @@ ifdef CONFIG_BOOT_ELF64
CFLAGS += -Wa,-32
LDFLAGS_vmlinux += -T arch/mips64/ld.script.elf32
#AS += -64
#LD += -m elf64bmip
#LDFLAGS += -m elf64bmip
#LDFLAGS_vmlinux += -T arch/mips64/ld.script.elf64
endif
......
......@@ -13,7 +13,7 @@
# Copyright (C) 1994 by Linus Torvalds
#
LD=$(CROSS_COMPILE)ld -m elf_s390
LDFLAGS := -m elf_s390
OBJCOPY=$(CROSS_COMPILE)objcopy -O binary -R .note -R .comment -S
ifeq ($(CONFIG_SHARED_KERNEL),y)
LINKSCRIPT := arch/s390/vmlinux-shared.lds
......
......@@ -9,7 +9,7 @@ EXTRA_AFLAGS := -traditional
include $(TOPDIR)/Rules.make
%.lnk: %.o
$(LD) -Ttext 0x0 -o $@ $<
$(LD) $(LDFLAGS) -Ttext 0x0 -o $@ $<
%.boot: %.lnk
$(OBJCOPY) -O binary $< $@
......
......@@ -13,7 +13,7 @@
# Copyright (C) 1994 by Linus Torvalds
#
LD=$(CROSS_COMPILE)ld -m elf64_s390
LDFLAGS := -m elf64_s390
CPP=$(CC) -E
OBJCOPY=$(CROSS_COMPILE)objcopy -O binary -R .note -R .comment -S
ifeq ($(CONFIG_SHARED_KERNEL),y)
......
......@@ -24,7 +24,6 @@ AFLAGS += -mb
LDFLAGS := -EB
endif
LD =$(CROSS_COMPILE)ld $(LDFLAGS)
OBJCOPY=$(CROSS_COMPILE)objcopy -O binary -R .note -R .comment -R .stab -R .stabstr -S
MODFLAGS +=
......
......@@ -25,7 +25,7 @@ ZLINKFLAGS = -Ttext $(ZIMAGE_OFFSET) $(ZLDFLAGS)
all: vmlinux
vmlinux: piggy.o $(OBJECTS)
$(LD) $(ZLINKFLAGS) -o vmlinux $(OBJECTS) piggy.o
$(LD) $(LDFLAGS) $(ZLINKFLAGS) -o vmlinux $(OBJECTS) piggy.o
head.o: head.S
$(CC) $(AFLAGS) -traditional -c head.S
......@@ -36,7 +36,7 @@ piggy.o: $(SYSTEM)
$(OBJCOPY) -R .empty_zero_page $(SYSTEM) $$tmppiggy; \
gzip -f -9 < $$tmppiggy > $$tmppiggy.gz; \
echo "SECTIONS { .data : { input_len = .; LONG(input_data_end - input_data) input_data = .; *(.data) input_data_end = .; }}" > $$tmppiggy.lnk; \
$(LD) -r -o piggy.o -b binary $$tmppiggy.gz -b elf32-sh-linux -T $$tmppiggy.lnk; \
$(LD) $(LDFLAGS) -r -o piggy.o -b binary $$tmppiggy.gz -b elf32-sh-linux -T $$tmppiggy.lnk; \
rm -f $$tmppiggy $$tmppiggy.gz $$tmppiggy.lnk
clean:
......
......@@ -20,7 +20,7 @@ NEW_GAS := $(shell if $(LD) --version 2>&1 | grep 'elf64_sparc' > /dev/null; the
ifeq ($(NEW_GAS),y)
AS := $(AS) -32
LD := $(LD) -m elf32_sparc
LDFLAGS := -m elf32_sparc
endif
#CFLAGS := $(CFLAGS) -g -pipe -fcall-used-g5 -fcall-used-g7
......
......@@ -31,7 +31,7 @@ BTLIBS := $(CORE_FILES_NO_BTFIX) $(FILESYSTEMS) \
# properly as it will cause head.o to be built with the implicit
# rules not the ones in kernel/Makefile. Someone please fix. --DaveM
vmlinux.o: FORCE
$(LD) -r $(patsubst %,$(TOPDIR)/%,$(BTOBJS)) \
$(LD) $(LDFLAGS) -r $(patsubst %,$(TOPDIR)/%,$(BTOBJS)) \
--start-group \
$(patsubst %,$(TOPDIR)/%,$(BTLIBS)) \
$(LIBS) \
......
......@@ -28,7 +28,7 @@ AR = sparc64-linux-ar
RANLIB = sparc64-linux-ranlib
else
AS := $(AS) -64
LD := $(LD) -m elf64_sparc
LDFLAGS := -m elf64_sparc
endif
ELFTOAOUT = elftoaout
ifneq ($(UNDECLARED_REGS),y)
......
......@@ -51,9 +51,3 @@ obj-$(CONFIG_FUSION_CTL) += mptctl.o
obj-$(CONFIG_FUSION_LAN) += mptlan.o
include $(TOPDIR)/Rules.make
# EXP...
## Fusion MPT extra's...
##mptscsih.o: $(mptscsih-objs)
## $(LD) -r -o $@ $(mptscsih-objs)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment