Possible bug; code-block vanishes when adding one assembler-instruction.

Jens Bauer jens-lists@gpio.dk
Thu May 9 09:38:00 GMT 2013


Hi Richard.

On Thu, 09 May 2013 10:16:23 +0100, Richard Sandiford wrote:
>> ...I'd like to use the -d option if I could add a single section;
>> eg. ".fastcode", but I haven't found out how to do this, if that's
>> possible.
> 
> --section=<section> (aka -j <section>) limits it to a particular section

I've tried this. Yes, it's usable in this case, in my default setup, however, I'd like to "add" sections.
That means it removes .text, .data and .bss (and perhaps other default sections?)


>> As I understand it, -d disassembles all the executable sections, but I
>> can't seem to find out how to mark a section 'executable' either.
> 
> Using:
> 
> 	.section .fastcode, "ax", @progbits
> 
> rather than:
> 
> 	.section .fastcode
> 
> ought to do the trick.

Excellent; I'll start using this! :)


>>>> This is the objcopy part of my Makefile:
>>>> $(PROJECT).hex: $(PROJECT).elf
>>>> 	$(OBJCOPY) -R .stack -O ihex $(PROJECT).elf $(PROJECT).hex
>>> -R .stack from here?  (I realise that might not give a viable executable.
>>> It'd just be interesting to know whether the same weirdness was visible.)
>> 
>> I just tried it; there seem to be no difference in the .fastcode section.
> 
> Oh well, thanks for trying.

:) If there's a chance it can help, I'll try it out.

> Normally you'd have a fake "section" like:
> 
>   /DISCARD/ : { *(.stack) }
> 
> I don't know whether there is something special about .stack on ARM
> that stops that from working though.

Does this differ from removing the section from the linker script completely ?

>> <http://scratch.gpio.dk/Fcode-Test.zip>
> 
> I'm afraid I don't have a full EABI toolchain to hand.  Could you upload
> the .elf and .hex files?  That ought to be enough to see what objcopy
> is doing.

Definitely, here they are:

<http://scratch.gpio.dk/Fcode-test-results.zip>

-I've also included the .map, the .dis and the .bin files, just in case they can provide additional information.
I just made a .diff on the .dis files; it seems that the label of the interrupt routine differs.
In one file, it's named _edata, in the other, it's named _sfastcode.
-So after all, there might be a difference in the .elf file too...

Fastcode-test1.dis:
Disassembly of section .fastcode:

10000000 <_edata>:
10000000:	6001      	str	r1, [r0, #0]
10000002:	f241 2034 	movw	r0, #4660	; 0x1234
10000006:	f2c5 6078 	movt	r0, #22136	; 0x5678
1000000a:	4770      	bx	lr

Fastcode-test2.dis:
Disassembly of section .fastcode:

10000000 <_sfastcode>:
10000000:	f241 2034 	movw	r0, #4660	; 0x1234
10000004:	f2c5 6078 	movt	r0, #22136	; 0x5678
10000008:	4770      	bx	lr
	...

...It may just be a side-effect, though.


Love
Jens



More information about the Binutils mailing list