[libdrm] intel: get rid of the .data section

Arjan van de Ven arjanvandeven at gmail.com
Sun Jun 16 17:02:11 PDT 2013


>From 8e61934c3918484bae10d9ff771c93ad1fa73e29 Mon Sep 17 00:00:00 2001
From: Arjan van de Ven <arjanvandeven at gmail.com>
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 at linux.intel.com>
---
 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-intel-get-rid-of-the-.data-section.patch
Type: application/octet-stream
Size: 2425 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/dri-devel/attachments/20130616/e5aa9a3e/attachment.obj>


More information about the dri-devel mailing list