This is the mail archive of the binutils@sourceware.org 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]

ARM/Thumb padding by gas


Hello,
If I assemble the attached ARM/Thumb code using arm-none-eabi-as, and look at the object file with objdump, I can see:
Disassembly of section .text:


00000000 <app_func2>:
   0:   e12fff1e        bx      lr
   4:   46c046c0        strbmi  r4, [r0], r0, asr #13
   8:   46c046c0        strbmi  r4, [r0], r0, asr #13
   c:   46c046c0        strbmi  r4, [r0], r0, asr #13

Disassembly of section .far_thumb:
00000000 <lab1>:
   0:   e12fff1e        bx      lr
00000004 <lab2>:
   4:   4770            bx      lr
00000006 <lab3>:
   6:   4770            bx      lr

I don't understand why app_func2 is padded with Thumb NOPs while it is written in ARM mode. If I remove the .thumb_func directive (after lab2), then the padding is encoded in ARM.

I tried to understand where gas does this padding, but I couldn't find it.

Can someone give me some hints?

Thanks
Christophe.
	.arm
	.p2align 4
	.globl app_func2
	.type app_func2,%function
app_func2:
	bx	lr

	@ We will place the section .far_thumb at 0x2200000.
	.section .far_thumb, "xa"
lab1:
	bx lr
lab2:
	.thumb_func
	bx lr
lab3:
	bx	lr

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