???C++????????????????????????
???????????? ???????[ 2013/1/31 11:17:11 ] ????????
??????????????binutils??????е?objdump????????????????????6?????class1.o?????????????????????????????е??????????????λ???4a??66?????????????????class1.cpp?????s_class1???????????????????????????????????
$ g++ -c –g class1.cpp
$ objdump -S -d --demangle=gnu-v3 class1.o
class1.o: file format pe-i386
Disassembly of section .text:
……?????????……
0000004a <global destructors keyed to class1.cpp>:
4a: 55 push %ebp
4b: 89 e5 mov %esp??%ebp
4d: 83 ec 08 sub $0x8??%esp
50: c7 44 24 04 ff ff 00 movl $0xffff??0x4(%esp)
57: 00
58: c7 04 24 00 00 00 00 movl $0x0??(%esp)
5f: e8 9c ff ff ff call 0
64: c9 leave
65: c3 ret
00000066 <global constructors keyed to class1.cpp>:
66: 55 push %ebp
67: 89 e5 mov %esp??%ebp
69: 83 ec 08 sub $0x8??%esp
6c: c7 44 24 04 ff ff 00 movl $0xffff??0x4(%esp)
73: 00
74: c7 04 24 01 00 00 00 movl $0x1??(%esp)
7b: e8 80 ff ff ff call 0
80: c9 leave
81: c3 ret
82: 90 nop
83: 90 nop
????6
????????7???????????objdump?????class1.o?????.ctors??.dtors???е?????????????п?????????????????4a??66?????????????????????ld????????????__CTOR_LIST__??__DTOR_LIST__?????С?
$ objdump -s -j .ctors class1.o
class1.o: file format pe-i386
Contents of section .ctors:
0000 66000000 f...
$ objdump -s -j .dtors class1.o
class1.o: file format pe-i386
Contents of section .dtors:
0000 4a000000 J...
????7
??????????????????δ????????????????????????????????????????????????????????????????????λ?????????????????????????????????????__CTOR_LIST__??__DTOR_LIST__?????е???????
??????????????????????????????????????????????C++????????singleton?????????????????????????????????????
??????
![](/images/ad-banner/ad-banner.png)
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11