This is the mail archive of the
mailing list for the binutils project.
PowerPC 32 : GOT access not optimized for DSO-scope static variable ?
- From: "yon ar c'hall" <yon dot ar dot chall at gmail dot com>
- To: "binutils at sourceware dot org" <binutils at sourceware dot org>
- Date: Fri, 14 Jun 2013 16:37:27 +0200
- Subject: PowerPC 32 : GOT access not optimized for DSO-scope static variable ?
In the paper "How to write shared libraries" of U.Drepper, it is
explained that declaring a global variable as static (scope supposed
to be limited to the DSO) is better for run-time performance : one
assembly instruction less is used for accessing the variable. However,
it's worth noting this is for x86, as shown below :
global variable :
movl globalvar@GOT(%ebx), %edx
movl (%edx), %eax
static DSO scope variable :
movl staticvar@GOTOFF(%ebx), %eax
When compiling for PowerPC e500mc/e500v2 with gcc 4.6 (options -fPIC,
no optimization specified) and binutils 2.2, the assembly code is the
same whether the variable is static or not :
with LCTOC1, LC0 and GOT stuff like this :
.LCTOC1 = .+32768
So is there any possible optimization regarding static DSO scope
variables access (and variables with visibility=hidden as well) for