Re: [PATCH] makekeys: Fix build/target word size mismatch when cross-compiling
On 11-05-30 12:07 PM, walter harms wrote: (val 24) 0xff = hi val 0xff = lo (maybe a simple %08x would do the same) Ntl. the coding style (byte oriented) indicated that the Signature may be different on big/little endian machines. i really have no idea but i learned to take that (and others) as warning sign. Obviously you took a look into this Signature stuff may be you have an idea ... re, wh As far as I can tell it should cause any trouble. Just to be sure, I ran makekeys, and the Keysym related functions in libX11 on both a big and little endian system, with identical output. All seems to be well, unless someone else can shed some light on something I may have missed. - Derek ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
Re: [PATCH] makekeys: Fix build/target word size mismatch when cross-compiling
Am 31.05.2011 17:24, schrieb Derek Buitenhuis: On 11-05-30 12:07 PM, walter harms wrote: (val 24) 0xff = hi val 0xff = lo (maybe a simple %08x would do the same) Ntl. the coding style (byte oriented) indicated that the Signature may be different on big/little endian machines. i really have no idea but i learned to take that (and others) as warning sign. Obviously you took a look into this Signature stuff may be you have an idea ... re, wh As far as I can tell it should cause any trouble. Just to be sure, I ran makekeys, and the Keysym related functions in libX11 on both a big and little endian system, with identical output. All seems to be well, unless someone else can shed some light on something I may have missed. - Derek thanks for testing that. re, wh ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
Re: [PATCH] makekeys: Fix build/target word size mismatch when cross-compiling
On Mon, May 30, 2011 at 10:46:01AM -0400, Derek Buitenhuis wrote: On 11-05-30 10:42 AM, Daniel Stone wrote: Why not just typedef Signature to be uint32_t everywhere? I wasn't sure what sort of black magic the libX11 code itself uses with regards to this, so I figured a safer option would be to modify makekeys in this way. If it is deemed safe, I have no objection to to doing this. I can't see any problem myself, given that all the interfaces using Signature are internal and the header files with it aren't installed anywhere. Cheers, Daniel ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
Re: [PATCH] makekeys: Fix build/target word size mismatch when cross-compiling
Am 30.05.2011 15:37, schrieb Derek Buitenhuis: From: Derek Buitenhuis dbuit...@windriver.com Since makekeys is built using build environment's gcc and run natively, we have to make sure that the size of the Signature type is the same on both the native build environment and the host, otherwise we get mismatches upon running X, and some LSB test failures (xts5). Have configure check the size of the host's unsigned long and typedef Signature in makekeys.c accordingly. I have no clue how signature is used but i guess it would be useful to have it the same size on all architectures. The way it is printed does not take into account big/little endian, is this adressed somewhere else ? re, wh --- configure.ac|3 +++ src/util/makekeys.c | 13 ++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index a39ab8d..81acb8f 100644 --- a/configure.ac +++ b/configure.ac @@ -227,6 +227,9 @@ AC_CHECK_HEADERS([sys/select.h]) # Checks for typedefs, structures, and compiler characteristics. +# Check the size of unsigned long for use in makekeys +AC_CHECK_SIZEOF([unsigned long]) + # Checks for library functions. AC_CHECK_FUNCS([strtol]) # Used in lcFile.c (see also --enable-xlocaledir settings below) diff --git a/src/util/makekeys.c b/src/util/makekeys.c index 8f88beb..6022f3b 100644 --- a/src/util/makekeys.c +++ b/src/util/makekeys.c @@ -31,10 +31,17 @@ from The Open Group. #include X11/X.h #include X11/Xos.h #include X11/keysymdef.h +#include stdint.h #include stdio.h #include stdlib.h -typedef unsigned long Signature; +#include ../config.h + +#if SIZEOF_UNSIGNED_LONG == 4 +typedef uint32_t Signature; +#else +typedef uint64_t Signature; +#endif #define KTNUM 4000 @@ -212,8 +219,8 @@ next1:; offsets[j] = k; indexes[i] = k; val = info[i].val; - printf(0x%.2lx, 0x%.2lx, 0x%.2lx, 0x%.2lx, 0x%.2lx, 0x%.2lx, , -(sig 8) 0xff, sig 0xff, + printf(0x%.2jx, 0x%.2jx, 0x%.2lx, 0x%.2lx, 0x%.2lx, 0x%.2lx, , +(uintmax_t)((sig 8) 0xff), (uintmax_t)(sig 0xff), (val 24) 0xff, (val 16) 0xff, (val 8) 0xff, val 0xff); for (name = info[i].name, k += 7; (c = *name++); k++) ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
Re: [PATCH] makekeys: Fix build/target word size mismatch when cross-compiling
Hi, On Fri, May 20, 2011 at 11:05:44AM -0400, Derek Buitenhuis wrote: Since makekeys is built using build environment's gcc and run natively, we have to make sure that the size of the Signature type is the same on both the native build environment and the host, otherwise we get mismatches upon running X, and some LSB test failures (xts5). Have configure check the size of the host's unsigned long and typedef Signature in makekeys.c accordingly. Why not just typedef Signature to be uint32_t everywhere? Cheers, Daniel ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
Re: [PATCH] makekeys: Fix build/target word size mismatch when cross-compiling
On 11-05-30 10:42 AM, Daniel Stone wrote: Why not just typedef Signature to be uint32_t everywhere? Cheers, Daniel I wasn't sure what sort of black magic the libX11 code itself uses with regards to this, so I figured a safer option would be to modify makekeys in this way. If it is deemed safe, I have no objection to to doing this. - Derek ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
Re: [PATCH] makekeys: Fix build/target word size mismatch when cross-compiling
On 11-05-30 10:28 AM, walter harms wrote: The way it is printed does not take into account big/little endian, is this adressed somewhere else ? re, wh Could you perhaps elaborate a bit on what you mean by this? I have a vague idea what you're getting at, but clarity never hurts. As far as I can tell, this isn't related to my fix, but may be a problem regardless, and would be nice to fix. - Derek ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
Re: [PATCH] makekeys: Fix build/target word size mismatch when cross-compiling
Am 30.05.2011 17:27, schrieb Derek Buitenhuis: On 11-05-30 10:28 AM, walter harms wrote: The way it is printed does not take into account big/little endian, is this adressed somewhere else ? re, wh Could you perhaps elaborate a bit on what you mean by this? I have a vague idea what you're getting at, but clarity never hurts. As far as I can tell, this isn't related to my fix, but may be a problem regardless, and would be nice to fix. - Derek + printf(0x%.2jx, 0x%.2jx, 0x%.2lx, 0x%.2lx, 0x%.2lx, 0x%.2lx, , +(uintmax_t)((sig 8) 0xff), (uintmax_t)(sig 0xff), (val 24) 0xff, (val 16) 0xff, (val 8) 0xff, val 0xff); (val 24) 0xff = hi val 0xff = lo (maybe a simple %08x would do the same) Ntl. the coding style (byte oriented) indicated that the Signature may be different on big/little endian machines. i really have no idea but i learned to take that (and others) as warning sign. Obviously you took a look into this Signature stuff may be you have an idea ... re, wh ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
Re: [PATCH] makekeys: Fix build/target word size mismatch when cross-compiling
I was going to push this patch, but something appears to have gotten mangled in the e-mailing, and it can't be applied. Can you resend with a non-whitespace mangling mailer like git send-email or as an attachment? Also, sticking the new CHECK_SIZEOF right in the middle of the loadable module checks seems like poor placement. Perhaps down after the: # Checks for typedefs, structures, and compiler characteristics. would be better? -- -Alan Coopersmith-alan.coopersm...@oracle.com Oracle Solaris Platform Engineering: X Window System On 05/20/11 08:05 AM, Derek Buitenhuis wrote: Since makekeys is built using build environment's gcc and run natively, we have to make sure that the size of the Signature type is the same on both the native build environment and the host, otherwise we get mismatches upon running X, and some LSB test failures (xts5). Have configure check the size of the host's unsigned long and typedef Signature in makekeys.c accordingly. --- configure.ac|3 +++ src/util/makekeys.c | 13 ++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index a39ab8d..16108a5 100644 --- a/configure.ac +++ b/configure.ac @@ -192,6 +192,9 @@ else fi AC_MSG_RESULT($HAVE_LOADABLE_MODULES) +#Check the size of unsigned long for use in makekeys +AC_CHECK_SIZEOF([unsigned long]) + AC_MSG_CHECKING([if loadable i18n module support should be enabled]) AC_ARG_ENABLE(loadable-i18n, AS_HELP_STRING([--enable-loadable-i18n], diff --git a/src/util/makekeys.c b/src/util/makekeys.c index 8f88beb..6022f3b 100644 --- a/src/util/makekeys.c +++ b/src/util/makekeys.c @@ -31,10 +31,17 @@ from The Open Group. #include X11/X.h #include X11/Xos.h #include X11/keysymdef.h +#include stdint.h #include stdio.h #include stdlib.h -typedef unsigned long Signature; +#include ../config.h + +#if SIZEOF_UNSIGNED_LONG == 4 +typedef uint32_t Signature; +#else +typedef uint64_t Signature; +#endif #define KTNUM 4000 @@ -212,8 +219,8 @@ next1:; offsets[j] = k; indexes[i] = k; val = info[i].val; -printf(0x%.2lx, 0x%.2lx, 0x%.2lx, 0x%.2lx, 0x%.2lx, 0x%.2lx, , - (sig 8) 0xff, sig 0xff, +printf(0x%.2jx, 0x%.2jx, 0x%.2lx, 0x%.2lx, 0x%.2lx, 0x%.2lx, , + (uintmax_t)((sig 8) 0xff), (uintmax_t)(sig 0xff), (val 24) 0xff, (val 16) 0xff, (val 8) 0xff, val 0xff); for (name = info[i].name, k += 7; (c = *name++); k++) ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
Re: [PATCH] makekeys: Fix build/target word size mismatch when cross-compiling
cross-compilation is a PITA. Reviewed-by: Jeremy Huddleston jerem...@apple.com On May 20, 2011, at 08:05, Derek Buitenhuis wrote: Since makekeys is built using build environment's gcc and run natively, we have to make sure that the size of the Signature type is the same on both the native build environment and the host, otherwise we get mismatches upon running X, and some LSB test failures (xts5). Have configure check the size of the host's unsigned long and typedef Signature in makekeys.c accordingly. --- configure.ac|3 +++ src/util/makekeys.c | 13 ++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index a39ab8d..16108a5 100644 --- a/configure.ac +++ b/configure.ac @@ -192,6 +192,9 @@ else fi AC_MSG_RESULT($HAVE_LOADABLE_MODULES) +#Check the size of unsigned long for use in makekeys +AC_CHECK_SIZEOF([unsigned long]) + AC_MSG_CHECKING([if loadable i18n module support should be enabled]) AC_ARG_ENABLE(loadable-i18n, AS_HELP_STRING([--enable-loadable-i18n], diff --git a/src/util/makekeys.c b/src/util/makekeys.c index 8f88beb..6022f3b 100644 --- a/src/util/makekeys.c +++ b/src/util/makekeys.c @@ -31,10 +31,17 @@ from The Open Group. #include X11/X.h #include X11/Xos.h #include X11/keysymdef.h +#include stdint.h #include stdio.h #include stdlib.h -typedef unsigned long Signature; +#include ../config.h + +#if SIZEOF_UNSIGNED_LONG == 4 +typedef uint32_t Signature; +#else +typedef uint64_t Signature; +#endif #define KTNUM 4000 @@ -212,8 +219,8 @@ next1:; offsets[j] = k; indexes[i] = k; val = info[i].val; -printf(0x%.2lx, 0x%.2lx, 0x%.2lx, 0x%.2lx, 0x%.2lx, 0x%.2lx, , - (sig 8) 0xff, sig 0xff, +printf(0x%.2jx, 0x%.2jx, 0x%.2lx, 0x%.2lx, 0x%.2lx, 0x%.2lx, , + (uintmax_t)((sig 8) 0xff), (uintmax_t)(sig 0xff), (val 24) 0xff, (val 16) 0xff, (val 8) 0xff, val 0xff); for (name = info[i].name, k += 7; (c = *name++); k++) -- 1.7.4.1 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel