public inbox for gas2@sourceware.org
 help / color / mirror / Atom feed
From: hjl@nynexst.com (H.J. Lu)
To: mat@ardi.com (Mat Hostetter)
Cc: gcc2@cygnus.com, raeburn@cygnus.com (Ken Raeburn), gas2@cygnus.com
Subject: Re: ELF weirdness
Date: Mon, 27 Nov 1995 20:01:00 -0000	[thread overview]
Message-ID: <9511280344.AA02910@nynexst.com> (raw)
In-Reply-To: <m0tJDVE-000GOwC@gwar.ardi.com>

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



H.J.


           reply	other threads:[~1995-11-27 20:01 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <m0tJDVE-000GOwC@gwar.ardi.com>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9511280344.AA02910@nynexst.com \
    --to=hjl@nynexst.com \
    --cc=gas2@cygnus.com \
    --cc=gcc2@cygnus.com \
    --cc=mat@ardi.com \
    --cc=raeburn@cygnus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).