Date: Thu, 30 Mar 2017 15:29:25 -0400 From: Ed Maste <emaste@freebsd.org> To: Andre Albsmeier <Andre.Albsmeier@siemens.com> Cc: Dimitry Andric <dim@freebsd.org>, "freebsd-toolchain@freebsd.org" <freebsd-toolchain@freebsd.org> Subject: Re: /tmp/ecp.* created during kernel build? Message-ID: <CAPyFy2Anufd2Bn2jTM2p=FgciNd22fxAH7rOeUZ6fvGd4NVx0w@mail.gmail.com> In-Reply-To: <20170324122129.GA24947@bali> References: <alpine.BSF.2.11.1612271756590.79526@eboyr.pbz> <1612271904400.79526@mx5.roble.com> <A7D222D1-48AA-4F9D-97CC-A2D9B7DD7B95@FreeBSD.org> <20170324122129.GA24947@bali>
next in thread | previous in thread | raw e-mail | index | archive | help
[redirected to freebsd-toolchain] On 24 March 2017 at 08:21, Andre Albsmeier <Andre.Albsmeier@siemens.com> wr= ote: > > Interesting is also that libc.a grows(!): > > Before the strip: > -r--r----- 1 andre wheel 2622684 24 Mar 13:18 libc.a > > After: > -r--r----- 1 andre wheel 2713792 24 Mar 13:19 libc.a It seems this is a side effect of the way elfcopy writes the new archive and objects. Using diffoscope to compare libc.a and a stripped libc.a we see a few interesting things: % objcopy --strip-debug /usr/lib/libc.a libc.strip1.a % diffoscope /usr/lib/libc.a libc.strip1.a --- /usr/lib/libc.a +++ libc.strip1.a =E2=94=9C=E2=94=80=E2=94=80 file list =E2=94=82 @@ -1,1258 +1,1258 @@ =E2=94=82 ----------- 0 0 0 83210 1970-01-01 00:00:00.00= 0000 / =E2=94=82 +---------- 0 0 0 83210 2017-03-30 19:01:14.00= 0000 / * Elfcopy is updating the timestamp on the "/" entry, despite leaving all other archive metadata alone. =E2=94=82 --rw-r--r-- 0 0 0 1104 1970-01-01 00:00:00.000000 iconvlist.o =E2=94=82 +-rw-r--r-- 0 0 0 1184 1970-01-01 00:00:00.000000 iconvlist.o * As you discovered output is larger, and this is true for the individual .o files in the .a archive. =E2=94=82 File: lib.a(iconvctl.o) =E2=94=82 ELF Header: =E2=94=82 Magic: 7f 45 4c 46 02 01 01 09 00 00 00 00 00 00 00 00 =E2=94=82 Class: ELF64 =E2=94=82 Data: 2's complement, little endi= an =E2=94=82 Version: 1 (current) =E2=94=82 OS/ABI: FreeBSD =E2=94=82 ABI Version: 0 =E2=94=82 Type: REL (Relocatable file) =E2=94=82 Machine: Advanced Micro Devices x86-= 64 =E2=94=82 Version: 0x1 =E2=94=82 Entry point address: 0 =E2=94=82 Start of program headers: 0 (bytes into file) =E2=94=82 - Start of section headers: 528 (bytes into file) =E2=94=82 + Start of section headers: 536 (bytes into file) =E2=94=82 Flags: 0 =E2=94=82 Size of this header: 64 (bytes) =E2=94=82 Size of program headers: 0 (bytes) =E2=94=82 Number of program headers: 0 =E2=94=82 Size of section headers: 64 (bytes) =E2=94=82 - Number of section headers: 9 =E2=94=82 - Section header string table index: 1 =E2=94=82 + Number of section headers: 10 =E2=94=82 + Section header string table index: 9 Section headers are at a different offset, elfcopy/strip output has an extra section. =E2=94=9C=E2=94=80=E2=94=80 readelf --wide --sections {} =E2=94=82 @@ -1,23384 +1,24634 @@ =E2=94=82 =E2=94=82 File: lib.a(iconvlist.o) =E2=94=82 -There are 9 section headers, starting at offset 0x210: =E2=94=82 +There are 10 section headers, starting at offset 0x220: =E2=94=82 =E2=94=82 Section Headers: =E2=94=82 [Nr] Name Type Addr Off Size ES Flg Lk Inf Al =E2=94=82 [ 0] NULL 0000000000000000 000000 000000 00 0 0 0 =E2=94=82 - [ 1] .strtab STRTAB 0000000000000000 000180 00008c 00 0 0 1 =E2=94=82 - [ 2] .text PROGBITS 0000000000000000 000040 00000a 00 AX 0 0 16 =E2=94=82 - [ 3] .rela.text RELA 0000000000000000 000150 000018 18 8 2 8 =E2=94=82 - [ 4] .comment PROGBITS 0000000000000000 00004a 000053 01 MS 0 0 1 =E2=94=82 - [ 5] .note.GNU-stack PROGBITS 0000000000000000 00009d 000000 00 0 0 1 =E2=94=82 - [ 6] .eh_frame X86_64_UNWIND 0000000000000000 0000a0 000038 00 A 0 0 8 =E2=94=82 - [ 7] .rela.eh_frame RELA 0000000000000000 000168 000018 18 8 6 8 =E2=94=82 - [ 8] .symtab SYMTAB 0000000000000000 0000d8 000078 18 1 3 8 =E2=94=82 + [ 1] .text PROGBITS 0000000000000000 000040 00000a 00 AX 0 0 16 =E2=94=82 + [ 2] .rela.text RELA 0000000000000000 000180 000018 18 I 7 1 8 =E2=94=82 + [ 3] .comment PROGBITS 0000000000000000 00004a 000053 01 MS 0 0 1 =E2=94=82 + [ 4] .note.GNU-stack PROGBITS 0000000000000000 00009d 000000 00 0 0 1 =E2=94=82 + [ 5] .eh_frame X86_64_UNWIND 0000000000000000 0000a0 000038 00 A 0 0 8 =E2=94=82 + [ 6] .rela.eh_frame RELA 0000000000000000 000198 000018 18 I 7 5 8 =E2=94=82 + [ 7] .symtab SYMTAB 0000000000000000 0000d8 0000a8 18 8 5 8 =E2=94=82 + [ 8] .strtab STRTAB 0000000000000000 0001b0 00001b 00 0 0 1 =E2=94=82 + [ 9] .shstrtab STRTAB 0000000000000000 0001cb 00004e 00 0 0 1 =E2=94=82 Key to Flags: =E2=94=82 W (write), A (alloc), X (execute), M (merge), S (strings) =E2=94=82 I (info), L (link order), G (group), x (unknown) =E2=94=82 O (extra OS processing required) o (OS specific), p (processor= specific) Sections are in a different order, and elfcopy/strip includes a separate section header string table, while Clang's output stores both symbol names and names used in the section header in .strtab. The increased size is interesting and somewhat unfortunate, but not necessarily a bug. > strip (objcopy) does more curious things: > > $ cd /tmp > $ cp /usr/lib/libc.a . > $ strip --strip-debug libc.a > $ strip --strip-debug libc.a > > [1] 960 segmentation fault strip --strip-debug libc.a This is also reproducible as: % objcopy --strip-debug /usr/lib/libc.a libc.1.a % objcopy --strip-debug libc.1.a libc.2.a zsh: bus error (core dumped) objcopy --strip-debug libc.1.a libc.2.a It wasn't reproducible in some trivial cases I tried though (e.g. .a archive with two trivial .o objects), or with some other .a archives: % objcopy --strip-debug /usr/lib/libm.a libm.1.a % objcopy --strip-debug libm.1.a libm.2.a % I've submitted ELF Tool Chain ticket #548 for this issue https://sourceforge.net/p/elftoolchain/tickets/548/
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAPyFy2Anufd2Bn2jTM2p=FgciNd22fxAH7rOeUZ6fvGd4NVx0w>