I have recently been reading up on linkers and I'm having trouble understanding this compilation code. If I were to run gcc -Wl,--hash-style=both example.c
, what difference will it make as opposed to me simply running gcc example.c
. And also, what does --hash-style
means
what does
--hash-style
means
--hash-style
allows you to change the format of hashtable which is used for runtime symbol resolution (see Drepper's article, section "The GNU-style Hash Table" for details). The GNU hashtable format is said to be slightly faster.
If I were to run
gcc -Wl,--hash-style=both example.c
, what difference will it make as opposed to me simply runninggcc example.c
It depends on how your distro's GCC was configured. AFAIK most use either both
or gnu
styles by default. Both
simply means that linked files will include, um, both gnu
and sysv
hashtables. This shouldn't matter unless you try to run your program on a system with dynamic linker which does not understand GNU hashtables. In that case, if program was built with -Wl,--hash-style=gnu
, you'll get an error at startup about unsupported hashtable format.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With