arm-linux-ld

可以将程序链接成我们arm平台下的可运行的程序

以之前使用过的led程序为例:

首先:

 arm-linux-gcc -g -c led.S (-g是表示产生调试信息, -c是表示只编译不链接)

产生led.o文件

 arm-linux-ld -Tled.lds -o led.elf led.o

产生.elf格式的文件

然后通过:

arm-linux-readelf命令:读出.elf的详细内容:

 arm-linux-readelf -a led.elf(显示所有的log信息)

摘网上一幅图显示.elf格式的内容:

(该图片使用的是Linux C编程作者 宋劲斌的图片)

log信息:(红色的自己修改的)

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(可运行在ARM平台上)

Version:                           0x1

Entry point address:               0xd0020000

Start of program headers:          52 (bytes into file)

Start of section headers:          33192 (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:         1

Size of section headers:           40 (bytes)

Number of section headers:         10

Section header string table index: 7

Section Headers:

[Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf Al

[ 0]                   NULL            00000000 000000 000000 00      0   0  0

[ 1] .text             PROGBITS        d0020000 008000 00004c 00  AX  0   0  4

[ 2] .ARM.attributes   ARM_ATTRIBUTES  00000000 00804c 000018 00      0   0  1

[ 3] .debug_line       PROGBITS        00000000 008064 000045 00      0   0  1

[ 4] .debug_info       PROGBITS        00000000 0080a9 000061 00      0   0  1

[ 5] .debug_abbrev     PROGBITS        00000000 00810a 000014 00      0   0  1

[ 6] .debug_aranges    PROGBITS        00000000 008120 000020 00      0   0  8

[ 7] .shstrtab         STRTAB          00000000 008140 000066 00      0   0  1

[ 8] .symtab           SYMTAB          00000000 008338 0000e0 10      9  11  4

[ 9] .strtab           STRTAB          00000000 008418 000033 00      0   0  1

Key to Flags:

W (write), A (alloc), X (execute), M (merge), S (strings)

I (info), L (link order), G (group), 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 Align

LOAD           0x008000 0xd0020000 0xd0020000 0x0004c 0x0004c R E 0x8000

Section to Segment mapping:

Segment Sections...

00     .text

There is no dynamic section in this file.

There are no relocations in this file.

There are no unwind sections in this file.

Symbol table '.symtab' contains 14 entries:

Num:    Value  Size Type    Bind   Vis      Ndx Name

0: 00000000     0 NOTYPE  LOCAL  DEFAULT  UND

1: d0020000     0 SECTION LOCAL  DEFAULT    1

2: 00000000     0 SECTION LOCAL  DEFAULT    2

3: 00000000     0 SECTION LOCAL  DEFAULT    3

4: 00000000     0 SECTION LOCAL  DEFAULT    4

5: 00000000     0 SECTION LOCAL  DEFAULT    5

6: 00000000     0 SECTION LOCAL  DEFAULT    6

7: d0020000     0 NOTYPE  LOCAL  DEFAULT    1 $a

8: d0020008     0 NOTYPE  LOCAL  DEFAULT    1 led_debug

9: d0020004     0 NOTYPE  LOCAL  DEFAULT    1 MAIN_LOOP

10: d0020044     0 NOTYPE  LOCAL  DEFAULT    1 $d

11: d0020000     0 NOTYPE  GLOBAL DEFAULT    1 _start

12: d002004c     0 NOTYPE  GLOBAL DEFAULT  ABS __bss_start

13: d002004c     0 NOTYPE  GLOBAL DEFAULT  ABS _end

No version information found in this file.

Attribute Section: aeabi

File Attributes

Tag_CPU_name: "4T"

Tag_CPU_arch: v4T

Tag_ARM_ISA_use: Yes

log信息:

Tag        Type                         Name/Value

0x00000001 (NEEDED)         Shared library: [libc.so.6](这就是需要用到的库) 0x0000000c (INIT)                        0x8274

0x0000000d (FINI)                       0x841c

0x00000019 (INIT_ARRAY)                 0x10448

0x0000001b (INIT_ARRAYSZ)               4 (bytes)

0x0000001a (FINI_ARRAY)                 0x1044c

0x0000001c (FINI_ARRAYSZ)               4 (bytes)

0x00000004 (HASH)                       0x8168

0x00000005 (STRTAB)                     0x81e0

0x00000006 (SYMTAB)                     0x8190

0x0000000a (STRSZ)                      65 (bytes)

0x0000000b (SYMENT)                     16 (bytes)

0x00000015 (DEBUG)                      0x0

0x00000003 (PLTGOT)                     0x1053c

0x00000002 (PLTRELSZ)                   32 (bytes)

0x00000014 (PLTREL)                     REL

0x00000017 (JMPREL)                     0x8254

0x00000011 (REL)                        0x824c

0x00000012 (RELSZ)                      8 (bytes)

0x00000013 (RELENT)                     8 (bytes)

0x6ffffffe (VERNEED)                    0x822c

0x6fffffff (VERNEEDNUM)                 1

0x6ffffff0 (VERSYM)                     0x8222

0x00000000 (NULL)                       0x0

最新文章

  1. redis-window 集群配置
  2. java常用工具
  3. maven-各配置文件详解
  4. freemarker内置函数和用法
  5. 一眼看懂KMP匹配算法
  6. ASP.NET管道
  7. Moom for mac 最棒的窗口管理软件
  8. 2016全国研究生数学建模A题多无人机协同任务规划——基于分布式协同多旅行商MTSP遗传算法
  9. 发布HTML5 RTS游戏-古代战争
  10. SQLHelper初实现---杨中科版(易懂,代码多点)
  11. Silverlight引用WebService时取消对ServiceReferences.ClientConfig文件的依赖
  12. Pomodairo,番茄工作法-应用篇
  13. 【字符串处理】HDOJ-1020-Encoding
  14. python实现的基于TCP的JSON数据通信
  15. kali rolling 安装typecho
  16. POJ 3683 Priest John's Busiest Day
  17. ldap数据库--ODSEE--卸载
  18. TextMesh Pro 超链接解析失败
  19. JVM学习之-栈
  20. cocos2d-x 3.0 播放MP4视频

热门文章

  1. iOS中通讯录的开发
  2. 教你一招:Word中的文字转换成表格,把表格转换成文字
  3. SVN配置管理(trunk、branches、tags)
  4. Leetcode: Remove Elements
  5. S_OK与S_FALSE,E_FAIL
  6. 查看EBS R12应用中使用CONTEXT_FILE的版本及路径
  7. c#2解决c#1中的问题之用泛型实现参数化类型
  8. 关于masonry
  9. 201521123100 《Java程序设计》第13周学习总结
  10. linux网路编程:字节序(大端、小端、网络、主机)
  11. [LeetCode] Contiguous Array 邻近数组
  12. redis的雪崩与穿透原理的浅理解
  13. 25 range打印100到0的连续整数
  14. Django-Form组件之字段
  15. PHP Backdoor + Reverse Shell on Vulnerable Website
  16. c# 24种设计模式
  17. log4net 日志配置及使用
  18. 简单的卷积神经网络(CNN)的搭建
  19. R语言爬虫:使用R语言爬取豆瓣电影数据
  20. Python学习札记(三十六) 面向对象编程 Object Oriented Program 7 __slots__