public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [gold] alignment of static globals
@ 2016-05-24 22:29 Christopher Jelesnianski
  2016-05-25  0:35 ` Alan Modra
  0 siblings, 1 reply; 3+ messages in thread
From: Christopher Jelesnianski @ 2016-05-24 22:29 UTC (permalink / raw)
  To: Binutils

To Whom it May Concern,

I am attempting to align symbols for .text, .rodata, .data, and .bss
through the means of creating my own linker script and passing it to
gold using -T. Symbols are aligned generally as:

. = ALIGN(0x10);
*(.text.cffts1);
. = ALIGN(0x10);
*(.text.main);

for each of their respective sections.

So far most of my symbols have been aligned as desired. However, it
seems static uninitialized global variables are a corner case and do
not follow what is specified in the linker script. It also seems some
have different sizes (and classes? b vs. B) when comparing the NM of
static and non-static.

non-static NM for sample symbols
0000000000424000 0000000000000004 B fftblock
0000000000424004 0000000000000004 B fftblockpad

static NM for sample symbols
0000000050729b35 0000000000000001 b fftblock
0000000050729b38 0000000000000004 b fftblockpad

How can I enforce static uninitialized global variables to follow my
linker script (without just removing the static keyword)?? Can such
constraints be defined in the linker command language, or will I have
to modify the gold linker itself?? Note that the variable is
initialized and used extensively in the program, so it is not being
optimized out.

I have looked at specifying various "__attribute__"'s to the variables
but adding ((used)) or specifying a section did not resolve the
problem.

Many Thanks,

Krzysztof Jelesnianski

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [gold] alignment of static globals
  2016-05-24 22:29 [gold] alignment of static globals Christopher Jelesnianski
@ 2016-05-25  0:35 ` Alan Modra
  2016-05-25 15:20   ` Christopher Jelesnianski
  0 siblings, 1 reply; 3+ messages in thread
From: Alan Modra @ 2016-05-25  0:35 UTC (permalink / raw)
  To: Christopher Jelesnianski; +Cc: Binutils

On Tue, May 24, 2016 at 06:28:55PM -0400, Christopher Jelesnianski wrote:
> How can I enforce static uninitialized global variables to follow my
> linker script (without just removing the static keyword)?? Can such

Compile with -fno-common.

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [gold] alignment of static globals
  2016-05-25  0:35 ` Alan Modra
@ 2016-05-25 15:20   ` Christopher Jelesnianski
  0 siblings, 0 replies; 3+ messages in thread
From: Christopher Jelesnianski @ 2016-05-25 15:20 UTC (permalink / raw)
  To: Alan Modra; +Cc: Binutils

I guess I should add I am using the following as my CFLAGS:

CFLAGS     := -O3 -Wall -g -gdwarf-aranges -c -DPOSIX -fopenmp=libomp
HET_CFLAGS := $(CFLAGS) -nostdinc -ffunction-sections -fdata-sections
-fno-common -ftls-model=initial-exec


I am already using -fno-common. It doesn't seem to apply to
uninitialized static globals that are in the .bss section for some
reason

On Tue, May 24, 2016 at 8:35 PM, Alan Modra <amodra@gmail.com> wrote:
> On Tue, May 24, 2016 at 06:28:55PM -0400, Christopher Jelesnianski wrote:
>> How can I enforce static uninitialized global variables to follow my
>> linker script (without just removing the static keyword)?? Can such
>
> Compile with -fno-common.
>
> --
> Alan Modra
> Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-05-25 15:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-24 22:29 [gold] alignment of static globals Christopher Jelesnianski
2016-05-25  0:35 ` Alan Modra
2016-05-25 15:20   ` Christopher Jelesnianski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).