Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Assembly 在GAS中调用相等的符号_Assembly_Nasm_Gnu Assembler - Fatal编程技术网

Assembly 在GAS中调用相等的符号

Assembly 在GAS中调用相等的符号,assembly,nasm,gnu-assembler,Assembly,Nasm,Gnu Assembler,下面是一个小型NASM程序: [BITS 64] [ORG 0x0000000000200000] b_print_newline equ 0x0000000000100040 start: call b_print_newline ret 组装它: $ nasm -f bin pr-nl-a.asm -o pr-nl-a.app $ objdump -D -b binary -m i386:x86-64

下面是一个小型NASM程序:

        [BITS 64]
        [ORG 0x0000000000200000]

        b_print_newline equ 0x0000000000100040

start:
        call b_print_newline

        ret
组装它:

$ nasm -f bin pr-nl-a.asm -o pr-nl-a.app
$ objdump -D -b binary -m i386:x86-64 pr-nl-a.app 
pr-nl-a.app:     file format binary


Disassembly of section .data:

0000000000000000 <.data>:
   0:   e8 3b 00 f0 ff          callq  0xfffffffffff00040
   5:   c3                      retq
$ objdump -D -b binary -m i386:x86-64 pr-nl-b.app 
pr-nl-b.app:     file format binary


Disassembly of section .data:

0000000000000000 <.data>:
   0:   ff 14 25 40 00 10 00    callq  *0x100040
   7:   c3                      retq
拆卸它:

$ nasm -f bin pr-nl-a.asm -o pr-nl-a.app
$ objdump -D -b binary -m i386:x86-64 pr-nl-a.app 
pr-nl-a.app:     file format binary


Disassembly of section .data:

0000000000000000 <.data>:
   0:   e8 3b 00 f0 ff          callq  0xfffffffffff00040
   5:   c3                      retq
$ objdump -D -b binary -m i386:x86-64 pr-nl-b.app 
pr-nl-b.app:     file format binary


Disassembly of section .data:

0000000000000000 <.data>:
   0:   ff 14 25 40 00 10 00    callq  *0x100040
   7:   c3                      retq
组装并连接它:

$ as -o pr-nl-b.o pr-nl-b.s
$ ld -Ttext 200000 --oformat binary -o pr-nl-b.app pr-nl-b.o
拆卸它:

$ nasm -f bin pr-nl-a.asm -o pr-nl-a.app
$ objdump -D -b binary -m i386:x86-64 pr-nl-a.app 
pr-nl-a.app:     file format binary


Disassembly of section .data:

0000000000000000 <.data>:
   0:   e8 3b 00 f0 ff          callq  0xfffffffffff00040
   5:   c3                      retq
$ objdump -D -b binary -m i386:x86-64 pr-nl-b.app 
pr-nl-b.app:     file format binary


Disassembly of section .data:

0000000000000000 <.data>:
   0:   ff 14 25 40 00 10 00    callq  *0x100040
   7:   c3                      retq
vs气体:

0:  ff 14 25 40 00 10 00    callq  *0x100040
对如何正确实施GAS版本有何建议

以下是FASM中的程序:

        b_print_newline equ 0x0000000000100040

        use64
        org 0x0000000000200000

start:  call b_print_newline
        ret
它做了正确的事情:

$ objdump -D -b binary -m i386:x86-64 pr-nl-c.app 

pr-nl-c.app:     file format binary


Disassembly of section .data:

0000000000000000 <.data>:
   0:   e8 3b 00 f0 ff          callq  0xfffffffffff00040
   5:   c3                      retq

将.org 0x000000000000添加到GAS文件。

可能存在的副本