Nonsense line numbers with --gc-sections
When I link with -Wl,--gc-sections, some of the line numbers (as reported by arm-none-
00000150 <mpu_init>:
mpu_init():
C:\Downloads\
150: b580 push {r7, lr}
152: af00 add r7, sp, #0
154: 2300 movs r3, #0
156: 1c18 adds r0, r3, #0
158: 46bd mov sp, r7
15a: bd80 pop {r7, pc}
0000015c <main>:
main():
C:\Downloads\
15c: b580 push {r7, lr}
15e: af00 add r7, sp, #0
160: f7ff fff6 bl 150 <mpu_init>
C:\Downloads\
164: e7fe b.n 164 <main+0x8>
unused_function():
166: 46c0 nop ; (mov r8, r8)
In the actual source code, mpu_init is actually at 18-21 and main is at 63-70 (there is an unused function at 23-61).
A simplified version of the project:
https:/
The linker script is a slightly modified version of the default linker script (it does not currently place the data at 0x20000000 as required by the target hardware but that should not be required for reproducing this issue). The line numbers are correct when linking without the --gc-sections option.
Question information
- Language:
- English Edit question
- Status:
- Answered
- Assignee:
- No assignee Edit question
- Last query:
- Last reply:
Can you help with this problem?
Provide an answer of your own, or ask Neil for more information if necessary.