How to generate debug symbols for custom linker file

OP (Company: Universiti Sains Malaysia) #1916039
Hi,

I'm trying to use a JLink JTAG to develop assembly code for a LEGO 
Mindstorms NXT (Atmel AT91SAM7S256). However, the code base uses a 
custom linker configuration file (attached).

I have two development platforms, Mac OS X and Windows based (Yagarto 
Toolchain + Eclipse + JLink GDB Server)


The problem is that after the code is built and linked, 
arm-none-eabi-gdb will always complain (example taken from Mac OS X 
version, but similar results were obtained in Windows):
1
iMac-TCWan:tests tcmac$ arm-none-eabi-gdb tests_rxe.elf
2
GNU gdb (GDB) 7.1
3
Copyright (C) 2010 Free Software Foundation, Inc.
4
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
5
This is free software: you are free to change and redistribute it.
6
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
7
and "show warranty" for details.
8
This GDB was configured as "--host=x86_64-apple-darwin10.4.0 --target=arm-none-eabi".
9
For bug reporting instructions, please see:
10
<http://www.gnu.org/software/gdb/bugs/>...
11
Reading symbols from /Users/tcmac/gitrepo/nxos-aholler/nxos/systems/tests/tests_rxe.elf...(no debugging symbols found)...done.

I verfied that if I objdump the tests_rxe.elf file, there is a symbol 
table.

Linking with the default linker (i.e., without -T option) generates 
debugging symbols recognized by gdb.
1
iMac-TCWan:tests tcmac$ arm-none-eabi-gdb tests_rxe.eabi
2
GNU gdb (GDB) 7.1
3
Copyright (C) 2010 Free Software Foundation, Inc.
4
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
5
This is free software: you are free to change and redistribute it.
6
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
7
and "show warranty" for details.
8
This GDB was configured as "--host=x86_64-apple-darwin10.4.0 --target=arm-none-eabi".
9
For bug reporting instructions, please see:
10
<http://www.gnu.org/software/gdb/bugs/>...
11
Reading symbols from /Users/tcmac/gitrepo/nxos-aholler/nxos/systems/tests/tests_rxe.eabi...done.

arm-none-eabi-objdump -rD of the custom-linker generated executable is 
as follows:
1
iMac-TCWan:tests tcmac$ fgrep Disassembly tests_rxe.elf.objdump 
2
Disassembly of section .rxe_header:
3
Disassembly of section .vectors:
4
Disassembly of section .rxe_init:
5
Disassembly of section .data:
6
Disassembly of section .text:
7
Disassembly of section .bss:
8
Disassembly of section .stack:

arm-none-eabi-objdump -rD of the default linker generated executable is 
as follows:
1
iMac-TCWan:tests tcmac$ fgrep Disassembly tests_rxe.eabi.objdump 
2
Disassembly of section .comment:
3
Disassembly of section .debug_aranges:
4
Disassembly of section .debug_pubnames:
5
Disassembly of section .debug_info:
6
Disassembly of section .debug_abbrev:
7
Disassembly of section .debug_line:
8
Disassembly of section .debug_frame:
9
Disassembly of section .debug_str:
10
Disassembly of section .debug_loc:
11
Disassembly of section .debug_pubtypes:
12
Disassembly of section .debug_ranges:
13
Disassembly of section .ARM.attributes:

There are no .data, .text, .bss, or .stack sections in this version.

How can I generate the debugging symbols when using a custom linker 
configuration file?
Attached files:
Guest #1916814
1
  /* Discard anything not mapped at this point. */
2
  /DISCARD/ : {
3
    * (*);
4
  }

This part of the linker script discards all sections not referenced in 
the script up to that point and that includes all the debug sections.

I don't know how the code uploader works in your case but it should be 
able to recognize that these sections (and others) do not need to be 
uploaded and ignore them. Try simply removing the lines I quoted.
OP (Company: Universiti Sains Malaysia) #1919184
Hi Andreas,

You are right. When I removed the "/DISCARD/" directive section, it 
generated the debug symbols. Thank you for the solution.

Reply

A question of your own? This thread is over 16 years old. Ask it in a thread of its own – more people read along there, and it gets answered more often and sooner.

Start a new thread

A fix, an addition or feedback on this thread? Then reply here.

Formatting
  • [c]C-Code[/c]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.