Empty ARM/THUMB interworking stubs

Momchil Velikov velco@fadata.bg
Mon Apr 15 01:03:00 GMT 2002


Hi there,

The link editor can output empty (zero) ARM/THUMB interworking stubs. See the attached archive for the test case.  Running ``arm-elf-objdump -S x'' produces

x:     file format elf32-littlearm

Disassembly of section .text:

00008000 <__foo_from_thumb>:
    8000:	0000      	lsl	r0, r0, #0
	...

00008004 <__foo_change_to_arm>:
    8004:	00000000 	andeq	r0, r0, r0

00008008 <__foo1_from_thumb>:
    8008:	4778      	bx	pc
    800a:	46c0      	nop			(mov r8, r8)

etc...

The problem is that the glue sections are output by
``elf_link_input_bfd'' before the .text sections relocation has
written the interworking stubs.

My "solution" so far is to delay the output of the sections having
SEC_IN_MEMORY flags set until all the other sections are relocated and
output. The idea is that SEC_IN_MEMORY sections generally depend upon
the other ones, thus it makes sense to delay writing them until all
the other section's processing has finished.

Patch against elfink.h attached. 

Comments ?

Regards,
-velco

P.S. And there's another thing, relocations are not generated for glue
sections, which is OK, unless the linker is to output relocateable
executables file (--emit-relocs). I'd appreciate guidance how to fix
this (or the fix itself :).

-------------- next part --------------
A non-text attachment was scrubbed...
Name: zero-stub.tar.gz
Type: application/octet-stream
Size: 2583 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20020415/b84f6122/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/x-patch
Size: 4409 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20020415/b84f6122/attachment.bin>


More information about the Binutils mailing list