summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToomas Soome <tsoome@me.com>2022-02-17 15:49:03 +0200
committerToomas Soome <tsoome@me.com>2022-02-22 21:29:44 +0200
commitdb1a8deb164e311ff6eed02e115664a901481118 (patch)
tree7f7f18df896982bbfe224378c9df13bdf61f2890
parentca783257c986cddcc674ae22916a6766b98a2d36 (diff)
downloadillumos-joyent-db1a8deb164e311ff6eed02e115664a901481118.tar.gz
14518 loader: linker cleanup
Reviewed by: Michael van der Westhuizen <r1mikey@gmail.com> Approved by: Robert Mustacchi <rm@fingolfin.org>
-rw-r--r--usr/src/boot/Makefile.inc5
-rw-r--r--usr/src/boot/efi/loader/Makefile.com2
-rw-r--r--usr/src/boot/i386/Makefile.inc1
-rw-r--r--usr/src/boot/i386/btx/btx/Makefile6
-rw-r--r--usr/src/boot/i386/btx/btxldr/Makefile6
-rw-r--r--usr/src/boot/i386/btx/lib/Makefile2
-rw-r--r--usr/src/boot/i386/cdboot/Makefile8
-rw-r--r--usr/src/boot/i386/gptzfsboot/Makefile6
-rw-r--r--usr/src/boot/i386/isoboot/Makefile8
-rw-r--r--usr/src/boot/i386/loader/Makefile2
-rw-r--r--usr/src/boot/i386/pmbr/Makefile2
-rw-r--r--usr/src/boot/i386/pxeldr/Makefile34
12 files changed, 40 insertions, 42 deletions
diff --git a/usr/src/boot/Makefile.inc b/usr/src/boot/Makefile.inc
index 495bfab86b..de634f81ed 100644
--- a/usr/src/boot/Makefile.inc
+++ b/usr/src/boot/Makefile.inc
@@ -17,14 +17,11 @@
# loader.help build needs better awk
AWK= /usr/xpg4/bin/awk
-LD= $(GNU_ROOT)/bin/gld
+GLD= $(GNU_ROOT)/bin/gld
OBJCOPY= $(GNU_ROOT)/bin/gobjcopy
OBJDUMP= $(GNU_ROOT)/bin/gobjdump
GSTRIP= $(GNU_ROOT)/bin/gstrip
-GLDTARGET= -melf_i386_sol2
-LDFLAGS += $(GLDTARGET)
-
# Default Console font setup.
# We want it to be the same as kernel.
# We build compressed, stripped down version of the default font, so we have
diff --git a/usr/src/boot/efi/loader/Makefile.com b/usr/src/boot/efi/loader/Makefile.com
index d7ae84091e..576f60eaf0 100644
--- a/usr/src/boot/efi/loader/Makefile.com
+++ b/usr/src/boot/efi/loader/Makefile.com
@@ -163,7 +163,7 @@ DPADD= $(DPLIBFICL) $(DPLIBEFI) $(DPLIBSA) $(LDSCRIPT)
LDADD= $(LIBFICL) $(LIBEFI) $(LIBSA)
loader.sym: $(OBJS) $(DPADD)
- $(LD) $(LDFLAGS) -o $@ $(OBJS) $(LDADD)
+ $(GLD) $(LDFLAGS) -o $@ $(OBJS) $(LDADD)
machine:
$(RM) machine
diff --git a/usr/src/boot/i386/Makefile.inc b/usr/src/boot/i386/Makefile.inc
index 6deaf96b27..2fa89ae753 100644
--- a/usr/src/boot/i386/Makefile.inc
+++ b/usr/src/boot/i386/Makefile.inc
@@ -15,6 +15,7 @@
# Common defines for all of /i386/
+GLDTARGET= -melf_i386_sol2
LOADER_ADDRESS=0x200000
CFLAGS += -m32
CCASFLAGS += -m32
diff --git a/usr/src/boot/i386/btx/btx/Makefile b/usr/src/boot/i386/btx/btx/Makefile
index 2157bf721e..1a4e446578 100644
--- a/usr/src/boot/i386/btx/btx/Makefile
+++ b/usr/src/boot/i386/btx/btx/Makefile
@@ -28,7 +28,7 @@ OBJS= btx.o
BOOT_BTX_FLAGS=0x0
#.endif
-CPPFLAGS += -DBTX_FLAGS=${BOOT_BTX_FLAGS}
+CPPFLAGS += -DBTX_FLAGS=$(BOOT_BTX_FLAGS)
CPPFLAGS += -I./../../common
#.if defined(BTX_SERIAL)
@@ -42,12 +42,12 @@ CPPFLAGS += -I./../../common
ORG= 0x9000
-LDFLAGS=-e start -Ttext ${ORG} -N -S --oformat binary $(GLDTARGET)
+LDFLAGS=-e start -Ttext $(ORG) -N -S --oformat binary $(GLDTARGET)
all install: $(PROG)
$(PROG): $(OBJS)
- $(LD) $(LDFLAGS) -o $@ $(OBJS)
+ $(GLD) $(LDFLAGS) -o $@ $(OBJS)
clobber: clean
diff --git a/usr/src/boot/i386/btx/btxldr/Makefile b/usr/src/boot/i386/btx/btxldr/Makefile
index 408db52b66..7fbf6a58e5 100644
--- a/usr/src/boot/i386/btx/btxldr/Makefile
+++ b/usr/src/boot/i386/btx/btxldr/Makefile
@@ -22,16 +22,16 @@ PROG= btxldr
SRCS= btxldr.S
OBJS= btxldr.o
-CPPFLAGS += -DLOADER_ADDRESS=${LOADER_ADDRESS}
+CPPFLAGS += -DLOADER_ADDRESS=$(LOADER_ADDRESS)
CPPFLAGS += -DBTXLDR_VERBOSE
CPPFLAGS += -I./../../common
-LDFLAGS=-e start -Ttext ${LOADER_ADDRESS} -N -S --oformat binary $(GLDTARGET)
+LDFLAGS=-e start -Ttext $(LOADER_ADDRESS) -N -S --oformat binary $(GLDTARGET)
all install: $(PROG)
$(PROG): $(OBJS)
- $(LD) $(LDFLAGS) -o $@ $(OBJS)
+ $(GLD) $(LDFLAGS) -o $@ $(OBJS)
clobber: clean
diff --git a/usr/src/boot/i386/btx/lib/Makefile b/usr/src/boot/i386/btx/lib/Makefile
index 5986c0d63f..49214e1a65 100644
--- a/usr/src/boot/i386/btx/lib/Makefile
+++ b/usr/src/boot/i386/btx/lib/Makefile
@@ -29,7 +29,7 @@ LDFLAGS = -r $(GLDTARGET)
all install: $(PROG)
$(PROG): $(OBJS)
- $(LD) $(LDFLAGS) -o $@ $(OBJS)
+ $(GLD) $(LDFLAGS) -o $@ $(OBJS)
clobber: clean
diff --git a/usr/src/boot/i386/cdboot/Makefile b/usr/src/boot/i386/cdboot/Makefile
index ac6beb0e41..d9461b42e7 100644
--- a/usr/src/boot/i386/cdboot/Makefile
+++ b/usr/src/boot/i386/cdboot/Makefile
@@ -22,19 +22,19 @@ CPPFLAGS += -I../common
PROG= cdboot
FILEMODE=0444
-SRCS= ${PROG}.S
+SRCS= $(PROG).S
OBJS= $(SRCS:%.S=%.o)
ORG= 0x7c00
LDFLAGS=-e start -Ttext $(ORG) -N -S --oformat binary $(GLDTARGET)
-all: ${PROG}
+all: $(PROG)
install: $(PROG:%=$(ROOT_BOOT)/%)
-${PROG}: ${OBJS}
- ${LD} ${LDFLAGS} -o $@ $^
+$(PROG): $(OBJS)
+ $(GLD) $(LDFLAGS) -o $@ $^
clobber: clean
clean:
diff --git a/usr/src/boot/i386/gptzfsboot/Makefile b/usr/src/boot/i386/gptzfsboot/Makefile
index 4e457fbaf8..ad97283ca4 100644
--- a/usr/src/boot/i386/gptzfsboot/Makefile
+++ b/usr/src/boot/i386/gptzfsboot/Makefile
@@ -71,7 +71,7 @@ zfs_cmd.o := CPPFLAGS += -I$(SRC)/uts/common
part.o := CPPFLAGS += -I$(ZLIB)
smbios.o := CPPFLAGS += -DSMBIOS_SERIAL_NUMBERS
smbios.o := CPPFLAGS += -DSMBIOS_LITTLE_ENDIAN_UUID
-gptldr.out := LD_FLAGS += -m elf_i386_sol2
+gptldr.out := LD_FLAGS += $(GLDTARGET)
CLEANFILES= gptzfsboot $(OBJS)
@@ -85,7 +85,7 @@ gptldr.bin: gptldr.out
$(OBJCOPY) -S -O binary gptldr.out $@
gptldr.out: gptldr.o
- $(LD) $(LD_FLAGS) -e start -Ttext $(ORG1) -o $@ gptldr.o
+ $(GLD) $(LD_FLAGS) -e start -Ttext $(ORG1) -o $@ gptldr.o
CLEANFILES += gptzfsboot.bin gptzfsboot.out
@@ -93,7 +93,7 @@ gptzfsboot.bin: gptzfsboot.out
$(OBJCOPY) -S -O binary gptzfsboot.out $@
gptzfsboot.out: $(BTXCRT) $(OBJS) $(DPADD)
- $(LD) $(LD_FLAGS) -T $(LDSCRIPT) -o $@ $(BTXCRT) $(OBJS) $(LIBS)
+ $(GLD) $(LD_FLAGS) -T $(LDSCRIPT) -o $@ $(BTXCRT) $(OBJS) $(LIBS)
machine:
$(RM) machine
diff --git a/usr/src/boot/i386/isoboot/Makefile b/usr/src/boot/i386/isoboot/Makefile
index 08a803f44e..39b56debf6 100644
--- a/usr/src/boot/i386/isoboot/Makefile
+++ b/usr/src/boot/i386/isoboot/Makefile
@@ -46,7 +46,7 @@ LDSCRIPT= ../boot.ldscript
LD_FLAGS= -static -N --gc-sections
LIBSTAND= ../../libsa/$(MACH)/libsa.a
-gptldr.out := LD_FLAGS += -m elf_i386_sol2
+gptldr.out := LD_FLAGS += $(GLDTARGET)
isoboot.o := SMOFF += unreachable
@@ -61,7 +61,7 @@ OBJS= mb_header.o isoboot.o sio.o drv.o cons.o gptldr.o
CLEANFILES += isoboot
isoboot: gptldr.bin isoboot.bin $(BTXKERN)
- btxld -v -E $(ORG2) -f bin -b $(BTXKERN) -V $(BOOT_VERSION) -l \
+ $(BTXLD) -v -E $(ORG2) -f bin -b $(BTXKERN) -V $(BOOT_VERSION) -l \
gptldr.bin -o $@ isoboot.bin
@set -- `ls -l $@`; x=$$(($(ISOBOOTSIZE)-$$5)); \
echo "$$x bytes available"; test $$x -ge 0
@@ -72,7 +72,7 @@ gptldr.bin: gptldr.out
$(OBJCOPY) -S -O binary gptldr.out $@
gptldr.out: gptldr.o
- $(LD) $(LD_FLAGS) -e start -Ttext $(ORG1) -o $@ gptldr.o
+ $(GLD) $(LD_FLAGS) -e start -Ttext $(ORG1) -o $@ gptldr.o
CLEANFILES += isoboot.bin isoboot.out $(OBJS)
@@ -80,7 +80,7 @@ isoboot.bin: isoboot.out
$(OBJCOPY) -S -O binary isoboot.out $@
isoboot.out: $(BTXCRT) $(OBJS)
- $(LD) $(LD_FLAGS) -T $(LDSCRIPT) -o $@ $(BTXCRT) $(OBJS) $(LIBSTAND)
+ $(GLD) $(LD_FLAGS) -T $(LDSCRIPT) -o $@ $(BTXCRT) $(OBJS) $(LIBSTAND)
machine:
$(RM) machine
diff --git a/usr/src/boot/i386/loader/Makefile b/usr/src/boot/i386/loader/Makefile
index 8a124cd603..f0a1a2e43b 100644
--- a/usr/src/boot/i386/loader/Makefile
+++ b/usr/src/boot/i386/loader/Makefile
@@ -145,7 +145,7 @@ OBJS= $(SRCS:%.c=%.o)
$(OBJS): machine x86
$(PROG): $(OBJS) $(DPADD)
- $(LD) $(LDFLAGS) -o $@ $(BTXCRT) $(OBJS) $(LDADD)
+ $(GLD) $(LDFLAGS) -o $@ $(BTXCRT) $(OBJS) $(LDADD)
clean: clobber
clobber:
diff --git a/usr/src/boot/i386/pmbr/Makefile b/usr/src/boot/i386/pmbr/Makefile
index dccd6d09f1..62855ed602 100644
--- a/usr/src/boot/i386/pmbr/Makefile
+++ b/usr/src/boot/i386/pmbr/Makefile
@@ -36,7 +36,7 @@ all: $(PROG)
install: $(PROG:%=$(ROOT_BOOT)/%)
$(PROG): $(OBJS)
- $(LD) $(LDFLAGS) -o $(PROG) $(OBJS)
+ $(GLD) $(LDFLAGS) -o $(PROG) $(OBJS)
clobber: clean
diff --git a/usr/src/boot/i386/pxeldr/Makefile b/usr/src/boot/i386/pxeldr/Makefile
index 32b6ee2f0c..0547a23c45 100644
--- a/usr/src/boot/i386/pxeldr/Makefile
+++ b/usr/src/boot/i386/pxeldr/Makefile
@@ -29,13 +29,13 @@ include ../Makefile.inc
BTXDIR= ../btx
-PROG= ${LDR}
+PROG= $(LDR)
INTERNALPROG=
-FILES= ${BOOT}
-MAN= ${BOOT}.8
-SRCS= ${LDR}.S
-OBJS= ${LDR}.o
-CLEANFILES= ${BOOT} ${OBJS}
+FILES= $(BOOT)
+MAN= $(BOOT).8
+SRCS= $(LDR).S
+OBJS= $(LDR).o
+CLEANFILES= $(BOOT) $(OBJS)
BOOT= pxeboot
LDR= pxeldr
@@ -51,25 +51,25 @@ FILEMODE=0444
LOADERBIN= ../loader/loader.bin
-CLEANFILES += ${BOOT}.tmp
+CLEANFILES += $(BOOT).tmp
-${BOOT}: ${LDR} ${LOADER}
- $(CAT) ${LDR} ${LOADER} > $@.tmp
+$(BOOT): $(LDR) $(LOADER)
+ $(CAT) $(LDR) $(LOADER) > $@.tmp
$(DD) if=$@.tmp of=$@ obs=2k conv=sync
$(RM) $@.tmp
-LDFLAGS +=-e start -Ttext ${ORG} -N -S --oformat binary
+LDFLAGS += $(GLDTARGET) -e start -Ttext $(ORG) -N -S --oformat binary
-CLEANFILES += ${LOADER} ${LDR}
+CLEANFILES += $(LOADER) $(LDR)
-${LDR}: ${OBJS}
- ${LD} ${LDFLAGS} -o $@ $^
+$(LDR): $(OBJS)
+ $(GLD) $(LDFLAGS) -o $@ $^
-${LOADER}: ${LOADERBIN} ${BTXLDR} ${BTXKERN}
- $(BTXLD) -f aout -e ${LOADER_ADDRESS} -o $@ -l ${BTXLDR} \
- -b ${BTXKERN} ${LOADERBIN}
+$(LOADER): $(LOADERBIN) $(BTXLDR) $(BTXKERN)
+ $(BTXLD) -f aout -e $(LOADER_ADDRESS) -o $@ -l $(BTXLDR) \
+ -b $(BTXKERN) $(LOADERBIN)
-all: ${BOOT}
+all: $(BOOT)
install: $(BOOT:%=$(ROOT_BOOT)/%)