How to link the gcc and nasm 's object file!!help!!

How to link the gcc and nasm 's object file!!help!!

Post by 陈&#2599 » Wed, 14 Aug 2002 23:26:10



I use gcc and nasm to generate 'elf' format file,and when I use ld -o
a.o b.o,it can success,but if I type './a.out' in the console,it says
'segment fault'.

So I disasm it ,and find that the 'call' address is wrong!For example
,it should 'call 0xd',but it actually 'call 0xe'.

I need to use nasm and gcc to generate relocatable object file,but I
can't use ld -r -o the generate correct binary file.Who can help me?
Thanks very much.

BTW:If I use 'gcc a.o b.o',it can work fine.But the 'gcc' can not
generate the relocatable file .

 
 
 

1. Linking nasm-created objects always gives me a segmentation fault

Hello,

On my system (linux-2.4.7, gcc version 2.95.3, glibc-2.2.1, i686), ld
always gets a segmentation fault when linking nasm-created objects with
objects created by gcc. This has happened with *any* piece of software that
uses nasm to build some objects, and there are never problem reports of
this kind. I've used several binary distributions of nasm-0.98, compiled
nasm myself, all to no avail.  This problem exists on my system for several
years, with many different versions of gcc, glibc, linux kernel, hardware,
etc.

I just can't find what is causing this problem. I looked at strace outputs
to see if old lingering objectfiles accidentally get linked in as well, but
that doesn't seem to be the problem. Can anyone suggest a method to find
the cause of this problem? I have no experience in assembly programming,
but I think a simple testcase would be a smallest possible assembly filed
linked against a very bare piece of C code, to see if that will work.

Any help will be greatly appreciated!

Kind regards,
Bram
--
Bram Avontuur (http://www.stack.nl/~brama/)

"What's worse; ignorance or apathy?   Who knows? who cares!"

2. Zftape-2.03b Problems

3. How to link object files from gcc and absoft f90 into a executable file?

4. Problem w/ Rendition V1k + 17" monitor

5. Dynamic linking and static class objects with GCC on Solaris doesn't seem to work

6. Direct serial connection

7. Linking C and C++ code object files with 'ld'?

8. Is there time-out setting for DIP???

9. can you link a.out object files with ELF files?

10. Linking GCC objects with ld

11. Linking shared Objects with gcc 3.0.2 on Tru64 V5.1

12. linking errors building shared object libs with gcc 2.7.0

13. Linking a Shared Object Library with gcc