diff options
author | gkoehler <gkoehler@cvs.openbsd.org> | 2020-11-29 18:57:30 +0000 |
---|---|---|
committer | gkoehler <gkoehler@cvs.openbsd.org> | 2020-11-29 18:57:30 +0000 |
commit | 798bf7f575ad1757356fff0c6f5af5d62e114b78 (patch) | |
tree | 3a62cbb7390bd354815635ab9eb6b0c30429c192 /sys | |
parent | 0f76b4922994be1cfa5e43a5927ebb2ae9a816d2 (diff) |
Teach lld to link the macppc kernel
Add R_PPC_ADDR24 to lld. We need R_PPC_ADDR24 for absolute branches
"ba" and "bla" in locore.S in the kernel.
In Makefile.macppc, add a gapdummy (like in Makefile.powerpc64) to
avoid an lld error. Also adapt a part of Makefile.i386, so my
powerpc64 can use clang and lld to build and link the macppc kernel.
(I didn't boot that kernel.)
My macppc can now build, link, and boot kernels with either ld.bfd or
ld.lld. Beware that kernels linked with ld.lld have at least one
problem (wrong &etext) not yet fixed.
ok kettenis@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/macppc/conf/Makefile.macppc | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/sys/arch/macppc/conf/Makefile.macppc b/sys/arch/macppc/conf/Makefile.macppc index 360122c0b7a..f994ef6518c 100644 --- a/sys/arch/macppc/conf/Makefile.macppc +++ b/sys/arch/macppc/conf/Makefile.macppc @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.macppc,v 1.99 2019/11/07 20:42:28 guenther Exp $ +# $OpenBSD: Makefile.macppc,v 1.100 2020/11/29 18:57:29 gkoehler Exp $ # For instructions on building kernels consult the config(8) and options(4) # manual pages. @@ -53,6 +53,13 @@ CFLAGS= ${DEBUG} ${CWARNFLAGS} ${CMACHFLAGS} ${COPTS} ${PIPE} AFLAGS= -D_LOCORE ${CMACHFLAGS} LINKFLAGS= -N -Ttext 100114 -e start --warn-common -nopie +.if ${MACHINE} == "powerpc64" +CFLAGS+= -m32 +AFLAGS+= -m32 +LDFLAGS= -melf32ppc +LINKFLAGS+= ${LDFLAGS} +.endif + HOSTCC?= ${CC} HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//} HOSTED_CFLAGS= ${CFLAGS} @@ -123,12 +130,16 @@ ioconf.o: ioconf.c ld.script: ${_machdir}/conf/ld.script cp ${_machdir}/conf/ld.script $@ +gapdummy.o: + echo '__asm(".section .rodata,\"a\"");' > gapdummy.c + ${CC} -c ${CFLAGS} ${CPPFLAGS} gapdummy.c -o $@ + makegap.sh: cp $S/conf/makegap.sh $@ -MAKE_GAP = LD="${LD}" sh makegap.sh 0x00000000 # guaranteed illegal +MAKE_GAP = LD="${LD}" sh makegap.sh 0x00000000 gapdummy.o -gap.o: Makefile makegap.sh vers.o +gap.o: Makefile makegap.sh gapdummy.o vers.o ${MAKE_GAP} vers.o: ${SYSTEM_DEP:Ngap.o} @@ -137,7 +148,7 @@ vers.o: ${SYSTEM_DEP:Ngap.o} clean: rm -f *bsd *bsd.gdb *.[dio] [a-z]*.s assym.* \ - gap.link ld.script lorder makegap.sh param.c + gap.link gapdummy.c ld.script lorder makegap.sh param.c cleandir: clean rm -f Makefile *.h ioconf.c options machine ${_mach} vers.c |