undefined reference to atan2f

Derrick Washington ddwashin at gmail.com
Fri Jun 24 18:40:34 UTC 2011


  Hi

   I can not understand for the life of me why I can't get this linker to
grab certain functions, like for example the atan function. I know it has
something to do with the linker script I'm using, however when I let the
compiler link automatically the functions I'm am trying to use do get called
but the problem is that the linker defaults the start of the code to
0x0400000 which is WRONG, I need the code to start at 0x0000000.  I looked
at the default linker script that the tool is using and I copied that
"EXACT" code into my linker script but then it goes right back to giving me
the orginal error of undefined reference to 'atan2f'.  I have been strugging
with this for at leats two weeks now I really need someone to help me out
here.  I have included my code and linker scripts.  Below are the
commandline commands I am issuing.

mips-sde-elf-as -Os -mips1 startup.s -o startup.o
mips-sde-elf-g++ -Os -c -g -mtune=r3k -mips1 autopilot.cpp -o
cpu_cache_instructions.o
mips-sde-elf-ld  -Os -mips1 -T ph_spr3.ld startup.o cpu_cache_instructions.o
-o cpu_cache_instructions.elf
mips-sde-elf-objdump --disassemble --line-numbers --source
cpu_cache_instructions_Spr3.elf > disassembly_Spr3.list

The above commands give me the error undefined reference to atan2f at the
linker stage

************************************************************

However when I use the following commands

mips-sde-elf-as -Os -mips1 startup.s -o startup.o
mips-sde-elf-g++ -Os -g -mtune=r3k -mips1 autopilot.cpp -o
cpu_cache_instructions.elf
mips-sde-elf-objdump --disassemble --line-numbers --source
cpu_cache_instructions.elf > disassembly_Spr3.list

Everything compilers and links find.  I get the warning message "warning can
not find entry symbol __start; defaulting to 0x04000b0" The problem here is
the code is not starting at 0x00000000 like it needs to.

*********************** REMEMBER FINALLY *********************

When I use these commands...

mips-sde-elf-as -Os -mips1 startup.s -o startup.o
mips-sde-elf-g++ -Os -g -mtune=r3k -mips1 autopilot.cpp -o
cpu_cache_instructions.o
mips-sde-elf-ld  -Os -mips1 -T elfbtsmipn32.ld startup.o
cpu_cache_instructions.o -o cpu_cache_instructions.elf
mips-sde-elf-objdump --disassemble --line-numbers --source
cpu_cache_instructions.elf > disassembly_Spr3.list


using the linker script that I created using the ld --verbose comand and
just cutting and pasting.  I not only still get the undefined reference to
atan2f, error but I also get the warning "warning can not find entry symbol
__start; defaulting to 0x04000b0".  I know how to fix the latter in this
case just alter the script to start at 0x00000000, but I still can't seem to
get the linker to use/find the atan2f.


SOMEONE HELP PLEASE AND THANK YOU!!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://sourcerytools.com/pipermail/mips-gnu-discuss/attachments/20110624/64855010/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: autopilot.cpp
Type: text/x-c++src
Size: 1283 bytes
Desc: not available
URL: <http://sourcerytools.com/pipermail/mips-gnu-discuss/attachments/20110624/64855010/attachment.cpp>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: autopilot_init.h
Type: text/x-chdr
Size: 4844 bytes
Desc: not available
URL: <http://sourcerytools.com/pipermail/mips-gnu-discuss/attachments/20110624/64855010/attachment.h>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CalAxisOrie.h
Type: text/x-chdr
Size: 2666 bytes
Desc: not available
URL: <http://sourcerytools.com/pipermail/mips-gnu-discuss/attachments/20110624/64855010/attachment-0001.h>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: elf32btsmipn32.ld
Type: application/octet-stream
Size: 9936 bytes
Desc: not available
URL: <http://sourcerytools.com/pipermail/mips-gnu-discuss/attachments/20110624/64855010/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: global.h
Type: text/x-chdr
Size: 19455 bytes
Desc: not available
URL: <http://sourcerytools.com/pipermail/mips-gnu-discuss/attachments/20110624/64855010/attachment-0002.h>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: init_accel.h
Type: text/x-chdr
Size: 3951 bytes
Desc: not available
URL: <http://sourcerytools.com/pipermail/mips-gnu-discuss/attachments/20110624/64855010/attachment-0003.h>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: init_gps.h
Type: text/x-chdr
Size: 2866 bytes
Desc: not available
URL: <http://sourcerytools.com/pipermail/mips-gnu-discuss/attachments/20110624/64855010/attachment-0004.h>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: init_gyro.h
Type: text/x-chdr
Size: 5055 bytes
Desc: not available
URL: <http://sourcerytools.com/pipermail/mips-gnu-discuss/attachments/20110624/64855010/attachment-0005.h>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ph_spr3.ld
Type: application/octet-stream
Size: 1327 bytes
Desc: not available
URL: <http://sourcerytools.com/pipermail/mips-gnu-discuss/attachments/20110624/64855010/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: retrSnrData.h
Type: text/x-chdr
Size: 6915 bytes
Desc: not available
URL: <http://sourcerytools.com/pipermail/mips-gnu-discuss/attachments/20110624/64855010/attachment-0006.h>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: startup.s
Type: application/octet-stream
Size: 653 bytes
Desc: not available
URL: <http://sourcerytools.com/pipermail/mips-gnu-discuss/attachments/20110624/64855010/attachment-0002.obj>


More information about the mips-gnu-discuss mailing list