You are not logged in.
I wrote some assemble code to select the maximum from a set of number, save as select_maximum.s
assembled it with as select_maximum.s -o select_maximum.o and linked with ld -dynamic-linked /lib/ld-linux.so.2 -lc -o select_maximum select_maximum.o
It all went nice, no error reported. but when I hit the directive ./select_maximum to run the program, the bash showed me the following words
-bash: ./select_maximum: Accessing a corrupted shared library
I had no idea of this and googled it but nothing I got, I need some tips
the source code:
/* select_maximum.s
* to find the max number in a set of number
*/
.code32
.section .data
input:
.int 32, 34, 23, 34, 45, 64, 23, 54, 2
hint:
.asciz "the max number is %d \n"
.section .text
.globl _start
_start:
nop
movl $1, %edi
mov input, %ebx
loop:
movl input(, %edi, 4), %eax
cmp %eax, %ebx
cmova %eax, %ebx
inc %edi
cmp $10, %edi
jne loop
pushl %ebx
pushl $hint
call printf
addl $8, %esp
pushl $0
call exit
Last edited by hackyoung (2013-11-18 01:18:11)
Offline
Moving from Arch Discussion to Programming & Scripting.
aur S & M :: forum rules :: Community Ethos
Resources for Women, POC, LGBT*, and allies
Offline
Does this help?
Offline
I've tried it, but it still did not work. I got a segment error
Does this help?
Offline
This isn't homework, is it?
CLI Paste | How To Ask Questions
Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L
Offline
it isn't but my own homework. I am learning at&t assemble language
I did something like
ls -l /lib/ld-linux.so.1
bash told me:
lrwxrwxrwx 1 root root 22 Nov 9 22:55 /lib/ld-linux.so.2 -> ../lib32/ld-linux.so.2
but I could not find the file /lib32/ld-linux.so.2 even there is no lib32 derictory
what does this mean?
This isn't homework, is it?
Offline
/usr/lib32/ld-linux.so.2 belongs to lib32-glibc. That's why I posted the link that I did. You're on 64 bit Arch, correct? I believe that your error is coming from trying to link to the the 32 bit glibc instead of the 64 bit one.
Offline