From owner-freebsd-ia64@FreeBSD.ORG Wed Feb 11 06:24:56 2004 Return-Path: Delivered-To: freebsd-ia64@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D18B716A4CF; Wed, 11 Feb 2004 06:24:56 -0800 (PST) Received: from phantom.cris.net (phantom.cris.net [212.110.130.74]) by mx1.FreeBSD.org (Postfix) with ESMTP id A4B8743D1D; Wed, 11 Feb 2004 06:24:52 -0800 (PST) (envelope-from ru@FreeBSD.org.ua) Received: from phantom.cris.net (ru@localhost [127.0.0.1]) by phantom.cris.net (8.12.10/8.12.10) with ESMTP id i1BEPpoh052767; Wed, 11 Feb 2004 16:25:51 +0200 (EET) (envelope-from ru@FreeBSD.org.ua) Received: (from ru@localhost) by phantom.cris.net (8.12.10/8.12.10/Submit) id i1BEPnUw052762; Wed, 11 Feb 2004 16:25:49 +0200 (EET) (envelope-from ru) Date: Wed, 11 Feb 2004 16:25:49 +0200 From: Ruslan Ermilov To: Marcel Moolenaar , Peter Wemm Message-ID: <20040211142549.GA52347@FreeBSD.org.ua> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="vGgW1X5XWziG23Ko" Content-Disposition: inline User-Agent: Mutt/1.5.5.1i cc: ia64@FreeBSD.org Subject: Help needed cleaning up sys/boot/{efi,ia64}/ makefiles X-BeenThere: freebsd-ia64@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Porting FreeBSD to the IA-64 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Feb 2004 14:24:57 -0000 --vGgW1X5XWziG23Ko Content-Type: multipart/mixed; boundary="5mCyUwZo2JvN/JJP" Content-Disposition: inline --5mCyUwZo2JvN/JJP Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Gang, As you've probably noticed, I've been working towards cleaning up sys/boot/ makefiles for some time already, and now is the time for IA64. I've compile-tested the attached patch on pluto2 today. I tested my changes by binary comparing the resulting binaries, in the same way as I did it for other architectures (i386, amd64 and sparc64). One thing about IA64 surprises me, and I hope you can help me here. With my patch, I get a slightly different "loader.sym" binary, and this is due to linking, i.e., all intermediate objects are the same. I first took away the -M option to ld(1) to not generate the link map. An analysis shown that this was responsible for a difference. I've put it back, and (as could be seen by adding -v to LDFLAGS after applying the patch), the link command now looks like this: : ld -Bshareable -Bsymbolic -o loader.sym \ : -L/usr/lib \ : -T/q/scratch/ru/src/sys/boot/efi/loader/../libefi/arch/ia64/ldscript.ia64= \ : -M -Map loader.list \ : start.o main.o conf.o dev_net.o bcache.o boot.o commands.o console.o \ : devopen.o interp.o interp_backslash.o interp_parse.o ls.o misc.o module.o= \ : panic.o load_elf64.o interp_forth.o vers.o \ : /q/scratch/ru/obj/q/scratch/ru/src/sys/boot/efi/loader/../../ficl/libficl= =2Ea \ : /q/scratch/ru/obj/q/scratch/ru/src/sys/boot/efi/loader/../libefi/libefi.a= \ : -lstand But this still gives a difference. By disassembling the resulting binary, I see the constant difference of 40 bytes in various offset, if I'm guessing the IA64 asm code correctly. Then the constant changes. The elfdump(1) also shows the difference in relocations. But if I change to an object directory, and relink loader.sym manually by tweaking the link command a bit (by changing -L/usr/lib to -nostdlib and replacing -lstand with /usr/lib/libstand.a), I see no difference (except probably for "normal" difference influenced by regenerating vers.c, if I regenerate it). ; ld -Bshareable -Bsymbolic -o loader.sym \ ; - -L/usr/lib \ ; + -nostdlib \ ; -T/q/scratch/ru/src/sys/boot/efi/loader/../libefi/arch/ia64/ldscript.ia= 64 \ ; -M -Map loader.list \ ; start.o main.o conf.o dev_net.o bcache.o boot.o commands.o console.o \ ; devopen.o interp.o interp_backslash.o interp_parse.o ls.o misc.o module= =2Eo \ ; panic.o load_elf64.o interp_forth.o vers.o \ ; /q/scratch/ru/obj/q/scratch/ru/src/sys/boot/efi/loader/../../ficl/libfi= cl.a \ ; /q/scratch/ru/obj/q/scratch/ru/src/sys/boot/efi/loader/../libefi/libefi= =2Ea \ ; - -lstand ; + /usr/lib/libstand.a So I have a few questions: - Why the hell removing -M from linker flags (both in unpatched and patched versions of makefiles) seems to affect the loader.sym binary? - Is it safe to commit my patch? Can someone please run-test it? - Is there a reason why libski is built with -g? Is it safe to remove it? - What is the reason that we cannot strip the skiload binary? (A slightly more verbose explanation than the below would be nice.) : revision 1.12 : date: 2003/11/09 06:53:37; author: marcel; state: Exp; lines: +1 -0 : Do not strip skiload when installed. The stripped binary does not load : in the simulator. - What is the reason that we cannot strip the boot.efi binary? (A slightly more verbose explanation than the below would be nice.) : revision 1.17 : date: 2002/04/07 04:27:50; author: peter; state: Exp; lines: +1 -0 : We must not let install(1) strip loader.efi when installing it, or the : resulting binary will be damaged and no longer work. Cheers, --=20 Ruslan Ermilov FreeBSD committer ru@FreeBSD.org --5mCyUwZo2JvN/JJP Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=p Content-Transfer-Encoding: quoted-printable Index: efi/Makefile.inc =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/ncvs/src/sys/boot/efi/Makefile.inc,v retrieving revision 1.6 diff -u -r1.6 Makefile.inc --- efi/Makefile.inc 10 Dec 2002 04:20:15 -0000 1.6 +++ efi/Makefile.inc 11 Feb 2004 08:59:03 -0000 @@ -1,4 +1,7 @@ # $FreeBSD: src/sys/boot/efi/Makefile.inc,v 1.6 2002/12/10 04:20:15 marcel= Exp $ =20 +BINDIR?=3D /boot + # Options used when building app-specific efi components CFLAGS+=3D -ffreestanding -fshort-wchar -Wformat +LDFLAGS+=3D -nostdlib Index: efi/libefi/Makefile =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/ncvs/src/sys/boot/efi/libefi/Makefile,v retrieving revision 1.12 diff -u -r1.12 Makefile --- efi/libefi/Makefile 2 Jul 2003 11:53:55 -0000 1.12 +++ efi/libefi/Makefile 9 Feb 2004 16:14:21 -0000 @@ -12,28 +12,21 @@ SRCS+=3D efifpswa.c .endif =20 -CFLAGS+=3D -ffreestanding -fpic +CFLAGS+=3D -fpic CFLAGS+=3D -I${.CURDIR}/../include CFLAGS+=3D -I${.CURDIR}/../include/${MACHINE_ARCH} -CFLAGS+=3D -I${.CURDIR}/../../../../lib/libstand/ +CFLAGS+=3D -I${.CURDIR}/../../../../lib/libstand =20 # Pick up the bootstrap header for some interface items -CFLAGS+=3D -I${.CURDIR}/../../common -I${.CURDIR}/../../.. -I. +CFLAGS+=3D -I${.CURDIR}/../../common =20 .if ${MACHINE_ARCH} =3D=3D "powerpc" CFLAGS+=3D -msoft-float .endif =20 -.ifdef(BOOT_DISK_DEBUG) +.if defined(BOOT_DISK_DEBUG) # Make the disk code more talkative CFLAGS+=3D -DDISK_DEBUG .endif =20 -machine: - ln -sf ${.CURDIR}/../../../${MACHINE_ARCH}/include machine - -CLEANFILES+=3D machine - .include - -beforedepend ${OBJS}: machine Index: efi/loader/Makefile =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/ncvs/src/sys/boot/efi/loader/Makefile,v retrieving revision 1.19 diff -u -r1.19 Makefile --- efi/loader/Makefile 26 Feb 2003 06:18:52 -0000 1.19 +++ efi/loader/Makefile 11 Feb 2004 12:45:07 -0000 @@ -1,76 +1,45 @@ # $FreeBSD: src/sys/boot/efi/loader/Makefile,v 1.19 2003/02/26 06:18:52 ob= rien Exp $ =20 -.PATH: ${.CURDIR}/../common - -BASE=3D loader -PROG=3D ${BASE}.efi +PROG=3D loader.sym +INTERNALPROG=3D NOMAN=3D NEWVERSWHAT=3D "EFI boot" ${MACHINE_ARCH} -BINDIR?=3D /boot -STRIP=3D # We must not strip loader.efi at install time. =20 -SRCS+=3D main.c conf.c dev_net.c +SRCS=3D start.S main.c conf.c dev_net.c #vers.c =20 -CFLAGS+=3D -ffreestanding +.PATH: ${.CURDIR}/../libefi/arch/${MACHINE_ARCH} =20 .if !defined(NOFORTH) # Enable BootForth BOOT_FORTH=3D yes CFLAGS+=3D -DBOOT_FORTH CFLAGS+=3D -I${.CURDIR}/../../ficl -I${.CURDIR}/../../ficl/${MACHINE_ARCH} -.if exists(${.OBJDIR}/../../ficl/libficl.a) LIBFICL=3D ${.OBJDIR}/../../ficl/libficl.a -.else -LIBFICL=3D ${.CURDIR}/../../ficl/libficl.a -.endif -.endif - -# where to get libstand from -.if exists(${.OBJDIR}/../../../../lib/libstand/libstand.a) -LIBSTAND=3D ${.OBJDIR}/../../../../lib/libstand/libstand.a -.else -LIBSTAND=3D ${.CURDIR}/../../../../lib/libstand/libstand.a .endif =20 -.if exists(${.OBJDIR}/../libefi/libefi.a) LIBEFI=3D ${.OBJDIR}/../libefi/libefi.a -.else -LIBEFI=3D ${.CURDIR}/../libefi/libefi.a -.endif =20 # Always add MI sources=20 .PATH: ${.CURDIR}/../../common -.include <${.CURDIR}/../../common/Makefile.inc> +.include "${.CURDIR}/../../common/Makefile.inc" =20 -CFLAGS+=3D -I- CFLAGS+=3D -I${.CURDIR}/../include CFLAGS+=3D -I${.CURDIR}/../include/${MACHINE_ARCH} -CFLAGS+=3D -I${.CURDIR}/../../common -I${.CURDIR} -CFLAGS+=3D -I${.CURDIR}/../../.. -I. +CFLAGS+=3D -I${.CURDIR}/../../common CFLAGS+=3D -I${.CURDIR}/../libefi CFLAGS+=3D -I${.CURDIR}/../../../../lib/libstand CFLAGS+=3D -DLOADER =20 LDSCRIPT=3D ${.CURDIR}/../libefi/arch/${MACHINE_ARCH}/ldscript.${MACHINE_A= RCH} -LDFLAGS=3D -nostdlib -T ${LDSCRIPT} -shared -Bsymbolic +LDFLAGS=3D -Wl,-T${LDSCRIPT} -Wl,-M,-Map,loader.list -shared -symbolic OBJCOPY?=3D objcopy =20 -CLEANFILES+=3D setdef0.c setdef0.o setdef1.c setdef1.o setdefs.h start.o \ - vers.c vers.o ${BASE}.efi ${BASE}.sym ${BASE}.list -CLEANFILES+=3D loader.help -CLEANFILES+=3D machine - -CRT=3D start.o - -all: ${BASE} +CLEANFILES=3D vers.c loader.efi loader.list loader.help =20 -vers.o: ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version +vers.c: ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT} - ${CC} -c vers.c =20 -${BASE}: ${BASE}.efi ${BASE}.help - -${BASE}.efi: ${BASE}.sym +loader.efi: loader.sym ${OBJCOPY} -j .text \ -j .hash \ -j .data \ @@ -81,43 +50,24 @@ -j .dynsym \ -j .dynstr \ --target=3Defi-app-${MACHINE_ARCH} \ - ${BASE}.sym ${BASE}.efi + loader.sym loader.efi =20 -${BASE}.help: help.common +loader.help: help.common cat ${.ALLSRC} | awk -f ${.CURDIR}/../../common/merge_help.awk \ > ${.TARGET} =20 -beforeinstall: -.if exists(${.OBJDIR}/loader.help) - ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \ - ${.OBJDIR}/${BASE}.help ${DESTDIR}/boot -.else - ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \ - ${.CURDIR}/${BASE}.help ${DESTDIR}/boot -.endif +.PATH: ${.CURDIR}/../../forth +FILES=3D loader.efi loader.help loader.4th support.4th loader.conf +FILESMODE_loader.efi=3D ${BINMODE} +FILESDIR_loader.conf=3D /boot/defaults + .if !exists(${DESTDIR}/boot/loader.rc) - ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \ - ${.CURDIR}/../../forth/loader.rc ${DESTDIR}/boot +FILES+=3D ${.CURDIR}/loader.rc .endif - ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \ - ${.CURDIR}/../../forth/loader.4th ${DESTDIR}/boot - ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \ - ${.CURDIR}/../../forth/support.4th ${DESTDIR}/boot - ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \ - ${.CURDIR}/../../forth/loader.conf ${DESTDIR}/boot/defaults =20 +SRCS+=3D vers.c =20 -# Other fragments still to be brought in from ../Makfile.booters? -start.o: ${.CURDIR}/../libefi/arch/${MACHINE_ARCH}/start.S - ${CC} -c ${CFLAGS} ${.IMPSRC} - -machine: - ln -sf ${.CURDIR}/../../../${MACHINE_ARCH}/include machine +DPADD=3D ${LIBFICL} ${LIBEFI} ${LIBSTAND} +LDADD=3D ${LIBFICL} ${LIBEFI} -lstand =20 .include - -${BASE}.sym: ${OBJS} ${LIBFICL} ${LIBEFI} ${LIBSTAND} ${CRT} vers.o - ${LD} ${LDFLAGS} -o ${BASE}.sym -M ${CRT} ${OBJS} vers.o \ - ${LIBFICL} ${LIBEFI} ${LIBSTAND} > ${.OBJDIR}/${BASE}.list - -beforedepend ${OBJS}: machine Index: ia64/Makefile.inc =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/ncvs/src/sys/boot/ia64/Makefile.inc,v retrieving revision 1.2 diff -u -r1.2 Makefile.inc --- ia64/Makefile.inc 1 Feb 2003 22:50:08 -0000 1.2 +++ ia64/Makefile.inc 11 Feb 2004 13:02:05 -0000 @@ -1,4 +1,7 @@ # $FreeBSD: src/sys/boot/ia64/Makefile.inc,v 1.2 2003/02/01 22:50:08 marce= l Exp $ =20 +BINDIR?=3D /boot + # Options used when building standalone components CFLAGS+=3D -ffreestanding -fshort-wchar -Wformat +LDFLAGS+=3D -nostdlib Index: ia64/libski/Makefile =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/ncvs/src/sys/boot/ia64/libski/Makefile,v retrieving revision 1.10 diff -u -r1.10 Makefile --- ia64/libski/Makefile 2 Jul 2003 11:47:33 -0000 1.10 +++ ia64/libski/Makefile 11 Feb 2004 13:36:11 -0000 @@ -7,30 +7,21 @@ SRCS+=3D delay.c skifs.c elf_freebsd.c bootinfo.c ssc.c SRCS+=3D acpi_stub.c efi_stub.c pal_stub.S sal_stub.c =20 -CFLAGS+=3D -ffreestanding -fpic -g -CFLAGS+=3D -I${.CURDIR}/../include -CFLAGS+=3D -I${.CURDIR}/../include/${MACHINE_ARCH} -CFLAGS+=3D -I${.CURDIR}/../../../../lib/libstand/ +CFLAGS+=3D -fpic -g +CFLAGS+=3D -I${.CURDIR}/../../../../lib/libstand CFLAGS+=3D -I${.CURDIR}/../../efi/include CFLAGS+=3D -I${.CURDIR}/../../efi/include/${MACHINE_ARCH} =20 # Pick up the bootstrap header for some interface items -CFLAGS+=3D -I${.CURDIR}/../../common -I${.CURDIR}/../../.. -I. +CFLAGS+=3D -I${.CURDIR}/../../common -I${.CURDIR}/../../.. =20 .if ${MACHINE_ARCH} =3D=3D "powerpc" CFLAGS+=3D -msoft-float .endif =20 -.ifdef(BOOT_DISK_DEBUG) +.if defined(BOOT_DISK_DEBUG) # Make the disk code more talkative CFLAGS+=3D -DDISK_DEBUG .endif =20 -machine: - ln -sf ${.CURDIR}/../../../${MACHINE_ARCH}/include machine - -CLEANFILES+=3D machine - .include - -beforedepend ${OBJS}: machine Index: ia64/skiload/Makefile =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/ncvs/src/sys/boot/ia64/skiload/Makefile,v retrieving revision 1.12 diff -u -r1.12 Makefile --- ia64/skiload/Makefile 9 Nov 2003 06:53:37 -0000 1.12 +++ ia64/skiload/Makefile 11 Feb 2004 13:14:24 -0000 @@ -8,78 +8,40 @@ BINDIR?=3D /boot STRIP=3D # We must not strip skiload at install time. =20 -SRCS+=3D conf.c main.c start.S - -CFLAGS+=3D -ffreestanding +SRCS=3D conf.c main.c start.S vers.c =20 .if !defined(NOFORTH) # Enable BootForth BOOT_FORTH=3D yes CFLAGS+=3D -DBOOT_FORTH CFLAGS+=3D -I${.CURDIR}/../../ficl -I${.CURDIR}/../../ficl/${MACHINE_ARCH} -.if exists(${.OBJDIR}/../../ficl/libficl.a) LIBFICL=3D ${.OBJDIR}/../../ficl/libficl.a -.else -LIBFICL=3D ${.CURDIR}/../../ficl/libficl.a -.endif .endif =20 -# where to get libstand from -.if exists(${.OBJDIR}/../../../../lib/libstand/libstand.a) -LIBSTAND=3D ${.OBJDIR}/../../../../lib/libstand/libstand.a -.else -LIBSTAND=3D ${.CURDIR}/../../../../lib/libstand/libstand.a -.endif - -.if exists(${.OBJDIR}/../libski/libski.a) LIBSKI=3D ${.OBJDIR}/../libski/libski.a -.else -LIBSKI=3D ${.CURDIR}/../libski/libski.a -.endif =20 # Always add MI sources=20 .PATH: ${.CURDIR}/../../common -.include <${.CURDIR}/../../common/Makefile.inc> +.include "${.CURDIR}/../../common/Makefile.inc" =20 -CFLAGS+=3D -I- -CFLAGS+=3D -I${.CURDIR}/../include -CFLAGS+=3D -I${.CURDIR}/../include/${MACHINE_ARCH} -CFLAGS+=3D -I${.CURDIR}/../../common -I${.CURDIR} -CFLAGS+=3D -I${.CURDIR}/../../.. -I. +CFLAGS+=3D -I${.CURDIR}/../../common CFLAGS+=3D -I${.CURDIR}/../libski CFLAGS+=3D -DLOADER =20 -LDFLAGS=3D -nostdlib -T ${.CURDIR}/ldscript.ia64 +LDFLAGS=3D -Wl,-T${.CURDIR}/ldscript.ia64 -Wl,-M,-Map,${PROG}.list =20 -CLEANFILES+=3D vers.c vers.o ${PROG}.list -CLEANFILES+=3D loader.help -CLEANFILES+=3D machine +CLEANFILES=3D vers.c ${PROG}.list ${PROG}.help =20 -all: ${PROG} - -vers.o: ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version +vers.c: ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT} - ${CC} -c vers.c =20 -${PROG}.help: help.common help.efi +${PROG}.help: help.common cat ${.ALLSRC} | awk -f ${.CURDIR}/../../common/merge_help.awk \ > ${.TARGET} =20 -beforeinstall: -.if exists(${.OBJDIR}/${PROG}.help) - ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \ - ${.OBJDIR}/${PROG}.help ${DESTDIR}/boot -.endif - -machine: - ln -sf ${.CURDIR}/../../../${MACHINE_ARCH}/include machine +FILES=3D ${PROG}.help =20 -${PROG}: ${OBJS} ${LIBFICL} ${LIBSKI} ${LIBSTAND} vers.o - ${LD} ${LDFLAGS} -o ${PROG} -M \ - ${OBJS} vers.o \ - ${LIBFICL} ${LIBSTAND} ${LIBSKI} ${LIBSTAND} \ - > ${.OBJDIR}/${PROG}.list +DPADD=3D ${LIBFICL} ${LIBSKI} ${LIBSTAND} +LDADD=3D ${LIBFICL} ${LIBSKI} -lstand =20 .include - -beforedepend ${OBJS}: machine --5mCyUwZo2JvN/JJP-- --vGgW1X5XWziG23Ko Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (FreeBSD) iD8DBQFAKjttUkv4P6juNwoRAqDAAJ9PN7Cmp9UK18JkABfQzeR/HItgCgCfSsn6 xVmatIq+HjRTOKbjO9jG+KA= =x8bv -----END PGP SIGNATURE----- --vGgW1X5XWziG23Ko-- From owner-freebsd-ia64@FreeBSD.ORG Wed Feb 11 21:50:49 2004 Return-Path: Delivered-To: freebsd-ia64@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2811D16A4CE; Wed, 11 Feb 2004 21:50:49 -0800 (PST) Received: from ns1.xcllnt.net (209-128-86-226.bayarea.net [209.128.86.226]) by mx1.FreeBSD.org (Postfix) with ESMTP id D941643D1F; Wed, 11 Feb 2004 21:50:48 -0800 (PST) (envelope-from marcel@xcllnt.net) Received: from dhcp01.pn.xcllnt.net (dhcp01.pn.xcllnt.net [192.168.4.201]) by ns1.xcllnt.net (8.12.10/8.12.10) with ESMTP id i1C5omOE088213; Wed, 11 Feb 2004 21:50:48 -0800 (PST) (envelope-from marcel@piii.pn.xcllnt.net) Received: from dhcp01.pn.xcllnt.net (localhost [127.0.0.1]) i1C5omq6003635; Wed, 11 Feb 2004 21:50:48 -0800 (PST) (envelope-from marcel@dhcp01.pn.xcllnt.net) Received: (from marcel@localhost) by dhcp01.pn.xcllnt.net (8.12.10/8.12.10/Submit) id i1C5omDH003634; Wed, 11 Feb 2004 21:50:48 -0800 (PST) (envelope-from marcel) Date: Wed, 11 Feb 2004 21:50:48 -0800 From: Marcel Moolenaar To: Ruslan Ermilov Message-ID: <20040212055048.GA2975@dhcp01.pn.xcllnt.net> References: <20040211142549.GA52347@FreeBSD.org.ua> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20040211142549.GA52347@FreeBSD.org.ua> User-Agent: Mutt/1.4.1i cc: ia64@FreeBSD.org Subject: Re: Help needed cleaning up sys/boot/{efi,ia64}/ makefiles X-BeenThere: freebsd-ia64@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Porting FreeBSD to the IA-64 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Feb 2004 05:50:49 -0000 On Wed, Feb 11, 2004 at 04:25:49PM +0200, Ruslan Ermilov wrote: > > With my patch, I get a slightly different "loader.sym" binary, and > this is due to linking, i.e., all intermediate objects are the same. Not quite. efi/libefi/pal.o is different. The difference is harmless and is caused by picking up asm.h from a different place (without the patch we get it from machine/asm.h, with the patch we get it from /usr/include/machine/asm.h). The object file contains the name of the header file. Anyway, I cannot reproduce what you're seeing. The differences I get are irrelevant (like timestamps or padding). > So I have a few questions: > > - Why the hell removing -M from linker flags (both in unpatched and > patched versions of makefiles) seems to affect the loader.sym binary? Are you sure this is what's going on? I don't see what you're seeing. The use of -M does not affect the output, AFAICT. > - Is it safe to commit my patch? Can someone please run-test it? Yes. I tested it. > - Is there a reason why libski is built with -g? Is it safe to > remove it? I think the reason is that ski uses the debug information, which helped with the porting. It safe to remove it. > - What is the reason that we cannot strip the skiload binary? (A > slightly more verbose explanation than the below would be nice.) > > : revision 1.12 > : date: 2003/11/09 06:53:37; author: marcel; state: Exp; lines: +1 -0 > : Do not strip skiload when installed. The stripped binary does not load > : in the simulator. See below. > - What is the reason that we cannot strip the boot.efi binary? (A > slightly more verbose explanation than the below would be nice.) > > : revision 1.17 > : date: 2002/04/07 04:27:50; author: peter; state: Exp; lines: +1 -0 > : We must not let install(1) strip loader.efi when installing it, or the > : resulting binary will be damaged and no longer work. I think the problem is related to the fact that both the ski loader and the EFI loader are not what you call regular programs and that strip may be buggy in this regard. I haven't actually tried to nail it down, but I know binutils has bugs. -- Marcel Moolenaar USPA: A-39004 marcel@xcllnt.net From owner-freebsd-ia64@FreeBSD.ORG Thu Feb 12 01:17:58 2004 Return-Path: Delivered-To: freebsd-ia64@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7818116A4CE for ; Thu, 12 Feb 2004 01:17:58 -0800 (PST) Received: from phantom.cris.net (phantom.cris.net [212.110.130.74]) by mx1.FreeBSD.org (Postfix) with ESMTP id 118B643D31 for ; Thu, 12 Feb 2004 01:17:56 -0800 (PST) (envelope-from ru@FreeBSD.org.ua) Received: from phantom.cris.net (ru@localhost [127.0.0.1]) by phantom.cris.net (8.12.10/8.12.10) with ESMTP id i1C9Isoh065402; Thu, 12 Feb 2004 11:18:54 +0200 (EET) (envelope-from ru@FreeBSD.org.ua) Received: (from ru@localhost) by phantom.cris.net (8.12.10/8.12.10/Submit) id i1C9Ipkf065393; Thu, 12 Feb 2004 11:18:51 +0200 (EET) (envelope-from ru) Date: Thu, 12 Feb 2004 11:18:51 +0200 From: Ruslan Ermilov To: Marcel Moolenaar Message-ID: <20040212091851.GA63369@FreeBSD.org.ua> References: <20040211142549.GA52347@FreeBSD.org.ua> <20040212055048.GA2975@dhcp01.pn.xcllnt.net> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Qxx1br4bt0+wmkIi" Content-Disposition: inline In-Reply-To: <20040212055048.GA2975@dhcp01.pn.xcllnt.net> User-Agent: Mutt/1.5.5.1i cc: ia64@FreeBSD.org Subject: Re: Help needed cleaning up sys/boot/{efi,ia64}/ makefiles X-BeenThere: freebsd-ia64@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Porting FreeBSD to the IA-64 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Feb 2004 09:17:58 -0000 --Qxx1br4bt0+wmkIi Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Feb 11, 2004 at 09:50:48PM -0800, Marcel Moolenaar wrote: > On Wed, Feb 11, 2004 at 04:25:49PM +0200, Ruslan Ermilov wrote: > >=20 > > With my patch, I get a slightly different "loader.sym" binary, and > > this is due to linking, i.e., all intermediate objects are the same. >=20 > Not quite. efi/libefi/pal.o is different. The difference is harmless > and is caused by picking up asm.h from a different place (without the > patch we get it from machine/asm.h, with the patch we get it from > /usr/include/machine/asm.h). The object file contains the name of > the header file. >=20 Er, sorry, I forgot to mention that to avoid getting false diffs, I've also patched the _old_ version to not build "machine". > Anyway, I cannot reproduce what you're seeing. The differences I get > are irrelevant (like timestamps or padding). >=20 > > So I have a few questions: > >=20 > > - Why the hell removing -M from linker flags (both in unpatched and > > patched versions of makefiles) seems to affect the loader.sym binary? >=20 > Are you sure this is what's going on? I don't see what you're seeing. > The use of -M does not affect the output, AFAICT. >=20 Yes, I'm sure. I have now committed my patch (thanks for testing), and if I now apply this patch to not generate loader.list: %%% Index: loader/Makefile =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/ncvs/src/sys/boot/efi/loader/Makefile,v retrieving revision 1.20 diff -u -p -r1.20 Makefile --- loader/Makefile 12 Feb 2004 08:10:33 -0000 1.20 +++ loader/Makefile 12 Feb 2004 08:15:14 -0000 @@ -31,7 +31,7 @@ CFLAGS+=3D -I${.CURDIR}/../../../../lib/li CFLAGS+=3D -DLOADER =20 LDSCRIPT=3D ${.CURDIR}/../libefi/arch/${MACHINE_ARCH}/ldscript.${MACHINE_A= RCH} -LDFLAGS=3D -Wl,-T${LDSCRIPT} -Wl,-M,-Map,loader.list -shared -symbolic +LDFLAGS=3D -Wl,-T${LDSCRIPT} -shared -symbolic OBJCOPY?=3D objcopy =20 CLEANFILES=3D vers.c loader.efi loader.list loader.help %%% I get the following differences: Files obj~/q/scratch/ru/src/sys/boot/efi/libefi/libefi.a and obj/q/scratch/= ru/src/sys/boot/efi/libefi/libefi.a differ Files obj~/q/scratch/ru/src/sys/boot/efi/loader/loader.efi and obj/q/scratc= h/ru/src/sys/boot/efi/loader/loader.efi differ Only in obj~/q/scratch/ru/src/sys/boot/efi/loader: loader.list Files obj~/q/scratch/ru/src/sys/boot/efi/loader/loader.sym and obj/q/scratc= h/ru/src/sys/boot/efi/loader/loader.sym differ Files obj~/q/scratch/ru/src/sys/boot/efi/loader/vers.c and obj/q/scratch/ru= /src/sys/boot/efi/loader/vers.c differ Files obj~/q/scratch/ru/src/sys/boot/efi/loader/vers.o and obj/q/scratch/ru= /src/sys/boot/efi/loader/vers.o differ Files obj~/q/scratch/ru/src/sys/boot/ficl/libficl.a and obj/q/scratch/ru/sr= c/sys/boot/ficl/libficl.a differ $ cmp -l obj*/q/scratch/ru/src/sys/boot/efi/libefi/libefi.a |wc -l 33 $ cmp -l obj*/q/scratch/ru/src/sys/boot/ficl/libficl.a |wc -l 34 But: $ cmp -l obj*/q/scratch/ru/src/sys/boot/efi/loader/loader.sym |wc -l 7511 "elfdump -a" shows the huge diffs in the .rela section. First, the constant difference of -64 bytes: : @@ -1555,22 +1555,22 @@ : r_addend: 0 :=20 : entry: 251 : - r_offset: 0x62530 : + r_offset: 0x624f0 : r_info: 111 : r_addend: 311296 :=20 : entry: 252 : - r_offset: 0x62538 : + r_offset: 0x624f8 : r_info: 111 : r_addend: 311328 [...] : entry: 378 : - r_offset: 0x62828 : + r_offset: 0x627e8 : r_info: 111 : r_addend: 314168 Then +10 bytes: : entry: 379 : - r_offset: 0x62e68 : + r_offset: 0x62e78 : r_info: 111 : r_addend: 314176 [...] Then offset sometimes changes, etc. So I'm still puzzled as to why -M seems to affect the output. You can find the binaries on pluto2:/q/scratch/ru/{obj~,obj}. And by the way, as it turns out, just putting -Wl,-V to the start of LDFLAGS (while preserving all other flags) also affects the output, and gives $ cmp -l obj*/q/scratch/ru/src/sys/boot/efi/loader/loader.sym | wc -l 9266 on pluto2. FWIW, sys/boot/alpha/ makefiles also generated map tables, and taking -M out of LDFLAGS or otherwise changing them in insignificant way did not affect the output like this. Cheers, --=20 Ruslan Ermilov FreeBSD committer ru@FreeBSD.org --Qxx1br4bt0+wmkIi Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (FreeBSD) iD8DBQFAK0T7Ukv4P6juNwoRAlbdAJ9j7ZvuiXWEmOFbNOER0OnAnGhsEQCdGrYE 7JulY4cyIsEDPuhR7mkiSqA= =E5EA -----END PGP SIGNATURE----- --Qxx1br4bt0+wmkIi-- From owner-freebsd-ia64@FreeBSD.ORG Thu Feb 12 09:33:01 2004 Return-Path: Delivered-To: freebsd-ia64@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1A53716A4CE; Thu, 12 Feb 2004 09:33:01 -0800 (PST) Received: from ns1.xcllnt.net (209-128-86-226.bayarea.net [209.128.86.226]) by mx1.FreeBSD.org (Postfix) with ESMTP id DD1CA43D2F; Thu, 12 Feb 2004 09:33:00 -0800 (PST) (envelope-from marcel@xcllnt.net) Received: from ns1.xcllnt.net (localhost [127.0.0.1]) by ns1.xcllnt.net (8.12.10/8.12.10) with ESMTP id i1CHX0OE090807; Thu, 12 Feb 2004 09:33:00 -0800 (PST) (envelope-from marcel@ns1.xcllnt.net) Received: (from marcel@localhost) by ns1.xcllnt.net (8.12.10/8.12.10/Submit) id i1CHX09V090806; Thu, 12 Feb 2004 09:33:00 -0800 (PST) (envelope-from marcel) Date: Thu, 12 Feb 2004 09:33:00 -0800 From: Marcel Moolenaar To: Ruslan Ermilov Message-ID: <20040212173300.GA90691@ns1.xcllnt.net> References: <20040211142549.GA52347@FreeBSD.org.ua> <20040212055048.GA2975@dhcp01.pn.xcllnt.net> <20040212091851.GA63369@FreeBSD.org.ua> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20040212091851.GA63369@FreeBSD.org.ua> User-Agent: Mutt/1.5.5.1i cc: ia64@FreeBSD.org Subject: Re: Help needed cleaning up sys/boot/{efi,ia64}/ makefiles X-BeenThere: freebsd-ia64@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Porting FreeBSD to the IA-64 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Feb 2004 17:33:01 -0000 On Thu, Feb 12, 2004 at 11:18:51AM +0200, Ruslan Ermilov wrote: > > > Anyway, I cannot reproduce what you're seeing. The differences I get > > are irrelevant (like timestamps or padding). > > > > > So I have a few questions: > > > > > > - Why the hell removing -M from linker flags (both in unpatched and > > > patched versions of makefiles) seems to affect the loader.sym binary? > > > > Are you sure this is what's going on? I don't see what you're seeing. > > The use of -M does not affect the output, AFAICT. > > > Yes, I'm sure. I have now committed my patch (thanks for testing), and > if I now apply this patch to not generate loader.list: [snip] Ok, I'll sync up with what you committed and look into this some more. Note that your list of files that differ contain .a, .o and .c files. The .c and .o differences are explanable, but I don't see how a linker flag affects .a files. There's no linking involved anywhere. Please make sure your comparison is untainted. > And by the way, as it turns out, just putting -Wl,-V to the start > of LDFLAGS (while preserving all other flags) also affects the > output, and gives > > $ cmp -l obj*/q/scratch/ru/src/sys/boot/efi/loader/loader.sym | wc -l > 9266 > > on pluto2. FWIW, sys/boot/alpha/ makefiles also generated map tables, > and taking -M out of LDFLAGS or otherwise changing them in insignificant > way did not affect the output like this. I think something fishy is going on on pluto2. -- Marcel Moolenaar USPA: A-39004 marcel@xcllnt.net From owner-freebsd-ia64@FreeBSD.ORG Thu Feb 12 13:37:26 2004 Return-Path: Delivered-To: freebsd-ia64@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 342E016A4CE for ; Thu, 12 Feb 2004 13:37:26 -0800 (PST) Received: from phantom.cris.net (phantom.cris.net [212.110.130.74]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6F68243D31 for ; Thu, 12 Feb 2004 13:37:23 -0800 (PST) (envelope-from ru@FreeBSD.org.ua) Received: from phantom.cris.net (ru@localhost [127.0.0.1]) by phantom.cris.net (8.12.10/8.12.10) with ESMTP id i1CLcMoh074044; Thu, 12 Feb 2004 23:38:22 +0200 (EET) (envelope-from ru@FreeBSD.org.ua) Received: (from ru@localhost) by phantom.cris.net (8.12.10/8.12.10/Submit) id i1CLcGKi074022; Thu, 12 Feb 2004 23:38:16 +0200 (EET) (envelope-from ru) Date: Thu, 12 Feb 2004 23:38:14 +0200 From: Ruslan Ermilov To: Marcel Moolenaar Message-ID: <20040212213814.GG67147@FreeBSD.org.ua> References: <20040211142549.GA52347@FreeBSD.org.ua> <20040212055048.GA2975@dhcp01.pn.xcllnt.net> <20040212091851.GA63369@FreeBSD.org.ua> <20040212173300.GA90691@ns1.xcllnt.net> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="uc35eWnScqDcQrv5" Content-Disposition: inline In-Reply-To: <20040212173300.GA90691@ns1.xcllnt.net> User-Agent: Mutt/1.5.5.1i cc: ia64@FreeBSD.org Subject: Re: Help needed cleaning up sys/boot/{efi,ia64}/ makefiles X-BeenThere: freebsd-ia64@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Porting FreeBSD to the IA-64 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Feb 2004 21:37:26 -0000 --uc35eWnScqDcQrv5 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Feb 12, 2004 at 09:33:00AM -0800, Marcel Moolenaar wrote: > On Thu, Feb 12, 2004 at 11:18:51AM +0200, Ruslan Ermilov wrote: > >=20 > > > Anyway, I cannot reproduce what you're seeing. The differences I get > > > are irrelevant (like timestamps or padding). > > >=20 > > > > So I have a few questions: > > > >=20 > > > > - Why the hell removing -M from linker flags (both in unpatched and > > > > patched versions of makefiles) seems to affect the loader.sym bin= ary? > > >=20 > > > Are you sure this is what's going on? I don't see what you're seeing. > > > The use of -M does not affect the output, AFAICT. > > >=20 > > Yes, I'm sure. I have now committed my patch (thanks for testing), and > > if I now apply this patch to not generate loader.list: > [snip] >=20 > Ok, I'll sync up with what you committed and look into this some > more. Note that your list of files that differ contain .a, .o and > .c files. The .c and .o differences are explanable, but I don't > see how a linker flag affects .a files. There's no linking involved > anywhere. Please make sure your comparison is untainted. >=20 The .a files get only timestamp differences that don't contribute to differences after linking. > > And by the way, as it turns out, just putting -Wl,-V to the start > > of LDFLAGS (while preserving all other flags) also affects the > > output, and gives > >=20 > > $ cmp -l obj*/q/scratch/ru/src/sys/boot/efi/loader/loader.sym | wc -l > > 9266 > >=20 > > on pluto2. FWIW, sys/boot/alpha/ makefiles also generated map tables, > > and taking -M out of LDFLAGS or otherwise changing them in insignificant > > way did not affect the output like this. >=20 > I think something fishy is going on on pluto2. >=20 I will re-check on pluto1. Cheers, --=20 Ruslan Ermilov FreeBSD committer ru@FreeBSD.org --uc35eWnScqDcQrv5 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (FreeBSD) iD8DBQFAK/JGUkv4P6juNwoRAve0AJ9zgtgCH+lVN+emAMtdpqZeIMSddACfUNGi WVdGpoxFxI6/W3SDQdIXu9M= =z98t -----END PGP SIGNATURE----- --uc35eWnScqDcQrv5--