Bug 13214 - Gold does emit mapping symbols for stubs
Summary: Gold does emit mapping symbols for stubs
Status: NEW
Alias: None
Product: binutils
Classification: Unclassified
Component: gold (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Doug Kwan
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-21 15:04 UTC by Matthew Gretton-Dann
Modified: 2016-03-27 18:28 UTC (History)
2 users (show)

See Also:
Host:
Target: arm-none-eabi
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matthew Gretton-Dann 2011-09-21 15:04:14 UTC
Given the following testcase:

@tmp.s
	.syntax unified
	.thumb
	.section sect1, "ax"
	.globl _start
_start:
	bl bar

	.section sect2, "ax"
	.globl bar
	.arm
bar:
	bx lr
@end of tmp.s

Doing the following:

arm-none-eabi-as -march=armv5t tmp.s -o tmp.o
arm-none-eabi-ld.gold tmp.o -o tmp --section-start sect2=0x1000 \
    --section-start sect1=0x04000000
arm-none-eabi-objdump -d tmp

Produces the following output:

00001000 <_start>:
    1000:       f000 e800       blx     1004 <_start+0x4>
    1004:       f004 e51f                       ; <UNDEFINED> instruction: 0xf004e51f
    1008:       0000            movs    r0, r0
    100a:       0400            lsls    r0, r0, #16

The instruction at 0x1004 is actually an ARM instruction (and so should have a $a mapping symbol).  The 'instructions' at 0x1008 and 0x100a are actually a word of data, and so should have a $d mapping symbol.

Not emitting these mapping symbols is technically in contravention of the ABI, and makes disassembly harder to read, but in the majority of cases won't impact correct execution of images.
Comment 1 Matthew Gretton-Dann 2011-09-21 15:05:31 UTC
Typo in the command lines above:

arm-none-eabi-ld.gold tmp.o -o tmp --section-start sect1=0x1000 \
    --section-start sect2=0x04000000
Comment 2 Cary Coutant 2016-03-27 18:28:01 UTC
Was this fixed with the fix to PR 13321?