Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] sim: tests: support .S files
@ 2010-03-14 22:02 Mike Frysinger
  2010-03-15  0:43 ` Matt Rice
  0 siblings, 1 reply; 10+ messages in thread
From: Mike Frysinger @ 2010-03-14 22:02 UTC (permalink / raw)
  To: gdb-patches; +Cc: 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>
---
2010-03-14  Jie Zhang  <jie@codesourcery.com>

	* lib/sim-defs.exp (run_sim_test): Run source file through preprocessor
	when it matches "*.S".

 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 3cef394..9314f2f 100644
--- a/sim/testsuite/lib/sim-defs.exp
+++ b/sim/testsuite/lib/sim-defs.exp
@@ -301,7 +301,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.0


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] sim: tests: support .S files
  2010-03-14 22:02 [PATCH] sim: tests: support .S files Mike Frysinger
@ 2010-03-15  0:43 ` Matt Rice
  2010-03-15  1:46   ` Jie Zhang
                     ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Matt Rice @ 2010-03-15  0:43 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: gdb-patches, Jie Zhang

On Sun, Mar 14, 2010 at 2:03 PM, Mike Frysinger <vapier@gentoo.org> wrote:

> 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.

not that I actually care about any such targets, but wouldn't this
just fall over on a case insentive filesystem?


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] sim: tests: support .S files
  2010-03-15  0:43 ` Matt Rice
@ 2010-03-15  1:46   ` Jie Zhang
  2010-03-15  7:09   ` Mike Frysinger
  2010-03-15 20:17   ` DJ Delorie
  2 siblings, 0 replies; 10+ messages in thread
From: Jie Zhang @ 2010-03-15  1:46 UTC (permalink / raw)
  To: Matt Rice; +Cc: Mike Frysinger, gdb-patches

On 03/15/2010 08:43 AM, Matt Rice wrote:
> On Sun, Mar 14, 2010 at 2:03 PM, Mike Frysinger<vapier@gentoo.org>  wrote:
>
>> 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.
>
> not that I actually care about any such targets, but wouldn't this
> just fall over on a case insentive filesystem?

I don't have any knowledge when come to case insensitive filesystems. 
What's the value of the following expression

   [string match "*.S" $sourcefile]

when $sourcefile is "abc.s" on such a filesystem?


-- 
Jie Zhang
CodeSourcery
(650) 331-3385 x735


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] sim: tests: support .S files
  2010-03-15  0:43 ` Matt Rice
  2010-03-15  1:46   ` Jie Zhang
@ 2010-03-15  7:09   ` Mike Frysinger
  2010-03-15 10:54     ` Matt Rice
  2010-03-15 20:17   ` DJ Delorie
  2 siblings, 1 reply; 10+ messages in thread
From: Mike Frysinger @ 2010-03-15  7:09 UTC (permalink / raw)
  To: Matt Rice; +Cc: gdb-patches, Jie Zhang

[-- Attachment #1: Type: Text/Plain, Size: 958 bytes --]

On Sunday 14 March 2010 20:43:45 Matt Rice wrote:
> On Sun, Mar 14, 2010 at 2:03 PM, Mike Frysinger <vapier@gentoo.org> wrote:
> > 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.
> 
> not that I actually care about any such targets, but wouldn't this
> just fall over on a case insentive filesystem?

case insensitive is not the same thing as case preserving.  assuming you're 
referring to the main ones (windows or OS X default), they're both case 
preserving.  so files checked out as foo.s will stay as foo.s.  the source 
code changes do string matches which have on relation at all to the file 
system the files reside upon.

so no, i dont think this change will make any difference at all to such 
systems.  otherwise you'd already see problems with the packages that utilize 
source files based on extension case.
-mike

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] sim: tests: support .S files
  2010-03-15  7:09   ` Mike Frysinger
@ 2010-03-15 10:54     ` Matt Rice
  2010-03-19 20:12       ` Mike Frysinger
  0 siblings, 1 reply; 10+ messages in thread
From: Matt Rice @ 2010-03-15 10:54 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: gdb-patches, Jie Zhang

On Mon, Mar 15, 2010 at 12:08 AM, Mike Frysinger <vapier@gentoo.org> wrote:
>> not that I actually care about any such targets, but wouldn't this
>> just fall over on a case insentive filesystem?
>
> case insensitive is not the same thing as case preserving.  assuming you're
> referring to the main ones (windows or OS X default), they're both case
> preserving.  so files checked out as foo.s will stay as foo.s.  the source
> code changes do string matches which have on relation at all to the file
> system the files reside upon.
>
> so no, i dont think this change will make any difference at all to such
> systems.  otherwise you'd already see problems with the packages that utilize
> source files based on extension case.
> -mike

Actually, i was thinking about the case-preserving thing, refreshing
my memory via google, pre-windows FAT filesystems (which i assume Eli
is using since he's not using long file names) case-destroy to
uppercase, which would just mean that they are pre-processing things
which don't need to be.


+           set comp_output [target_compile $sourcefile ${name}.s
"preprocess" "incdir=$srcdir/$subdir"]

is it possible for ${name}.s and $sourcefile somehow clash on
case-preserving case-insensitive filesystems when builddir==sourcedir?


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] sim: tests: support .S files
  2010-03-15  0:43 ` Matt Rice
  2010-03-15  1:46   ` Jie Zhang
  2010-03-15  7:09   ` Mike Frysinger
@ 2010-03-15 20:17   ` DJ Delorie
  2 siblings, 0 replies; 10+ messages in thread
From: DJ Delorie @ 2010-03-15 20:17 UTC (permalink / raw)
  To: Matt Rice; +Cc: vapier, gdb-patches, jie


> > 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.
> 
> not that I actually care about any such targets, but wouldn't this
> just fall over on a case insentive filesystem?

It works if you use explicit rules to find the .S files, or have
pattern rules for .S but not .s with an explicit list of targets.
It's when you rely on wildcards to scan for *.[sS] files that things
go badly.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] sim: tests: support .S files
  2010-03-15 10:54     ` Matt Rice
@ 2010-03-19 20:12       ` Mike Frysinger
  0 siblings, 0 replies; 10+ messages in thread
From: Mike Frysinger @ 2010-03-19 20:12 UTC (permalink / raw)
  To: Matt Rice; +Cc: gdb-patches, Jie Zhang

[-- Attachment #1: Type: Text/Plain, Size: 1512 bytes --]

On Monday 15 March 2010 06:47:33 Matt Rice wrote:
> On Mon, Mar 15, 2010 at 12:08 AM, Mike Frysinger <vapier@gentoo.org> wrote:
> >> not that I actually care about any such targets, but wouldn't this
> >> just fall over on a case insentive filesystem?
> > 
> > case insensitive is not the same thing as case preserving.  assuming
> > you're referring to the main ones (windows or OS X default), they're
> > both case preserving.  so files checked out as foo.s will stay as foo.s.
> >  the source code changes do string matches which have on relation at all
> > to the file system the files reside upon.
> > 
> > so no, i dont think this change will make any difference at all to such
> > systems.  otherwise you'd already see problems with the packages that
> > utilize source files based on extension case.
> > -mike
> 
> Actually, i was thinking about the case-preserving thing, refreshing
> my memory via google, pre-windows FAT filesystems (which i assume Eli
> is using since he's not using long file names) case-destroy to
> uppercase, which would just mean that they are pre-processing things
> which don't need to be.
> 
> 
> +           set comp_output [target_compile $sourcefile ${name}.s
> "preprocess" "incdir=$srcdir/$subdir"]
> 
> is it possible for ${name}.s and $sourcefile somehow clash on
> case-preserving case-insensitive filesystems when builddir==sourcedir?

i guess the only way to handle this then would be to pipe it directly to the 
assembler ...
-mike

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 10+ 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; 10+ 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] 10+ messages in thread

* Re: [PATCH] sim: tests: support .S files
  2011-03-14  8:20 Mike Frysinger
@ 2011-03-14 12:32 ` Pedro Alves
  2011-03-14 21:06   ` Mike Frysinger
  0 siblings, 1 reply; 10+ 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] 10+ messages in thread

* [PATCH] sim: tests: support .S files
@ 2011-03-14  8:20 Mike Frysinger
  2011-03-14 12:32 ` Pedro Alves
  0 siblings, 1 reply; 10+ 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] 10+ messages in thread

end of thread, other threads:[~2011-03-14 20:50 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-14 22:02 [PATCH] sim: tests: support .S files Mike Frysinger
2010-03-15  0:43 ` Matt Rice
2010-03-15  1:46   ` Jie Zhang
2010-03-15  7:09   ` Mike Frysinger
2010-03-15 10:54     ` Matt Rice
2010-03-19 20:12       ` Mike Frysinger
2010-03-15 20:17   ` DJ Delorie
2011-03-14  8:20 Mike Frysinger
2011-03-14 12:32 ` Pedro Alves
2011-03-14 21:06   ` Mike Frysinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox