End of binary (MASM and GAS)

Programming, for all ages and all languages.
Post Reply
mgoppold
Posts: 9
Joined: Wed Feb 13, 2013 9:12 pm

End of binary (MASM and GAS)

Post by mgoppold »

How do you refer to the end address of your EXE, in MASM and GAS?

Is there a variable for the address? I cant find it in the MASM manual.
Mikemk
Member
Member
Posts: 409
Joined: Sat Oct 22, 2011 12:27 pm

Re: End of binary (MASM and GAS)

Post by Mikemk »

Put a label at the end of the file, here's your variable.
Programming is 80% Math, 20% Grammar, and 10% Creativity <--- Do not make fun of my joke!
If you're new, check this out.
mgoppold
Posts: 9
Joined: Wed Feb 13, 2013 9:12 pm

Re: End of binary (MASM and GAS)

Post by mgoppold »

Oops, I meant NASM, not MASM.
mgoppold
Posts: 9
Joined: Wed Feb 13, 2013 9:12 pm

Re: End of binary (MASM and GAS)

Post by mgoppold »

m12 wrote:Put a label at the end of the file, here's your variable.
Should I specify a section?
Mikemk
Member
Member
Posts: 409
Joined: Sat Oct 22, 2011 12:27 pm

Re: End of binary (MASM and GAS)

Post by Mikemk »

Sure, whatever section appears at the end of the binary.
Programming is 80% Math, 20% Grammar, and 10% Creativity <--- Do not make fun of my joke!
If you're new, check this out.
User avatar
Nessphoro
Member
Member
Posts: 308
Joined: Sat Apr 30, 2011 12:50 am

Re: End of binary (MASM and GAS)

Post by Nessphoro »

Or you could do it in your linker.
Mikemk
Member
Member
Posts: 409
Joined: Sat Oct 22, 2011 12:27 pm

Re: End of binary (MASM and GAS)

Post by Mikemk »

Nessphoro wrote:Or you could do it in your linker.
mgoppold wrote:Oops, I meant NASM
Why would he be using a linker when nasm can do it for him?
Programming is 80% Math, 20% Grammar, and 10% Creativity <--- Do not make fun of my joke!
If you're new, check this out.
User avatar
Nessphoro
Member
Member
Posts: 308
Joined: Sat Apr 30, 2011 12:50 am

Re: End of binary (MASM and GAS)

Post by Nessphoro »

Because linker is better.
Plus he might want to split his code into multiple files later.
User avatar
Love4Boobies
Member
Member
Posts: 2111
Joined: Fri Mar 07, 2008 5:36 pm
Location: Bucharest, Romania

Re: End of binary (MASM and GAS)

Post by Love4Boobies »

mgoppold wrote:How do you refer to the end address of your EXE, in MASM and GAS?
Executable files don't have addresses; only processes do. Also, note that sections needn't be loaded contiguously. The best approach is to query the loader or OS for this information, if they can provide it. After all, the loader is generally a component of a trusted system, whereas 3rd party executables are not, meaning you can achieve secure modularity.
m12 wrote:Why would he be using a linker when nasm can do it for him?
Because sections might not be loaded in the order in which they appear in the code.
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
Post Reply