Help needed cleaning up sys/boot/{efi,ia64}/ makefiles

Ruslan Ermilov ru at FreeBSD.org
Thu Feb 12 01:17:58 PST 2004


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:
> > 
> > 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.
> 
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).
> 
> > 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:

%%%
Index: loader/Makefile
===================================================================
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+= -I${.CURDIR}/../../../../lib/li
 CFLAGS+= -DLOADER
 
 LDSCRIPT=	${.CURDIR}/../libefi/arch/${MACHINE_ARCH}/ldscript.${MACHINE_ARCH}
-LDFLAGS=	-Wl,-T${LDSCRIPT} -Wl,-M,-Map,loader.list -shared -symbolic
+LDFLAGS=	-Wl,-T${LDSCRIPT} -shared -symbolic
 OBJCOPY?=	objcopy
 
 CLEANFILES=	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/scratch/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/scratch/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/src/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
: 
:  entry: 251
: -       r_offset: 0x62530
: +       r_offset: 0x624f0
:         r_info: 111
:         r_addend: 311296
: 
:  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,
-- 
Ruslan Ermilov
FreeBSD committer
ru at FreeBSD.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-ia64/attachments/20040212/37e77443/attachment.bin


More information about the freebsd-ia64 mailing list