Re: .EXE -> .ASM -> .EXE




santosh wrote:
....
Nevertheless, you mentioned that *only* the routines actually needed
get linked into a program. I just compiled a typical "hello world" C
program with gcc, passing the '-static' and '-static-libgcc' linker
options and the resulting executable is ~437 kB in size, even after
running 'strip --strip-all' on it.

I admit I'm a beginner in C, but I wonder if all the ~435 kB of code
are actually needed to just print a string to the console and exit. I
mean, how many other functions would printf() be calling? It seems
likely that most of the linked code is never actually called by the
particular executable.

The actual static version of libc on my system is ~2.5 megabytes. But
assuming, as you say, that the linker links in only the necessary
object modules, a size of 437 kB still seems inordinately large.
dependency.

This is most likely a source organization problem. The HLA standard
library for example is organized so that each function compiles to a
separate object file which are then linked into a library. With this
kind of organization, the linker can pick out only the object module it
needs according to the external symbols and link them to your program.

If however, the entire source is compiled into one object and then
archived into a library, you'll get the extreme bloat of the entire
library getting linked to your program. I suspect your libc library is
compiled in this manner.

-sevag.k
www.geocities.com/kahlinor

.



Relevant Pages

  • LNK2001 Unresolved external symbol
    ... I have a backup of my project that compiles and links OK ... Any offers of help would be appreciated, here's some of the linker ... "\Ti2000\Liberator Wont ... external symbol "public: virtual int __thiscall ...
    (microsoft.public.dotnet.languages.vc)
  • newbie linking IoXxx routines problem
    ... While writing a small test driver from ... linker cannot find IoCreateSymbolicLink ... while it compiles and links perfectly if the call to IoWriteErrorLogEntry is ...
    (microsoft.public.development.device.drivers)
  • Re: WSAStartup()
    ... I added ws2.lib as an Additional Dependency for the linker and all now ... compiles, links and runs on my eBox fine, even though it does nothing). ... unresolved external symbol _WSAStartup referenced ...
    (microsoft.public.windowsce.platbuilder)
  • Re: MSVC 7.1 Compile Time Slowdown
    ... When you are using global optimizations the linker effectively "compiles" the code, ... I donīt know it for sure, but it seems that the "linker" is doing something like a full ... I would recommend global optimization only for release builds, ... I wonder why you experience such a high difference in code size, ...
    (microsoft.public.vc.ide_general)
  • Re: Wiki, some vicious editing
    ... Sorry to deflate your expectations, but the clarification I've made to ... although RosAsm contains a linker for internal operation, ... not allow linking in external object modules other than DLLs, ...
    (alt.lang.asm)

Loading