This is the mail archive of the
mailing list for the GCC project.
Re: undefined reference to __fixunssfdi, __ashldi3, __lshrdi3
I've solved this issue. I needed to add the -lgcc option to the linker.
Is this the right way to make a standalone binary:
cross-ld -static -nostdlib -T temp.ld -o standalone_program start.o
abc.o xyz.o -lgcc -L<path_to_libs>
This is a cross compiled binary and I haven't tested it as yet.
On Thu, Oct 22, 2009 at 5:43 PM, JJ <firstname.lastname@example.org> wrote:
> I'm trying to build a standalone binary. In the linking stage, I get
> errors complaining that the following symbols are missing:
> __fixunssfdi, __ashldi3, __lshrdi3
> These look like standard C symbols. For this code, I've implemented
> custom versions of the standard C functions I use - strcpy, printf,
> sprintf etc. I provide the -static and -nostdlib option to the linker
> to build the standalone binary.
> cross-ld -static -nostdlib -T temp.ld -o standalone_program start.o abc.o xyz.o
> : undefined reference to `__fixunssfdi'
> : undefined reference to `__ashldi3'
> : undefined reference to `__lshrdi3'
> gmake: *** [standalone_program] Error 1
> I've tried using g++ instead of the ld but that didn't help either.
> If I add the optimization option -Os to the build, it complains about
> an undefined reference to 'memset' in addition to the above symbols:
> : undefined reference to `memset'
> I'm using:
> GNU ld version 2.15
> gcc version 3.4.3