Currently, building an amd64 or i386 kernel with lld breaks in
makegap.sh.  It turns out that we already have the missing pieces
(gapdummy) on some other archs, so we can just copy them.

With this, I can successfully build and run
* amd64 kernel with ld.bfd
*  i386 kernel with ld.bfd
* amd64 kernel with ld.lld

An i386 kernel with ld.lld doesn't get very far; my APU2 reboots
right after "entry point at 0xf2c".

Any reason not to add the gapdummy logic to amd64/i386 now?
OK?

Index: arch/amd64/conf/Makefile.amd64
===================================================================
RCS file: /cvs/src/sys/arch/amd64/conf/Makefile.amd64,v
retrieving revision 1.104
diff -u -p -r1.104 Makefile.amd64
--- arch/amd64/conf/Makefile.amd64      12 Sep 2018 04:34:59 -0000      1.104
+++ arch/amd64/conf/Makefile.amd64      13 Sep 2018 21:33:19 -0000
@@ -134,12 +134,16 @@ locore.o: assym.h
 ld.script: ${_machdir}/conf/ld.script
        cp ${_machdir}/conf/ld.script $@
 
+gapdummy.o:
+       echo 'const char gapdummy;' > gapdummy.c
+       ${CC} -c ${CFLAGS} ${CPPFLAGS} gapdummy.c -o $@
+
 makegap.sh:
        cp $S/conf/makegap.sh $@
 
-MAKE_GAP = LD="${LD}" sh makegap.sh 0xcccccccc
+MAKE_GAP = LD="${LD}" sh makegap.sh 0xcccccccc 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}
@@ -153,7 +157,7 @@ kcov.o: $S/dev/kcov.c
 
 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
Index: arch/i386/conf/Makefile.i386
===================================================================
RCS file: /cvs/src/sys/arch/i386/conf/Makefile.i386,v
retrieving revision 1.127
diff -u -p -r1.127 Makefile.i386
--- arch/i386/conf/Makefile.i386        12 Sep 2018 04:34:59 -0000      1.127
+++ arch/i386/conf/Makefile.i386        13 Sep 2018 21:33:49 -0000
@@ -130,12 +130,16 @@ ioconf.o: ioconf.c
 ld.script: ${_machdir}/conf/ld.script
        cp ${_machdir}/conf/ld.script $@
 
+gapdummy.o:
+       echo 'const char gapdummy;' > gapdummy.c
+       ${CC} -c ${CFLAGS} ${CPPFLAGS} gapdummy.c -o $@
+
 makegap.sh:
        cp $S/conf/makegap.sh $@
 
-MAKE_GAP = LD="${LD}" LDFLAGS="${LDFLAGS}" sh makegap.sh 0xcccccccc
+MAKE_GAP = LD="${LD}" LDFLAGS="${LDFLAGS}" sh makegap.sh 0xcccccccc 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}
@@ -149,7 +153,7 @@ kcov.o: $S/dev/kcov.c
 
 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
-- 
Christian "naddy" Weisgerber                          [email protected]

Reply via email to