From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13264 invoked by alias); 26 Nov 2009 02:24:58 -0000 Received: (qmail 13255 invoked by uid 22791); 26 Nov 2009 02:24:57 -0000 X-SWARE-Spam-Status: No, hits=-0.5 required=5.0 tests=AWL,BAYES_00,HK_OBFDOM,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail-pw0-f57.google.com (HELO mail-pw0-f57.google.com) (209.85.160.57) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 26 Nov 2009 02:24:44 +0000 Received: by pwi2 with SMTP id 2so221627pwi.16 for ; Wed, 25 Nov 2009 18:24:42 -0800 (PST) MIME-Version: 1.0 Received: by 10.143.154.14 with SMTP id g14mr886421wfo.266.1259202282915; Wed, 25 Nov 2009 18:24:42 -0800 (PST) In-Reply-To: <4df04b840911231758md5a545el2d417b663af1647f@mail.gmail.com> References: <4df04b840911231758md5a545el2d417b663af1647f@mail.gmail.com> Date: Thu, 26 Nov 2009 02:24:00 -0000 Message-ID: <4df04b840911251824j71fa1d33i2cecc9481617dda5@mail.gmail.com> Subject: Re: No .got section in ELF From: yunfeng zhang To: gcc@gcc.gnu.org Cc: Richard Henderson , Andrew Haley Content-Type: text/plain; charset=ISO-8859-1 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org X-SW-Source: 2009-11/txt/msg00738.txt.bz2 It seems that original limitation isn't clear or sufficient For a sample: // f.c int g; void foo(void) { g = 1; } compile with `gcc -shared -fPIC -Wl,-soname,f.so,-Map,f.map -o f.so f.c', according to f.map, offsetof(g - foo) in library is 0x1550 - 0x3cc = 0x1184, however let's load the library to memory, offsetof(g - foo) in memory is 0x2c2550 - 0x2c13cc = 0x1184. That's the key of my idea! Target OS need support --segment-model=elf-layout. In fact, Linux only simply maps the library to memory, using segment model *defined* in ELF! So as the previous mail, offsetof(C - A) is const!