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

Re: [Xen-devel] [PATCH v3] tools: detect appropriate debug optimization level



On 4/28/16 12:40 PM, Wei Liu wrote:
> On Tue, Apr 26, 2016 at 09:38:45AM -0500, Doug Goldstein wrote:
>> When building debug use -Og as the optimization level if its available,
>> otherwise retain the use of -O0. -Og has been added by GCC to enable all
>> optimizations that to not affect debugging while retaining full
>> debugability.
>>
>> Signed-off-by: Doug Goldstein <cardoe@xxxxxxxxxx>
>> ---
>> change since v2:
>> - switch back to cc-option-add to not call cc-option on every invocation
>> change since v1:
>> - switch to cc-option to only specify -O0 if -Og isn't supported
>> ---
>>  tools/Rules.mk | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/tools/Rules.mk b/tools/Rules.mk
>> index 9ef0b47..1b79a6e 100644
>> --- a/tools/Rules.mk
>> +++ b/tools/Rules.mk
>> @@ -138,6 +138,7 @@ SHLIB_libxenvchan  = $(SHDEPS_libxenvchan) 
>> -Wl,-rpath-link=$(XEN_LIBVCHAN)
>>  ifeq ($(debug),y)
>>  # Disable optimizations and enable debugging information for macros
>>  CFLAGS += -O0 -g3
>> +$(call cc-option-add,CFLAGS,CC,-Og)
>>  # But allow an override to -O0 in case Python enforces 
>> -D_FORTIFY_SOURCE=<n>.
>>  PY_CFLAGS += $(PY_NOOPT_CFLAGS)
>>  endif
>> -- 
>> 2.7.3
> 
> Heh, this patch seems to has a (good) side effect. I will look into
> fixing that tomorrow.
> 
> make[10]: Entering directory 
> '/local/work/COMMITTER/xen.git/tools/firmware/rombios/32bit/tcgbios'
> gcc   -O1 -fno-omit-frame-pointer -m32 -march=i686 -g -fno-strict-aliasing 
> -std=gnu99 -Wall -Wstrict-prototypes -Wdeclaration-after-statement 
> -Wno-unused-but-set-variable -Wno-unused-local-typedefs   -O0 -g3 -Og 
> -D__XEN_INTERFACE_VERSION__=__XEN_LATEST_INTERFACE_VERSION__ -MMD -MF 
> .tcgbios.o.d -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE 
> -fno-optimize-sibling-calls -mno-tls-direct-seg-refs  -Werror 
> -fno-stack-protector -fno-exceptions -fno-builtin -msoft-float 
> -I/local/work/COMMITTER/xen.git/tools/firmware/rombios/32bit/tcgbios/../../../../../tools/include
>  -I.. -I../..  -c -o tcgbios.o tcgbios.c 
> gcc   -O1 -fno-omit-frame-pointer -m32 -march=i686 -g -fno-strict-aliasing 
> -std=gnu99 -Wall -Wstrict-prototypes -Wdeclaration-after-statement 
> -Wno-unused-but-set-variable -Wno-unused-local-typedefs   -O0 -g3 -Og 
> -D__XEN_INTERFACE_VERSION__=__XEN_LATEST_INTERFACE_VERSION__ -MMD -MF 
> .tpm_drivers.o.d -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE 
> -fno-optimize-sibling-calls -mno-tls-direct-seg-refs  -Werror 
> -fno-stack-protector -fno-exceptions -fno-builtin -msoft-float 
> -I/local/work/COMMITTER/xen.git/tools/firmware/rombios/32bit/tcgbios/../../../../../tools/include
>  -I.. -I../..  -c -o tpm_drivers.o tpm_drivers.c 
> tcgbios.c: In function ‘tcpa_extend_acpi_log’:
> tcgbios.c:362:3: error: ‘size’ may be used uninitialized in this function 
> [-Werror=maybe-uninitialized]
>    memcpy((char *)lasa_last, (char *)entry_ptr, size);
>    ^
> tcgbios.c: In function ‘HashLogEvent32’:
> tcgbios.c:1142:22: error: ‘entry’ may be used uninitialized in this function 
> [-Werror=maybe-uninitialized]
>     hleo->eventnumber = entry;
>                       ^
> tcgbios.c:1131:10: error: ‘logdataptr’ may be used uninitialized in this 
> function [-Werror=maybe-uninitialized]
>     entry = tcpa_extend_acpi_log(logdataptr);
>           ^

This appears to be fixed with 0b5e769ae3ac81f8a8dfaf476147ccdf41caeb68
but the patch referenced here never landed. The patch doesn't apply
cleanly anymore (due to context) but its a one-liner so maybe someone
can fix it up as its committed?

-- 
Doug Goldstein

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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