On Tue, 12 Jan 2016 23:15:51 +0000 (UTC) Vicente Sendra <vise...@yahoo.es> wrote:
> Hello. > > I've been using SDCC (PIC port) for some time and using gputils to assemble > and link. > > Gplink has an option to remove dead sections -O2. > > It crashed when using this option, but recently i've repported the bug and it > has been quickly fixed. > (See details here: https://sourceforge.net/p/gputils/bugs/286/ ) > > The problem is -O2 removes code only from entire sections not used, and SDCC > generates only one code section for all functions of each file. So code is > only removed if no function of a file is used. > This is not very useful, normally you have some libraries and use part of the > functions of that files, all unused functions should be removed. This could > be possible if each file had it's own code section. I have done some test > with real projects (adding a code section for each function manually to the > resulting asm) and i've seen very big memory savings after linking (up to > 20%, very project dependent). > > I suggest adding a new Option for the SDCC PIC port to create a code section > for each function in every compiled file. I think it should be very easy to > implement this option, it just adds a line for each function in the output > file, i propose the following format (the one i used in my tests): > > function_name (.c file function) -> _function_name (.asm file function) -> > code_function_name (.asm file code section) > > Just add "code" prefix to each generated asm function name and add new > section line before the function start label, an example here: > > -------------------------------------------------- > ;*** > ; pBlock Stats: dbName = C > ;*** > ;entry: _serial_hw_init ;Function > start > ; 2 exit points > ;has an exit > ;; Starting pCode block > code_serial_hw_init code > ;Function start > _serial_hw_init ;Function start > ; 2 exit points > ; .line 695; > "src/serial/serial_hw.c" > pin_mode_input(SERIAL_HW_RX0); > BANKSEL _TRISB > BSF _TRISB,5 > The solution is ready, in the #9457 svn version. Molnár Károly ------------------------------------------------------------------------------ Site24x7 APM Insight: Get Deep Visibility into Application Performance APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month Monitor end-to-end web transactions and take corrective actions now Troubleshoot faster and improve end-user experience. Signup Now! http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140 _______________________________________________ Sdcc-user mailing list Sdcc-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sdcc-user