This is the mail archive of the
mailing list for the binutils project.
The difference in behavior between ld and gold when processing "start group/end group" option
- From: "Nikola Ikonic" <Nikola dot Ikonic at rt-rk dot com>
- To: binutils at sourceware dot org
- Cc: "Petar Jovanovic" <Petar dot Jovanovic at rt-rk dot com>
- Date: Tue, 03 Mar 2015 18:19:45 +0100
- Subject: The difference in behavior between ld and gold when processing "start group/end group" option
- Authentication-results: sourceware.org; auth=none
I have found a difference in behavior of gold and GNU ld when processing command line in one specific case when "start group/end group" is used in conjuction with linker script, and I am wondering if this difference is intentional or possible bug in either of linkers. In the example I have made, two libraries (libtest.a/libtest2.a) have different definitions of the same function and the command line uses linker script with a library name inside "start group/end group" option. Linker script only includes other libraries. When the same line is given to gold and GNU LD they call function from different libraries.
extern void head_dummy();
Â return 0;
Â printf("\nthis is library TEST\n\n");
Â printf("\nthis is library TEST2\n\n");
extern void dummy_func();ÂÂ Â
GROUP ( libtest2.a libdummy.a )
$ gcc main.o -o main.exe -Wl,--start-group -Wl,-lscript -Wl,-ltestÂ -Wl,--end-group -L./
Executable linked with LD prints "... TEST2" while gold-linked executable prints "... TEST".
Which of these linkers behave correctly?
Thank you in advance for the explanation.