Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F107791587
D23952.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
6 KB
Referenced Files
None
Subscribers
None
D23952.diff
View Options
Index: head/stand/i386/Makefile.inc
===================================================================
--- head/stand/i386/Makefile.inc
+++ head/stand/i386/Makefile.inc
@@ -22,13 +22,12 @@
# compact binary with no padding between text, data, bss
LDSCRIPT= ${BOOTSRC}/i386/boot.ldscript
-# LDFLAGS_BIN=-e start -Ttext ${ORG} -Wl,-T,${LDSCRIPT},-S,--oformat,binary
-# LD_FLAGS_BIN=-static -T ${LDSCRIPT} --gc-sections
-LDFLAGS_BIN=-e start -Ttext ${ORG} -Wl,-N,-S,--oformat,binary
+LDFLAGS_ORG= -Wl,--defsym,ORG=${ORG},-T,${LDSCRIPT}
+LDFLAGS_BIN= -e start ${LDFLAGS_ORG} -Wl,-N,-S,--oformat,binary
.if ${LINKER_FEATURES:Mbuild-id} != ""
-LDFLAGS_BIN+=-Wl,--build-id=none
+LDFLAGS_BIN+= -Wl,--build-id=none
.endif
-LD_FLAGS_BIN=-static -N --gc-sections
+LD_FLAGS_BIN= -static -N --gc-sections
.if ${MACHINE_CPUARCH} == "amd64"
DO32=1
Index: head/stand/i386/boot.ldscript
===================================================================
--- head/stand/i386/boot.ldscript
+++ head/stand/i386/boot.ldscript
@@ -1,11 +1,17 @@
/* $FreeBSD$ */
-/* Merge text, data and bss together almost no padding */
+/* Simplified linker script for the boot loaders. */
OUTPUT_FORMAT("elf32-i386-freebsd")
OUTPUT_ARCH(i386)
ENTRY(_start)
SECTIONS {
- . = 0x08048000 + SIZEOF_HEADERS;
- .text : { *(.text) } =0x90909090 /* Pad with nops, if needed */
- .data : { *(.data) } _edata = .;
- .bss : { *(.bss) } _end = .;
+ . = ORG;
+ .text : { *(.text .text.*) } =0xcccccccc /* Pad with int3, if needed */
+ .rodata : { *(.rodata .rodata.*) }
+ .got : { *(.got) *(.igot) }
+ .got.plt : { *(.got.plt) *(.igot.plt) }
+ .data : { *(.data .data.*) }
+ _edata = .; PROVIDE (edata = .);
+ .bss : { *(.bss .bss.*) }
+ _end = .; PROVIDE (end = .);
+ /DISCARD/ : { *(.interp) }
}
Index: head/stand/i386/boot2/Makefile
===================================================================
--- head/stand/i386/boot2/Makefile
+++ head/stand/i386/boot2/Makefile
@@ -56,7 +56,7 @@
${OBJCOPY} -S -O binary boot1.out ${.TARGET}
boot1.out: boot1.o
- ${LD} ${LD_FLAGS} -e start -Ttext ${ORG1} -o ${.TARGET} boot1.o
+ ${LD} ${LD_FLAGS} -e start --defsym ORG=${ORG1} -T ${LDSCRIPT} -o ${.TARGET} boot1.o
CLEANFILES+= boot2 boot2.ld boot2.ldr boot2.bin boot2.out boot2.o \
boot2.h sio.o
@@ -84,7 +84,7 @@
CLEANFILES+= ashldi3.o
boot2.out: ${BTXCRT} boot2.o sio.o ashldi3.o
- ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC}
+ ${LD} ${LD_FLAGS} --defsym ORG=${ORG2} -T ${LDSCRIPT} -o ${.TARGET} ${.ALLSRC}
SRCS= boot2.c boot2.h
Index: head/stand/i386/gptboot/Makefile
===================================================================
--- head/stand/i386/gptboot/Makefile
+++ head/stand/i386/gptboot/Makefile
@@ -51,7 +51,7 @@
${OBJCOPY} -S -O binary gptldr.out ${.TARGET}
gptldr.out: gptldr.o
- ${LD} ${LD_FLAGS} -e start -Ttext ${ORG1} -o ${.TARGET} gptldr.o
+ ${LD} ${LD_FLAGS} -e start --defsym ORG=${ORG1} -T ${LDSCRIPT} -o ${.TARGET} gptldr.o
CLEANFILES+= gptboot.bin gptboot.out gptboot.o sio.o drv.o \
cons.o ${OPENCRYPTO_XTS}
@@ -60,6 +60,6 @@
${OBJCOPY} -S -O binary gptboot.out ${.TARGET}
gptboot.out: ${BTXCRT} gptboot.o sio.o drv.o cons.o ${OPENCRYPTO_XTS}
- ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBSA32}
+ ${LD} ${LD_FLAGS} --defsym ORG=${ORG2} -T ${LDSCRIPT} -o ${.TARGET} ${.ALLSRC} ${LIBSA32}
.include <bsd.prog.mk>
Index: head/stand/i386/gptzfsboot/Makefile
===================================================================
--- head/stand/i386/gptzfsboot/Makefile
+++ head/stand/i386/gptzfsboot/Makefile
@@ -57,7 +57,7 @@
${OBJCOPY} -S -O binary gptldr.out ${.TARGET}
gptldr.out: gptldr.o
- ${LD} ${LD_FLAGS} -e start -Ttext ${ORG1} -o ${.TARGET} gptldr.o
+ ${LD} ${LD_FLAGS} -e start --defsym ORG=${ORG1} -T ${LDSCRIPT} -o ${.TARGET} gptldr.o
CLEANFILES+= gptzfsboot.bin gptzfsboot.out zfsboot.o sio.o cons.o \
drv.o gpt.o ${OPENCRYPTO_XTS}
@@ -67,7 +67,7 @@
gptzfsboot.out: ${BTXCRT} zfsboot.o sio.o gpt.o drv.o cons.o \
${OPENCRYPTO_XTS}
- ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBSA32}
+ ${LD} ${LD_FLAGS} --defsym ORG=${ORG2} -T ${LDSCRIPT} -o ${.TARGET} ${.ALLSRC} ${LIBSA32}
zfsboot.o: ${ZFSSRC}/zfsimpl.c
Index: head/stand/i386/isoboot/Makefile
===================================================================
--- head/stand/i386/isoboot/Makefile
+++ head/stand/i386/isoboot/Makefile
@@ -53,7 +53,7 @@
${OBJCOPY} -S -O binary gptldr.out ${.TARGET}
gptldr.out: gptldr.o
- ${LD} ${LD_FLAGS} -e start -Ttext ${ORG1} -o ${.TARGET} gptldr.o
+ ${LD} ${LD_FLAGS} -e start --defsym ORG=${ORG1} -T ${LDSCRIPT} -o ${.TARGET} gptldr.o
CLEANFILES+= isoboot.bin isoboot.out isoboot.o sio.o drv.o \
cons.o ${OPENCRYPTO_XTS}
@@ -62,6 +62,6 @@
${OBJCOPY} -S -O binary isoboot.out ${.TARGET}
isoboot.out: ${BTXCRT} isoboot.o sio.o drv.o cons.o ${OPENCRYPTO_XTS}
- ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBSA32}
+ ${LD} ${LD_FLAGS} --defsym ORG=${ORG2} -T ${LDSCRIPT} -o ${.TARGET} ${.ALLSRC} ${LIBSA32}
.include <bsd.prog.mk>
Index: head/stand/i386/loader/Makefile
===================================================================
--- head/stand/i386/loader/Makefile
+++ head/stand/i386/loader/Makefile
@@ -46,8 +46,10 @@
CLEANFILES+= ${LOADER} ${LOADER}.bin
+ORG= 0x0
+
CFLAGS+= -Wall
-LDFLAGS+= -static -Ttext 0x0 -Wl,--gc-sections
+LDFLAGS+= -static ${LDFLAGS_ORG} -Wl,--gc-sections
# i386 standalone support library
LIBI386= ${BOOTOBJ}/i386/libi386/libi386.a
Index: head/stand/i386/zfsboot/Makefile
===================================================================
--- head/stand/i386/zfsboot/Makefile
+++ head/stand/i386/zfsboot/Makefile
@@ -49,7 +49,7 @@
${OBJCOPY} -S -O binary zfsldr.out ${.TARGET}
zfsldr.out: zfsldr.o
- ${LD} ${LD_FLAGS} -e start -Ttext ${ORG1} -o ${.TARGET} zfsldr.o
+ ${LD} ${LD_FLAGS} -e start --defsym ORG=${ORG1} -T ${LDSCRIPT} -o ${.TARGET} zfsldr.o
CLEANFILES+= zfsboot2 zfsboot.ld zfsboot.ldr zfsboot.bin zfsboot.out \
zfsboot.o zfsboot.s zfsboot.s.tmp sio.o cons.o drv.o
@@ -75,7 +75,7 @@
${OBJCOPY} -S -O binary zfsboot.out ${.TARGET}
zfsboot.out: ${BTXCRT} zfsboot.o sio.o drv.o cons.o
- ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBSA32}
+ ${LD} ${LD_FLAGS} --defsym ORG=${ORG2} -T ${LDSCRIPT} -o ${.TARGET} ${.ALLSRC} ${LIBSA32}
SRCS= zfsboot.c
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Jan 19, 5:43 AM (10 h, 15 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15927508
Default Alt Text
D23952.diff (6 KB)
Attached To
Mode
D23952: Link stand/i386 components using a linker script
Attached
Detach File
Event Timeline
Log In to Comment