6

Using avr-gcc and attempting to reduce size of binary using -ffunction-sections and -fdata-sections when compiling and linking with --gc-sections. The .lds file contains nothing:

SECTIONS { }

This error occurs when partial linking many .o's into a .a, which will then be used later to complete the build.

I've read through some other posts that discuss these options, but nothing that clarifies the ENTRY() issue. Their doesn't seem to be a need for it at the partial stage before trying to reduce code size(pre-existing linker script clearly doesn't use it).

Documentation states : --gc-sectionts

"This option can be set when doing a partial link (enabled with option '-r'). In this case the root of symbols kept must be explicitly specified either by an '--entry' or `--undefined' option or by a ENTRY command in the linker script."

This is where I'm lost. Would greatly appreciate some more explanation of how to use --undefined, --entry, or ENTRY cmd in linker script to resolve this issue.

too honest for this site
  • 12,050
  • 4
  • 30
  • 52
Brandon Schaefer
  • 451
  • 1
  • 4
  • 12
  • So it looks like no one has a suggestion. I ended up skipping --gc-sections at partial link stages, and only use this linker option at final stage of linking. This results in other issues still, where necessary things are removed from the binary.. But I will post a new question regarding this. – Brandon Schaefer Jul 20 '15 at 14:56

1 Answers1

-1

I had a similar issue and gave up. I ended up compiling with the -fwhole-program option enabled which significantly reduced the size of my bootloader.