This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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

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
   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}

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]