* [PATCH] sim: tests: support .S files @ 2011-03-14 8:20 Mike Frysinger 2011-03-14 12:32 ` Pedro Alves 2011-03-14 21:23 ` [PATCH] sim: tests: support .S/.c files Mike Frysinger 0 siblings, 2 replies; 12+ messages in thread From: Mike Frysinger @ 2011-03-14 8:20 UTC (permalink / raw) To: gdb-patches; +Cc: toolchain-devel, Jie Zhang From: Jie Zhang <jie@codesourcery.com> Rather than requiring all sim tests to be preprocessed .s files, add support for .S files so we can easily write code using normal CPP defines/macros. Signed-off-by: Jie Zhang <jie@codesourcery.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org> --- sim/testsuite/lib/sim-defs.exp | 13 ++++++++++++- 1 files changed, 12 insertions(+), 1 deletions(-) diff --git a/sim/testsuite/lib/sim-defs.exp b/sim/testsuite/lib/sim-defs.exp index 1e65817..eacdf76 100644 --- a/sim/testsuite/lib/sim-defs.exp +++ b/sim/testsuite/lib/sim-defs.exp @@ -310,7 +310,18 @@ proc run_sim_test { name requested_machs } { if [info exists cpu_option] { set as_options "$as_options $cpu_option=$mach" } - set comp_output [target_assemble $sourcefile ${name}.o "$as_options $global_as_options"] + if [string match "*.S" $sourcefile] { + set comp_output [target_compile $sourcefile ${name}.s "preprocess" "incdir=$srcdir/$subdir"] + if ![string match "" $comp_output] { + verbose -log "$comp_output" 3 + fail "$mach $testname (preprocessing)" + continue + } + set comp_output [target_assemble ${name}.s ${name}.o "$as_options $global_as_options"] + file delete ${name}.s + } else { + set comp_output [target_assemble $sourcefile ${name}.o "$as_options $global_as_options"] + } if ![string match "" $comp_output] { verbose -log "$comp_output" 3 -- 1.7.4.1 ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] sim: tests: support .S files 2011-03-14 8:20 [PATCH] sim: tests: support .S files Mike Frysinger @ 2011-03-14 12:32 ` Pedro Alves 2011-03-14 21:06 ` Mike Frysinger 2011-03-14 21:23 ` [PATCH] sim: tests: support .S/.c files Mike Frysinger 1 sibling, 1 reply; 12+ messages in thread From: Pedro Alves @ 2011-03-14 12:32 UTC (permalink / raw) To: gdb-patches; +Cc: Mike Frysinger, toolchain-devel, Jie Zhang On Sunday 13 March 2011 23:10:48, Mike Frysinger wrote: > - set comp_output [target_assemble $sourcefile ${name}.o "$as_options $global_as_options"] > + if [string match "*.S" $sourcefile] { > + set comp_output [target_compile $sourcefile ${name}.s "preprocess" "incdir=$srcdir/$subdir"] > + if ![string match "" $comp_output] { > + verbose -log "$comp_output" 3 > + fail "$mach $testname (preprocessing)" > + continue > + } > + set comp_output [target_assemble ${name}.s ${name}.o "$as_options $global_as_options"] > + file delete ${name}.s > + } else { > + set comp_output [target_assemble $sourcefile ${name}.o "$as_options $global_as_options"] > + } > When using srcdir==buildir, won't this overwrite the source file on non case-sensitive filesystems? -- Pedro Alves ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] sim: tests: support .S files 2011-03-14 12:32 ` Pedro Alves @ 2011-03-14 21:06 ` Mike Frysinger 0 siblings, 0 replies; 12+ messages in thread From: Mike Frysinger @ 2011-03-14 21:06 UTC (permalink / raw) To: Pedro Alves; +Cc: gdb-patches, toolchain-devel [-- Attachment #1: Type: Text/Plain, Size: 1244 bytes --] On Monday, March 14, 2011 07:56:23 Pedro Alves wrote: > On Sunday 13 March 2011 23:10:48, Mike Frysinger wrote: > > - set comp_output [target_assemble $sourcefile ${name}.o > > "$as_options $global_as_options"] > > + if [string match "*.S" $sourcefile] { > > + set comp_output [target_compile $sourcefile ${name}.s > > "preprocess" "incdir=$srcdir/$subdir"] > > + if ![string match "" $comp_output] { > > + verbose -log "$comp_output" 3 > > + fail "$mach $testname (preprocessing)" > > + continue > > + } > > + set comp_output [target_assemble ${name}.s ${name}.o > > "$as_options $global_as_options"] > > + file delete ${name}.s > > + } else { > > + set comp_output [target_assemble $sourcefile ${name}.o > > "$as_options $global_as_options"] > > + } > > When using srcdir==buildir, won't this overwrite the source file on > non case-sensitive filesystems? picking any diff named file runs the risk of collision. i have a local patch to follow this up to add support for .c files too, but i guess i'll just fold them into one since the .c step goes .c -> .o without the .s step. -mike [-- Attachment #2: This is a digitally signed message part. --] [-- Type: application/pgp-signature, Size: 836 bytes --] ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH] sim: tests: support .S/.c files 2011-03-14 8:20 [PATCH] sim: tests: support .S files Mike Frysinger 2011-03-14 12:32 ` Pedro Alves @ 2011-03-14 21:23 ` Mike Frysinger 2011-03-23 10:40 ` Mike Frysinger ` (3 more replies) 1 sibling, 4 replies; 12+ messages in thread From: Mike Frysinger @ 2011-03-14 21:23 UTC (permalink / raw) To: gdb-patches; +Cc: toolchain-devel Rather than requiring all sim tests to be preprocessed .s files, add support for .S and .c files so we can easily write code using a higher level language like C. Signed-off-by: Mike Frysinger <vapier@gentoo.org> 2011-03-14 Mike Frysinger <vapier@gentoo.org> * sim-defs.exp: Support cc tag in test files. (run_sim_test): Support global_cc_options in boards files. Convert assembler options into compiler options (c_as_options) with -Wa. Convert linker options into compiler options (c_ld_options) with -Wl. Compile .c and .S files into .x programs. --- sim/testsuite/lib/sim-defs.exp | 48 ++++++++++++++++++++++++++++++++------- 1 files changed, 39 insertions(+), 9 deletions(-) diff --git a/sim/testsuite/lib/sim-defs.exp b/sim/testsuite/lib/sim-defs.exp index 1e65817..c8093a2 100644 --- a/sim/testsuite/lib/sim-defs.exp +++ b/sim/testsuite/lib/sim-defs.exp @@ -169,6 +169,7 @@ proc sim_run { prog sim_opts prog_opts redir options } { # mach: [all | machine names] # as[(mach-list)]: <assembler options> # ld[(mach-list)]: <linker options> +# cc[(mach-list)]: <compiler options> # sim[(mach-list)]: <simulator options> # progopts: <arguments to the program being simulated> # output: program output pattern to match with string-match @@ -190,6 +191,7 @@ proc run_sim_test { name requested_machs } { global cpu_option global global_as_options global global_ld_options + global global_cc_options global global_sim_options if [string match "*/*" $name] { @@ -207,6 +209,7 @@ proc run_sim_test { name requested_machs } { # Clear default options set opts(as) "" set opts(ld) "" + set opts(cc) "" set opts(progopts) "" set opts(sim) "" set opts(output) "" @@ -222,6 +225,9 @@ proc run_sim_test { name requested_machs } { if ![info exists global_ld_options] { set global_ld_options "" } + if ![info exists global_cc_options] { + set global_cc_options "" + } if ![info exists global_sim_options] { set global_sim_options "" } @@ -234,6 +240,9 @@ proc run_sim_test { name requested_machs } { if [info exists opts(ld,$m)] { unset opts(ld,$m) } + if [info exists opts(cc,$m)] { + unset opts(cc,$m) + } if [info exists opts(sim,$m)] { unset opts(sim,$m) } @@ -310,23 +319,44 @@ proc run_sim_test { name requested_machs } { if [info exists cpu_option] { set as_options "$as_options $cpu_option=$mach" } - set comp_output [target_assemble $sourcefile ${name}.o "$as_options $global_as_options"] - - if ![string match "" $comp_output] { - verbose -log "$comp_output" 3 - fail "$mach $testname (assembling)" - continue - } + regsub {(^ *| +)([^ ]+)} "$as_options $global_as_options" { -Wa,\2} c_as_options if ![info exists opts(ld,$mach)] { set opts(ld,$mach) $opts(ld) } + regsub {(^ *| +)([^ ]+)} "$opts(ld,$mach) $global_ld_options" { -Wl,\2} c_ld_options + + if ![info exists opts(cc,$mach)] { + set opts(cc,$mach) $opts(cc) + } + + if [string match "*.c" $sourcefile] { + set comp_output [target_compile $sourcefile ${name}.x "executable" \ + [list "incdir=$srcdir/$subdir" "additional_flags=$c_as_options $c_ld_options $opts(cc,$mach) $global_cc_options"]] + set method "compiling/linking" + } else { + if [string match "*.S" $sourcefile] { + set comp_output [target_compile $sourcefile ${name}.o "object" \ + [list "incdir=$srcdir/$subdir" "additional_flags=$c_as_options"]] + set method "compiling" + } else { + set comp_output [target_assemble $sourcefile ${name}.o "$as_options $global_as_options"] + set method "assembling" + } + + if ![string match "" $comp_output] { + verbose -log "$comp_output" 3 + fail "$mach $testname (${method})" + continue + } - set comp_output [target_link ${name}.o ${name}.x "$opts(ld,$mach) $global_ld_options"] + set comp_output [target_link ${name}.o ${name}.x "$opts(ld,$mach) $global_ld_options"] + set method "linking" + } if ![string match "" $comp_output] { verbose -log "$comp_output" 3 - fail "$mach $testname (linking)" + fail "$mach $testname (${method})" continue } -- 1.7.4.1 ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] sim: tests: support .S/.c files 2011-03-14 21:23 ` [PATCH] sim: tests: support .S/.c files Mike Frysinger @ 2011-03-23 10:40 ` Mike Frysinger 2011-03-23 17:02 ` Joel Brobecker ` (2 subsequent siblings) 3 siblings, 0 replies; 12+ messages in thread From: Mike Frysinger @ 2011-03-23 10:40 UTC (permalink / raw) To: gdb-patches; +Cc: toolchain-devel On Mon, Mar 14, 2011 at 5:06 PM, Mike Frysinger wrote: > Rather than requiring all sim tests to be preprocessed .s files, add > support for .S and .c files so we can easily write code using a higher > level language like C. ping ... once this guy is in, i can start merging the giant Blackfin testsuite dir. although not strictly necessary, but .S/.c files make up about a quarter of our tests (~800 and counting). -mike ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] sim: tests: support .S/.c files 2011-03-14 21:23 ` [PATCH] sim: tests: support .S/.c files Mike Frysinger 2011-03-23 10:40 ` Mike Frysinger @ 2011-03-23 17:02 ` Joel Brobecker 2011-03-23 18:50 ` Mike Frysinger 2011-03-24 5:38 ` Mike Frysinger 2011-03-29 3:06 ` Mike Frysinger 2011-05-14 17:48 ` Mike Frysinger 3 siblings, 2 replies; 12+ messages in thread From: Joel Brobecker @ 2011-03-23 17:02 UTC (permalink / raw) To: Mike Frysinger; +Cc: gdb-patches, toolchain-devel > 2011-03-14 Mike Frysinger <vapier@gentoo.org> > > * sim-defs.exp: Support cc tag in test files. > (run_sim_test): Support global_cc_options in boards files. Convert > assembler options into compiler options (c_as_options) with -Wa. > Convert linker options into compiler options (c_ld_options) with -Wl. > Compile .c and .S files into .x programs. Sorry for the delay in reviewing. > - set comp_output [target_assemble $sourcefile ${name}.o "$as_options $global_as_options"] > - > - if ![string match "" $comp_output] { > - verbose -log "$comp_output" 3 > - fail "$mach $testname (assembling)" > - continue > - } > + regsub {(^ *| +)([^ ]+)} "$as_options $global_as_options" { -Wa,\2} c_as_options > > if ![info exists opts(ld,$mach)] { > set opts(ld,$mach) $opts(ld) > } > + regsub {(^ *| +)([^ ]+)} "$opts(ld,$mach) $global_ld_options" { -Wl,\2} c_ld_options > + > + if ![info exists opts(cc,$mach)] { > + set opts(cc,$mach) $opts(cc) > + } > + > + if [string match "*.c" $sourcefile] { > + set comp_output [target_compile $sourcefile ${name}.x "executable" \ > + [list "incdir=$srcdir/$subdir" "additional_flags=$c_as_options $c_ld_options $opts(cc,$mach) $global_cc_options"]] > + set method "compiling/linking" > + } else { > + if [string match "*.S" $sourcefile] { > + set comp_output [target_compile $sourcefile ${name}.o "object" \ > + [list "incdir=$srcdir/$subdir" "additional_flags=$c_as_options"]] > + set method "compiling" > + } else { > + set comp_output [target_assemble $sourcefile ${name}.o "$as_options $global_as_options"] > + set method "assembling" > + } > + > + if ![string match "" $comp_output] { > + verbose -log "$comp_output" 3 > + fail "$mach $testname (${method})" > + continue > + } It looks like you are not checking the output from the compilation of .c files, while you kept that check for all other files. Is that intentional? -- Joel ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] sim: tests: support .S/.c files 2011-03-23 17:02 ` Joel Brobecker @ 2011-03-23 18:50 ` Mike Frysinger 2011-03-24 5:38 ` Mike Frysinger 1 sibling, 0 replies; 12+ messages in thread From: Mike Frysinger @ 2011-03-23 18:50 UTC (permalink / raw) To: Joel Brobecker; +Cc: gdb-patches, toolchain-devel On Wed, Mar 23, 2011 at 12:42 PM, Joel Brobecker wrote: >> - set comp_output [target_assemble $sourcefile ${name}.o "$as_options $global_as_options"] >> - >> - if ![string match "" $comp_output] { >> - verbose -log "$comp_output" 3 >> - fail "$mach $testname (assembling)" >> - continue >> - } >> + regsub {(^ *| +)([^ ]+)} "$as_options $global_as_options" { -Wa,\2} c_as_options >> >> if ![info exists opts(ld,$mach)] { >> set opts(ld,$mach) $opts(ld) >> } >> + regsub {(^ *| +)([^ ]+)} "$opts(ld,$mach) $global_ld_options" { -Wl,\2} c_ld_options >> + >> + if ![info exists opts(cc,$mach)] { >> + set opts(cc,$mach) $opts(cc) >> + } >> + >> + if [string match "*.c" $sourcefile] { >> + set comp_output [target_compile $sourcefile ${name}.x "executable" \ >> + [list "incdir=$srcdir/$subdir" "additional_flags=$c_as_options $c_ld_options $opts(cc,$mach) $global_cc_options"]] >> + set method "compiling/linking" >> + } else { >> + if [string match "*.S" $sourcefile] { >> + set comp_output [target_compile $sourcefile ${name}.o "object" \ >> + [list "incdir=$srcdir/$subdir" "additional_flags=$c_as_options"]] >> + set method "compiling" >> + } else { >> + set comp_output [target_assemble $sourcefile ${name}.o "$as_options $global_as_options"] >> + set method "assembling" >> + } >> + >> + if ![string match "" $comp_output] { >> + verbose -log "$comp_output" 3 >> + fail "$mach $testname (${method})" >> + continue >> + } > > It looks like you are not checking the output from the compilation > of .c files, while you kept that check for all other files. Is that > intentional? i dont think so ... actual build failures would still be caught we would try to run it. i'll see if link time warnings cause a problem. there should at least be a comment in here if the behavior is intended. -mike ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] sim: tests: support .S/.c files 2011-03-23 17:02 ` Joel Brobecker 2011-03-23 18:50 ` Mike Frysinger @ 2011-03-24 5:38 ` Mike Frysinger 1 sibling, 0 replies; 12+ messages in thread From: Mike Frysinger @ 2011-03-24 5:38 UTC (permalink / raw) To: Joel Brobecker; +Cc: gdb-patches, toolchain-devel On Wed, Mar 23, 2011 at 12:42 PM, Joel Brobecker wrote: >> - set comp_output [target_assemble $sourcefile ${name}.o "$as_options $global_as_options"] >> - >> - if ![string match "" $comp_output] { >> - verbose -log "$comp_output" 3 >> - fail "$mach $testname (assembling)" >> - continue >> - } >> + regsub {(^ *| +)([^ ]+)} "$as_options $global_as_options" { -Wa,\2} c_as_options >> >> if ![info exists opts(ld,$mach)] { >> set opts(ld,$mach) $opts(ld) >> } >> + regsub {(^ *| +)([^ ]+)} "$opts(ld,$mach) $global_ld_options" { -Wl,\2} c_ld_options >> + >> + if ![info exists opts(cc,$mach)] { >> + set opts(cc,$mach) $opts(cc) >> + } >> + >> + if [string match "*.c" $sourcefile] { >> + set comp_output [target_compile $sourcefile ${name}.x "executable" \ >> + [list "incdir=$srcdir/$subdir" "additional_flags=$c_as_options $c_ld_options $opts(cc,$mach) $global_cc_options"]] >> + set method "compiling/linking" >> + } else { >> + if [string match "*.S" $sourcefile] { >> + set comp_output [target_compile $sourcefile ${name}.o "object" \ >> + [list "incdir=$srcdir/$subdir" "additional_flags=$c_as_options"]] >> + set method "compiling" >> + } else { >> + set comp_output [target_assemble $sourcefile ${name}.o "$as_options $global_as_options"] >> + set method "assembling" >> + } >> + >> + if ![string match "" $comp_output] { >> + verbose -log "$comp_output" 3 >> + fail "$mach $testname (${method})" >> + continue >> + } > > It looks like you are not checking the output from the compilation > of .c files, while you kept that check for all other files. Is that > intentional? mmm, that's not the case after all. if you look at the wider context, the .c statement will fall down to the *next* comp_output branch. old code was basically: - assemble - check - link - check new code is: if (*.c) { - compile & link } else { if (*.S) { - compile } else { - assemble } - check - link } -check so that intended check isnt "removed" from the .c step, it's simply made obsolete because the compiler driver (i.e. gcc) is allowed to compile/link in one shot. -mike ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] sim: tests: support .S/.c files 2011-03-14 21:23 ` [PATCH] sim: tests: support .S/.c files Mike Frysinger 2011-03-23 10:40 ` Mike Frysinger 2011-03-23 17:02 ` Joel Brobecker @ 2011-03-29 3:06 ` Mike Frysinger 2011-05-14 17:48 ` Mike Frysinger 3 siblings, 0 replies; 12+ messages in thread From: Mike Frysinger @ 2011-03-29 3:06 UTC (permalink / raw) To: gdb-patches; +Cc: toolchain-devel On Mon, Mar 14, 2011 at 5:06 PM, Mike Frysinger wrote: > Rather than requiring all sim tests to be preprocessed .s files, add > support for .S and .c files so we can easily write code using a higher > level language like C. these targets do not build for me: cr16 d10v erc32 mcore for those that build, these fail tests before my patch: m32r sh64 the rest pass before and after my patch: arm avr bfin cris frv h8300 iq2000 lm32 m32c m32r m68hc11 microblaze mips mn10300 moxie ppc rx sh sh64 v850 -mike ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] sim: tests: support .S/.c files 2011-03-14 21:23 ` [PATCH] sim: tests: support .S/.c files Mike Frysinger ` (2 preceding siblings ...) 2011-03-29 3:06 ` Mike Frysinger @ 2011-05-14 17:48 ` Mike Frysinger 2011-05-16 18:37 ` Joel Brobecker 3 siblings, 1 reply; 12+ messages in thread From: Mike Frysinger @ 2011-05-14 17:48 UTC (permalink / raw) To: gdb-patches; +Cc: toolchain-devel [-- Attachment #1: Type: Text/Plain, Size: 242 bytes --] On Monday, March 14, 2011 17:06:09 Mike Frysinger wrote: > Rather than requiring all sim tests to be preprocessed .s files, add > support for .S and .c files so we can easily write code using a higher > level language like C. ping ... -mike [-- Attachment #2: This is a digitally signed message part. --] [-- Type: application/pgp-signature, Size: 836 bytes --] ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] sim: tests: support .S/.c files 2011-05-14 17:48 ` Mike Frysinger @ 2011-05-16 18:37 ` Joel Brobecker 2011-05-16 18:49 ` Mike Frysinger 0 siblings, 1 reply; 12+ messages in thread From: Joel Brobecker @ 2011-05-16 18:37 UTC (permalink / raw) To: Mike Frysinger; +Cc: gdb-patches, toolchain-devel > On Monday, March 14, 2011 17:06:09 Mike Frysinger wrote: > > Rather than requiring all sim tests to be preprocessed .s files, add > > support for .S and .c files so we can easily write code using a higher > > level language like C. > > ping ... As far as I can tell, you answered the only concern I had left, so please go ahead. Sorry about the delay - I accidently dropped the ball there, somehow thinking the infamous somebody was already following that thread. -- Joel ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] sim: tests: support .S/.c files 2011-05-16 18:37 ` Joel Brobecker @ 2011-05-16 18:49 ` Mike Frysinger 0 siblings, 0 replies; 12+ messages in thread From: Mike Frysinger @ 2011-05-16 18:49 UTC (permalink / raw) To: gdb-patches; +Cc: Joel Brobecker, toolchain-devel [-- Attachment #1: Type: Text/Plain, Size: 683 bytes --] On Monday, May 16, 2011 14:36:43 Joel Brobecker wrote: > > On Monday, March 14, 2011 17:06:09 Mike Frysinger wrote: > > > Rather than requiring all sim tests to be preprocessed .s files, add > > > support for .S and .c files so we can easily write code using a higher > > > level language like C. > > > > ping ... > > As far as I can tell, you answered the only concern I had left, > so please go ahead. Sorry about the delay - I accidently dropped > the ball there, somehow thinking the infamous somebody was already > following that thread. np ... i know you were busy with the gdb branching, so i didnt want to hassle you further until that settled down -mike [-- Attachment #2: This is a digitally signed message part. --] [-- Type: application/pgp-signature, Size: 836 bytes --] ^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2011-05-16 18:49 UTC | newest] Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2011-03-14 8:20 [PATCH] sim: tests: support .S files Mike Frysinger 2011-03-14 12:32 ` Pedro Alves 2011-03-14 21:06 ` Mike Frysinger 2011-03-14 21:23 ` [PATCH] sim: tests: support .S/.c files Mike Frysinger 2011-03-23 10:40 ` Mike Frysinger 2011-03-23 17:02 ` Joel Brobecker 2011-03-23 18:50 ` Mike Frysinger 2011-03-24 5:38 ` Mike Frysinger 2011-03-29 3:06 ` Mike Frysinger 2011-05-14 17:48 ` Mike Frysinger 2011-05-16 18:37 ` Joel Brobecker 2011-05-16 18:49 ` Mike Frysinger
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox