ld: once multiple symbol definitions are allowed, both definitions end up in the executable

2017-01-11 Thread Pavel Shishpor
Hello, Could please someone advice is it a bug or a feature when we get both bodies of the functions with the same name in the executable once multiple symbol definitions are allowed? Here is the example showing the behavior: $ cat main.c int f() {return 6;} int main() { return f();} $ cat a.c

Re: ld: once multiple symbol definitions are allowed, both definitions end up in the executable

2017-01-11 Thread Jim Wilson
On 01/11/2017 01:49 AM, Pavel Shishpor wrote: Could please someone advice is it a bug or a feature when we get both bodies of the functions with the same name in the executable once multiple symbol definitions are allowed? Here is the example showing the behavior: The only thing that the --allo

Re: ld: once multiple symbol definitions are allowed, both definitions end up in the executable

2017-01-17 Thread Pavel Shishpor
Thanks a lot for the answer: it put me on the right track. The '-ffunction-sections' option works OK on toy examples though GNU linker crashed when I tried the following on real-life object files compiled with -ffunction-sections and -fdata-sections options enabled: for i in $object_files_original

Re: ld: once multiple symbol definitions are allowed, both definitions end up in the executable

2017-01-17 Thread Jim Wilson
On Tue, Jan 17, 2017 at 6:56 AM, Pavel Shishpor wrote: > Thanks a lot for the answer: it put me on the right track. The > '-ffunction-sections' option works OK on toy examples though GNU linker > crashed when I tried the following on real-life object files compiled with > -ffunction-sections and -