From patchwork Sun Jun 16 19:20:26 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: 2730591 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 474A8C0AB1 for ; Mon, 17 Jun 2013 06:26:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6313C2015C for ; Mon, 17 Jun 2013 06:26:48 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 77096200DF for ; Mon, 17 Jun 2013 06:26:47 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6C79AE5EA0 for ; Sun, 16 Jun 2013 23:26:47 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ve0-f171.google.com (mail-ve0-f171.google.com [209.85.128.171]) by gabe.freedesktop.org (Postfix) with ESMTP id C4F4EE5F1F for ; Sun, 16 Jun 2013 12:20:27 -0700 (PDT) Received: by mail-ve0-f171.google.com with SMTP id b10so1609748vea.30 for ; Sun, 16 Jun 2013 12:20:27 -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=ibU6p3GSZKGLwOE6JbzQCMkngmDVJ09FwE7mde0ymN0=; b=D1DbvB0zyEXUQXGln4pvaGovsxTf1WXA6nWVjxUSa12hOpblG+eH/t6kHnzJFP1jEh A3bnsETp+6IOugWtwC1iKbK6WbszfwTRsVAuedSyKUJUhJYfjYTdUmPEXE93c1O4OxwX vpZ7wrI8dVMBDkA8uayTOn0AS6nSfV/Kdks//YhqfPTI5cbUIm4hb7uJWOgAasl5pWfx UZfBFoNu1lAnP/8ptJqiOwNnYncm8yr9Z6h6cR+GIVeM+JKzHk7TFqJuUg+YfX/zbbti z14ajrqVTaIjr5/YxUbvqOPtyEJVH6UfjpxZGNfeTD2pBcrB+VHI11ae2WKcUgUKwRxo KtaA== MIME-Version: 1.0 X-Received: by 10.52.35.19 with SMTP id d19mr2822299vdj.63.1371410427141; Sun, 16 Jun 2013 12:20:27 -0700 (PDT) Received: by 10.221.41.67 with HTTP; Sun, 16 Jun 2013 12:20:26 -0700 (PDT) Date: Sun, 16 Jun 2013 12:20:26 -0700 Message-ID: Subject: [patch] libdrm_intel: intel: get rid of the .data section From: Arjan van de Ven To: dri-devel@lists.freedesktop.org X-Mailman-Approved-At: Sun, 16 Jun 2013 22:35:15 -0700 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]))