From patchwork Mon Jun 17 00:02:11 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arjan van de Ven X-Patchwork-Id: 2729941 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 3B4A0C0AB1 for ; Mon, 17 Jun 2013 00:02:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 59948201CB for ; Mon, 17 Jun 2013 00:02:52 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 3702B201C2 for ; Mon, 17 Jun 2013 00:02:51 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2FBAFE5F52 for ; Sun, 16 Jun 2013 17:02:51 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ve0-f170.google.com (mail-ve0-f170.google.com [209.85.128.170]) by gabe.freedesktop.org (Postfix) with ESMTP id 18271E5F75 for ; Sun, 16 Jun 2013 17:02:12 -0700 (PDT) Received: by mail-ve0-f170.google.com with SMTP id 14so1662781vea.15 for ; Sun, 16 Jun 2013 17:02:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=DCVrXr8W/F4+vwBznbtpFwg/ckXy+Xjx+KEkJ9JKlG8=; b=pKVFQ/1ZUhsYppszr/j7fU9X/B2N02FByxkFe8Nviqst+iG+SP+PzGcahfiLiR6g8v utGu4GcVM/Kx//k2rdjXmrm7MbfrvMqBrh+ym+XfnkahCYz9oGhm81UWxaa5BFu5Zryj 6HwX61alpIlAVwdhKBgtUqy5XiF0E3hNlJElFuARFxCZoVC8w5Sc5b4iOGUN7ZVrg+Os uBZ/1RNiuw5foE75dsnNtrwHejPWZgXd+CIR3nUeBEdYv6h/DI/yfqYGC1scLkPhhnbp eGtUXwV/NxX3/xQgmI55AJfvCozn810qdloA5wBjU3Nc7KF2Tmb+HQLRMizTM4lzQff4 dV/g== MIME-Version: 1.0 X-Received: by 10.58.24.201 with SMTP id w9mr2759064vef.82.1371427331468; Sun, 16 Jun 2013 17:02:11 -0700 (PDT) Received: by 10.221.41.67 with HTTP; Sun, 16 Jun 2013 17:02:11 -0700 (PDT) Date: Sun, 16 Jun 2013 17:02:11 -0700 Message-ID: Subject: [libdrm] intel: get rid of the .data section From: Arjan van de Ven To: dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org X-Spam-Status: No, score=-5.2 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From 8e61934c3918484bae10d9ff771c93ad1fa73e29 Mon Sep 17 00:00:00 2001 From: Arjan van de Ven 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 --- intel/intel_decode.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 1.7.11.7 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]))