linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* 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

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