GMP-汇编代码?

发布于 2024-08-19 22:22:15 字数 152 浏览 5 评论 0原文

在哪里可以找到为 gmp-5.0.0 编写的程序的汇编代码 我使用 UBUNTU 和 G++ 编译器.. 编译代码的命令是“g++ test.cc -o outp -lgmp”

实际上我想知道内部发生的1和0的情况... 内存分配将如何发生以及如何在 RAW 位上执行操作!

Where i can find ASSEMBLY code for my program written for gmp-5.0.0
im using UBUNTU and G++ compiler..
command for compiling the code is "g++ test.cc -o outp -lgmp"

actually i want to know what happens internally in terms of 1's and 0's...
how the memory allocation will takes place and how the operations will performed on RAW bits!!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

抽个烟儿 2024-08-26 22:22:15

GMP 包包含一个 mpn\ 文件夹,其中包含 GMP 的所有汇编代码。请参阅我的答案此处,但是,简而言之,所有 GMP 高级功能(例如mpz_...mpq_...mpf_...)调用 mpn_...自然数运算的函数。这些“低级”函数实际上调用为大量平台(x86、ARM、sparcs、powerpcs 等)编写的高度优化的汇编代码,并且由 GMP Autotools 决定链接哪些特定代码( Autoconf 和 A​​utomake)根据您的目标平台系统。 mpn\ dir 中的代码非常不言自明。

The GMP package contains a mpn\ folder which contains all assembly code for GMP. Please, see my answer here but, in short, all GMP high level functions (like mpz_..., mpq_..., and mpf_...) call the mpn_... functions for operations on natural numbers. These "low-level" functions actually call highly-optimized assembly code written for a great deal of platforms (x86, ARMs, sparcs, powerpcs, etc.), and the decision on which specific code to link is done by the GMP Autotools (Autoconf and Automake) system according to your target platform. The code there in mpn\ dir is pretty self-explanatory.

鯉魚旗 2024-08-26 22:22:15

来自 gcc(1) 手册页:

   -save-temps
       Store the usual "temporary" intermediate files permanently; place
       them in the current directory and name them based on the source
       file.  Thus, compiling foo.c with -c -save-temps would produce
       files foo.i and foo.s, as well as foo.o.  This creates a
       preprocessed foo.i output file even though the compiler now
       normally uses an integrated preprocessor.

From the gcc(1) man page:

   -save-temps
       Store the usual "temporary" intermediate files permanently; place
       them in the current directory and name them based on the source
       file.  Thus, compiling foo.c with -c -save-temps would produce
       files foo.i and foo.s, as well as foo.o.  This creates a
       preprocessed foo.i output file even though the compiler now
       normally uses an integrated preprocessor.
随风而去 2024-08-26 22:22:15

您可以使用 -S 标志获取生成的汇编语言。请记住,这将主要包含为您的代码生成的程序集,而不是为您使用的库函数等生成的代码。 “主要”是因为它可以/将在您包含的标头中包含为内联函数生成的代码。

You can get the generated assembly language using the -S flag. Keep in mind that this will mostly contain the assembly generated for your code, not the generated code for things like library functions you use. The "mostly" is because it can/will include code generated for inline functions in headers you've included.

┼── 2024-08-26 22:22:15

该代码是用 C 编写的,因此您应该查看源代码,这将是理解汇编代码的第一步(通常足以理解“原始位”发生的情况)。无论如何,都有一些内联的程序集

那么也许您可以做的是在 gdb 中运行代码并使用 disassemble 命令查看极少数特定代码的汇编代码并尝试理解它们。

The code is written in C so you should look at the source code this will be a first step to understand the assembly code (usually it is enough to understand what happen with "raw bits"). There is some assembly inlined anyway

Then maybe what you could do is to run your code inside gdb and use the disassemble command to see the assembly code of a very few and specific peace of code and try to understand them.

多彩岁月 2024-08-26 22:22:15

您可以使用 objdump 1 反汇编 libgmp。这不会很有趣。

(代码的反汇编大多只包括对 libgmp 函数的调用,除非您也反汇编 libgmp ,否则不会揭示“内部发生的情况”。)

也许您想要阅读源代码2

You can use objdump1 to disassemble your libgmp. It won't be interesting.

(And the disassembly of your code mostly just include a call to the libgmp function which won't reveal "what happens internally" unless you disassemble libgmp as well.)

Perhaps you want to read the source code2 instead?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文