|
I never got around to open sourcing them. But here's part of a dump of a .o file: Section 14 .eh_frame PROGBITS,ALLOC,SIZE=0x0030(48),OFFSET=0x0040,ALIGN=8
offset = 00000000, length = 0x0014(20)
CIE_id = 00000000
version = 1
augmentation = 'zR'
code_alignment_factor = 1
data_alignment_factor = -8
return_address_register = 16
Augmentation_Length = 1
Address pointer encoding = DW_EH_PE_pcrel|sdata4
DW_CFA_def_cfa reg = 7, off = 00000008
DW_CFA_offset_10 off = 1
DW_CFA_nop
DW_CFA_nop
offset = 00000018, length = 0x0014(20)
CIE_pointer = 0000001c offset 00000000
augmentation = 'zR'
PC_Begin = 0
PC_Range = 6
Augmentation_Length = 0
DW_CFA_nop
DW_CFA_nop
DW_CFA_nop
DW_CFA_nop
DW_CFA_nop
DW_CFA_nop
DW_CFA_nop
0040: 14 0 0 0 0 0 0 0 1 7a 52 0 1 78 10 1 .........zR..x..
0050: 1b c 7 8 90 1 0 0 14 0 0 0 1c 0 0 0 ................
0060: 0 0 0 0 6 0 0 0 0 0 0 0 0 0 0 0 ................
Section 15 .data._D16TypeInfo_S3__C1S6__initZ PROGBITS,WRITE,ALLOC,SIZE=0x0090(144),OFFSET=0x0070,ALIGN=16
0070: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ................
0080: 7 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ................
0090: 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ................
00a0: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ................
00b0: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ................
00c0: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ................
00d0: 0 0 0 0 0 0 0 0 4 0 0 0 0 0 0 0 ................
00e0: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ................
00f0: 0 0 0 0 0 0 0 0 53 33 5f 5f 43 31 53 0 ........S3__C1S.
Section 16 .rela.data._D16TypeInfo_S3__C1S6__initZ RELA,ENTRIES=3,OFFSET=0x06A4,ALIGN=8,LINK=8,INFO=15
0 offset=00000000 addend=0000000000000000 type=R_X86_64_64 sym=24 sym="_D15TypeInfo_Struct6__vtblZ"
1 offset=00000018 addend=0000000000000088 type=R_X86_64_64 sym=21 sym="_D16TypeInfo_S3__C1S6__initZ"
2 offset=00000070 addend=0000000000000000 type=R_X86_64_64 sym=25 sym="_D10TypeInfo_i6__initZ"
Section 17 .bss.__bzeroBytes NOBITS,WRITE,ALLOC,SIZE=0x0080(128),OFFSET=0x0100,ALIGN=16
Section 18 .group GROUP,ENTRIES=2,OFFSET=0x0100,ALIGN=4,LINK=8,INFO=23
0100: 1 0 0 0 13 0 0 0 ........
Section 19 .text.test PROGBITS,ALLOC,EXEC,GROUP,SIZE=0x0008(8),OFFSET=0x0108,ALIGN=4
0108: b8 4 0 0 0 c3 0 0 ........
|
In llvm-project, obj2yaml pretty prints an object file in YAML and yaml2obj can convert the output back to an object file.
The test cases are a good way to explore the functionality: https://github.com/llvm/llvm-project/tree/main/llvm/test/too... https://github.com/llvm/llvm-project/tree/main/llvm/test/too...