--- gcc/listing 2018/04/24 17:51:21 1.1 +++ gcc/listing 2018/04/24 18:10:58 1.1.1.3 @@ -29,22 +29,26 @@ # mc68030 for Motorola 68030 (Sun-3, ..) # sparc for SPARC (SUN-4, ..) # i386 for i386 (Sun i386, ...) +# i386-linux for i386 (Linux, ...) # uncomment the line you need: # MYSYS=mc68020 # MYSYS=mc68030 # MYSYS=sparc # MYSYS=i386 +# MYSYS=i386-linux # MYSYS=`mach` # this will work on Suns with SunOS > 4.0.0 -exec gawk -vsys=$MYSYS ' +FILENAME=$1 +shift + +exec gawk -vsys=$MYSYS -voptions="$*" ' # commandline arguments: # ARGV[0] = "gawk" # ARGV[1] = processid # ARGV[2] = filename -# ARGV[3] .. ARGV[ARGC-1] = compiler options BEGIN { - if (ARGC < 3) { + if (ARGC != 3) { usage() exit 1 } @@ -65,7 +69,7 @@ BEGIN { if (sys == "sparc" || sys == "i386") { line_hint = "^[ \t]*\.stabn.*" } - else if (sys == "mc68020" || sys == "mc68030") { + else if (sys == "mc68020" || sys == "mc68030" || sys == "i386-linux") { line_hint = "^[ \t]*\.stabd.*" } else { @@ -85,7 +89,7 @@ BEGIN { while ( getline asm_code < asm_filename > 0 ) { if ( (ignore_stabd==0) && (asm_code ~ line_hint)) { - # source line hint found. Split the line into fields seperated by commas. + # source line hint found. Split the line into fields separated by commas. # num_of_fields is 4 for sparc, 3 for m68k num_of_fields = split(asm_code, fields, ",") newlineno = fields[3] + 0 # the line number we are looking for is field 3 @@ -145,13 +149,11 @@ function parse_cmdline( i) { cmdline = cmdline " -g -S -o " asm_filename # now we append the compiler options specified by the user - for (i = 3; i < ARGC; i++) { - cmdline = cmdline " " ARGV[i] - ARGV[i] = "" # we do not want to treat it as an inputfile - } + cmdline = cmdline " " options # last but not least: the name of the file to compile cmdline = cmdline " " c_filename } -' $$ $* +' $$ $FILENAME +