Didn't come up with any better place to ask this, but:
Does anyone have an idea how Mint handles the command line parameters?
I wrote a small toy program, in AT&T form assembly, and if I compile it with GCC it works fine, but
if I compile it with GAS, the command line parameters are garbage, and the program dies in segmentation fault.
Any pointers to where can I find the righ way to do the command line parameter handling so, that it'd work with GAS too.
Assembly programming in Mint
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
- turboscrew
- Level 4
- Posts: 222
- Joined: Sat Sep 26, 2009 2:13 pm
Assembly programming in Mint
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
- turboscrew
- Level 4
- Posts: 222
- Joined: Sat Sep 26, 2009 2:13 pm
Re: Assembly programming in Mint
Ah, GCC adds a prologue that rearanges the parameters and calls "main".
# argv[3] -> "Outfile"
Code: Select all
# GCC
# Stack is:
#ESP -> ret addr
# argc
# argv -> argv[0] -> "program name"
# argv[1] -> "Key"
# argv[2] -> "Infile"
# argv[3] -> "Outfile"
# GAS
# Stack is:
#ESP -> argc
# argv[0] -> "program name"
# argv[1] -> "Key"
# argv[2] -> "Infile"