lld for macppc kernel
With this diff, lld can link macppc's kernel. The first part of the diff adds R_PPC_ADDR24 to lld. I didn't find code in upstream lld's git for R_PPC_ADDR24. We need R_PPC_ADDR24 for "ba" and "bla" in locore.S. The second part edits the kernel's Makefile.macppc. I add gapdummy (like in Makefile.powerpc64) to avoid an lld error. I also adapt a part of Makefile.i386, so my powerpc64 can build and link the macppc kernel. (I didn't boot that kernel.) My macppc can now build, link, and boot the GENERIC kernel with either ld.bfd or ld.lld. ok to commit? Index: gnu/llvm/lld/ELF/Arch/PPC.cpp === RCS file: /cvs/src/gnu/llvm/lld/ELF/Arch/PPC.cpp,v retrieving revision 1.1.1.1 diff -u -p -r1.1.1.1 PPC.cpp --- gnu/llvm/lld/ELF/Arch/PPC.cpp 3 Aug 2020 14:32:29 - 1.1.1.1 +++ gnu/llvm/lld/ELF/Arch/PPC.cpp 23 Nov 2020 19:49:47 - @@ -220,6 +220,7 @@ RelExpr PPC::getRelExpr(RelType type, co case R_PPC_ADDR16_HA: case R_PPC_ADDR16_HI: case R_PPC_ADDR16_LO: + case R_PPC_ADDR24: case R_PPC_ADDR32: return R_ABS; case R_PPC_DTPREL16: @@ -344,6 +345,7 @@ void PPC::relocateOne(uint8_t *loc, RelT break; } case R_PPC_REL24: + case R_PPC_ADDR24: case R_PPC_LOCAL24PC: case R_PPC_PLTREL24: { uint32_t mask = 0x03FC; Index: sys/arch/macppc/conf/Makefile.macppc === RCS file: /cvs/src/sys/arch/macppc/conf/Makefile.macppc,v retrieving revision 1.99 diff -u -p -r1.99 Makefile.macppc --- sys/arch/macppc/conf/Makefile.macppc7 Nov 2019 20:42:28 - 1.99 +++ sys/arch/macppc/conf/Makefile.macppc23 Nov 2020 19:49:49 - @@ -53,6 +53,13 @@ CFLAGS= ${DEBUG} ${CWARNFLAGS} ${CMACHF 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 0x # guaranteed illegal +MAKE_GAP = LD="${LD}" sh makegap.sh 0x 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
Re: clean /dev from /etc/daily ?
On Mon, Nov 23, 2020 at 12:53:01PM GMT, Solene Rapenne wrote: > A common mistake when using dd is to create a file in /dev which > fills up the space of / and may stay silent until / gets filled up > by something else that will fail. > > Would it be OK to add this in /etc/daily? > > find /dev -type f ! -name MAKEDEV -delete > > AFAIK /dev should have only MAKEDEV as a regular file. > hier(7) says /dev only have block and character devices > with the exception of MAKEDEV. > Whichever way this ends up going - or not - please don't forget about MAKEDEV.local Cheers, Raf
Re: clean /dev from /etc/daily ?
On Mon, 23 Nov 2020 14:46:29 + Stuart Henderson : > On 2020/11/23 09:31, Bryan Steele wrote: > > On Mon, Nov 23, 2020 at 03:25:34PM +0100, Otto Moerbeek wrote: > > > tOn Mon, Nov 23, 2020 at 01:53:01PM +0100, Solene Rapenne wrote: > > > > > > > A common mistake when using dd is to create a file in /dev which > > > > fills up the space of / and may stay silent until / gets filled up > > > > by something else that will fail. > > > > > > > > Would it be OK to add this in /etc/daily? > > > > > > > > find /dev -type f ! -name MAKEDEV -delete > > > > > > > > AFAIK /dev should have only MAKEDEV as a regular file. > > > > hier(7) says /dev only have block and character devices > > > > with the exception of MAKEDEV. > > > > > > > > > > reporting is good, but deleting not. > > > > > > -Otto > > > > ^^ > > > > I like this option a lot more, as users will get an opportunity to > > learn. > > I don't object to reporting (I do object to automatically deleting), > but realistically for many people who would make this mistake, the > daily mails are just going to build up unread in /var/mail/$USER... > That's exactly why I thought removing them was better than reporting. The disk usage is already reported daily. With the script being run during night, this would also only be useful for workstation that stay online at the time the script is run. In conclusion, it was a bad idea.
clean /dev from /etc/daily ?
A common mistake when using dd is to create a file in /dev which fills up the space of / and may stay silent until / gets filled up by something else that will fail. Would it be OK to add this in /etc/daily? find /dev -type f ! -name MAKEDEV -delete AFAIK /dev should have only MAKEDEV as a regular file. hier(7) says /dev only have block and character devices with the exception of MAKEDEV.
Re: clean /dev from /etc/daily ?
Solene Rapenne wrote: > A common mistake when using dd is to create a file in /dev which > fills up the space of / and may stay silent until / gets filled up > by something else that will fail. > > Would it be OK to add this in /etc/daily? > > find /dev -type f ! -name MAKEDEV -delete > > AFAIK /dev should have only MAKEDEV as a regular file. > hier(7) says /dev only have block and character devices > with the exception of MAKEDEV. I cannot agree to any of this...
Re: clean /dev from /etc/daily ?
On 2020/11/23 09:31, Bryan Steele wrote: > On Mon, Nov 23, 2020 at 03:25:34PM +0100, Otto Moerbeek wrote: > > tOn Mon, Nov 23, 2020 at 01:53:01PM +0100, Solene Rapenne wrote: > > > > > A common mistake when using dd is to create a file in /dev which > > > fills up the space of / and may stay silent until / gets filled up > > > by something else that will fail. > > > > > > Would it be OK to add this in /etc/daily? > > > > > > find /dev -type f ! -name MAKEDEV -delete > > > > > > AFAIK /dev should have only MAKEDEV as a regular file. > > > hier(7) says /dev only have block and character devices > > > with the exception of MAKEDEV. > > > > > > > reporting is good, but deleting not. > > > > -Otto > > ^^ > > I like this option a lot more, as users will get an opportunity to > learn. I don't object to reporting (I do object to automatically deleting), but realistically for many people who would make this mistake, the daily mails are just going to build up unread in /var/mail/$USER...
Re: clean /dev from /etc/daily ?
On Mon, Nov 23, 2020 at 03:25:34PM +0100, Otto Moerbeek wrote: > tOn Mon, Nov 23, 2020 at 01:53:01PM +0100, Solene Rapenne wrote: > > > A common mistake when using dd is to create a file in /dev which > > fills up the space of / and may stay silent until / gets filled up > > by something else that will fail. > > > > Would it be OK to add this in /etc/daily? > > > > find /dev -type f ! -name MAKEDEV -delete > > > > AFAIK /dev should have only MAKEDEV as a regular file. > > hier(7) says /dev only have block and character devices > > with the exception of MAKEDEV. > > > > reporting is good, but deleting not. > > -Otto ^^ I like this option a lot more, as users will get an opportunity to learn. -Bryan.
Re: clean /dev from /etc/daily ?
On Mon, Nov 23, 2020 at 03:19:24PM +0100, Mark Kettenis wrote: > > Date: Mon, 23 Nov 2020 13:53:01 +0100 > > From: Solene Rapenne > > > > A common mistake when using dd is to create a file in /dev which > > fills up the space of / and may stay silent until / gets filled up > > by something else that will fail. > > > > Would it be OK to add this in /etc/daily? > > > > find /dev -type f ! -name MAKEDEV -delete > > > > AFAIK /dev should have only MAKEDEV as a regular file. > > hier(7) says /dev only have block and character devices > > with the exception of MAKEDEV. > > Well, the man page is lying as /dev also contains: > > - sockets (/dev/log) > - symlinks To be fair, the -type f in solene@'s proposal would preserve all of those, and just cleanup stray normal files. This does seem to be mostly harmless, but I do wonder if silently cleaning up after a users mess is the way to go or not, and should this be done at boot instead, like the /tmp clearing? -Bryan.
Re: clean /dev from /etc/daily ?
tOn Mon, Nov 23, 2020 at 01:53:01PM +0100, Solene Rapenne wrote: > A common mistake when using dd is to create a file in /dev which > fills up the space of / and may stay silent until / gets filled up > by something else that will fail. > > Would it be OK to add this in /etc/daily? > > find /dev -type f ! -name MAKEDEV -delete > > AFAIK /dev should have only MAKEDEV as a regular file. > hier(7) says /dev only have block and character devices > with the exception of MAKEDEV. > reporting is good, but deleting not. -Otto
Re: clean /dev from /etc/daily ?
> Date: Mon, 23 Nov 2020 13:53:01 +0100 > From: Solene Rapenne > > A common mistake when using dd is to create a file in /dev which > fills up the space of / and may stay silent until / gets filled up > by something else that will fail. > > Would it be OK to add this in /etc/daily? > > find /dev -type f ! -name MAKEDEV -delete > > AFAIK /dev should have only MAKEDEV as a regular file. > hier(7) says /dev only have block and character devices > with the exception of MAKEDEV. Well, the man page is lying as /dev also contains: - sockets (/dev/log) - symlinks
Re: clean /dev from /etc/daily ?
Hey, i think this is a great idea. I gave this a try on my machines and everything still works great. I asume that this will also reduce the number of questions about overgrown / partitions. But i cannot give you an OK, i am not an official developer. Just some feedback that it works great on my machines. Thanks so much and greetings Leo Am 23.11.2020 um 13:53 schrieb Solene Rapenne: A common mistake when using dd is to create a file in /dev which fills up the space of / and may stay silent until / gets filled up by something else that will fail. Would it be OK to add this in /etc/daily? find /dev -type f ! -name MAKEDEV -delete AFAIK /dev should have only MAKEDEV as a regular file. hier(7) says /dev only have block and character devices with the exception of MAKEDEV.