欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Accessing a corrupted shared library

程序员文章站 2022-03-08 20:50:03
...
源:https://*.com/questions/30419857/accessing-a-corrupted-shared-library
评:
As you've sort of realized, you're trying to compile assembly for a 32 bit machine, on a 64 bit machine. With the commands you copied and pasted, you're letting as and ld know that you're compiling something 32 bit.

The issue you've run into is that you don't have a 32 bit version of libc available to link against.

apt-get install libc6:i386 libc6-dev-i386

Then assemble the code with:

as --32 -o cpuid2.o cpuid2.s

and finally link it with:

ld -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 -o cpuid2 -lc cpuid2.o

Then it should work:

[jkominek@kyatt /tmp]$ ./cpuid2
The processor Vendor ID is 'GenuineIntel'