ld

Android NDK linking problems

此生再无相见时 提交于 2019-12-12 03:03:53
问题 I compiled Sox et al with NDK. So, I have all Android-friendly shared libs. I made a simple test file which calls a sox function. NDK build tells me: undefined reference to `sox_open_read' sox_open_read is defined in sox.h. I know it's finding sox.h because it gives me a warning about that file: In file included from (...)/sox/sox.h:19 So maybe it wants to find sox_open_read in the actual libsox.so. Well, I've tried about a 100 different ways to tell it where the sox shared lib is e.g. LOCAL

Win32 Assembly - Extern function naming (The meaning of '@')

孤街醉人 提交于 2019-12-12 02:42:31
问题 As I see, extern WinAPI functions in assembly code have names like _ExitProcess@4 . What is the meaning of the @4 part, and how to determine what number to use after @ ? I know that this has something to do with DLL we are linking against, but in many cases it's not known what number to use after the @ , and this leads to many nasty undefined reference errors. 回答1: As Andreas H answer said the number after the @ is the number of bytes the function removes from stack before the function

How to write this ld script ?

隐身守侯 提交于 2019-12-11 20:45:06
问题 If I want to link all .o files except z.o .All .o (no z.o) is relocated at 0xC0000000 while z.o is at 0xFFFF0000 but z.o is located at file offset 0x8000. So.how to write this ld script ? Here is my loader.lds SECTIONS { loader 0x00000000 : { start.o loader.o } kloader 0x30100000 : AT(4096) { loaderk.o ../lib/klib.a } vect 0xFFFF0000 : AT(0x4000) { high_vect.o } } Is this right ???? 回答1: It is much easier if you use input sections. Just using filename is not the normal way to do this. The

ld cannot find -luuid

泪湿孤枕 提交于 2019-12-11 17:25:38
问题 Attempting to cross-compile with Cmake using a toolchain file I've written for a mips processor. At 22% I get this error: /usr/local/mipsisa32r2el/r23/bin/ld: cannot find -luuid Is it LD that is missing a library? Is it possible to rectify when using a mips gcc-compiler? 回答1: Did as Tsyvarev said. git clone https://github.com/karelzak/util-linux.git Then executed the the autogen.sh to create the configure files. Finally, ./configure --host=x86_64-unknown-linux-gnu --prefix=$INSTALL_DIR CC=

riscv/gcc/ld - “Undefined reference to printf” using own script to link

最后都变了- 提交于 2019-12-11 17:23:38
问题 Currently, I'm learning RISC-V, use the RISC-V toolchain, and edit a new ld script for my embedded. I write a example, and compile to watch the opcode. Example: #include <stdio.h> //float.c int main() { float a=1.04; printf("a=%f\n",a); return 0; } My steps is: 1. riscv64-unknown-elf-gcc -S float.c  *//generate assembly code* 2. riscv64-unknown-elf-as float.s -o float.o  *//generate obj file* 3. riscv64-unknown-elf-ld -T elf64lriscv1.x float.o *//use own script to link, -T is using other

Cause link to fail if certain symbol is referenced

爱⌒轻易说出口 提交于 2019-12-11 16:46:32
问题 Is there a way to make linking fail if the code references a certain symbol from a library? I seem to remember dimly that there was such a directive in the linker script language, but apparently it was not GNU LD (maybe it's a false memory). I need it to prevent some part of a third-party library from accidentally linking into the application. If it does link, it adds some static initializers which wreak havoc at runtime (it's an embedded project so the environment is a bit quirky). I cannot

loop 0xb7 assembles but won't link

我们两清 提交于 2019-12-11 15:00:37
问题 I have the following ASM code on Debian that I am trying to compile but am having issues with both ld and gcc . uname -a: Linux kali 4.18.0-kali3-amd64 #1 SMP Debian 4.18.20-2kali2 (2018-11-30) x86_64 GNU/Linux I start off by running: nasm -f elf shellcode.asm This completes with no issues. GCC Issue... Command: gcc -m32 -o key shellcode.o Error: /usr/bin/ld: shellcode.o: in function `_start': shellcode.asm:(.text+0x0): multiple definition of `_start'; /usr/lib/gcc/x86_64-linux-gnu/8/../../..

Undefined symbols for architecture x86_64: “_SSLv2_ …”

浪尽此生 提交于 2019-12-11 13:03:58
问题 I am trying to build a small example for a Telegram Bot library in C++ (https://github.com/reo7sp/tgbot-cpp#samples) but when linking I get this output: Undefined symbols for architecture x86_64: "_SSLv2_client_method", referenced from: boost::asio::ssl::context::context(boost::asio::ssl::context_base::method) in libTgBot.a(HttpClient.cpp.o) "_SSLv2_method", referenced from: boost::asio::ssl::context::context(boost::asio::ssl::context_base::method) in libTgBot.a(HttpClient.cpp.o) "_SSLv2

Linker error - trying to link against arm, but linker using x86

若如初见. 提交于 2019-12-11 12:02:58
问题 I'm attempting to cross compile this C library as an iOS library, i.e., for an armv7 machine. I'm using an OSX machine to compile the library. The project is setup to use Autoconf - here are the options i'm using : ./configure --host=arm-apple-darwin --prefix ~/dev/xmlrpc-c-1.25.28/iOS_bin_arm CFLAGS="-arch armv7s -isysroot /Applications/XCode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk -miphoneos-version-min=4.0" --disable-curl-client --disable-cplusplus

GNU Linker - orphan sections and symbol assignment

人走茶凉 提交于 2019-12-11 10:09:11
问题 After reading enough documentation about the GNU linker, I feel confused about combining two different concepts regarding implementing custom linker file. First concept is orphan sections- If there is no output section with a matching name then new output sections will be created . Each new output section will have the same name as the orphan section placed within it. If there are multiple orphan sections with the same name, these will all be combined into one new output section . If new