Re: [Mspgcc-users] Unused functions occupying unnecessary memory

2010-06-24 Thread JMGross
Von: Grant Edwards Gesendet am: 23 Jun 2010 18:01:14 I never got one. In theory, my frontend should capture stdout and stderr. And normally I see any output from compiler and/or linker. So I never thought that I was missing the -Wl prefix. That's bizarre. Indeed. I just tested it again

Re: [Mspgcc-users] Unused functions occupying unnecessary memory

2010-06-23 Thread JMGross
Von: Grant Edwards Gesendet am: 22 Jun 2010 16:16:20 segments - = sections. I think I got the 'empty' by browsing the ld option description. Or i dedutcted it from your expression of discarded unused content. unused != empty right. Well, when all content has been discarded because being

Re: [Mspgcc-users] Unused functions occupying unnecessary memory

2010-06-23 Thread Peter Bigot
One reason why keep it even if unreferenced may be the default even when optimizations are enabled is that these tools (binutils, gcc) are primarily used in environments that have far more capabilities, and couldn't care less if a few extra kilobytes are present in the image. If you work in Linux

Re: [Mspgcc-users] Unused functions occupying unnecessary memory

2010-06-22 Thread JMGross
- Ursprüngliche Nachricht - Von: Grant Edwards Gesendet am: 21 Jun 2010 16:54:37 If I understood the linker scripts correctly, the linker will put all .text and .text.* compiler segments into the linker text segment. After the unreferenced .text.* sections are discarded, the

Re: [Mspgcc-users] Unused functions occupying unnecessary memory

2010-06-22 Thread Grant Edwards
On 2010-06-22, JMGross msp...@grossibaer.de wrote: If I understood the linker scripts correctly, the linker will put all .text and .text.* compiler segments into the linker text segment. After the unreferenced .text.* sections are discarded, the remaining ones will all be placed into the

Re: [Mspgcc-users] Unused functions occupying unnecessary memory

2010-06-21 Thread JMGross
Von: Grant Edwards Gesendet am: 18 Jun 2010 19:09:51 On 2010-06-18, JMGross msp...@grossibaer.de wrote: I dug out some older project files and if I understand their old makefile correctly, all object files were put into a library (.a) and then this was fed into the linker. So maybe this was

Re: [Mspgcc-users] Unused functions occupying unnecessary memory

2010-06-21 Thread Grant Edwards
On 2010-06-21, JMGross msp...@grossibaer.de wrote: Unfortunately., my boss really dislikes me posting our project code into the world. Yes, bosses can be funny that way. I didn't set up a separate project for checking. I just took a randomly chosen existing project, added the function foo()

Re: [Mspgcc-users] Unused functions occupying unnecessary memory

2010-06-21 Thread Grant Edwards
On 2010-06-21, Grant Edwards grant.b.edwa...@gmail.com wrote: Thank you for posting a real example. Now we can figure out what's going on. First, both -ffunction-sections and -gc-sections flags are commented out in your makefile. Second, it's '--gc-sections' not '-gc-sections' Oops. That

Re: [Mspgcc-users] Unused functions occupying unnecessary memory

2010-06-21 Thread Grant Edwards
On 2010-06-15, Grant Edwards grant.b.edwa...@gmail.com wrote: On 2010-06-15, JMGross msp...@grossibaer.de wrote: The suggested compiler/linker flags, however, let the compiler treat each function as a separate compilation unit, starting at its own 0-offset address. [...] Also, it keeps

Re: [Mspgcc-users] Unused functions occupying unnecessary memory

2010-06-18 Thread JMGross
- Ursprüngliche Nachricht - Von: Grant Edwards Gesendet am: 17 Jun 2010 21:01:31 On 2010-06-17, JMGross msp...@grossibaer.de wrote: [I don't suppose you could wrap lines in your posts?] I'll try. :) Normally, the receivers mail program should do if necessary. (You don't use plain

Re: [Mspgcc-users] Unused functions occupying unnecessary memory

2010-06-18 Thread Grant Edwards
On 2010-06-18, JMGross msp...@grossibaer.de wrote: I dug out some older project files and if I understand their old makefile correctly, all object files were put into a library (.a) and then this was fed into the linker. So maybe this was the reason for the missing code if the project object

Re: [Mspgcc-users] Unused functions occupying unnecessary memory

2010-06-17 Thread JMGross
- Ursprüngliche Nachricht - Von: Grant Edwards An: mspgcc-users@lists.sourceforge.net Gesendet am: 16 Jun 2010 21:43:44 On 2010-06-16, JMGross msp...@grossibaer.de wrote: I had this happen long time ago when I included the different object files or libraries in the wrong order with

Re: [Mspgcc-users] Unused functions occupying unnecessary memory

2010-06-17 Thread Grant Edwards
On 2010-06-17, JMGross msp...@grossibaer.de wrote: [I don't suppose you could wrap lines in your posts?] Not with the gc-sections feature. But I'm pretty sure it happened with object files and not just libraries. (And I'm sure that no libraries were linked before the object files, but maybe

Re: [Mspgcc-users] Unused functions occupying unnecessary memory

2010-06-17 Thread Przemek Klosowski
On Thu, Jun 17, 2010 at 3:01 PM, Grant Edwards grant.b.edwa...@gmail.com wrote: On 2010-06-17, JMGross msp...@grossibaer.de wrote: interesting. Still two wasted bytes (I don't think the linker will move the following code and adjust any other jumps if necessary), Yes, if the linker supports

Re: [Mspgcc-users] Unused functions occupying unnecessary memory

2010-06-17 Thread Grant Edwards
On 2010-06-17, Przemek Klosowski przemek.klosow...@gmail.com wrote: On Thu, Jun 17, 2010 at 3:01 PM, Grant Edwards grant.b.edwa...@gmail.com wrote: On 2010-06-17, JMGross msp...@grossibaer.de wrote: interesting. Still two wasted bytes (I don't think the linker will move the following code and

Re: [Mspgcc-users] Unused functions occupying unnecessary memory

2010-06-16 Thread JMGross
elimination was a bad example. (I was a bit in haste when I wrote this, it was at the end of my office hours) JMGross - Ursprüngliche Nachricht - Von: Grant Edwards An: mspgcc-users@lists.sourceforge.net Gesendet am: 15 Jun 2010 20:26:25 Betreff: Re: [Mspgcc-users] Unused functions

Re: [Mspgcc-users] Unused functions occupying unnecessary memory

2010-06-16 Thread Grant Edwards
On 2010-06-16, JMGross msp...@grossibaer.de wrote: I had this happen long time ago when I included the different object files or libraries in the wrong order with GCC under linux. After reordering them so that their contend had already been referenced, all was well. I think I had similar

[Mspgcc-users] Unused functions occupying unnecessary memory

2010-06-15 Thread Alex Polbach
Hi all: I have been noticing that a function that is not used by any module in program gets linked anyway, occupying some precious amount of memory. Suppose that you were sharing a common module but you only needed some functions of it. Is there a way to avoid linking all the unused functions?

Re: [Mspgcc-users] Unused functions occupying unnecessary memory

2010-06-15 Thread JMGross
- Ursprüngliche Nachricht - Von: Alex Polbach An: mspgcc-users@lists.sourceforge.net Gesendet am: 15 Jun 2010 11:02:58 Betreff: [Mspgcc-users] Unused functions occupying unnecessary memory Hi all: I have been noticing that a function that is not used by any module in program gets linked anyway

Re: [Mspgcc-users] Unused functions occupying unnecessary memory

2010-06-15 Thread Grant Edwards
On 2010-06-15, Alex Polbach alex.polb...@wimet.es wrote: I have been noticing that a function that is not used by any module in program gets linked anyway, occupying some precious amount of memory. Suppose that you were sharing a common module but you only needed some functions of it. Is

Re: [Mspgcc-users] Unused functions occupying unnecessary memory

2010-06-15 Thread Grant Edwards
On 2010-06-15, Grant Edwards grant.b.edwa...@gmail.com wrote: On 2010-06-15, Alex Polbach alex.polb...@wimet.es wrote: I have been noticing that a function that is not used by any module in program gets linked anyway, occupying some precious amount of memory. Suppose that you were sharing a

Re: [Mspgcc-users] Unused functions occupying unnecessary memory

2010-06-15 Thread Alex Polbach
Thanks a lot for so fast answers!! I have added both flags to CFLAGS and LDFLAGS and they work just fine. Very neat solution. Alex On 2010-06-15, Grant Edwards grant.b.edwa...@gmail.com wrote: On 2010-06-15, Alex Polbach alex.polb...@wimet.es wrote: I have been noticing that a function that

Re: [Mspgcc-users] Unused functions occupying unnecessary memory

2010-06-15 Thread Grant Edwards
On 2010-06-15, Alex Polbach alex.polb...@wimet.es wrote: Thanks a lot for so fast answers!! I have added both flags to CFLAGS and LDFLAGS and they work just fine. Very neat solution. I'm not sure how much those features get used with mspgcc, but I found them to be invaluable if you want to

Re: [Mspgcc-users] Unused functions occupying unnecessary memory

2010-06-15 Thread JMGross
, as they are all referenced as externals. If you want it or not depends on your project. JMGross. - Ursprüngliche Nachricht - Von: Grant Edwards An: mspgcc-users@lists.sourceforge.net Gesendet am: 15 Jun 2010 17:54:00 Betreff: Re: [Mspgcc-users] Unused functions occupying unnecessary

Re: [Mspgcc-users] Unused functions occupying unnecessary memory

2010-06-15 Thread Grant Edwards
On 2010-06-15, JMGross msp...@grossibaer.de wrote: The suggested compiler/linker flags, however, let the compiler treat each function as a separate compilation unit, starting at its own 0-offset address. This means teh compiler will not resolve any local references and let it all to the