t******q 发帖数: 117 | 1 objdump dump the routine and variables,
what is the meanning of each coloum.
Anyone is in compiler field?
thank you very mcuh.
for example,
what is the g, F/O and | stands for?
V
00000020 g F .text 00000000 _start
00000030 g O .text 00000000 _Mem_Size_Boot
00000034 g O .text 00000000 _start2 |
|
w***g 发帖数: 5958 | 2 前面的回复了的除了SSA以外,别的都是不懂装懂,一看就知道有多少水平。竟然还有
人说这个不是c的强项。你这个问题问得挺好,我给你演示一下。源程序叫hello.c,
贴在最后
$ make hello
$ objdump -t hello | grep XXX
00000000004006ec g F .text 00000000000001b1 XXX_TEXT
0000000000601070 g O .data 0000000000000004 XXX_DATA
0000000000400968 g O .rodata 0000000000000001 XXX_RODATA
0000000000601078 g O .bss 0000000000000004 XXX_BSS
$ ./hello
Global:
&XXX_DATA: 0x601070
&XXX_BSS: 0x601078
... 阅读全帖 |
|
l****c 发帖数: 838 | 3 some processors have to use register as one operand.
If you implement a = a + b on ARM, it is like:
ldr r0, =a (address of variable)
ldr r1, [r0]
ldr r0, =b
ldr r2, [r0]
add r1, r1, r2
ldr r0, =a
str r1, [r0]
I don't remember the details and the above code is not optimized,but you get
the idea.
If you want to know what a function looks like at instruction level
on x86, compile it, and use objdump to get the assembly code.
If you don't know objdump is, look at gcc toolchain and the man page.
Th... 阅读全帖 |
|
W*****x 发帖数: 684 | 4 $ cd geoip-api-c-master
$ libtoolize
$ aclocal
$ autoconf
$ automake --add-missing
$./configure
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
... 阅读全帖 |
|
s*****t 发帖数: 89 | 5 1:g++ -std=c++11 -g -o test test.cpp
2: objdump -S test |c++filt | less
找到你想找的函数(main)然后看看的call,结果大概是这个样子:
http://pastebin.com/Xr9p4DcC
补充:
- objdump :-S能够把代码 inline到汇编里面,-d(-D)只能反汇编
- 不用c++filt标准库的符号很难看, |
|
c*****e 发帖数: 737 | 6 "abc" is in .rodata section, not heap.
# objdump -s -j .rodata str
Contents of section .rodata:
80486e8 03000000 01000200 00000000 61626300 ............abc.
80485c5: 89 44 24 08 mov %eax,0x8(%esp)
80485c9: c7 44 24 04 f4 86 04 movl $0x80486f4,0x4(%esp)
80485d0: 08
80485d1: 8d 45 ec lea -0x14(%ebp),%eax
80485d4: 89 04 24 mov %eax,(%e... 阅读全帖 |
|
v*****r 发帖数: 1119 | 7 You can use nm or objdump to check symbol table of executable or library |
|
|
r*********r 发帖数: 3195 | 9 gnu has some programs in the "binutils" package. they are very useful.
like nm, c++filt, objdump, ldd etc.
in this example, you can type: "nm cppfile.o", and it tells you that the
function name has be mangled to __Z4foo1v, hence the error message that foo1
cann't be found.
use c++filt to de-mangle the name: "c++filt __Z4foo1v", and it tells you the
original function name is foo1. |
|
a****j 发帖数: 8 | 10 Almost same as GNU, run
Start Menu /
Microsoft Visual Studio 2010 /
Visual Studio Tools /
Visual Studio Command Prompt (2010)
Then
gcc - cl.exe
ld - link.exe
ar - lib.exe
make - nmake.exe
gdb - cdb.exe / windbg.exe (google windbg)
c++filt - undname.exe
objdump / nm - dumpbin.exe |
|
f********i 发帖数: 563 | 11
上百兆字节了
用objdump你可以看到各个字段的容量 |
|
j*a 发帖数: 14423 | 12 gcc编译一下, objdump反编译一下,看看汇编代码 |
|
|
x**l 发帖数: 64 | 14
所以我很迷惑,你似乎知道很多内部细节,但是你又忽律
很多重要的技术细节。你不按照 Intel 建议的方式来测量,
然后抱怨有意想不到的结果。
你现在还是没有论据支持你的1000 cycle 的说法。我对 Intel
CPU 还算比较了解也不敢按照你那样乱推测。我感觉你的
测量就没有可靠性。
----关于测量问题我刚给你回了,请看一下,谢谢
+++++++++++
就算我退一步,按照你的思路,50个pipeline,先假设
Intel CPU 里面就是这样工作的。你的论据也不成立。
rdtsc 单单一个 instruction 就有 250-300 cycle。
你只要pipelien 里面有 4 个 rdtsc 那样的 instruction,
你的误差就有 1000 cycle 了。 50 个 pipeline 里面
出现 4 个 rdtscp 还是有可能的吧,特别是对空循环
的例子。
----不知道你的rdtsc需要250~300cycle是从哪里来的?有reference没有?还是自己测的?
如果我们定义x86指令在pipeline中要占多少级为指令所花的时间,可以重复调用(不... 阅读全帖 |
|
S*A 发帖数: 7142 | 15 .file "m.c"
.text
.align 2
.globl main
main:
link.w %fp,#-8
move.w #3,-2(%fp)
move.w -2(%fp),%d0
ext.l %d0
move.l %d0,-(%sp)
jsr f
addq.l #4,%sp
move.l %d0,-6(%fp)
move.l -6(%fp),%d0
unlk %fp
rts
.align 2
.globl f
f:
link.w %fp,#-4
move.l 8(%fp),%d0
move.w %d0,-2(%fp)
move.w -2(%fp),%d0
ext.l %d0
add.l %d0,%d... 阅读全帖 |
|
|
k**********g 发帖数: 989 | 17 "Old Boost" is based on pre-C++11, so it has to use inefficient tricks to
emulate features that don't yet exist in pre-C++11 compilers.
"New boost" is in process of C++11-modernization and modularization, not
complete yet.
https://github.com/boostorg
真怕 binary bloat 的话,可以用 objdump 看看 bloat 在什么地方。 |
|