EmbDev.net

Forum: ARM programming with GCC/GNU tools GNU link "Discarded input sections"


Author: Dustin Sr (dbrazeau)
Posted on:

Rate this post
0 useful
not useful
I have a "Discarded input sections" in my map output from linking, and I
believe that there are some functions/variables that are getting put in
this section that I don't want to discarded? How do I keep the linker
from discarding these functions/variables?

Thanks

Author: Clifford Slocombe (clifford)
Posted on:

Rate this post
0 useful
not useful
Dustin Sr wrote:
> I have a "Discarded input sections" in my map output from linking, and I
> believe that there are some functions/variables that are getting put in
> this section that I don't want to discarded?

The linker will not create output sections which do not have any
contents. So it seems unlikely that the discarded sections contain
function or variables. It would fail to link if any referenced symbols
did not exist.

The standard sections are:

text - for executable code and read-only data
common/bss - for unitialised globals and statics (zeroed at runtime)
data - for initialised writeable data.

If you have variables of code in any other sections it will be because
you have explicitly placed them there with an attribute specification.
And if you did that, the section should presumably not be discarded.

As ever in these cases it is much better if you were to post the actual
output rather than merely describing it. A copy & paste would be easier
for you and more accurate and informative for us.

Clifford

Author: Dustin Sr (dbrazeau)
Posted on:

Rate this post
0 useful
not useful
Clifford Slocombe wrote:
> Dustin Sr wrote:
>> I have a "Discarded input sections" in my map output from linking, and I
>> believe that there are some functions/variables that are getting put in
>> this section that I don't want to discarded?
>
> The linker will not create output sections which do not have any
> contents. So it seems unlikely that the discarded sections contain
> function or variables. It would fail to link if any referenced symbols
> did not exist.
>
> The standard sections are:
>
> text - for executable code and read-only data
> common/bss - for unitialised globals and statics (zeroed at runtime)
> data - for initialised writeable data.
>
> If you have variables of code in any other sections it will be because
> you have explicitly placed them there with an attribute specification.
> And if you did that, the section should presumably not be discarded.
>
> As ever in these cases it is much better if you were to post the actual
> output rather than merely describing it. A copy & paste would be easier
> for you and more accurate and informative for us.
>
> Clifford
Here is a small section of the Discarded input sections.

Discarded input sections

 _ZN2RM7New_WQEEv
                0x00000000        0x0 CfgSer.o
 _ZN2RM4FreeEP7SCmdRec
                0x00000000        0x0 CfgSer.o
 _ZN2RM4FreeEP7BuffSeg
                0x00000000        0x0 CfgSer.o
 _ZN2RM4FreeEP3WQE
                0x00000000        0x0 CfgSer.o
 .text          0x00000000        0x0 CfgSer.o
 .data          0x00000000        0x0 CfgSer.o
 .bss           0x00000000        0x0 CfgSer.o
 .rodata.str1.8
                0x00000000        0x0 CfgSer.o
 .text._ZN6CfgSer9SerRecLUNEv
                0x00000000        0x0 CfgSer.o
 .text._ZN6CfgSer12SerSixDrivesEv
                0x00000000        0x0 CfgSer.o
 .text._ZN6CfgSer8SerRdSbkEv
                0x00000000        0x0 CfgSer.o
 .text._ZN6CfgSer3IRdEv
                0x00000000        0x0 CfgSer.o
 .text._ZN6CfgSer11SerDumpDoneEv
                0x00000000        0x0 CfgSer.o
 .text._ZN6CfgSer8ChkPortsEv
                0x00000000        0x0 CfgSer.o
 .text._ZN6CfgSer9SerCUP_CBEP4WQEe
                0x00000000        0x0 CfgSer.o
 .text._ZN6CfgSer3IWrEv
                0x00000000        0x0 CfgSer.o
 .text._ZN6CfgSer10SerReadRGLEv
                0x00000000        0x0 CfgSer.o
 .text._ZN6CfgSer6SerCUPEv
                0x00000000        0x0 CfgSer.o

Reply

Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]




Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.