.ascii/.asciz does not tag its data as data as needed for be8

John Breitenbach breiten@lexmark.com
Mon Jul 6 15:24:00 GMT 2009


I just found that the arm assembler does not tag the output of .ascii 
and .asciz as data like .long/.word, .etc do.
This is a problem when building in be8 mode, where instructions get 
swapped but data must not.  I found that
preceding the .asciz with a .long does get us into "data mode" - we 
don't switch back to instruction mode with the .ascii.

This macro from the linux kernel shows the problem - the format string 
gets byte-swapped because its not marked
as data by the assembler.  readelf -a shows the absence of a $d symbol 
for the ascii data.

    DBGSTR    "bounce"

    .macro    DBGSTR, str
#if DEBUG
    stmfd    sp!, {r0-r3, ip, lr}
    add    r0, pc, #4
    bl    printk
    b    1f
    .asciz  "<7>VFP: \str\n"
    .balign 4
1:    ldmfd    sp!, {r0-r3, ip, lr}
#endif
    .endm

By adding a .long in front of the .asciz and adding 8 instead of 4 to 
the pc avoids the problem in this
situation, but there are a handful more throughout the kernel.

gas version is:
GNU assembler (CodeSourcery 2007q1-10. Marvell 2008q3-13 20081204) 2.17

John.



More information about the Binutils mailing list