tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Trivial program size inflation



mouse%Rodents-Montreal.ORG@localhost (Mouse) writes:

>>> amd64, 9.0_STABLE (ftp.n.o):

>>>    text    data     bss     dec     hex filename
>>>  562318   29064 2176416 2767798  2a3bb6 main


amd64, 9.0_STABLE:
   data     bss     dec     hex filename
   2873     186      72    3131     c3b a.out


crt0 pulls in
- atexit
- environment
- static TLS
- stack guard

which all more or less pull in jemalloc, stdio and string functions.

You need to replace these with dummies (compile with -fno-common)
and of course, your program must not make use of the functionality...


#include <stdbool.h>
#include <sys/types.h>

int atexit(void) { return 0; };
void abort(void) { };
void __cxa_atexit() { };
void __cxa_finalize() { };
void __libc_atexit_init() { };
void __cxa_thread_atexit_impl() { };
int __cxa_thread_atexit_used;
void __cxa_thread_run_atexit() { };

char *__allocenvvar() { return 0; };
bool __canoverwriteenvvar() { return true; };
size_t __envvarnamelen() { return 0; };
void *__findenv() { return 0; };
void *__findenvvar() { return 0; };
void __freeenvvar() { };
ssize_t __getenvslot() { return 0; };
void __libc_env_init() { };
bool __readlockenv() { return true; };
bool __unlockenv() { return true; };
bool __writelockenv() { return false; };

void __libc_rtld_tls_allocate() { };
void __libc_rtld_tls_free() { };
void __libc_static_tls_setup() { };
void __libc_tls_get_addr() { };

void __chk_fail() { };
void __guard_setup() { };
void __stack_chk_fail() { };
void __stack_chk_fail_local() { };
int __stack_chk_guard;




Home | Main Index | Thread Index | Old Index