dynamic-linking

CUDA nvcc building chain of libraries

心不动则不痛 提交于 2021-01-29 00:16:39
问题 My goal is: library2.so is using library1.so and mycode.o is using (libs should be linked) library2.so (and maybe library1.so ). The source code is (one line header files are omitted): library1.cu: __device__ void func1_lib1(void){} library2.cu: #include "library1.h" __global__ void func1_lib2(void) { func1_lib1(); } extern "C" void func2_lib2(void) { func1_lib2<<<1,1>>>(); } mycode.c: #include "library2.h" int main(void) { func2_lib2(); } I'm building the shared libraries according to with

CUDA nvcc building chain of libraries

孤街浪徒 提交于 2021-01-29 00:09:35
问题 My goal is: library2.so is using library1.so and mycode.o is using (libs should be linked) library2.so (and maybe library1.so ). The source code is (one line header files are omitted): library1.cu: __device__ void func1_lib1(void){} library2.cu: #include "library1.h" __global__ void func1_lib2(void) { func1_lib1(); } extern "C" void func2_lib2(void) { func1_lib2<<<1,1>>>(); } mycode.c: #include "library2.h" int main(void) { func2_lib2(); } I'm building the shared libraries according to with

CUDA nvcc building chain of libraries

你离开我真会死。 提交于 2021-01-29 00:05:09
问题 My goal is: library2.so is using library1.so and mycode.o is using (libs should be linked) library2.so (and maybe library1.so ). The source code is (one line header files are omitted): library1.cu: __device__ void func1_lib1(void){} library2.cu: #include "library1.h" __global__ void func1_lib2(void) { func1_lib1(); } extern "C" void func2_lib2(void) { func1_lib2<<<1,1>>>(); } mycode.c: #include "library2.h" int main(void) { func2_lib2(); } I'm building the shared libraries according to with

Wrapping a glibc function using the dynamic linker

我与影子孤独终老i 提交于 2021-01-27 08:00:47
问题 I am trying to wrap the GLIBC fstat function (it could be any other: it is just a proof of concept) by injecting my library to an executable. I do this by placing my library where the executable's RPATH is pointing with the name libc.so.6 . The source code of my library is the one below: #define _GNU_SOURCE #include <stdio.h> #include <sys/stat.h> #include <sys/types.h> #include <dlfcn.h> int fstat(int fd, struct stat *buf){ typeof(fstat) *old_fstat; // Try with a printf... printf("HOOT!

Wrapping a glibc function using the dynamic linker

早过忘川 提交于 2021-01-27 07:58:08
问题 I am trying to wrap the GLIBC fstat function (it could be any other: it is just a proof of concept) by injecting my library to an executable. I do this by placing my library where the executable's RPATH is pointing with the name libc.so.6 . The source code of my library is the one below: #define _GNU_SOURCE #include <stdio.h> #include <sys/stat.h> #include <sys/types.h> #include <dlfcn.h> int fstat(int fd, struct stat *buf){ typeof(fstat) *old_fstat; // Try with a printf... printf("HOOT!

how to understand fields of Relocation section '.rela.plt'

人盡茶涼 提交于 2021-01-01 04:43:52
问题 I'm trying to understand the dynamic linking of shared libraries on Linux. Given the following dump of Relocation section '.rela.plt': Offset Info Type Sym. Value Sym. Name + Addend 000000373f68 0f8300000007 R_X86_64_JUMP_SLO 0000000000000000 _ZN8CashFlowmIERK7Paym + 0 000000373f70 0f9800000007 R_X86_64_JUMP_SLO 0000000000000000 _Z8printCapPK3CapP8_IO + 0 000000373f78 0f9900000007 R_X86_64_JUMP_SLO 0000000000000000 _ZN13SharedBaggage16ge + 0 000000373f80 0f9c00000007 R_X86_64_JUMP_SLO

How can I change the following static linked program into dynamic linked program?

时光毁灭记忆、已成空白 提交于 2020-12-14 23:48:40
问题 I have already figure out how to staticly link v8 with my own GLIBC/STDC++. $(GCC_ROOT)/bin/g++ samples/bench.cpp -o bench -isystem$(GLIBC_ROOT)/include/ -I. -Iinclude -isystem$(GLIBC) -nodefaultlibs -DV8_COMPRESS_POINTERS -static $(V8_OBJ)/libv8_monolith.a -Wl,--start-group $(GCC_ROOT)/lib64/libstdc++.a $(GLIBC_ROOT)/lib/libpthread.a $(GLIBC_ROOT)/lib/libdl.a $(GLIBC_ROOT)/lib/libm.a $(GLIBC_ROOT)/lib/librt.a $(GCC_GCC)/libgcc.a $(GCC_GCC)/libgcc_eh.a $(GCC_GCC)/libcommon.a $(GLIBC_ROOT)/lib

How can I change the following static linked program into dynamic linked program?

故事扮演 提交于 2020-12-14 23:39:05
问题 I have already figure out how to staticly link v8 with my own GLIBC/STDC++. $(GCC_ROOT)/bin/g++ samples/bench.cpp -o bench -isystem$(GLIBC_ROOT)/include/ -I. -Iinclude -isystem$(GLIBC) -nodefaultlibs -DV8_COMPRESS_POINTERS -static $(V8_OBJ)/libv8_monolith.a -Wl,--start-group $(GCC_ROOT)/lib64/libstdc++.a $(GLIBC_ROOT)/lib/libpthread.a $(GLIBC_ROOT)/lib/libdl.a $(GLIBC_ROOT)/lib/libm.a $(GLIBC_ROOT)/lib/librt.a $(GCC_GCC)/libgcc.a $(GCC_GCC)/libgcc_eh.a $(GCC_GCC)/libcommon.a $(GLIBC_ROOT)/lib

Assembler output does not run on my Linux machine

我们两清 提交于 2020-12-13 04:54:00
问题 I followed up this page and compiled the following code ; assembly program that calls a C function on 64-bit Linux ; ; int main(void) { ; printf(fmt, 1, msg1); ; printf(fmt, 2, msg2); ; return 0; ; ; Assemble in 64-bit: nasm -f elf64 -o hp64.o -l hp64.lst hello-printf-64.asm ; ; Link: ld hp64.o -o hp64 -lc --dynamic-linker /lib/ld-2.7.so ; or maybe ld hp64.o -o hp64 -lc --dynamic-linker /lib/ld-linux-x86-64.so.2 ; (the "-lc" option is needed to resolve "printf") ;-----------------------------

Assembler output does not run on my Linux machine

霸气de小男生 提交于 2020-12-13 04:50:05
问题 I followed up this page and compiled the following code ; assembly program that calls a C function on 64-bit Linux ; ; int main(void) { ; printf(fmt, 1, msg1); ; printf(fmt, 2, msg2); ; return 0; ; ; Assemble in 64-bit: nasm -f elf64 -o hp64.o -l hp64.lst hello-printf-64.asm ; ; Link: ld hp64.o -o hp64 -lc --dynamic-linker /lib/ld-2.7.so ; or maybe ld hp64.o -o hp64 -lc --dynamic-linker /lib/ld-linux-x86-64.so.2 ; (the "-lc" option is needed to resolve "printf") ;-----------------------------