public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Arm AARCH64 string alignment in .rodata
@ 2022-09-24 18:24 Bob Plantz
  2022-09-24 18:55 ` Xi Ruoyao
  0 siblings, 1 reply; 2+ messages in thread
From: Bob Plantz @ 2022-09-24 18:24 UTC (permalink / raw)
  To: gcc-help

[-- 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?


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

end of thread, other threads:[~2022-09-24 18:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-24 18:24 Arm AARCH64 string alignment in .rodata Bob Plantz
2022-09-24 18:55 ` Xi Ruoyao

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