public inbox for crossgcc@sourceware.org
 help / color / mirror / Atom feed
* RE: Build a short executable
@ 2001-01-09  8:17 David Korn
  2001-01-09  9:07 ` Peter Barada
  2001-04-01  0:00 ` David Korn
  0 siblings, 2 replies; 10+ messages in thread
From: David Korn @ 2001-01-09  8:17 UTC (permalink / raw)
  To: 'Pierre Saucourt-Harmel (r54698)', crossgcc

>-----Original Message-----
>From: Pierre Saucourt-Harmel (r54698) 

>I removed the -g option to generate the cross libraries 
>(libg.a and libgcc.a) but not for my small files. I used -o2 
>everywhere and I obtained an executable file of 132656 bytes ! 

  Did you try using the 'strip' command from binutils on the output ? You'd
be surprised how much difference it might make.  It will be the main reason
why your exe is so large.

>With the generated map, I noticed more than 20 objects files 
>coming from libg.a and libgcc.a were *fully* loaded in my executable. 

  Yes, but each of those files is very small; by and large, each one
contains
just one or two functions, for this very reason: so that only the minimum
that
needs to be linked in will be.  Looking at your list, it's got things like
malloc and free, open, close, read and write; I assume your program wants to
use these functions ?

       DaveK
-- 
The Boulder Pledge: "Under no circumstances will I ever purchase anything 
offered to me as the result of an unsolicited email message. Nor will I 
forward chain letters, petitions, mass mailings, or virus warnings to large 
numbers of others. This is my contribution to the survival of the online
community."


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**********************************************************************

------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 10+ messages in thread
* Build a short executable
@ 2001-01-09  8:05 Pierre Saucourt-Harmel (r54698)
  2001-04-01  0:00 ` Pierre Saucourt-Harmel (r54698)
  0 siblings, 1 reply; 10+ messages in thread
From: Pierre Saucourt-Harmel (r54698) @ 2001-01-09  8:05 UTC (permalink / raw)
  To: crossgcc

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 6879 bytes --]

Hello everybody,
I am trying to build a short program for a stand-alone ARM 7 processor
(without any OS), from a Solaris work station.
I generated sucessfully binutils-2.10.1, gcc-2.95.2, newlib-1.8.2 and
gdb-5.0.
I made a crt0.S (but refered to the default crtbegin.o). All my files
(*.c and crt0.S) explicitely call the external memset () and strlen ()
functions.
I removed the -g option to generate the cross libraries (libg.a and
libgcc.a) but not for my small files. I used -o2 everywhere and I obtained
an executable file of 132656 bytes !
With the generated map, I noticed more than 20 objects files coming
from libg.a and libgcc.a were *fully* loaded in my executable.
The linker processing that makes the symbol dependencies of the object
files (coming from libg.a and libgcc.a libraries) does not focus on which
function is used and which is not. The function dependencies and loading
seem to stop at the object level but not at the function level.
Is it possible to load what is strictly necessary ?
Here you find the archive includes, coming from the generated map :
/lavalette/gnuInstall/lib/gcc-lib/arm-elf/2.95.2/libgcc.a(__main.o)
                              
example.o (__gccmain)
/lavalette/gnuInstall/lib/gcc-lib/arm-elf/2.95.2/libgcc.a(_ctors.o)
                             
/lavalette/gnuInstall/lib/gcc-lib/arm-elf/2.95.2/libgcc.a(__main.o) (__CTOR_LIST__)
/lavalette/gnuInstall/lib/gcc-lib/arm-elf/2.95.2/libgcc.a(_exit.o)
                             
/lavalette/gnuInstall/lib/gcc-lib/arm-elf/2.95.2/libgcc.a(__main.o) (_exit_dummy_decl)
/lavalette/gnuInstall/arm-elf/lib/libg.a(atexit.o)
                             
/lavalette/gnuInstall/lib/gcc-lib/arm-elf/2.95.2/libgcc.a(__main.o) (atexit)
/lavalette/gnuInstall/arm-elf/lib/libg.a(impure.o)
                             
/lavalette/gnuInstall/arm-elf/lib/libg.a(atexit.o) (_impure_ptr)
/lavalette/gnuInstall/arm-elf/lib/libg.a(malloc.o)
                             
/lavalette/gnuInstall/arm-elf/lib/libg.a(atexit.o) (malloc)
/lavalette/gnuInstall/arm-elf/lib/libg.a(mallocr.o)
                             
/lavalette/gnuInstall/arm-elf/lib/libg.a(malloc.o) (_malloc_r)
/lavalette/gnuInstall/arm-elf/lib/libg.a(memset.o)
                             
crt0.o (memset)
/lavalette/gnuInstall/arm-elf/lib/libg.a(mlock.o)
                             
/lavalette/gnuInstall/arm-elf/lib/libg.a(mallocr.o) (__malloc_lock)
/lavalette/gnuInstall/arm-elf/lib/libg.a(sbrkr.o)
                             
/lavalette/gnuInstall/arm-elf/lib/libg.a(mallocr.o) (_sbrk_r)
/lavalette/gnuInstall/arm-elf/lib/libg.a(strlen.o)
                             
example.o (strlen)
/lavalette/gnuInstall/arm-elf/lib/libg.a(syscalls.o)
                             
/lavalette/gnuInstall/arm-elf/lib/libg.a(sbrkr.o) (_sbrk)
/lavalette/gnuInstall/arm-elf/lib/libg.a(errno.o)
                             
/lavalette/gnuInstall/arm-elf/lib/libg.a(syscalls.o) (__errno)
/lavalette/gnuInstall/arm-elf/lib/libg.a(findfp.o)
                             
/lavalette/gnuInstall/arm-elf/lib/libg.a(syscalls.o) (__sinit)
/lavalette/gnuInstall/arm-elf/lib/libg.a(freer.o)
                             
/lavalette/gnuInstall/arm-elf/lib/libg.a(malloc.o) (_free_r)
/lavalette/gnuInstall/arm-elf/lib/libg.a(fwalk.o)
                             
/lavalette/gnuInstall/arm-elf/lib/libg.a(findfp.o) (_fwalk)
/lavalette/gnuInstall/arm-elf/lib/libg.a(libcfunc.o)
                             
/lavalette/gnuInstall/arm-elf/lib/libg.a(syscalls.o) (abort)
/lavalette/gnuInstall/arm-elf/lib/libg.a(stdio.o)
                             
/lavalette/gnuInstall/arm-elf/lib/libg.a(findfp.o) (__sread)
/lavalette/gnuInstall/arm-elf/lib/libg.a(writer.o)
                             
/lavalette/gnuInstall/arm-elf/lib/libg.a(stdio.o) (_write_r)
/lavalette/gnuInstall/arm-elf/lib/libg.a(closer.o)
                             
/lavalette/gnuInstall/arm-elf/lib/libg.a(stdio.o) (_close_r)
/lavalette/gnuInstall/arm-elf/lib/libg.a(fflush.o)
                             
/lavalette/gnuInstall/arm-elf/lib/libg.a(findfp.o) (fflush)
/lavalette/gnuInstall/arm-elf/lib/libg.a(lseekr.o)
                             
/lavalette/gnuInstall/arm-elf/lib/libg.a(stdio.o) (_lseek_r)
/lavalette/gnuInstall/arm-elf/lib/libg.a(readr.o)
                             
/lavalette/gnuInstall/arm-elf/lib/libg.a(stdio.o) (_read_r)
/lavalette/gnuInstall/lib/gcc-lib/arm-elf/2.95.2/libgcc.a(_udivsi3.o)
                             
/lavalette/gnuInstall/arm-elf/lib/libg.a(freer.o) (__udivsi3)
/lavalette/gnuInstall/lib/gcc-lib/arm-elf/2.95.2/libgcc.a(_dvmd_tls.o)
                             
/lavalette/gnuInstall/lib/gcc-lib/arm-elf/2.95.2/libgcc.a(_udivsi3.o) (__div0)
 
 
 

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2001-04-01  0:00 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-01-09  8:17 Build a short executable David Korn
2001-01-09  9:07 ` Peter Barada
2001-01-10  2:16   ` Pierre Saucourt-Harmel (r54698)
2001-01-11  5:37     ` Pierre Saucourt-Harmel (r54698)
2001-04-01  0:00       ` Pierre Saucourt-Harmel (r54698)
2001-04-01  0:00     ` Pierre Saucourt-Harmel (r54698)
2001-04-01  0:00   ` Peter Barada
2001-04-01  0:00 ` David Korn
  -- strict thread matches above, loose matches on Subject: below --
2001-01-09  8:05 Pierre Saucourt-Harmel (r54698)
2001-04-01  0:00 ` Pierre Saucourt-Harmel (r54698)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).