From: John Marino Date: Fri, 24 Feb 2012 23:38:03 +0000 (+0100) Subject: boot2: Add linker scripts for gold v2.22 X-Git-Tag: v3.2.0~1326 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/044f3f17590dce567fb0fc7057d96a0aebe13049 boot2: Add linker scripts for gold v2.22 The precursors for boot2 and boot2_64 also require linker scripts when built with gold. The boot2 program was tested using disklabel for both linkers after introducing the attached linker script. --- diff --git a/sys/boot/pc32/boot2/Makefile b/sys/boot/pc32/boot2/Makefile index 63055d18b9..6a3f51fdea 100644 --- a/sys/boot/pc32/boot2/Makefile +++ b/sys/boot/pc32/boot2/Makefile @@ -76,7 +76,8 @@ CFLAGS+= -fno-unit-at-a-time # NSECT_32?= 16 NSECT_64?= 30 -LDFLAGS=-nostdlib -static -N --gc-sections +LDFLAGS= -nostdlib -static -N --gc-sections +LINKSCRIPT= --script ${.CURDIR}/boot2.ldscript all: boot @@ -135,7 +136,7 @@ boot2$s.bin: boot2$s.out objcopy -S -O binary boot2$s.out ${.TARGET} boot2$s.out: boot2$s.o sio.o ${_ADDOBJS$s} - ${LD} ${LDFLAGS} -Ttext ${ORG2} -o ${.TARGET} \ + ${LD} ${LDFLAGS} -Ttext ${ORG2} ${LINKSCRIPT} -o ${.TARGET} \ ${BTX}/lib/crt0.o ${.ALLSRC} boot2$s.o: boot2$s.h diff --git a/sys/boot/pc32/boot2/boot2.ldscript b/sys/boot/pc32/boot2/boot2.ldscript new file mode 100644 index 0000000000..6f6ed890d8 --- /dev/null +++ b/sys/boot/pc32/boot2/boot2.ldscript @@ -0,0 +1,13 @@ +PHDRS +{ + text PT_LOAD ; +} + +SECTIONS { + .text : { KEEP (*(.text)) } :text + .rodata : { KEEP (*(.rodata .rodata.*)) } + .data : { KEEP (*(.data)) } + _edata = .; + .bss : { KEEP (*(.bss)) } + _end = .; +}