objdump section

attribute有属性的含义,一般出现在代码中是用来定义“编译属性”的,当我们需要将C语言代码中的某个部分编译后链接到某个特定的段时,就需要在这个部分前面加上__attribute__((section(段名))),例如在代码中使用了__attribute__ ((section(".isr_vector")))将实现的中断向量表数组设置为.isr_vector段的位置,等待链接器链接到.isr_vector段中。

因为中断向量表数组在los_hwi.c文件中,所以我们可以反汇编编译int_vector.c后生成的int_vector.o中间文件来一探究竟。

       使用反汇编命令 arm-none-eabi-objdump -x -j.isr_vector。

-x选项用于显示数据段的全部信息,如果不加该选项则看不到完整的数据。-

-j.isr_vector选项用于反汇编指定的段,我们只关心.isr_vector段。

结果如下:

复制代码
root@ubuntu:~/arm/rtos/02_cm3#  arm-none-eabi-objdump -x -j.isr_vector int_vector.o

int_vector.o:     file format elf32-littlearm
int_vector.o
architecture: arm, flags 0x00000011:
HAS_RELOC, HAS_SYMS
start address 0x00000000
private flags = 5000000: [Version5 EABI]

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  3 .isr_vector   0000026c  00000000  00000000  00000050  2**2
                  CONTENTS, ALLOC, LOAD, RELOC, DATA
SYMBOL TABLE:
00000000 l    d  .isr_vector    00000000 .isr_vector
00000000 g     O .isr_vector    0000026c g_pfnVectors


RELOCATION RECORDS FOR [.isr_vector]:
OFFSET   TYPE              VALUE 
00000004 R_ARM_ABS32       reset_handler
00000008 R_ARM_ABS32       NmiSR
0000000c R_ARM_ABS32       FaultISR
00000010 R_ARM_ABS32       IntDefaultHandler
00000014 R_ARM_ABS32       IntDefaultHandler
00000018 R_ARM_ABS32       IntDefaultHandler
0000002c R_ARM_ABS32       IntDefaultHandler
00000030 R_ARM_ABS32       IntDefaultHandler
00000038 R_ARM_ABS32       IntDefaultHandler
0000003c R_ARM_ABS32       systick_handler
00000040 R_ARM_ABS32       IntDefaultHandler
00000044 R_ARM_ABS32       IntDefaultHandler
00000048 R_ARM_ABS32       IntDefaultHandler
0000004c R_ARM_ABS32       IntDefaultHandler
00000050 R_ARM_ABS32       IntDefaultHandler
00000054 R_ARM_ABS32       IntDefaultHandler
00000058 R_ARM_ABS32       IntDefaultHandler
0000005c R_ARM_ABS32       IntDefaultHandler
00000060 R_ARM_ABS32       IntDefaultHandler
00000064 R_ARM_ABS32       IntDefaultHandler
00000068 R_ARM_ABS32       IntDefaultHandler
0000006c R_ARM_ABS32       IntDefaultHandler
00000070 R_ARM_ABS32       IntDefaultHandler
00000074 R_ARM_ABS32       IntDefaultHandler
00000078 R_ARM_ABS32       IntDefaultHandler
0000007c R_ARM_ABS32       IntDefaultHandler
00000080 R_ARM_ABS32       IntDefaultHandler
00000084 R_ARM_ABS32       IntDefaultHandler
00000088 R_ARM_ABS32       IntDefaultHandler
0000008c R_ARM_ABS32       IntDefaultHandler
00000090 R_ARM_ABS32       IntDefaultHandler
00000094 R_ARM_ABS32       IntDefaultHandler
00000098 R_ARM_ABS32       IntDefaultHandler
0000009c R_ARM_ABS32       IntDefaultHandler
000000a0 R_ARM_ABS32       IntDefaultHandler
000000a4 R_ARM_ABS32       IntDefaultHandler
000000a8 R_ARM_ABS32       IntDefaultHandler
000000ac R_ARM_ABS32       IntDefaultHandler
000000b0 R_ARM_ABS32       IntDefaultHandler
000000b4 R_ARM_ABS32       IntDefaultHandler
000000b8 R_ARM_ABS32       IntDefaultHandler
000000bc R_ARM_ABS32       IntDefaultHandler
000000c0 R_ARM_ABS32       IntDefaultHandler
000000c4 R_ARM_ABS32       IntDefaultHandler
000000c8 R_ARM_ABS32       IntDefaultHandler
000000cc R_ARM_ABS32       IntDefaultHandler
000000d0 R_ARM_ABS32       IntDefaultHandler
000000d4 R_ARM_ABS32       IntDefaultHandler
000000d8 R_ARM_ABS32       IntDefaultHandler
000000dc R_ARM_ABS32       IntDefaultHandler
000000e0 R_ARM_ABS32       IntDefaultHandler
000000e4 R_ARM_ABS32       IntDefaultHandler
000000e8 R_ARM_ABS32       IntDefaultHandler
000000ec R_ARM_ABS32       IntDefaultHandler
000000f0 R_ARM_ABS32       IntDefaultHandler
000000f4 R_ARM_ABS32       IntDefaultHandler
000000f8 R_ARM_ABS32       IntDefaultHandler
000000fc R_ARM_ABS32       IntDefaultHandler
00000100 R_ARM_ABS32       IntDefaultHandler
00000104 R_ARM_ABS32       IntDefaultHandler
00000108 R_ARM_ABS32       IntDefaultHandler
0000010c R_ARM_ABS32       IntDefaultHandler
00000110 R_ARM_ABS32       IntDefaultHandler
00000114 R_ARM_ABS32       IntDefaultHandler
00000118 R_ARM_ABS32       IntDefaultHandler
0000011c R_ARM_ABS32       IntDefaultHandler
00000120 R_ARM_ABS32       IntDefaultHandler
00000124 R_ARM_ABS32       IntDefaultHandler
00000128 R_ARM_ABS32       IntDefaultHandler
0000012c R_ARM_ABS32       IntDefaultHandler
00000130 R_ARM_ABS32       IntDefaultHandler
00000134 R_ARM_ABS32       IntDefaultHandler
00000138 R_ARM_ABS32       IntDefaultHandler
0000013c R_ARM_ABS32       IntDefaultHandler
00000150 R_ARM_ABS32       IntDefaultHandler
00000154 R_ARM_ABS32       IntDefaultHandler
00000158 R_ARM_ABS32       IntDefaultHandler
0000015c R_ARM_ABS32       IntDefaultHandler
000001b0 R_ARM_ABS32       IntDefaultHandler
000001b4 R_ARM_ABS32       IntDefaultHandler
000001b8 R_ARM_ABS32       IntDefaultHandler
000001bc R_ARM_ABS32       IntDefaultHandler
000001c0 R_ARM_ABS32       IntDefaultHandler
000001c4 R_ARM_ABS32       IntDefaultHandler
000001c8 R_ARM_ABS32       IntDefaultHandler
000001cc R_ARM_ABS32       IntDefaultHandler
000001d0 R_ARM_ABS32       IntDefaultHandler
000001d4 R_ARM_ABS32       IntDefaultHandler
000001d8 R_ARM_ABS32       IntDefaultHandler
000001dc R_ARM_ABS32       IntDefaultHandler
000001e0 R_ARM_ABS32       IntDefaultHandler
000001e4 R_ARM_ABS32       IntDefaultHandler
000001e8 R_ARM_ABS32       IntDefaultHandler
000001ec R_ARM_ABS32       IntDefaultHandler
000001f0 R_ARM_ABS32       IntDefaultHandler
000001f4 R_ARM_ABS32       IntDefaultHandler
000001f8 R_ARM_ABS32       IntDefaultHandler
000001fc R_ARM_ABS32       IntDefaultHandler
00000200 R_ARM_ABS32       IntDefaultHandler
00000204 R_ARM_ABS32       IntDefaultHandler
00000208 R_ARM_ABS32       IntDefaultHandler
00000210 R_ARM_ABS32       IntDefaultHandler
00000214 R_ARM_ABS32       IntDefaultHandler
00000218 R_ARM_ABS32       IntDefaultHandler
0000021c R_ARM_ABS32       IntDefaultHandler
00000220 R_ARM_ABS32       IntDefaultHandler
00000224 R_ARM_ABS32       IntDefaultHandler
00000228 R_ARM_ABS32       IntDefaultHandler
0000022c R_ARM_ABS32       IntDefaultHandler
00000230 R_ARM_ABS32       IntDefaultHandler
00000234 R_ARM_ABS32       IntDefaultHandler
00000238 R_ARM_ABS32       IntDefaultHandler
0000023c R_ARM_ABS32       IntDefaultHandler
00000240 R_ARM_ABS32       IntDefaultHandler
00000244 R_ARM_ABS32       IntDefaultHandler
00000248 R_ARM_ABS32       IntDefaultHandler
0000024c R_ARM_ABS32       IntDefaultHandler
00000250 R_ARM_ABS32       IntDefaultHandler
00000254 R_ARM_ABS32       IntDefaultHandler
00000258 R_ARM_ABS32       IntDefaultHandler
0000025c R_ARM_ABS32       IntDefaultHandler
00000260 R_ARM_ABS32       IntDefaultHandler
00000264 R_ARM_ABS32       IntDefaultHandler
00000268 R_ARM_ABS32       IntDefaultHandler
复制代码

 

复制代码
root@ubuntu:~/arm/rtos/02_cm3# cat int_vector.c
#include "os_stdio.h"
void ResetISR(void);
static void NmiSR(void);
static void FaultISR(void);
static void IntDefaultHandler(void);

extern unsigned long _etext;
extern unsigned long _data;
extern unsigned long _edata;
extern unsigned long _stack_bottom;
extern unsigned long _stack_top;
extern void reset_handler(void);
extern void systick_handler(void);

__attribute__ ((section(".isr_vector")))void (*g_pfnVectors[])(void) =
{
    0x2000c000,                             // StackPtr, set in RestetISR
    ((unsigned int)reset_handler + 1),      // The reset handler
    NmiSR,                                  // The NMI handler
    FaultISR,                               // The hard fault handler
    IntDefaultHandler,                      // The MPU fault handler
    IntDefaultHandler,                      // The bus fault handler
    IntDefaultHandler,                      // The usage fault handler
    0,                                      // Reserved
    0,                                      // Reserved
    0,                                      // Reserved
    0,                                      // Reserved
    IntDefaultHandler,                      // SVCall handler
    IntDefaultHandler,                      // Debug monitor handler
    0,                                      // Reserved
    IntDefaultHandler,                      // The PendSV handler
    systick_handler,                      // The SysTick handler
    IntDefaultHandler,                      // GPIO Port A
    IntDefaultHandler,                      // GPIO Port B
    IntDefaultHandler,                      // GPIO Port C
    IntDefaultHandler,                      // GPIO Port D
    IntDefaultHandler,                      // GPIO Port E
    IntDefaultHandler,                      // UART0 Rx and Tx
    IntDefaultHandler,                      // UART1 Rx and Tx
    IntDefaultHandler,                      // SSI0 Rx and Tx
    IntDefaultHandler,                      // I2C0 Master and Slave
    IntDefaultHandler,                      // PWM Fault
    IntDefaultHandler,                      // PWM Generator 0
    IntDefaultHandler,                      // PWM Generator 1
    IntDefaultHandler,                      // PWM Generator 2
    IntDefaultHandler,                      // Quadrature Encoder 0
    IntDefaultHandler,                      // ADC Sequence 0
    IntDefaultHandler,                      // ADC Sequence 1
    IntDefaultHandler,                      // ADC Sequence 2
    IntDefaultHandler,                      // ADC Sequence 3
    IntDefaultHandler,                      // Watchdog timer
    IntDefaultHandler,                      // Timer 0 subtimer A
    IntDefaultHandler,                      // Timer 0 subtimer B
    IntDefaultHandler,                      // Timer 1 subtimer A
    IntDefaultHandler,                      // Timer 1 subtimer B
    IntDefaultHandler,                      // Timer 2 subtimer A
    IntDefaultHandler,                      // Timer 2 subtimer B
    IntDefaultHandler,                      // Analog Comparator 0
    IntDefaultHandler,                      // Analog Comparator 1
    IntDefaultHandler,                      // Analog Comparator 2
    IntDefaultHandler,                      // System Control (PLL, OSC, BO)
    IntDefaultHandler,                      // FLASH Control
    IntDefaultHandler,                      // GPIO Port F
    IntDefaultHandler,                      // GPIO Port G
    IntDefaultHandler,                      // GPIO Port H
    IntDefaultHandler,                      // UART2 Rx and Tx
    IntDefaultHandler,                      // SSI1 Rx and Tx
    IntDefaultHandler,                      // Timer 3 subtimer A
    IntDefaultHandler,                      // Timer 3 subtimer B
    IntDefaultHandler,                      // I2C1 Master and Slave
    IntDefaultHandler,                      // Quadrature Encoder 1
    IntDefaultHandler,                      // CAN0
    IntDefaultHandler,                      // CAN1
    IntDefaultHandler,                      // CAN2
    IntDefaultHandler,                      // Ethernet
    IntDefaultHandler,                      // Hibernate
    IntDefaultHandler,                      // USB0
    IntDefaultHandler,                      // PWM Generator 3
    IntDefaultHandler,                      // uDMA Software Transfer
    IntDefaultHandler,                      // uDMA Error
    IntDefaultHandler,                      // ADC1 Sequence 0
    IntDefaultHandler,                      // ADC1 Sequence 1
    IntDefaultHandler,                      // ADC1 Sequence 2
    IntDefaultHandler,                      // ADC1 Sequence 3
    IntDefaultHandler,                      // I2S0
    IntDefaultHandler,                      // External Bus Interface 0
    IntDefaultHandler,                      // GPIO Port J
    IntDefaultHandler,                      // GPIO Port K
    IntDefaultHandler,                      // GPIO Port L
    IntDefaultHandler,                      // SSI2 Rx and Tx
    IntDefaultHandler,                      // SSI3 Rx and Tx
    IntDefaultHandler,                      // UART3 Rx and Tx
    IntDefaultHandler,                      // UART4 Rx and Tx
    IntDefaultHandler,                      // UART5 Rx and Tx
    IntDefaultHandler,                      // UART6 Rx and Tx
    IntDefaultHandler,                      // UART7 Rx and Tx
    0,                                      // Reserved
    0,                                      // Reserved
    0,                                      // Reserved
    0,                                      // Reserved
    IntDefaultHandler,                      // I2C2 Master and Slave
    IntDefaultHandler,                      // I2C3 Master and Slave
    IntDefaultHandler,                      // Timer 4 subtimer A
    IntDefaultHandler,                      // Timer 4 subtimer B
    0,                                      // Reserved
    0,                                      // Reserved
    0,                                      // Reserved
    0,                                      // Reserved
    0,                                      // Reserved
    0,                                      // Reserved
    0,                                      // Reserved
    0,                                      // Reserved
    0,                                      // Reserved
    0,                                      // Reserved
    0,                                      // Reserved
    0,                                      // Reserved
    0,                                      // Reserved
    0,                                      // Reserved
    0,                                      // Reserved
    0,                                      // Reserved
    0,                                      // Reserved
    0,                                      // Reserved
    0,                                      // Reserved
    0,                                      // Reserved
    IntDefaultHandler,                      // Timer 5 subtimer A
    IntDefaultHandler,                      // Timer 5 subtimer B
    IntDefaultHandler,                      // Wide Timer 0 subtimer A
    IntDefaultHandler,                      // Wide Timer 0 subtimer B
    IntDefaultHandler,                      // Wide Timer 1 subtimer A
    IntDefaultHandler,                      // Wide Timer 1 subtimer B
    IntDefaultHandler,                      // Wide Timer 2 subtimer A
    IntDefaultHandler,                      // Wide Timer 2 subtimer B
    IntDefaultHandler,                      // Wide Timer 3 subtimer A
    IntDefaultHandler,                      // Wide Timer 3 subtimer B
    IntDefaultHandler,                      // Wide Timer 4 subtimer A
    IntDefaultHandler,                      // Wide Timer 4 subtimer B
    IntDefaultHandler,                      // Wide Timer 5 subtimer A
    IntDefaultHandler,                      // Wide Timer 5 subtimer B
    IntDefaultHandler,                      // FPU
    IntDefaultHandler,                      // PECI 0
    IntDefaultHandler,                      // LPC 0
    IntDefaultHandler,                      // I2C4 Master and Slave
    IntDefaultHandler,                      // I2C5 Master and Slave
    IntDefaultHandler,                      // GPIO Port M
    IntDefaultHandler,                      // GPIO Port N
    IntDefaultHandler,                      // Quadrature Encoder 2
    IntDefaultHandler,                      // Fan 0
    0,                                      // Reserved
    IntDefaultHandler,                      // GPIO Port P (Summary or P0)
    IntDefaultHandler,                      // GPIO Port P1
    IntDefaultHandler,                      // GPIO Port P2
    IntDefaultHandler,                      // GPIO Port P3
    IntDefaultHandler,                      // GPIO Port P4
    IntDefaultHandler,                      // GPIO Port P5
    IntDefaultHandler,                      // GPIO Port P6
    IntDefaultHandler,                      // GPIO Port P7
    IntDefaultHandler,                      // GPIO Port Q (Summary or Q0)
    IntDefaultHandler,                      // GPIO Port Q1
    IntDefaultHandler,                      // GPIO Port Q2
    IntDefaultHandler,                      // GPIO Port Q3
    IntDefaultHandler,                      // GPIO Port Q4
    IntDefaultHandler,                      // GPIO Port Q5
    IntDefaultHandler,                      // GPIO Port Q6
    IntDefaultHandler,                      // GPIO Port Q7
    IntDefaultHandler,                      // GPIO Port R
    IntDefaultHandler,                      // GPIO Port S
    IntDefaultHandler,                      // PWM 1 Generator 0
    IntDefaultHandler,                      // PWM 1 Generator 1
    IntDefaultHandler,                      // PWM 1 Generator 2
    IntDefaultHandler,                      // PWM 1 Generator 3
    IntDefaultHandler                       // PWM 1 Fault
};
复制代码

 

 

 

复制代码
root@ubuntu:~/arm/rtos/02_cm3# objdump -s -j .text  rtos.elf 

rtos.elf:     file format elf32-littlearm

Contents of section .text:
 0000 00c00020 b90c0000 6d020000 73020000  ... ....m...s...
 0010 79020000 79020000 79020000 00000000  y...y...y.......
 0020 00000000 00000000 00000000 79020000  ............y...
 0030 79020000 00000000 79020000 c1020000  y.......y.......
 0040 79020000 79020000 79020000 79020000  y...y...y...y...
 0050 79020000 79020000 79020000 79020000  y...y...y...y...
 0060 79020000 79020000 79020000 79020000  y...y...y...y...
 0070 79020000 79020000 79020000 79020000  y...y...y...y...
 0080 79020000 79020000 79020000 79020000  y...y...y...y...
 0090 79020000 79020000 79020000 79020000  y...y...y...y...
 00a0 79020000 79020000 79020000 79020000  y...y...y...y...
 00b0 79020000 79020000 79020000 79020000  y...y...y...y...
 00c0 79020000 79020000 79020000 79020000  y...y...y...y...
 00d0 79020000 79020000 79020000 79020000  y...y...y...y...
 00e0 79020000 79020000 79020000 79020000  y...y...y...y...
 00f0 79020000 79020000 79020000 79020000  y...y...y...y...
 0100 79020000 79020000 79020000 79020000  y...y...y...y...
 0110 79020000 79020000 79020000 79020000  y...y...y...y...
 0120 79020000 79020000 79020000 79020000  y...y...y...y...
 0130 79020000 79020000 79020000 79020000  y...y...y...y...
 0140 00000000 00000000 00000000 00000000  ................
 0150 79020000 79020000 79020000 79020000  y...y...y...y...
复制代码

 

 

复制代码
root@ubuntu:~/arm/rtos/02_cm3#  arm-none-eabi-objdump -x -j.isr_vector rtos.elf 

rtos.elf:     file format elf32-littlearm
rtos.elf
architecture: arm, flags 0x00000112:
EXEC_P, HAS_SYMS, D_PAGED
start address 0x00000000

Program Header:
    LOAD off    0x00010000 vaddr 0x00000000 paddr 0x00000000 align 2**16
         filesz 0x00000d80 memsz 0x00000d80 flags r-x
private flags = 5000200: [Version5 EABI] [soft-float ABI]

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
SYMBOL TABLE:


arm-none-eabi-objdump: section '.isr_vector' mentioned in a -j option, but not found in any input file
root@ubuntu:~/arm/rtos/02_cm3# ls
cm3.c  cm3.o  cm3_s.o  cm3_s.s  include  int_vector.c  int_vector.o  main.c  main.o  Makefile  os_stdio.c  os_stdio.o  rtos.bin  rtos.dis  rtos.elf  rtos.ld
root@ubuntu:~/arm/rtos/02_cm3#  arm-none-eabi-objdump -x -j.isr_vector cm3.o

cm3.o:     file format elf32-littlearm
cm3.o
architecture: arm, flags 0x00000011:
HAS_RELOC, HAS_SYMS
start address 0x00000000
private flags = 5000000: [Version5 EABI]

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
SYMBOL TABLE:


arm-none-eabi-objdump: section '.isr_vector' mentioned in a -j option, but not found in any input file
root@ubuntu:~/arm/rtos/02_cm3#  arm-none-eabi-objdump -x -j.isr_vector cm3
cm3.c    cm3.o    cm3_s.o  cm3_s.s  
root@ubuntu:~/arm/rtos/02_cm3#  arm-none-eabi-objdump -x -j.isr_vector cm3_s.o

cm3_s.o:     file format elf32-littlearm
cm3_s.o
architecture: arm, flags 0x00000011:
HAS_RELOC, HAS_SYMS
start address 0x00000000
private flags = 5000000: [Version5 EABI]

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
SYMBOL TABLE:


arm-none-eabi-objdump: section '.isr_vector' mentioned in a -j option, but not found in any input file
root@ubuntu:~/arm/rtos/02_cm3# 
复制代码

 

posted on   tycoon3  阅读(223)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· .NET Core 中如何实现缓存的预热?
· 三行代码完成国际化适配,妙~啊~
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
历史上的今天:
2020-02-16 ovs 添加物理端口
2020-02-16 vxlan层次化绑定
2020-02-16 vpn&bgp&ofpf

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

统计

点击右上角即可分享
微信分享提示