public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Andreas Krebbel <krebbel@linux.ibm.com>
To: Nick Clifton <nickc@redhat.com>, binutils@sourceware.org
Cc: amodra@gmail.com
Subject: Re: [PATCH] ld - Add SYMBOL_ABI_ALIGNMENT variable and apply to __bss_start
Date: Wed, 28 Jun 2023 08:23:52 +0200	[thread overview]
Message-ID: <a19f964b-baa2-8e95-67ed-1c4db2484464@linux.ibm.com> (raw)
In-Reply-To: <312682e3-fc76-cac1-6d19-fb54c9ce0cf6@redhat.com>

On 6/27/23 16:14, Nick Clifton wrote:
> Hi Andreas,
> 
>> Currently not specific alignment is applied to the __bss_start
>> symbol. However, on s390x we require every symbol to be on an even
>> address.  The patch introduces a new variable for the elf.sc template
>> which allows to specify such an symbol alignment requirement.
> 
> This patch looks good, but I see one issue - there are lot more symbols
> provided by the elf.sc template than just __bss_start.  So if an ABI
> requires symbols to be aligned, then that should apply to all symbols,
> right ?

I think most of the other symbols are implicitly aligned because of other effects. The same way it
used to be for __bss_start actually. GCC for Z pads the .data section size to a multiple of 8 but
LLVM doesn't. But you are right. In order to make it more robust we should apply it to the other
symbols as well. I'll have a look.

> Actually there is one other thing.  Rather than doing:
> 
>     ${RELOCATING+. = ALIGN(${SYMBOL_ABI_ALIGNMENT});}
>     ${RELOCATING+${CREATE_SHLIB+PROVIDE (}${USER_LABEL_PREFIX}__bss_start = .${CREATE_SHLIB+)};}
> 
> Wouldn't it make more sense to do:
> 
>     ${RELOCATING+${CREATE_SHLIB+PROVIDE (}${USER_LABEL_PREFIX}__bss_start = ALIGN (.${CREATE_SHLIB+), ${SYMBOL_ABI_ALIGNMENT});}

Yes, that's better.

> Ie making it clear that the alignment is being applied to the symbol.
> 
> It might even be possible to create a macro to do all of this
> USER_LABEL_PREFIX and ALIGN munging, so that it does not have
> to be repeated countless times in the elf.sc file.  I have not
> actually checked to see if this is possible, but it would be
> nice if it could be done.

Agreed. I'm not that familiar with what is possible in these files but I'll try to come up with
something.

Thanks for having a look!

Bye,

Andreas

> 
> Cheers
>    Nick
> 


  reply	other threads:[~2023-06-28  6:23 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-26  9:16 Andreas Krebbel
2023-06-27 14:14 ` Nick Clifton
2023-06-28  6:23   ` Andreas Krebbel [this message]
2023-07-04 12:18   ` [PATCH] Align linkerscript symbols according to ABI Andreas Krebbel
2023-07-05  9:44     ` Nick Clifton
2023-07-05  9:53       ` Andreas Krebbel
2023-07-07  3:03         ` Alan Modra
2023-07-07  9:38           ` Andreas Krebbel
2023-07-12  1:36             ` Alan Modra

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=a19f964b-baa2-8e95-67ed-1c4db2484464@linux.ibm.com \
    --to=krebbel@linux.ibm.com \
    --cc=amodra@gmail.com \
    --cc=binutils@sourceware.org \
    --cc=nickc@redhat.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).