ld give me a error message like this:
undefined reference to _functionname
in console:
ld -Ttext 0x10500 --oformat binary -o main.bin main.o timer.o task.o
timer.o:timer.c:(.text+0xc6): undefined reference to '_install'
in timer.c:
extern void install(void);
...
...
install();
[Help me] A link error
[Help me] A link error
Last edited by SCSoft on Sun Feb 05, 2006 12:00 am, edited 1 time in total.
- carbonBased
- Member
- Posts: 382
- Joined: Sat Nov 20, 2004 12:00 am
- Location: Wellesley, Ontario, Canada
- Contact:
Re: [Help me] A link error
You haven't told us where _install is defined. Is it being linked in?
Which platform/object format are you using? Certain ABIs do not prepend underscores, while others do.
--Jeff
Which platform/object format are you using? Certain ABIs do not prepend underscores, while others do.
--Jeff
Re: [Help me] A link error
_install is defined in a asm file :
[bits 32]
[global _install]
_install:
......
platform/object format? What's that?
[bits 32]
[global _install]
_install:
......
platform/object format? What's that?
- intel_breaker
- Member
- Posts: 46
- Joined: Tue Jan 04, 2005 12:00 am
- Location: Poland
- Contact:
Re: [Help me] A link error
Platfrom: Windows/Linux/BSD, or anything else=)
Object format: elf, coff ?
Maybe you don't have to use underscore before function name, check it!
Object format: elf, coff ?
Maybe you don't have to use underscore before function name, check it!
Re: [Help me] A link error
It's Ok after I add "section .text" to the asm file!
^^thanks all the same
^^thanks all the same
- carbonBased
- Member
- Posts: 382
- Joined: Sat Nov 20, 2004 12:00 am
- Location: Wellesley, Ontario, Canada
- Contact:
Re: [Help me] A link error
Hopefully you understand *why*?
Most programmers tend to know what platform they're developing on! Keep in mind that other ABIs (Linux/ELF) will not use underscores and you'll get the same link error.
--Jeff
Most programmers tend to know what platform they're developing on! Keep in mind that other ABIs (Linux/ELF) will not use underscores and you'll get the same link error.
--Jeff
Re: [Help me] A link error
I think that the gcc will take the function to .text section but nasm won't.
where can I find the infomation for gcc and ld
where can I find the infomation for gcc and ld
Last edited by SCSoft on Sun Feb 12, 2006 12:00 am, edited 1 time in total.
- carbonBased
- Member
- Posts: 382
- Joined: Sat Nov 20, 2004 12:00 am
- Location: Wellesley, Ontario, Canada
- Contact:
Re: [Help me] A link error
You should be able to find information about it all over the internet. If you've got specific things you want to look into, google's probably your best resource. gcc.gnu.org probably contains a lot of information, as well.
ld is part of the binutils distribution, and has a homesite at http://www.gnu.org/software/binutils/
--Jeff
ld is part of the binutils distribution, and has a homesite at http://www.gnu.org/software/binutils/
--Jeff