Thank you. That is correct. Alexander Bluhm <alexander.bl...@gmx.net> wrote:
> Hi, > > After enabling -fcf-protection=branch for the kernel, we have a new > .plt section in the kernel. It was not there before. > > $ objdump -s .../snapshots/amd64/bsd > ... > ffffffff82048540 c7c13140 0682c9e9 c43646ff ..1@.....6F. > Contents of section .plt: > ffffffff82048550 00000000 00000000 00000000 00000000 ................ > Contents of section .rodata: > ffffffff82049000 cccccccc cccccccc cccccccc cccccccc ................ > > This is caused by compiling gapdummy.c with -fcf-protection=branch. > Then gapdummy.o gets a new .note.gnu.property section. > > $ objdump -s arch/amd64/compile/GENERIC.MP/obj/gapdummy.o > > arch/amd64/compile/GENERIC.MP/obj/gapdummy.o: file format elf64-x86-64 > > Contents of section .note.gnu.property: > 0000 04000000 10000000 05000000 474e5500 ............GNU. > 0010 020000c0 04000000 01000000 00000000 ................ > > When creating gap.o from that, the linker adds a .plt section which > finally shows up in the kernel. > > Diff below restores old behavior. I stumbled over this when linking > kernel with sorted and aligned objects for my performance tests. > There it resulted in unexpexted gaps within the kernel image. > > I am not sure if we want to fix this. If not, I can probly add > another workaround for my use case. But this new .plt does not > make much sense. > > ok? > > bluhm > > Index: sys/arch/amd64/conf/Makefile.amd64 > =================================================================== > RCS file: /mount/openbsd/cvs/src/sys/arch/amd64/conf/Makefile.amd64,v > retrieving revision 1.131 > diff -u -p -r1.131 Makefile.amd64 > --- sys/arch/amd64/conf/Makefile.amd64 17 Apr 2023 01:14:24 -0000 > 1.131 > +++ sys/arch/amd64/conf/Makefile.amd64 20 Apr 2023 21:25:05 -0000 > @@ -177,7 +177,7 @@ ld.script: ${_machdir}/conf/ld.script > > gapdummy.o: > echo '__asm(".section .rodata,\"a\"");' > gapdummy.c > - ${CC} -c ${CFLAGS} ${CPPFLAGS} gapdummy.c -o $@ > + ${CC} -c ${CFLAGS} ${CPPFLAGS} -fcf-protection=none gapdummy.c -o $@ > > makegap.sh: > cp $S/conf/makegap.sh $@ >