This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: statically linking standard libraries
Hi,
Thanks a lot for the help.
I've gotten to a point where g++ no longer complains about missing
functions in my program. It now complains about some system(?)
functions:
$ cross-g++ -Bstatic -Xlinker -T -Xlinker temp.ld -o
standalone_program xyz.o abc.o
In function `__libc_csu_init':
../../elf-init.c:66: undefined reference to `__init_array_start'
..
: undefined reference to `__init_array_end'
..
: undefined reference to `__fini_array_start'
..
..
If I specify the "-shared" option, it doesn't throw these errors. But
I need to build a standalone program with the standard libraries built
in - hence the "-Bstatic" option.
JJ
On Fri, Oct 16, 2009 at 6:38 PM, Ian Lance Taylor <iant@google.com> wrote:
> JJ <alchemistmba@gmail.com> writes:
>
>> I also need to pass a linker script to the linker. I tried the
>> following option to g++:
>>
>> -Xlinker "-T temp.ld"
>
> That will pass "-T temp.ld" as a single option, which causes the
> linker to look for the file " temp.ld" (with a leading space).
>
> Use
>
> -Xlinker -T -Xlinker temp.ld
>
> or
>
> -Wl,-T,temp.ld
>
> Ian
>