AAJ
AAJ

Reputation: 65

What are the AT&T equivalents to these Intel assembler directives?

In some example code written in Intel syntax there was a line that said [org 0x7c00]. I couldn’t seem to figure out how to get this to work with AT&T syntax and couldn’t find it online.

Also, I found a line that had $$(this might not be considered an assembler directive). From what I could tell, this references the beginning of the binary(?) I can’t seem to find the AT&T equivalent of this either.

To ask a broader question. What is a good way to find AT&T equivalents to (obscure?) Intel statements?

Upvotes: 1

Views: 475

Answers (1)

mevets
mevets

Reputation: 10445

org in at&t syntax is . =, so:

. = 0x7c00
.globl _a
_a: ret

After compiling, nm produces:

0000000000007c00 T _a

But because ld is different from the dos tools, you mightn’t get the effect you want; that is a further relocation might be applied to _a, so it would end up with something like:

0000000100000000 T __mh_execute_header
0000000100007fac T _a
0000000100000390 T _main

Upvotes: 2

Related Questions