* DTC Patch for Cygwin
@ 2007-09-21 15:26 Matt Tyrlik
2007-09-21 18:46 ` Scott Wood
0 siblings, 1 reply; 4+ messages in thread
From: Matt Tyrlik @ 2007-09-21 15:26 UTC (permalink / raw)
To: linuxppc-dev; +Cc: dwg
[-- Attachment #1: Type: text/plain, Size: 2353 bytes --]
Changes required to compile DTC under Cygwin
===================================================================
--- dtc-org.orig/tests/supernode_atdepth_offset.c
+++ dtc-org/tests/supernode_atdepth_offset.c
@@ -63,8 +63,11 @@ int path_prefix(const char *path, int de
return 1;
p = path;
- for (i = 0; i < depth; i++)
- p = strchrnul(p+1, '/');
+ for (i = 0; i < depth; i++) {
+ p = strchr(p+1, '/');
+ if (!p)
+ p = path + strlen(path);
+ }
return p - path;
}
Index: dtc-org/tests/testutils.c
===================================================================
--- dtc-org.orig/tests/testutils.c
+++ dtc-org/tests/testutils.c
@@ -52,10 +52,9 @@ static void sigint_handler(int signum, s
void test_init(int argc, char *argv[])
{
int err;
- struct sigaction sa_int = {
- .sa_sigaction = sigint_handler,
- };
+ struct sigaction sa_int;
+ sa_int.sa_sigaction = sigint_handler,
test_name = argv[0];
err = sigaction(SIGINT, &sa_int, NULL);
Index: dtc-org/tests/trees.S
===================================================================
--- dtc-org.orig/tests/trees.S
+++ dtc-org/tests/trees.S
@@ -17,10 +17,16 @@
.byte ((val) >> 8) & 0xff ; \
.byte (val) & 0xff
+#ifdef __CYGWIN__
+#define TREE_SYMBOL(tree) __##tree
+#else
+#define TREE_SYMBOL(tree) _##tree
+#endif
+
#define TREE_HDR(tree) \
.balign 4 ; \
- .globl _##tree ; \
-_##tree: \
+ .globl TREE_SYMBOL(tree); \
+TREE_SYMBOL(tree): \
tree: \
FDTLONG(FDT_MAGIC) ; \
FDTLONG(tree##_end - tree) ; \
Index: dtc-org/tests/tests.h
===================================================================
--- dtc-org.orig/tests/tests.h
+++ dtc-org/tests/tests.h
@@ -130,4 +130,15 @@ const void *check_getprop(void *fdt, int
void *load_blob_arg(int argc, char *argv[]);
void save_blob(const char *filename, void *blob);
+#ifndef GLIBC
+#define strndupa(my_str, my_len) \
+ ({ \
+ char *new_str=alloca((my_len) + 1); \
+ strncpy(new_str, my_str, my_len); \
+ new_str[my_len]='\0'; \
+ new_str; \
+ })
+
+#endif
+
#endif /* _TESTS_H */
Matt Tyrlik
[-- Attachment #2: Type: text/html, Size: 4295 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: DTC Patch for Cygwin
2007-09-21 15:26 DTC Patch for Cygwin Matt Tyrlik
@ 2007-09-21 18:46 ` Scott Wood
2007-09-21 19:42 ` Matt Tyrlik
0 siblings, 1 reply; 4+ messages in thread
From: Scott Wood @ 2007-09-21 18:46 UTC (permalink / raw)
To: Matt Tyrlik; +Cc: linuxppc-dev, dwg
On Fri, Sep 21, 2007 at 11:26:04AM -0400, Matt Tyrlik wrote:
>
> Changes required to compile DTC under Cygwin
>
> ===================================================================
> --- dtc-org.orig/tests/supernode_atdepth_offset.c
> +++ dtc-org/tests/supernode_atdepth_offset.c
> @@ -63,8 +63,11 @@ int path_prefix(const char *path, int de
> return 1;
>
> p = path;
> - for (i = 0; i < depth; i++)
> - p = strchrnul(p+1, '/');
> + for (i = 0; i < depth; i++) {
> + p = strchr(p+1, '/');
> + if (!p)
> + p = path + strlen(path);
> + }
>
> return p - path;
> }
Maybe we should define strchrnul under #ifndef GLIBC, similar to
strndupa?
> Index: dtc-org/tests/testutils.c
> ===================================================================
> --- dtc-org.orig/tests/testutils.c
> +++ dtc-org/tests/testutils.c
> @@ -52,10 +52,9 @@ static void sigint_handler(int signum, s
> void test_init(int argc, char *argv[])
> {
> int err;
> - struct sigaction sa_int = {
> - .sa_sigaction = sigint_handler,
> - };
> + struct sigaction sa_int;
>
> + sa_int.sa_sigaction = sigint_handler,
> test_name = argv[0];
What version of GCC does cygwin use? That doesn't seem like something
that should break due to OS differences.
-Scott
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: DTC Patch for Cygwin
2007-09-21 18:46 ` Scott Wood
@ 2007-09-21 19:42 ` Matt Tyrlik
2007-09-22 0:19 ` David Gibson
0 siblings, 1 reply; 4+ messages in thread
From: Matt Tyrlik @ 2007-09-21 19:42 UTC (permalink / raw)
To: Scott Wood; +Cc: linuxppc-dev, dwg
[-- Attachment #1: Type: text/plain, Size: 1733 bytes --]
>Scott Wood <scottwood@freescale.com> wrote on 09/21/2007 02:46:39 PM:
> On Fri, Sep 21, 2007 at 11:26:04AM -0400, Matt Tyrlik wrote:
> >
> > Changes required to compile DTC under Cygwin
> >
> > ===================================================================
> > --- dtc-org.orig/tests/supernode_atdepth_offset.c
> > +++ dtc-org/tests/supernode_atdepth_offset.c
> > @@ -63,8 +63,11 @@ int path_prefix(const char *path, int de
> > return 1;
> >
> > p = path;
> > - for (i = 0; i < depth; i++)
> > - p = strchrnul(p+1, '/');
> > + for (i = 0; i < depth; i++) {
> > + p = strchr(p+1, '/');
> > + if (!p)
> > + p = path + strlen(path);
> > + }
> >
> > return p - path;
> > }
>
> Maybe we should define strchrnul under #ifndef GLIBC, similar to
> strndupa?
Since this is used only in one place David Gibson suggested that the
change should be done in code.
>
> > Index: dtc-org/tests/testutils.c
> > ===================================================================
> > --- dtc-org.orig/tests/testutils.c
> > +++ dtc-org/tests/testutils.c
> > @@ -52,10 +52,9 @@ static void sigint_handler(int signum, s
> > void test_init(int argc, char *argv[])
> > {
> > int err;
> > - struct sigaction sa_int = {
> > - .sa_sigaction = sigint_handler,
> > - };
> > + struct sigaction sa_int;
> >
> > + sa_int.sa_sigaction = sigint_handler,
> > test_name = argv[0];
>
> What version of GCC does cygwin use? That doesn't seem like something
> that should break due to OS differences.
>
> -Scott
Currently 3.4.4. The compiler can't handle unnamed union in an
initializer.
Matt
[-- Attachment #2: Type: text/html, Size: 2720 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: DTC Patch for Cygwin
2007-09-21 19:42 ` Matt Tyrlik
@ 2007-09-22 0:19 ` David Gibson
0 siblings, 0 replies; 4+ messages in thread
From: David Gibson @ 2007-09-22 0:19 UTC (permalink / raw)
To: Matt Tyrlik; +Cc: linuxppc-dev
On Fri, Sep 21, 2007 at 03:42:04PM -0400, Matt Tyrlik wrote:
> >Scott Wood <scottwood@freescale.com> wrote on 09/21/2007 02:46:39 PM:
> > On Fri, Sep 21, 2007 at 11:26:04AM -0400, Matt Tyrlik wrote:
> > >
> > > Changes required to compile DTC under Cygwin
A S-o-b line will be needed before this can be applied.
> > >
> > > ===================================================================
> > > --- dtc-org.orig/tests/supernode_atdepth_offset.c
> > > +++ dtc-org/tests/supernode_atdepth_offset.c
> > > @@ -63,8 +63,11 @@ int path_prefix(const char *path, int de
> > > return 1;
> > >
> > > p = path;
> > > - for (i = 0; i < depth; i++)
> > > - p = strchrnul(p+1, '/');
> > > + for (i = 0; i < depth; i++) {
> > > + p = strchr(p+1, '/');
> > > + if (!p)
> > > + p = path + strlen(path);
> > > + }
> > >
> > > return p - path;
> > > }
> >
> > Maybe we should define strchrnul under #ifndef GLIBC, similar to
> > strndupa?
> Since this is used only in one place David Gibson suggested that the
> change should be done in code.
Yeah, I don't actually particularly care which way we go with this one.
> > > Index: dtc-org/tests/testutils.c
> > > ===================================================================
> > > --- dtc-org.orig/tests/testutils.c
> > > +++ dtc-org/tests/testutils.c
> > > @@ -52,10 +52,9 @@ static void sigint_handler(int signum, s
> > > void test_init(int argc, char *argv[])
> > > {
> > > int err;
> > > - struct sigaction sa_int = {
> > > - .sa_sigaction = sigint_handler,
> > > - };
> > > + struct sigaction sa_int;
> > >
> > > + sa_int.sa_sigaction = sigint_handler,
> > > test_name = argv[0];
> >
> > What version of GCC does cygwin use? That doesn't seem like something
> > that should break due to OS differences.
> >
> > -Scott
> Currently 3.4.4. The compiler can't handle unnamed union in an
> initializer.
Or at least that's my surmise, I can't see why else it would be
breaking.
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-09-22 0:20 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-21 15:26 DTC Patch for Cygwin Matt Tyrlik
2007-09-21 18:46 ` Scott Wood
2007-09-21 19:42 ` Matt Tyrlik
2007-09-22 0:19 ` David Gibson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).