public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Bob Plantz <rgplantz@outlook.com>
To: "gcc-help@gcc.gnu.org" <gcc-help@gcc.gnu.org>
Subject: Arm AARCH64 string alignment in .rodata
Date: Sat, 24 Sep 2022 18:24:41 +0000	[thread overview]
Message-ID: <SN6PR04MB46723B9470BF2D38119A70BFD4509@SN6PR04MB4672.namprd04.prod.outlook.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 697 bytes --]

On 64-bit Raspberry Pi OS, gcc aligns strings in the .rodata section on 64-bit boundaries:

       .text
        .section        .rodata
        .align  3
.LC0:
        .string "Enter a number: "
        .align  3
.LC1:
        .string "%i"
        .align  3
.LC2:
        .string "Result: %i\n"
        .text
        .align  2
        .global main
        .type   main, %function
main:

I understand the 32-bit boundary for the .text (32-bit instructions), but the element in a string is a byte. Arm documentation says that array addresses should be aligned at the element size. Why align the first character at a 64-bit boundary? Does this have to do with cache alignment?


             reply	other threads:[~2022-09-24 18:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-24 18:24 Bob Plantz [this message]
2022-09-24 18:55 ` Xi Ruoyao

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=SN6PR04MB46723B9470BF2D38119A70BFD4509@SN6PR04MB4672.namprd04.prod.outlook.com \
    --to=rgplantz@outlook.com \
    --cc=gcc-help@gcc.gnu.org \
    /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).