本文主要是介绍关于加载器ld-linux-armhf.so.3,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
关于加载器ld-linux-armhf.so.3
这几天在搞一块am335x的板子,移植完成之后,发现在上面运行程序时候出现
-sh: ./a.out: not found
这个就很奇怪了。
后来发现并不是我的a.out找不到而是板子当前的环境下,缺少加载器。
运行 readelf a.out -a
esc_fei@fei-virtual-machine:~/test/hello$ readelf a.out -a
ELF Header:Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 Class: ELF32Data: 2's complement, little endianVersion: 1 (current)OS/ABI: UNIX - System VABI Version: 0Type: EXEC (Executable file)Machine: ARMVersion: 0x1Entry point address: 0x102f1Start of program headers: 52 (bytes into file)Start of section headers: 5236 (bytes into file)Flags: 0x5000402, has entry point, Version5 EABI, <unknown>Size of this header: 52 (bytes)Size of program headers: 32 (bytes)Number of program headers: 8Size of section headers: 40 (bytes)Number of section headers: 38Section header string table index: 35Section Headers:[Nr] Name Type Addr Off Size ES Flg Lk Inf Al[ 0] NULL 00000000 000000 000000 00 0 0 0[ 1] .interp PROGBITS 00010134 000134 000019 00 A 0 0 1[ 2] .note.ABI-tag NOTE 00010150 000150 000020 00 A 0 0 4[ 3] .note.gnu.build-i NOTE 00010170 000170 000024 00 A 0 0 4[ 4] .hash HASH 00010194 000194 000028 04 A 5 0 4[ 5] .dynsym DYNSYM 000101bc 0001bc 000050 10 A 6 1 4[ 6] .dynstr STRTAB 0001020c 00020c 000041 00 A 0 0 1[ 7] .gnu.version VERSYM 0001024e 00024e 00000a 02 A 5 0 2[ 8] .gnu.version_r VERNEED 00010258 000258 000020 00 A 6 1 4[ 9] .rel.dyn REL 00010278 000278 000008 08 A 5 0 4[10] .rel.plt REL 00010280 000280 000020 08 A 5 12 4[11] .init PROGBITS 000102a0 0002a0 00000c 00 AX 0 0 4[12] .plt PROGBITS 000102ac 0002ac 000044 04 AX 0 0 4[13] .text PROGBITS 000102f0 0002f0 00013c 00 AX 0 0 4[14] .fini PROGBITS 0001042c 00042c 000008 00 AX 0 0 4[15] .rodata PROGBITS 00010434 000434 00000c 00 A 0 0 4[16] .ARM.exidx ARM_EXIDX 00010440 000440 000008 00 AL 13 0 4[17] .eh_frame PROGBITS 00010448 000448 000004 00 A 0 0 4[18] .init_array INIT_ARRAY 0002044c 00044c 000004 00 WA 0 0 4[19] .fini_array FINI_ARRAY 00020450 000450 000004 00 WA 0 0 4[20] .jcr PROGBITS 00020454 000454 000004 00 WA 0 0 4[21] .dynamic DYNAMIC 00020458 000458 0000e8 08 WA 6 0 4[22] .got PROGBITS 00020540 000540 000020 04 WA 0 0 4[23] .data PROGBITS 00020560 000560 000008 00 WA 0 0 4[24] .bss NOBITS 00020568 000568 000004 00 WA 0 0 1[25] .comment PROGBITS 00000000 000568 00003a 01 MS 0 0 1[26] .ARM.attributes ARM_ATTRIBUTES 00000000 0005a2 000035 00 0 0 1[27] .debug_aranges PROGBITS 00000000 0005d8 0000b0 00 0 0 8[28] .debug_info PROGBITS 00000000 000688 00042e 00 0 0 1[29] .debug_abbrev PROGBITS 00000000 000ab6 000183 00 0 0 1[30] .debug_line PROGBITS 00000000 000c39 000275 00 0 0 1[31] .debug_frame PROGBITS 00000000 000eb0 000044 00 0 0 4[32] .debug_str PROGBITS 00000000 000ef4 0002f0 01 MS 0 0 1[33] .debug_loc PROGBITS 00000000 0011e4 0000bb 00 0 0 1[34] .debug_ranges PROGBITS 00000000 0012a0 000068 00 0 0 8[35] .shstrtab STRTAB 00000000 001308 00016c 00 0 0 1[36] .symtab SYMTAB 00000000 001a64 000770 10 37 94 4[37] .strtab STRTAB 00000000 0021d4 000529 00 0 0 1
Key to Flags:W (write), A (alloc), X (execute), M (merge), S (strings)I (info), L (link order), G (group), T (TLS), E (exclude), x (unknown)O (extra OS processing required) o (OS specific), p (processor specific)There are no section groups in this file.Program Headers:Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg AlignEXIDX 0x000440 0x00010440 0x00010440 0x00008 0x00008 R 0x4PHDR 0x000034 0x00010034 0x00010034 0x00100 0x00100 R E 0x4INTERP 0x000134 0x00010134 0x00010134 0x00019 0x00019 R 0x1[Requesting program interpreter: /lib/ld-linux-armhf.so.3]LOAD 0x000000 0x00010000 0x00010000 0x0044c 0x0044c R E 0x10000LOAD 0x00044c 0x0002044c 0x0002044c 0x0011c 0x00120 RW 0x10000DYNAMIC 0x000458 0x00020458 0x00020458 0x000e8 0x000e8 RW 0x4NOTE 0x000150 0x00010150 0x00010150 0x00044 0x00044 R 0x4GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x00000 RW 0x10Section to Segment mapping:Segment Sections...00 .ARM.exidx 01 02 .interp 03 .interp .note.ABI-tag .note.gnu.build-id .hash .dynsym .dynstr .gnu.version .gnu.version_r .rel.dyn .rel.plt .init .plt .text .fini .rodata .ARM.exidx .eh_frame 04 .init_array .fini_array .jcr .dynamic .got .data .bss 05 .dynamic 06 .note.ABI-tag .note.gnu.build-id 07 Dynamic section at offset 0x458 contains 24 entries:Tag Type Name/Value0x00000001 (NEEDED) Shared library: [libc.so.6]0x0000000c (INIT) 0x102a00x0000000d (FINI) 0x1042c0x00000019 (INIT_ARRAY) 0x2044c0x0000001b (INIT_ARRAYSZ) 4 (bytes)0x0000001a (FINI_ARRAY) 0x204500x0000001c (FINI_ARRAYSZ) 4 (bytes)0x00000004 (HASH) 0x101940x00000005 (STRTAB) 0x1020c0x00000006 (SYMTAB) 0x101bc0x0000000a (STRSZ) 65 (bytes)0x0000000b (SYMENT) 16 (bytes)0x00000015 (DEBUG) 0x00x00000003 (PLTGOT) 0x205400x00000002 (PLTRELSZ) 32 (bytes)0x00000014 (PLTREL) REL0x00000017 (JMPREL) 0x102800x00000011 (REL) 0x102780x00000012 (RELSZ) 8 (bytes)0x00000013 (RELENT) 8 (bytes)0x6ffffffe (VERNEED) 0x102580x6fffffff (VERNEEDNUM) 10x6ffffff0 (VERSYM) 0x1024e0x00000000 (NULL) 0x0Relocation section '.rel.dyn' at offset 0x278 contains 1 entries:Offset Info Type Sym.Value Sym. Name
0002055c 00000315 R_ARM_GLOB_DAT 00000000 __gmon_start__Relocation section '.rel.plt' at offset 0x280 contains 4 entries:Offset Info Type Sym.Value Sym. Name
0002054c 00000116 R_ARM_JUMP_SLOT 00000000 puts
00020550 00000216 R_ARM_JUMP_SLOT 00000000 __libc_start_main
00020554 00000316 R_ARM_JUMP_SLOT 00000000 __gmon_start__
00020558 00000416 R_ARM_JUMP_SLOT 00000000 abortUnwind table index '.ARM.exidx' at offset 0x440 contains 1 entries:0x102f0 <_start>: 0x1 [cantunwind]Symbol table '.dynsym' contains 5 entries:Num: Value Size Type Bind Vis Ndx Name0: 00000000 0 NOTYPE LOCAL DEFAULT UND 1: 00000000 0 FUNC GLOBAL DEFAULT UND puts@GLIBC_2.4 (2)2: 00000000 0 FUNC GLOBAL DEFAULT UND __libc_start_main@GLIBC_2.4 (2)3: 00000000 0 NOTYPE WEAK DEFAULT UND __gmon_start__4: 00000000 0 FUNC GLOBAL DEFAULT UND abort@GLIBC_2.4 (2)Symbol table '.symtab' contains 119 entries:Num: Value Size Type Bind Vis Ndx Name0: 00000000 0 NOTYPE LOCAL DEFAULT UND 1: 00010134 0 SECTION LOCAL DEFAULT 1 2: 00010150 0 SECTION LOCAL DEFAULT 2 3: 00010170 0 SECTION LOCAL DEFAULT 3 4: 00010194 0 SECTION LOCAL DEFAULT 4 5: 000101bc 0 SECTION LOCAL DEFAULT 5 6: 0001020c 0 SECTION LOCAL DEFAULT 6 7: 0001024e 0 SECTION LOCAL DEFAULT 7 8: 00010258 0 SECTION LOCAL DEFAULT 8 9: 00010278 0 SECTION LOCAL DEFAULT 9 10: 00010280 0 SECTION LOCAL DEFAULT 10 11: 000102a0 0 SECTION LOCAL DEFAULT 11 12: 000102ac 0 SECTION LOCAL DEFAULT 12 13: 000102f0 0 SECTION LOCAL DEFAULT 13 14: 0001042c 0 SECTION LOCAL DEFAULT 14 15: 00010434 0 SECTION LOCAL DEFAULT 15 16: 00010440 0 SECTION LOCAL DEFAULT 16 17: 00010448 0 SECTION LOCAL DEFAULT 17 18: 0002044c 0 SECTION LOCAL DEFAULT 18 19: 00020450 0 SECTION LOCAL DEFAULT 19 20: 00020454 0 SECTION LOCAL DEFAULT 20 21: 00020458 0 SECTION LOCAL DEFAULT 21 22: 00020540 0 SECTION LOCAL DEFAULT 22 23: 00020560 0 SECTION LOCAL DEFAULT 23 24: 00020568 0 SECTION LOCAL DEFAULT 24 25: 00000000 0 SECTION LOCAL DEFAULT 25 26: 00000000 0 SECTION LOCAL DEFAULT 26 27: 00000000 0 SECTION LOCAL DEFAULT 27 28: 00000000 0 SECTION LOCAL DEFAULT 28 29: 00000000 0 SECTION LOCAL DEFAULT 29 30: 00000000 0 SECTION LOCAL DEFAULT 30 31: 00000000 0 SECTION LOCAL DEFAULT 31 32: 00000000 0 SECTION LOCAL DEFAULT 32 33: 00000000 0 SECTION LOCAL DEFAULT 33 34: 00000000 0 SECTION LOCAL DEFAULT 34 35: 00000000 0 FILE LOCAL DEFAULT ABS /home/tcwg-buildslave/wor36: 00010150 0 NOTYPE LOCAL DEFAULT 2 $d37: 00000000 0 FILE LOCAL DEFAULT ABS /home/tcwg-buildslave/wor38: 000102f0 0 NOTYPE LOCAL DEFAULT 13 $t39: 00010440 0 NOTYPE LOCAL DEFAULT 16 $d40: 00010314 0 NOTYPE LOCAL DEFAULT 13 $d41: 0000000c 0 NOTYPE LOCAL DEFAULT 27 $d42: 00000000 0 FILE LOCAL DEFAULT ABS init.c43: 00010434 0 NOTYPE LOCAL DEFAULT 15 $d44: 00000000 0 FILE LOCAL DEFAULT ABS 45: 00020560 0 NOTYPE LOCAL DEFAULT 23 $d46: 00000000 0 FILE LOCAL DEFAULT ABS /home/esc_fei/Project/lie47: 00010320 0 NOTYPE LOCAL DEFAULT 13 $a48: 00010320 0 FUNC LOCAL DEFAULT 13 call_weak_fn49: 0001033c 0 NOTYPE LOCAL DEFAULT 13 $d50: 000102a0 0 NOTYPE LOCAL DEFAULT 11 $a51: 0001042c 0 NOTYPE LOCAL DEFAULT 14 $a52: 00000044 0 NOTYPE LOCAL DEFAULT 27 $d53: 00000000 0 FILE LOCAL DEFAULT ABS /home/esc_fei/Project/lie54: 000102a8 0 NOTYPE LOCAL DEFAULT 11 $a55: 00010430 0 NOTYPE LOCAL DEFAULT 14 $a56: 00000094 0 NOTYPE LOCAL DEFAULT 27 $d57: 00000000 0 FILE LOCAL DEFAULT ABS crtstuff.c58: 00020454 0 OBJECT LOCAL DEFAULT 20 __JCR_LIST__59: 00010344 0 NOTYPE LOCAL DEFAULT 13 $t60: 00010345 0 FUNC LOCAL DEFAULT 13 deregister_tm_clones61: 00010364 0 NOTYPE LOCAL DEFAULT 13 $d62: 00010368 0 NOTYPE LOCAL DEFAULT 13 $t63: 00010369 0 FUNC LOCAL DEFAULT 13 register_tm_clones64: 00020564 0 NOTYPE LOCAL DEFAULT 23 $d65: 00010395 0 FUNC LOCAL DEFAULT 13 __do_global_dtors_aux66: 00020568 1 OBJECT LOCAL DEFAULT 24 completed.898567: 00020450 0 NOTYPE LOCAL DEFAULT 19 $d68: 00020450 0 OBJECT LOCAL DEFAULT 19 __do_global_dtors_aux_fin69: 000103ad 0 FUNC LOCAL DEFAULT 13 frame_dummy70: 0002044c 0 NOTYPE LOCAL DEFAULT 18 $d71: 0002044c 0 OBJECT LOCAL DEFAULT 18 __frame_dummy_init_array_72: 00020568 0 NOTYPE LOCAL DEFAULT 24 $d73: 00000000 0 FILE LOCAL DEFAULT ABS main.c74: 00010438 0 NOTYPE LOCAL DEFAULT 15 $d75: 000103d0 0 NOTYPE LOCAL DEFAULT 13 $t76: 00000000 0 FILE LOCAL DEFAULT ABS elf-init.c77: 000103e8 0 NOTYPE LOCAL DEFAULT 13 $t78: 00010420 0 NOTYPE LOCAL DEFAULT 13 $d79: 00010428 0 NOTYPE LOCAL DEFAULT 13 $t80: 00000010 0 NOTYPE LOCAL DEFAULT 31 $d81: 00000000 0 FILE LOCAL DEFAULT ABS crtstuff.c82: 00010448 0 NOTYPE LOCAL DEFAULT 17 $d83: 00010448 0 OBJECT LOCAL DEFAULT 17 __FRAME_END__84: 00020454 0 NOTYPE LOCAL DEFAULT 20 $d85: 00020454 0 OBJECT LOCAL DEFAULT 20 __JCR_END__86: 00000000 0 FILE LOCAL DEFAULT ABS 87: 00020450 0 NOTYPE LOCAL DEFAULT 18 __init_array_end88: 00020458 0 OBJECT LOCAL DEFAULT 21 _DYNAMIC89: 0002044c 0 NOTYPE LOCAL DEFAULT 18 __init_array_start90: 00020540 0 OBJECT LOCAL DEFAULT 22 _GLOBAL_OFFSET_TABLE_91: 000102ac 0 NOTYPE LOCAL DEFAULT 12 $a92: 000102bc 0 NOTYPE LOCAL DEFAULT 12 $d93: 000102c0 0 NOTYPE LOCAL DEFAULT 12 $a94: 00010429 2 FUNC GLOBAL DEFAULT 13 __libc_csu_fini95: 00000000 0 NOTYPE WEAK DEFAULT UND _ITM_deregisterTMCloneTab96: 00020560 0 NOTYPE WEAK DEFAULT 23 data_start97: 00020568 0 NOTYPE GLOBAL DEFAULT 24 __bss_start__98: 0002056c 0 NOTYPE GLOBAL DEFAULT 24 _bss_end__99: 00020568 0 NOTYPE GLOBAL DEFAULT 23 _edata100: 0001042c 0 FUNC GLOBAL DEFAULT 14 _fini101: 0002056c 0 NOTYPE GLOBAL DEFAULT 24 __bss_end__102: 00020560 0 NOTYPE GLOBAL DEFAULT 23 __data_start103: 00000000 0 FUNC GLOBAL DEFAULT UND puts@@GLIBC_2.4104: 00000000 0 FUNC GLOBAL DEFAULT UND __libc_start_main@@GLIBC_105: 00000000 0 NOTYPE WEAK DEFAULT UND __gmon_start__106: 00020564 0 OBJECT GLOBAL HIDDEN 23 __dso_handle107: 00010434 4 OBJECT GLOBAL DEFAULT 15 _IO_stdin_used108: 000103e9 64 FUNC GLOBAL DEFAULT 13 __libc_csu_init109: 0002056c 0 NOTYPE GLOBAL DEFAULT 24 _end110: 000102f1 0 FUNC GLOBAL DEFAULT 13 _start111: 0002056c 0 NOTYPE GLOBAL DEFAULT 24 __end__112: 00020568 0 NOTYPE GLOBAL DEFAULT 24 __bss_start113: 000103d1 22 FUNC GLOBAL DEFAULT 13 main114: 00000000 0 NOTYPE WEAK DEFAULT UND _Jv_RegisterClasses115: 00020568 0 OBJECT GLOBAL HIDDEN 23 __TMC_END__116: 00000000 0 NOTYPE WEAK DEFAULT UND _ITM_registerTMCloneTable117: 00000000 0 FUNC GLOBAL DEFAULT UND abort@@GLIBC_2.4118: 000102a0 0 FUNC GLOBAL DEFAULT 11 _initHistogram for bucket list length (total of 3 buckets):Length Number % of total Coverage0 0 ( 0.0%)1 2 ( 66.7%) 50.0%2 1 ( 33.3%) 100.0%Version symbols section '.gnu.version' contains 5 entries:Addr: 000000000001024e Offset: 0x00024e Link: 5 (.dynsym)000: 0 (*local*) 2 (GLIBC_2.4) 2 (GLIBC_2.4) 0 (*local*) 004: 2 (GLIBC_2.4) Version needs section '.gnu.version_r' contains 1 entries:Addr: 0x0000000000010258 Offset: 0x000258 Link: 6 (.dynstr)000000: Version: 1 File: libc.so.6 Cnt: 10x0010: Name: GLIBC_2.4 Flags: none Version: 2Notes at offset 0x00000150 with length 0x00000020:Owner Data size DescriptionGNU 0x00000010 NT_GNU_ABI_TAG (ABI version tag)OS: Linux, ABI: 2.6.16Notes at offset 0x00000170 with length 0x00000024:Owner Data size DescriptionGNU 0x00000014 NT_GNU_BUILD_ID (unique build ID bitstring)Build ID: b51634e7c53710594a57b0381c219912f0685bb1
Attribute Section: aeabi
File AttributesTag_CPU_name: "7-A"Tag_CPU_arch: v7Tag_CPU_arch_profile: ApplicationTag_ARM_ISA_use: YesTag_THUMB_ISA_use: Thumb-2Tag_FP_arch: VFPv3-D16Tag_ABI_PCS_wchar_t: 4Tag_ABI_FP_rounding: NeededTag_ABI_FP_denormal: NeededTag_ABI_FP_exceptions: NeededTag_ABI_FP_number_model: IEEE 754Tag_ABI_align_needed: 8-byteTag_ABI_align_preserved: 8-byte, except leaf SPTag_ABI_enum_size: intTag_ABI_HardFP_use: SP and DPTag_ABI_VFP_args: VFP registersTag_CPU_unaligned_access: v6
中间出现一行
[Requesting program interpreter: /lib/ld-linux-armhf.so.3]
说明运行该文件需要/lib/ld-linux-armhf.so.3文件。
接下来是两步
- 在/etc/profile下加入
export LD_LIBRARY_PATH=/lib:$LD_LIBRARY_PATH
- 在/lib下运行
ln -s ld-2.12.2.so ld-linux-armhf.so.3
然后
root@am335x-evm:/mnt/nfs/test/hello# ./a.out
hello
OK!
这篇关于关于加载器ld-linux-armhf.so.3的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!