public inbox for
 help / color / mirror / Atom feed
* Re: ELF weirdness
       [not found] <>
@ 1995-11-27 20:01 ` H.J. Lu
  0 siblings, 0 replies; only message in thread
From: H.J. Lu @ 1995-11-27 20:01 UTC (permalink / raw)
  To: Mat Hostetter; +Cc: gcc2, Ken Raeburn, gas2

> This is an ELF-specific question, so I thought I'd ask you before
> looking further.  I'm running gcc 2.7.0.  I have not yet installed
> 2.7.1.  Compiling this program with "gcc foo.c -o foo":
> int
> main (void)
> {
>   static int x __attribute__ ((aligned (16)));
>   return 0;
> }
> Results in this error:
> gwar:~$ gcc foo.c -o foo
> foo: Not enough room for program headers (allocated 5, need 6)
> /usr/i486-linux/bin/ld: final link failed: Bad value
> Compiling with "gcc -b i486-linuxaout foo.c -o foo" works fine.
> Does this happen to you?  Is this a known bug?  Thanks!

It looks like a gcc/gas bug. In c-common.c around line 515, there is

	align = TREE_INT_CST_LOW (align_expr) * BITS_PER_UNIT;

It seems to work ok with the a.out format. But the gcc for x86/ELF
outputs the .comm stuff differently depending on if the symbol is
local or not. If it is local, the alignment will be divided by
BITS_PER_UNIT. If the source code is changed to

static int x __attribute__ ((aligned (16))) = 0;

gcc will complain:

warning: alignment of `x' is greater than maximum object file alignment

But gas seems not in sync with gcc. I don't know who is correct. I think
gas may be correct. Gcc may be changed to

	align = TREE_INT_CST_LOW (align_expr)

and output local symbols with log2 (align) instead of divide it by
BITS_PER_UNIT. But I don't know if the changes will work on all


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1995-11-27 20:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <>
1995-11-27 20:01 ` ELF weirdness H.J. Lu

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).