This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Why code size increases after uncommenting some lines?

Hello,
I am a student from germany and I am working on a project with KeilC an uVison. I have a strange problem.
- I get some C-code for a 8051 compatible
- this code has extern linker files
- the current code compiles without errors
- after compiling I see some size-values for DATA,XDATA,PDATA
- if i want to shrink the code by deleting or uncommenting some lines the linker throws errors, because the size of data exceed the restrictions by the linker file.

I do not understand, why the code size increases if I shrink the code? Can some one explain me this issue?

Thank you for help,
Regard Chris

Parents
  • that some functions are in precompiled libraries and if I am linking against them but only using a few of their functions it happens this what you describe

    If so, that library is constructed incorrectly. It's one of the basic requirements of proper library design to have each independent functional unit in its own translation unit, so it can be left out of the final link if not needed. Basically, a library must have a separate source file for every single data object and function listed in its interface header(s), and another one for each internal functionality used by more than one other.

Reply
  • that some functions are in precompiled libraries and if I am linking against them but only using a few of their functions it happens this what you describe

    If so, that library is constructed incorrectly. It's one of the basic requirements of proper library design to have each independent functional unit in its own translation unit, so it can be left out of the final link if not needed. Basically, a library must have a separate source file for every single data object and function listed in its interface header(s), and another one for each internal functionality used by more than one other.

Children
No data