导航:首页 > 源码编译 > 查看文件使用编译链

查看文件使用编译链

发布时间:2022-05-24 04:28:06

linux下如何查看.a.so文件是由什么文件编译连接

linux下如何查看.a.so文件是由什么文件编译连接
so文件就是通常说的动态链接库,就跟windows下的dll文件差不多。
ko是内核模块文件,驱动之类的啥的。
不过在linux系统下文件的后缀多数情况下只是个标识,有可能代表不了文件的真实属性的。
至于怎么编写,就跟用VS编译dll或者lib文件差不多,把你的代码编译完成以后命名为相应的后缀就好了。
我了解的一般都是C程序,java属于脚本语言,程序多数情况下是被解释执行的,所以一般不需要编译成库。至于如何编译成库文件,如果你在windows下做过开发的话应该不用我解释太多。实在不知道的话可以再问我哈~~
希望以上回答能对你有所帮助。

❷ 如何查看程序被哪个版本编译器编译的linux-gcc

那是不可能的,除非你加入了调试信息,也就是编译的时候加入了-g参数,然后用gdb调试就可以显示。最大程度上查看一个elf文件信息。



readelf -Wa a.out | head
readelf -wi a.out
readelf -p .comment a.out
objmp -s --section .comment audioplayer



如下:

[root@localhost rootfs]# readelf -Wa bin/gzip

复制代码
ELF Header:
Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00
Class: ELF32
Data: 2's complement, little endian
Version: 1 (current)
OS/ABI: UNIX - System V
ABI Version: 0
Type: EXEC (Executable file)
Machine: ARM
Version: 0x1
Entry point address: 0xa080
Start of program headers: 52 (bytes into file)
Start of section headers: 1975444 (bytes into file)
Flags: 0x5000002, has entry point, Version5 EABI
Size of this header: 52 (bytes)
Size of program headers: 32 (bytes)
Number of program headers: 6
Size of section headers: 40 (bytes)
Number of section headers: 25
Section header string table index: 24

Section Headers:
[Nr] Name Type Addr Off Size ES Flg Lk Inf Al
[ 0] NULL 00000000 000000 000000 00 0 0 0
[ 1] .note.ABI-tag NOTE 000080f4 0000f4 000020 00 A 0 0 4
[ 2] .init PROGBITS 00008114 000114 00000c 00 AX 0 0 4
[ 3] .text PROGBITS 00008120 000120 17fcfc 00 AX 0 0 16
[ 4] __libc_freeres_fn PROGBITS 00187e1c 17fe1c 000f20 00 AX 0 0 4
[ 5] __libc_thread_fre PROGBITS 00188d3c 180d3c 0000e4 00 AX 0 0 4
[ 6] .fini PROGBITS 00188e20 180e20 000008 00 AX 0 0 4
[ 7] .rodata PROGBITS 00188e28 180e28 058147 00 A 0 0 8
[ 8] __libc_subfreeres PROGBITS 001e0f70 1d8f70 00005c 00 A 0 0 4
[ 9] __libc_atexit PROGBITS 001e0fcc 1d8fcc 000004 00 A 0 0 4
[10] __libc_thread_sub PROGBITS 001e0fd0 1d8fd0 000008 00 A 0 0 4
[11] .ARM.extab PROGBITS 001e0fd8 1d8fd8 001b04 00 A 0 0 4
[12] .ARM.exidx ARM_EXIDX 001e2adc 1daadc 006ea8 00 AL 3 0 4
[13] .tdata PROGBITS 001f1984 1e1984 000018 00 WAT 0 0 4
[14] .tbss NOBITS 001f199c 1e199c 000034 00 WAT 0 0 4
[15] .init_array INIT_ARRAY 001f199c 1e199c 000004 00 WA 0 0 4
[16] .fini_array FINI_ARRAY 001f19a0 1e19a0 000008 00 WA 0 0 4
[17] .jcr PROGBITS 001f19a8 1e19a8 000004 00 WA 0 0 4
[18] .data.rel.ro PROGBITS 001f19ac 1e19ac 00002c 00 WA 0 0 4
[19] .got PROGBITS 001f19d8 1e19d8 00007c 04 WA 0 0 4
[20] .data PROGBITS 001f1a58 1e1a58 0008f7 00 WA 0 0 8
[21] .bss NOBITS 001f2350 1e234f 004828 00 WA 0 0 8
[22] __libc_freeres_pt NOBITS 001f6b78 1e234f 00003c 00 WA 0 0 4
[23] .ARM.attributes ARM_ATTRIBUTES 00000000 1e234f 00002b 00 0 0 1
[24] .shstrtab STRTAB 00000000 1e237a 000118 00 0 0 1

Section to Segment mapping:
Segment Sections...
00 .ARM.exidx
01 .note.ABI-tag .init .text __libc_freeres_fn __libc_thread_freeres_fn .fini .rodata __libc_subfreeres __libc_atexit __libc_thread_subfreeres .ARM.extab .ARM.exidx
02 .tdata .init_array .fini_array .jcr .data.rel.ro .got .data .bss __libc_freeres_ptrs
03 .note.ABI-tag
04 .tdata .tbss

Attribute Section: aeabi
File Attributes
Tag_CPU_name: "5TE"
Tag_CPU_arch: v5TE
Tag_ARM_ISA_use: Yes
Tag_THUMB_ISA_use: Thumb-1
Tag_ABI_PCS_wchar_t: 4
Tag_ABI_FP_denormal: Needed
Tag_ABI_FP_exceptions: Needed
Tag_ABI_FP_number_model: IEEE 754
Tag_ABI_align8_needed: Yes
Tag_ABI_align8_preserved: Yes, except leaf SP
Tag_ABI_enum_size: int
Tag_unknown_44: 1 (0x1)
复制代码

How to retrieve the GCC version used to compile a given ELF executable? http://stackoverflow.com/questions/2387040/how-to-retrieve-the-gcc-version-used-to-compile-a-given-elf-executable

QUES: I'd like to retrieve the GCC version used to compile a given executable. I tried readelf but didn't get the information. Any thoughts?

ANS: To complete what others have said: it's not stored in the object (or exe) file, unless you compile with debugging information! (option -g). If you compile with debug info, you can get it back with readelf:

复制代码
[root@localhost test]# gcc a.c
[root@localhost test]# readelf -wi a.out
[root@localhost test]# gcc a.c -g
[root@localhost test]# readelf -wi a.out
The section .debug_info contains:

Compilation Unit @ offset 0x0:
Length: 135
Version: 2
Abbrev Offset: 0
Pointer Size: 8
<0><b>: Abbrev Number: 1 (DW_TAG_compile_unit)
DW_AT_stmt_list : 0
DW_AT_high_pc : 0x400453
DW_AT_low_pc : 0x400448
DW_AT_procer : GNU C 4.1.2 20080704 (Red Hat 4.1.2-55)
DW_AT_language : 1 (ANSI C)
DW_AT_name : a.c
DW_AT_comp_dir : /work/farsight/test
<1><61>: Abbrev Number: 2 (DW_TAG_subprogram)
DW_AT_external : 1
DW_AT_name : main
DW_AT_decl_file : 1
DW_AT_decl_line : 4
DW_AT_prototyped : 1
DW_AT_type : <83>
DW_AT_low_pc : 0x400448
DW_AT_high_pc : 0x400453
DW_AT_frame_base : 0 (location list)
<1><83>: Abbrev Number: 3 (DW_TAG_base_type)
DW_AT_name : int
DW_AT_byte_size : 4
DW_AT_encoding : 5 (signed)
复制代码

ANS2:

❸ 在linux系统下怎么用编译工具链编译源代码

一般是用的GNU的那一套工具链

比如你写了一个源码为main.c

然后gcc main.c即可,生成的a,out为可执行的ELF文件。

如果你需要了解GCC的详解资料,最好读一下它的man pages

❹ 怎么查看一个可执行程序是由什么编译器生成的

不同编译器组装二进制文件的时候是有不同的风格的,于是程序可以通过这个来“猜测”是用什么编译器写的。为什么是猜测呢?因为这个风格是可以伪装的,比如某些加密壳把自己伪装成某种编译器来欺骗用户自己没有加壳,如果用户上当会对分析产生一些麻烦。

❺ 如何查看执行文件或者库文件的编译器版本

ldd 查看可执行文件链接了哪些 系统动态链接库 nm 查看可执行文件里面有哪些符号 strip 去除符号表可以给可执行文件瘦身 如果我们想从可执行程序里面提取出来一点什么文本信息的话,还可以用strings命令 strings Linux操作系统上面的动态共享库...

❻ 怎么查看linux库是使用哪个版本的编译器编译的

如果是你自己编译的
那么gcc
-v
查看本机版本号。
如果是你拿到的别人的,可以
objmp -s --section=.comment your_program查看程序编译器版本

❼ 怎么查看.so或者.a文件是用什么工具编译生成的

file xxx.so

❽ 怎么查看android编译时候交叉编译链工具位置

经常搞嵌入式开发的朋友对于交叉编译环境应该并不陌生,说白了,就是一组运行在x86 PC机的编译工具,可以让你在PC机上编译出目标平台(例如ARM)可识别的二进制文件。Android平台也提供了这样的交叉编译工具链,就放在Android的NDK开发包的toolchains目录下,因此,我们的Makefile文件中,只需给出相应的编译工具即可。
废话就先说到这,直接上例子,我们目标是把下面这个math.c文件编译成一个静态库文件:
#include <stdio.h>
int add( int a , int b ) {
return a+b;
}
你需要编写一个Makefile文件,这里假设你的Android ndk被安装在 /opt/android/ndk 目录下,当然,你可以根据自己的实际情况修改Makefile中相关路径的定义,Makefile文件示例如下:
# Makefile Written by ticktick
# Show how to cross-compile c/c++ code for android platform
.PHONY: clean
NDKROOT=/opt/android/ndk
PLATFORM=$(NDKROOT)/platforms/android-14/arch-arm
CROSS_COMPILE=$(NDKROOT)/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/arm-linux-androideabi-
CC=$(CROSS_COMPILE)gcc
AR=$(CROSS_COMPILE)ar
LD=$(CROSS_COMPILE)ld
CFLAGS = -I$(PWD) -I$(PLATFORM)/usr/include -Wall -O2 -fPIC -DANDROID -DHAVE_PTHREAD -mfpu=neon -mfloat-abi=softfp
LDFLAGS =

❾ 如何查看一个dll是用什么编译器编译的

dll文件是系统的动态链接库文件,可以用一些十六位春文本编辑器打开,如UltraEdit
修改DLL文件的方法
1、下载DLL文件修改工具EXESCOPE6.0-6.3或6.4工具
2、获取Browselc.dll、Shdoclc.dll、Shell32.dll和Cryptui.dll这几个链接文件。在找这几个文件时,最好将其他机器的硬盘,挂接在本机中,然后用本机的操作系统启动并复制这几个文件。
3、在修改DLL文件的时候,打开该键值,在右面的对话框中将所要修改的键值禁用即可,不要删除,以备日后恢复

阅读全文

与查看文件使用编译链相关的资料

热点内容
程序员共享网站 浏览:935
搬家服务app怎么开发 浏览:414
腾讯云外卖服务器 浏览:154
单片机1602显示程序 浏览:255
php检测网络 浏览:336
程序员面试金典第6版 浏览:718
内存2g编译安卓 浏览:414
单片机小数点怎么亮 浏览:414
安卓手机怎么设置健康码双击两下就出来 浏览:266
同一个文件夹可以存在两个相同的文件吗 浏览:535
动态重编译jit 浏览:132
android蓝牙音频 浏览:451
mc国际版怎么加服务器 浏览:816
phphtaccess配置 浏览:747
dos命令锁定 浏览:486
python中调换数据位置 浏览:300
武汉市中石油加油什么APP优惠 浏览:545
程序员33岁以后的规划 浏览:858
招标文件加密流转 浏览:897
源码数据盈利可信吗 浏览:860