In NASM I can write jmp $
and use ($-$$)
, but what is the equivalent in GNU Assembler (GAS).
Asked
Active
Viewed 52 times
4

user3840170
- 26,597
- 4
- 30
- 62

kamkow1
- 467
- 2
- 8
-
4`$` would be [`.`](https://sourceware.org/binutils/docs/as/Dot.html), but I don’t think `$$` has a direct equivalent. You’d have to know which section you’re in. – user3840170 Jan 04 '23 at 22:17
-
2Is this a bootloader (I'm guessing it is, and your other question today confirms it)? After your last line of code and data in the bootloader you can do an `.org 510` and then do a `.word 0xaa55`. Otherwise you might have to look at doing it in a linker script. The answers to this question might be of some use: https://stackoverflow.com/questions/47859273/calculating-padding-length-with-gas-att-directives-for-a-boot-sector and might be a duplicate. – Michael Petch Jan 04 '23 at 23:54