Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 12 Feb 2004 11:18:51 +0200
From:      Ruslan Ermilov <ru@FreeBSD.org>
To:        Marcel Moolenaar <marcel@xcllnt.net>
Cc:        ia64@FreeBSD.org
Subject:   Re: Help needed cleaning up sys/boot/{efi,ia64}/ makefiles
Message-ID:  <20040212091851.GA63369@FreeBSD.org.ua>
In-Reply-To: <20040212055048.GA2975@dhcp01.pn.xcllnt.net>
References:  <20040211142549.GA52347@FreeBSD.org.ua> <20040212055048.GA2975@dhcp01.pn.xcllnt.net>

next in thread | previous in thread | raw e-mail | index | archive | help

--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--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040212091851.GA63369>