ld

Can't link a shared library from an x86-64 object from assembly because of PIC

依然范特西╮ 提交于 2020-03-14 14:47:27
问题 I'm porting a shared library from 32-bit to 64-bit. It's composed of some assembly (written for NASM) that exports several procedures and a little bit of higher-level C glue code. I'm building on a 64-bit Debian machine with NASM 2.10.01 and GNU ld 2.22. Having fixed all the push/pop issues (pushing 32-bit parts of registers obviously won't work in 64-bit mode), I've got the object to assemble, but now I'm halted by the linking stage. Here are my command lines - assembly: nasm -Ox -dPTC_ARCH

Can't link a shared library from an x86-64 object from assembly because of PIC

六眼飞鱼酱① 提交于 2020-03-14 14:45:05
问题 I'm porting a shared library from 32-bit to 64-bit. It's composed of some assembly (written for NASM) that exports several procedures and a little bit of higher-level C glue code. I'm building on a 64-bit Debian machine with NASM 2.10.01 and GNU ld 2.22. Having fixed all the push/pop issues (pushing 32-bit parts of registers obviously won't work in 64-bit mode), I've got the object to assemble, but now I'm halted by the linking stage. Here are my command lines - assembly: nasm -Ox -dPTC_ARCH

Missing a library in ldd after using gcc -l

不羁岁月 提交于 2020-02-20 07:13:06
问题 I'm compiling an executable called "interrogate" with: g++ -o built/bin/interrogate -Lbuilt/lib -Lbuilt/tmp -L/usr/X11R6/lib \ built/tmp/interrogate_composite1.o built/tmp/interrogate_composite2.o \ -lp3cppParser -lp3dtool -lp3dtoolconfig -lp3pystub -pthread -ldl After the compilation, when i try to execute the executable: $ LD_LIBRARY_PATH=built/lib built/bin/interrogate built/bin/interrogate: symbol lookup error: built/lib/libp3dtool.so.1.8: undefined symbol: _Py_NoneStruct This symbol is

Missing a library in ldd after using gcc -l

风流意气都作罢 提交于 2020-02-20 07:12:22
问题 I'm compiling an executable called "interrogate" with: g++ -o built/bin/interrogate -Lbuilt/lib -Lbuilt/tmp -L/usr/X11R6/lib \ built/tmp/interrogate_composite1.o built/tmp/interrogate_composite2.o \ -lp3cppParser -lp3dtool -lp3dtoolconfig -lp3pystub -pthread -ldl After the compilation, when i try to execute the executable: $ LD_LIBRARY_PATH=built/lib built/bin/interrogate built/bin/interrogate: symbol lookup error: built/lib/libp3dtool.so.1.8: undefined symbol: _Py_NoneStruct This symbol is

Linker errors when using boost serialization

╄→гoц情女王★ 提交于 2020-02-19 09:48:51
问题 I am using boost serialization. I compiled with: -L/opt/local/lib -lboost_serialization -stdlib=libc++ , but got several (ungooglable) errors: Undefined symbols for architecture x86_64: "boost::archive::text_oarchive_impl::save(std::__1::basic_string, std::__1::allocator > const&)", referenced from: void boost::archive::save_access::save_primitive, std::__1::allocator > >(boost::archive::text_oarchive&, std::__1::basic_string, std::__1::allocator > const&) in main.o "boost::archive::basic

Difference between *(.data), *(.data*) and *(.data.*) in linker script

十年热恋 提交于 2020-01-24 19:11:37
问题 Just curious to know what is the difference between such constructions (for text , data , rodata , bss etc) in linker script: .data : { *(.data) } .data : { *(.data*) } .data : { *(.data.*) } In all cases we gather data sections from all object files, but the devil is in the detail. Fast test showed that addresses in map file differ and in turn it influences the size of executable file. I tried to find the information in ld documentation but found nothing (or just missed it). I guess that it

Difference between *(.data), *(.data*) and *(.data.*) in linker script

六眼飞鱼酱① 提交于 2020-01-24 19:11:13
问题 Just curious to know what is the difference between such constructions (for text , data , rodata , bss etc) in linker script: .data : { *(.data) } .data : { *(.data*) } .data : { *(.data.*) } In all cases we gather data sections from all object files, but the devil is in the detail. Fast test showed that addresses in map file differ and in turn it influences the size of executable file. I tried to find the information in ld documentation but found nothing (or just missed it). I guess that it

how to link a static library for iOS

隐身守侯 提交于 2020-01-23 00:45:53
问题 I have create a bunch of .o files (via gcc -c $file.c $someotherops -o $file.o ). Now I want to link them into a static library. I'm not exactly sure wether I am supposed to use ld or gcc for this. In the ld manual, it is said that I'm not supposed to use it directly. However, I cannot figure out the gcc parameters to create a static library. I tried ld *.o -static -o libfoo.a but it complains about a lot of missing symbols (I think all from libc). I don't understand why it complains because

undefined reference to `log'

天大地大妈咪最大 提交于 2020-01-22 04:50:28
问题 I am trying to compile the implementation of the RFC 3797 random selection algorithm by Donald Eastlake (code: http://kambing.ui.ac.id/minix/other/rfc3797/). However, I am getting a linker error: rfc3797.c:(.text+0xe7f): undefined reference to `log' I am trying to make it with the provided Makefile, which explicitly links against the math libraray, but I still get the error: cc -lm -o randomselection rfc3797.c MD5.c How can I compile this program? 回答1: I don't know what the reason is, but if

undefined reference to `log'

心不动则不痛 提交于 2020-01-22 04:50:05
问题 I am trying to compile the implementation of the RFC 3797 random selection algorithm by Donald Eastlake (code: http://kambing.ui.ac.id/minix/other/rfc3797/). However, I am getting a linker error: rfc3797.c:(.text+0xe7f): undefined reference to `log' I am trying to make it with the provided Makefile, which explicitly links against the math libraray, but I still get the error: cc -lm -o randomselection rfc3797.c MD5.c How can I compile this program? 回答1: I don't know what the reason is, but if