0
내가 자일링스 SDK에 workind입니다 자일링스 SDK에, 우 dlclose를 dlopen.dlsym, 나는 작업 공유 librariesand 내가 creatind 라이브러리 후 aarch64-none-elf-gcc -shared -o libhello.so ../src/helloworld.o
정의되지 않은 참조
를 사용하여 하나의 공유 라이브러리 ( libhello.so )를 생성하고 내가 dynamiclly
void *handle;
void (*foo)(void);
handle = dlopen("/proj/ssw_xhd/boot/balakrish/workspace/hello_world/Debug/libhello.so", RTLD_GLOBAL);
foo = dlsym(handle,"foo");
if (foo){
library_function();
}
dlclose(handle);
로 내 C 파일에서로드 그러나
<artificial>:(.text.startup+0x18c): undefined reference to `dlopen'
<artificial>:(.text.startup+0x18c): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `dlopen'
<artificial>:(.text.startup+0x1a0): undefined reference to `dlsym'
<artificial>:(.text.startup+0x1a0): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `dlsym'
<artificial>:(.text.startup+0x1a8): undefined reference to `library_function'
<artificial>:(.text.startup+0x1a8): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `library_function'
<artificial>:(.text.startup+0x1b0): undefined reference to `dlclose'
<artificial>:(.text.startup+0x1b0): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `dlclose'
collect2: error: ld returned 1 exit status
make: *** [fsbl.elf] Error 1
다음과 같이 나는 오류를 얻고있다3210 또한 -ldl을 추가하려고 시도했습니다. C/C++ 빌드 설정 -> ARM v8 gcc 링커 -> 라이브러리 -> 라이브러리 (dl) -> 라이브러리 경로 (/ usr/lib/또는/usr/lib64 /) 그리고 리눅스 (인텔)에서 크로스 컴파일하는 경우 무장
Building target: fsbl.elf
Invoking: ARM v8 gcc linker
aarch64-none-elf-gcc -L"/proj/ssw_xhd/boot/balakrish/workspace/hello_world/Debug" -L/usr/lib64/ -L/usr/local/lib -Wl,-T -Wl,../src/lscript.ld -L../../fsbl_bsp/psu_cortexa53_0/lib -o "fsbl.elf" ./src/psu_init.o ./src/xfsbl_authentication.o ./src/xfsbl_board.o ./src/xfsbl_bs.o ./src/xfsbl_csu_dma.o ./src/xfsbl_dfu_util.o ./src/xfsbl_exit.o ./src/xfsbl_handoff.o ./src/xfsbl_hooks.o ./src/xfsbl_image_header.o ./src/xfsbl_initialization.o ./src/xfsbl_main.o ./src/xfsbl_misc.o ./src/xfsbl_misc_drivers.o ./src/xfsbl_nand.o ./src/xfsbl_partition_load.o ./src/xfsbl_plpartition_valid.o ./src/xfsbl_qspi.o ./src/xfsbl_rsa_sha.o ./src/xfsbl_sd.o ./src/xfsbl_translation_table.o ./src/xfsbl_usb.o -lhello -ldl -Wl,--start-group,-lxil,-lgcc,-lc,--end-group -Wl,--start-group,-lxilffs,-lxil,-lgcc,-lc,--end-group -Wl,--start-group,-lxilsecure,-lxil,-lgcc,-lc,--end-group -Wl,--start-group,-lxilpm,-lxil,-lgcc,-lc,--end-group -n
/wrk/released/2017.3/GA/2017.3_1005_1/installs/lin64/SDK/2017.3/gnu/aarch64/lin/aarch64-none/bin/../lib/gcc/aarch64-none-elf/6.2.1/../../../../aarch64-none-elf/bin/ld: cannot find -ldl
collect2: error: ld returned 1 exit status
make: *** [fsbl.elf] Error 1
14:08:01 Build Finished (took 5s.747ms)
안녕하세요, 크로스 컴파일에서 -ldl에 액세스하는 방법은 -L /wrk/released/2017.3/GA/2017.3_1005_1/installs/lin64/SDK/2017.3/gnu/aarch64/lin/aarch64-none을 사용할 수 있습니까? /bin/../lib/gcc/aarch64-none-elf/6.2.1/../../../../aarch64-none-elf/bin/ld –
libdl.so * 파일이있는 팔 SDK의 PATH를 찾으십시오. 그리고 -ld와 함께 -L과 함께 PATH를 사용하십시오. – awahl