Okay, so I have been learning x86, and I understand most of it, but I don't get what any of the following mean:
.sect
.bss
.data
.text
.rom
.global
Basically anything that begins with a '.'.
Any help?
These just specify the different sections of your program. I'll walk you through each one.
.sect - Allows you to specify your own kind of section.
.bss - Reserve space for all your global variables here. These are variables you want to be able to change.
.data - Reserve space for all your global data here. This means stuff you can't change, like string constants, error messages, etc.
.text - This is the section where all your executable code goes.
As for these...what kind of assembler are you using? MASM, TASM, YASM, or something else? I know it's not NASM because it has different syntax for that. I'm not sure what these are.
.rom
.global
sudo rm -rf /
Thanks!
I am using the GNU assembler that comes with GCC (I guess that'd be gas). Is there a different one you'd recommend?
Ah. I don't use that one, though it did come with GCC. I prefer NASM, as it's platform-independent and widely supported. Does GAS force you to use AT&T syntax, or can it accept Intel sytax? I personally abhor AT&T syntax, as it makes no sense.
sudo rm -rf /
Yeah, it uses AT&T styled syntax. I'm going to check out NASM because I currently really dislike what I have seen of gas in-general.
Oh, good. Let me know if you need help or something. I love NASM.Benefits of Intel syntax, by the way:
AT&T:
Intel:Code:leal $0x80(%esi,%ecx,8), %eax
Code:lea eax, [ecx*8 + esi + 0x80] or alternatively, lea eax, [esi + ecx*8 + 0x80] or this... lea eax, [0x80 + ecx*8+ esi] ...you get the picture.
sudo rm -rf /
.global is the same as global in nasm
It just makes a label externally available to the linker.
I've never heard of .rom before
I typed up a post yesterday but I guess it didn't post.
"The best optimizer is between your ears" - Michael Abrash
Saying you can optimize a program is like saying you understand how a program works on every level of every facet on a specific machines configuration.
I should've known. But yeah, the ROM directive is weird.
sudo rm -rf /
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks