| | |
Linking problem under linux
![]() |
•
•
Join Date: Jul 2009
Posts: 1
Reputation:
Solved Threads: 0
Hello,
I'm actually learning assembly and I have a problem even though I am copying word for word what my book tells me. Here's the code:
(there used to be 'pushl's but as I am using an AMD64 I had to replace them with 'pushq's)
It is then written that I must compile and link in this way:
It works without printing out an error but during execution of the newly generated executable, it crashes immediately and I get this:
"bash: ./helloworld-lib: Accessing a corrupted shared library"
I also tried replacing "-dynamic-linker /lib/ld-linux.so.2" by "-dynamic-linker /lib/ld-linux-x86-64.so.2" but I get this error now when I execute "Illegal instruction".
After checking with gdb, I conclude that the SIGILL is sent during the fprintf function call.
Any idea how I could solve this problem?
Thanks.
I'm actually learning assembly and I have a problem even though I am copying word for word what my book tells me. Here's the code:
Assembly Syntax (Toggle Plain Text)
1 .section .data 2 helloworld: 3 .ascii "hello world\n\0" 4 .section .text 5 .globl _start 6 _start: 7 pushq $helloworld 8 call printf 9 pushq $0 10 call exit
It is then written that I must compile and link in this way:
Assembly Syntax (Toggle Plain Text)
as helloworld-lib.s -o helloworld-lib.o ld -dynamic-linker /lib/ld-linux.so.2 \ -o helloworld-lib helloworld-lib.o -lc
"bash: ./helloworld-lib: Accessing a corrupted shared library"
I also tried replacing "-dynamic-linker /lib/ld-linux.so.2" by "-dynamic-linker /lib/ld-linux-x86-64.so.2" but I get this error now when I execute "Illegal instruction".
After checking with gdb, I conclude that the SIGILL is sent during the fprintf function call.
Any idea how I could solve this problem?
Thanks.
![]() |
Similar Threads
- g++ - linking error - undefined reference to <func_name> (C++)
- Linking Problem in VC++8.0 (C++)
- problem with linux installation (Getting Started and Choosing a Distro)
- What's better? Windows 2000 Server or Linux Server? (Windows Servers and IIS)
- Vista Networking Problem With Linux DHCP (Windows Vista and Windows 7)
- gcc on windows-linking problem (C++)
- C++ linking problem (C++)
- Problem in using Linux applications (*nix Software)
Other Threads in the Assembly Forum
- Previous Thread: Problem assembling with Nasm-IDE
- Next Thread: Memory Location
| Thread Tools | Search this Thread |





