>From 8e61934c3918484bae10d9ff771c93ad1fa73e29 Mon Sep 17 00:00:00 2001 From: Arjan van de Ven <arjanvandeven@xxxxxxxxx> Date: Sun, 16 Jun 2013 11:12:53 -0700 Subject: [PATCH 2/2] intel: get rid of the .data section head_offset and tail_offset are the only two global variables in the whole library that are not 0 initialized (and thus make up the .data section) However, the first thing that drm_intel_decode() does is give them a new value, and all uses of instr_out() that uses head_offset/etc should come from drm_intel_decode() in the first place... so the non-0 initialization is superfluous. on x86-64, the elf data from before and after: Before libdrm_intel.so.1.0.0: 32 relocations, 25 relative (78%), 56 PLT entries, 11 for local syms (19%) [11] .text PROGBITS 0000000000002860 00002860 00011db8 0 AX 0 0 16 [13] .rodata PROGBITS 0000000000014640 00014640 00005c63 0 A 0 0 32 [19] .data.rel.ro PROGBITS 000000000021d020 0001d020 00001a08 0 WA 0 0 32 [23] .data PROGBITS 000000000021ee48 0001ee48 00000008 0 WA 0 0 4 [24] .bss NOBITS 000000000021ee50 0001ee50 00000048 0 WA 0 0 8 After libdrm_intel.so.1.0.0: 32 relocations, 25 relative (78%), 56 PLT entries, 11 for local syms (19%) [11] .text PROGBITS 0000000000002860 00002860 00011db8 0 AX 0 0 16 [13] .rodata PROGBITS 0000000000014640 00014640 00005c63 0 A 0 0 32 [19] .data.rel.ro PROGBITS 000000000021d020 0001d020 00001a08 0 WA 0 0 32 [23] .bss NOBITS 000000000021ee48 0001ee48 00000050 0 WA 0 0 8 e.g. no more .data section Signed-off-by: Arjan van de Ven <arjan@xxxxxxxxxxxxxxx> --- intel/intel_decode.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/intel/intel_decode.c b/intel/intel_decode.c index fdbbe0c..3c0a1f5 100644 --- a/intel/intel_decode.c +++ b/intel/intel_decode.c @@ -80,8 +80,8 @@ struct drm_intel_decode { static FILE *out; static uint32_t saved_s2 = 0, saved_s4 = 0; static char saved_s2_set = 0, saved_s4_set = 0; -static uint32_t head_offset = 0xffffffff; /* undefined */ -static uint32_t tail_offset = 0xffffffff; /* undefined */ +static uint32_t head_offset; +static uint32_t tail_offset; #ifndef ARRAY_SIZE #define ARRAY_SIZE(A) (sizeof(A)/sizeof(A[0])) -- 1.7.11.7
Attachment:
0002-intel-get-rid-of-the-.data-section.patch
Description: Binary data
_______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/dri-devel