I'm trying to generate ARM Object file under ubuntu using arm-none-eabi package but without success.
url describing this format:
http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0041c/BCEJDJBC.html
root#ubuntu:~/arm/blink# arm-none-eabi-as hello.S
root#ubuntu:~/arm/blink# file a.out
a.out: ELF 32-bit LSB relocatable, ARM, version 1 (SYSV), not stripped
Related
I directly use the binary file you released to test on my arm64-based computer. But the test result is not normal operation. The reason is that nw interpreter needs to be /lib/ld-linux-aarch64.so.1 instead of /lib/ld-linux-armhf.so.3 on Linux version 4.19.172 for arm64.
How to compile the binary file so that the interpreter of this file is /lib/ld-linux-aarch64.so?
$ file ./nwjs-chromium-ffmpeg-branding/nwjs-v0.52.3-linux-arm/nw
$ ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 3.2.0, BuildID[xxHash]=4c8a98c5d541ac00, stripped
But, I want to get a binary executable file like this:
$ file ./nwjs-chromium-ffmpeg-branding/nwjs-v0.52.3-linux-arm/nw
$ ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, for GNU/Linux 3.2.0, BuildID[xxHash]=4c8a98c5d541ac00, stripped
I have a compiled binary of Dropbear. When I do file dbclient I get the following :
dbclient: ELF 32-bit LSB executable, ARM, version 1 (SYSV),
dynamically linked (uses shared libs), stripped
When I am trying to compile it on my own (very beginner) with
./configure --host=arm-linux-gnueabi --prefix=/ --disable-zlib
CC=arm-linux-gnueabi-gcc LD=arm-linux-gnueabi-ld make make install
I get the following after it compiled
dbclient: ELF 32-bit LSB executable, ARM, version 1 (SYSV),
dynamically linked (uses shared libs), for GNU/Linux 2.6.31,
BuildID[sha1]=0x016ac7e729afb02d60248393619b41380379777d, not stripped
For the stripped part, I don't care I could strip it later.
But my question is how to specify the "for GNU/Linux 2.6.31". What does it mean and how do I change it to target Linux 3.10.49 armv5tejl?
OpenSSL doesn't work well with valgrind unless you build it with a particular option so I've build OpenSSL again so that I can debug a program easily. The problem is, every time I build the program it links to an OpenSSL library I do not want. My makefile prints out a lot but the two lines that are most important are:
cc /usr/local/ssl/lib/libcrypto.so.1.0.0 /usr/local/ssl/lib/libssl.so.1.0.0 -L/opt/local/lib -shared -o bin/libcbitcoin-crypto.2.0.so build/CBOpenSSLCrypto.o
cc build/testCBNodeFull.o -L/home/matt/Desktop/cbitcoin/bin -lcbitcoin.2.0 -lcbitcoin-network.2.0 -lcbitcoin-storage.2.0 -lcbitcoin-threads.2.0 -lcbitcoin-logging.2.0 -lcbitcoin-crypto.2.0 -lcbitcoin.2.0 -lcbitcoin-file-ec.2.0 -lcbitcoin-rand.2.0 -L/opt/local/lib -lpthread -levent_core -levent_pthreads /usr/local/ssl/lib/libcrypto.so.1.0.0 -o bin/testCBNodeFull
As suggested elsewhere I'm specifying the precise location of the OpenSSL library I want. However ldd bin/testCBNodeFull gives me this:
libcrypto.so.1.0.0 => /lib/x86_64-linux-gnu/libcrypto.so.1.0.0
There is apparently nothing wrong with the library I want to link to:
$ file bin/testCBNodeFull
bin/testCBNodeFull: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=0xd9472ecc11e12dc66d165c807a5dbe31fd461cf2, not stripped
$ file /usr/local/ssl/lib/libcrypto.so.1.0.0
/usr/local/ssl/lib/libcrypto.so.1.0.0: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=0xb75602dc478ae55576e21aac5251b915b1653e73, not stripped
Both compiled as x86-64 as you can see. Maybe there is a tool that allows me to change the location of the shared library of the executable?
Shared libraries are loaded at runtime, not compile time. So, you need to tell valgrind which OpenSSL library you want it to use at runtime. You can do this by setting the LD_LIBRARY_PATH environment variable to the directory containing your rebuilt object.
export LD_LIBRARY_PATH=/home/matt/mylib
#now try ldd bin/testCBNodeFull
Is there a way to know what shared libraries are used from a executable file ?
From DivFix++ for example:
$ file DivFix++
DivFix++: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.15, stripped
Using ldd:
$ ldd DivFix++
You can use the ldd command which prints the shared library dependencies:
ldd DivFix++
I am using a shared library. Which I am using it to cross compile my executable. During the linking stage linker throws the error file format not recognised.
When I run ld on it libcclass.so: file not recognized: File format not recognized
When I run file libcclass.so: it gives libcclass.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), not stripped
If you're cross-compiling an executable, you also need to cross-compile all of the shared libraries it depends on, and link against those. For example, you can't link an i386 executable to an x86_64 shared library.