EmbDev.net

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


von Dustin S. (dbrazeau)


Rate this post
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

von Clifford S. (clifford)


Rate this post
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

von Dustin S. (dbrazeau)


Rate this post
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

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.