[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v3 2/3] XENVER_build_id: Provide ld-embedded build-ids (v8)



>>> On 15.01.16 at 22:49, <konrad@xxxxxxxxxx> wrote:
>> > --- a/Config.mk
>>> +++ b/Config.mk
>>> @@ -126,6 +126,17 @@ endef
>>>  check-$(gcc) = $(call cc-ver-check,CC,0x040100,"Xen requires at least 
> gcc-4.1")
>>>  $(eval $(check-y))
>>>
>>> +ld-ver = $(shell if [ $$((`$(1) --version | head -1 | sed 's/[^0-9]/ /g' | 
> awk \
>>> +           '{ printf "0x%02x%02x", $$1, $$2}'`)) -ge $$(($(2))) ]; \
>>> +           then echo y; else echo n; fi ;)
>>> +
>>> +# binutils 2.18 implement build-id.
>>> +ifeq ($(call ld-ver,$(LD),0x0212),n)
>>> +build_id :=
>>> +else
>>> +build_id := --build-id=sha1
>>> +endif
>>
>> Wouldn't it be better to probe the linker for recognizing the --build-id
>> command line option, along the lines of $(cc-option)?
> 
> +ld-ver-build-id = $(shell $(1) --build-id 2>&1 | \
> +                                       grep -q unrecognized && echo n
> || echo y)
> 
> -ish ?

If that fulfills the purpose - why not?

>> In any event the option should be added to LDFLAGS unless this
>> conflicts with something else.
> 
> That had some interesting side-effect:
> 
> $ find . -name *.o | xargs readelf -n | more
> File: ./arch/x86/built_in.o
> 
> Displaying notes found at file offset 0x00000040 with length 0x00000240:
>   Owner                 Data size       Description
>   GNU                  0x00000014       NT_GNU_BUILD_ID (unique build
> ID bitstring)
>     Build ID: a114d1fdec2ace38448f141013f5a659122f2390
>   GNU                  0x00000014       NT_GNU_BUILD_ID (unique build
> ID bitstring)
>     Build ID: 4a913d3d1ece4d175fc0df0b36745b801f88bfab
>   GNU                  0x00000014       NT_GNU_BUILD_ID (unique build
> ID bitstring)
>     Build ID: ead89ba3aa9a8257cfc863966b7a9a725ecce133
>   GNU                  0x00000014       NT_GNU_BUILD_ID (unique build
> ID bitstring)
>     Build ID: 9b034a93573015c611d0900e949370d9f776bac1
>   GNU                  0x00000014       NT_GNU_BUILD_ID (unique build
> ID bitstring)
>     Build ID: 0e5fab6126ce69edd5720b96e2d5414618259c78
>   GNU                  0x00000014       NT_GNU_BUILD_ID (unique build
> ID bitstring)
>     Build ID: 49eca2138553b5e85ee45bb47c52aca394c31c31
>   GNU                  0x00000014       NT_GNU_BUILD_ID (unique build
> ID bitstring)
>     Build ID: f1cc2c8ae09fefe1440662efc44208a0b9ff8ddd
>   GNU                  0x00000014       NT_GNU_BUILD_ID (unique build
> ID bitstring)
>     Build ID: 29991f03f7a1aeeb59c8f83c0e7a349384a7262c
>   GNU                  0x00000014       NT_GNU_BUILD_ID (unique build
> ID bitstring)
>     Build ID: 3e2c4df9f60fdbd970bd1a35d03c7b68fd794385
>   GNU                  0x00000014       NT_GNU_BUILD_ID (unique build
> ID bitstring)
>     Build ID: 2c4f5cd9bcf553a022dace08b7741d85a4eb657f
>   GNU                  0x00000014       NT_GNU_BUILD_ID (unique build
> ID bitstring)
>     Build ID: 41c502289e5b28722ab5df6ae5bd7b99fb90c09e
>   GNU                  0x00000014       NT_GNU_BUILD_ID (unique build
> ID bitstring)
>     Build ID: f268afebdf211de6bb6d12e513520bba969130cc
>   GNU                  0x00000014       NT_GNU_BUILD_ID (unique build
> ID bitstring)
>     Build ID: b73b7296f6165d3dcacee36691d92ab1996d9908
>   GNU                  0x00000014       NT_GNU_BUILD_ID (unique build
> ID bitstring)
>     Build ID: ff8e080d8e01966cf8d893ce6cd258dd0d1c6124
>   GNU                  0x00000014       NT_GNU_BUILD_ID (unique build
> ID bitstring)
>     Build ID: dcc8964716f74bb710911d80faaae016820f72d9
>   GNU                  0x00000014       NT_GNU_BUILD_ID (unique build
> ID bitstring)
>     Build ID: 649f4bb66df2fead426edda62d0c90ab088c5fd4
> 
> 
> And during build:
> ld: warning: Cannot create .note.gnu.build-id section, --build-id ignored.
> ld: warning: Cannot create .note.gnu.build-id section, --build-id ignored.
> ld: warning: Cannot create .note.gnu.build-id section, --build-id ignored.
> 
> With:
> [konrad@char xen]$ readelf -n xen-syms  | grep Build | wc
>      38     114    2090
> 
> I think we should skip on the LDFLAGS idea.

Isn't that merely a result of LDFLAGS being used for both the
linking of the various built_in.o and the final binaries? A fully
shared set of flags for these two pretty distinct operations
doesn't seem very sensible anyway. In fact I wonder how
much of LDFLAGS is actually relevant when passing -r to ld.

Jan

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.