Deterministic builds, part 2
Erik Cederstrand
erik at cederstrand.dk
Thu Nov 25 12:09:01 UTC 2010
Hello hackers,
With a simple version of deterministic builds done (see my previous post here - anyone willing to comment the patch?), I have started to look at the more general case where OBJDIR and SRCDIR change between builds. The following are my findings.
Kernel modules:
----------------------
In the ELF section .gnu-debuglink, there is a link to the corresponding *.ko.symbols file. It seems to be an inode or such rather than a file path since nothing shows up in strings(1). I have commented out "makeoptions DEBUG=-g" in the GENERIC kernel conf file which I am testing now, but I'd like to know what is actually going on.
Symbol tables:
--------------------
For example, libstand.a shows up in a diff. Looking with objdump, I see the contained _setjmp.o file has the following symbol table:
SYMBOL TABLE:
00000000 l df *ABS* 00000000 /usr/home/erik/freebsd/head1/src/lib/libstand/i386/_setjmp.S
00000000 l df *ABS* 00000000 ./machine/asm.h
00000000 l df *ABS* 00000000 /home/erik/freebsd/obj1/usr/home/erik/freebsd/head1/src/tmp/usr/include/sys/cdefs.h
00000000 l df *ABS* 00000000 ./machine/asm.h
00000000 l df *ABS* 00000000 /usr/home/erik/freebsd/head1/src/lib/libstand/i386/_setjmp.S
00000000 l df *ABS* 00000000 <command-line>
00000000 l df *ABS* 00000000 <built-in>
00000000 l df *ABS* 00000000 /usr/home/erik/freebsd/head1/src/lib/libstand/i386/_setjmp.S
00000000 l d .text 00000000
00000000 l d .data 00000000
00000000 l d .bss 00000000
00000000 g F .text 0000001d _setjmp
00000020 g F .text 00000024 _longjmp
There are absolute paths within SRCDIR and OBJDIR. I'm pretty sure libarchive.a will still work at runtime if I blow away those directories. I could really use some help changing the paths to be relative to SRJ/OBJDIR if that makes sense, or even removing them if that's better.
rodata.str1.4:
------------------
Some *.o files (all?) contain the path to the corresponding source file:
Contents of section .rodata.str1.4:
0000 2f757372 2f686f6d 652f6572 696b2f66 /usr/home/erik/f
0010 72656562 73642f68 6561642f 7372632f reebsd/head1/src/
0020 6c69622f 6c696273 74616e64 2f6f7065 lib/libstand/ope
0030 6e2e6300 n.c.
As with the symbol tables, is it possible to change these to relative paths, or just remove them?
If there are no flags to gcc or other tricks to do this, I've thought about calling strip(1) within the build process to remove the things I don't want.
Thanks,
Erik
More information about the freebsd-hackers
mailing list