bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug gas/12931] New: ARM: gas fails to set the proper alignment on code


From: dave.martin at linaro dot org
Subject: [Bug gas/12931] New: ARM: gas fails to set the proper alignment on code sections, causing broken output
Date: Fri, 24 Jun 2011 19:30:09 +0000

http://sourceware.org/bugzilla/show_bug.cgi?id=12931

           Summary: ARM: gas fails to set the proper alignment on code
                    sections, causing broken output
           Product: binutils
           Version: 2.22 (HEAD)
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gas
        AssignedTo: address@hidden
        ReportedBy: address@hidden


Whenever an instruction is assembled, gas should increase the alignment of the
output section.

Currently the output section alignment is often left untouched, which may
result in invalid alignment when sections are merged at link-time.

This appears to be responsible for a faulty WebM codec behaviour when firefox-5
is built in Thumb, as a result of ARM code being linked into .text alongside
Thumb code.  The ARM instructions are placed at halfword alignment and so can't
be executed correctly.

I don't know if this is a recent regression or an older bug.

It appears present in trunk as of 2011-06-24.
The bug is also present in linaro binutils 2.21.0.20110327-2ubuntu2cross1.62


In both of the cases below, the .text section alignment should not be 2**0. 
The alignment should probably be set to 2**2 (though it could in principle be
2**1 for some Thumb code, some Thumb instructions are alignment-sensitive
modulo 1 word; the 16-bit PC-relative add and ldr instructions have this
restriction).

$ cat <<EOF >tst-align.s
.type f, %function
.globl f
f:      nop
EOF

$ arm-linux-gnueabi-as -o tst-align.o tst-align.s
$ arm-linux-gnueabi-objdump -hd tst-align.o

tst-align.o:     file format elf32-littlearm

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .text         00000004  00000000  00000000  00000034  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  1 .data         00000000  00000000  00000000  00000038  2**0
                  CONTENTS, ALLOC, LOAD, DATA
  2 .bss          00000000  00000000  00000000  00000038  2**0
                  ALLOC
  3 .ARM.attributes 00000016  00000000  00000000  00000038  2**0
                  CONTENTS, READONLY

Disassembly of section .text:

00000000 <f>:
   0:   e1a00000        nop                     ; (mov r0, r0)
$ arm-linux-gnueabi-as mthumb  
$ arm-linux-gnueabi-objdump -hd tst-align.o

tst-align.o:     file format elf32-littlearm

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .text         00000002  00000000  00000000  00000034  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  1 .data         00000000  00000000  00000000  00000036  2**0
                  CONTENTS, ALLOC, LOAD, DATA
  2 .bss          00000000  00000000  00000000  00000036  2**0
                  ALLOC
  3 .ARM.attributes 00000016  00000000  00000000  00000036  2**0
                  CONTENTS, READONLY

Disassembly of section .text:

00000000 <f>:
   0:   46c0            nop                     ; (mov r8, r8)

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]