Gentoo Archives: gentoo-dev

From: Donnie Berkholz <dberkholz@g.o>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] Using -frecord-gcc-switches
Date: Tue, 03 Mar 2009 06:33:39
Message-Id: 20090303063336.GB3811@comet
1 -frecord-gcc-switches is a really cool gcc option to save the CFLAGS a
2 binary was built with in the binary itself. This could help with our bug
3 reporting or with various QA checks. Imagine if `emerge --info cat/pkg`
4 showed the CFLAGS that the binaries were actually built with, instead of
5 some global setting or the CFLAGS environment variable that may well not
6 be respected.
7
8 Here's a couple examples of it:
9
10 comet $ eu-readelf -p /usr/lib/libxdl_view.so | grep -v -e distcc -e ccache
11
12 String section [25] '.GCC.command.line' contains 1870 bytes at offset 0x69760:
13 [ 27] -march=core2
14 [ 34] -msse4.1
15 [ 64] -g
16 [ 67] -O2
17 [ 6b] -w
18 [ 6e] -ftree-vectorize
19 [ 7f] -frecord-gcc-switches
20 [ 95] -fPIC
21
22 comet $ eu-readelf -p /bin/ls | grep -v -e distcc -e ccache
23
24 String section [26] '.GCC.command.line' contains 4558 bytes at offset 0x1b4d0:
25 [ 34] -march=core2
26 [ 41] -msse4.1
27 [ 80] -g
28 [ 83] -O2
29 [ 87] -w
30 [ 8a] -std=gnu99
31 [ 95] -ftree-vectorize
32 [ a6] -frecord-gcc-switches
33 [ 107e] -I.
34 [ 1082] -MD isnanl.d
35 [ 108f] -MF .deps/isnanl.Tpo
36 [ 10a4] -MP
37 [ 10a8] -MT isnanl.o
38 [ 10b5] isnanl.c
39 [ 10be] -D_FORTIFY_SOURCE=2
40 [ 10d2] -auxbase-strip isnanl.o
41
42
43 Thoughts? Could we do something useful with this?
44
45 --
46 Thanks,
47 Donnie
48
49 Donnie Berkholz
50 Developer, Gentoo Linux
51 Blog: http://dberkholz.wordpress.com

Replies

Subject Author
Re: [gentoo-dev] Using -frecord-gcc-switches "RĂ©mi Cardona" <remi@g.o>