This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC] Hide autogenerated symbols when linking shared libraries


Hi Yuri,

> Currently default linker script 

For which target(s) ?

> generates several temporary symbols
> which globally visible and unnecessarily increase size of dynamic
> symtable:
>   $ gcc -shared -fPIC -O2 tmp.c -o tmp.so
>   $ readelf --dyn-syms -W tmp.so
>   ...
>      7: 0000000000201020     0 NOTYPE  GLOBAL DEFAULT   21 _edata
>      9: 0000000000201028     0 NOTYPE  GLOBAL DEFAULT   22 _end
>     10: 0000000000201020     0 NOTYPE  GLOBAL DEFAULT   22 __bss_start
> 
> Is this intentional?

Yes.  Sometime these symbols are used by the crt initialization code.
For example, on bare metal systems the sbrk() function often uses the
_end symbol as the starting address for the heap.

Also tools like the dynamic loader, profilers, gdb and so on, sometimes
make use of these symbols too.  So unless you are really short on space
I would recommend leaving them in.

Cheers
  Nick

PS.  You can always create your own linker script which does not define
these symbols...


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]