Re: [evlog-dev] [Bug] evlog cannot work properly if compiled with gcc 3.2
Hien Nguyen <[email protected]> Mon, 03 Feb 2003 14:36:09 -0800
| Newsgroups | gmane.linux.kernel.event-logging |
|---|---|
| Message-ID | <[email protected]> |
Hi Yi,
We were aware of the bitfield issue and identified that is gcc related.
We also fixed the defaultTest line number issue. Thanks for your patch,
but we need to investigate the issue a little more rather using your
patch this time.
We will issue a warning to all users that are using bitfields, to be
aware of the structure alignment issue (particularly with long long
bitfields) with gcc v3.2 vs v2.96.
Best regards, Hien.
Zhu, Yi wrote:
> Hi,
>
> I find the bitfield test and default test failed when I ran them under my
> Redhat 8.0 which uses gcc 3.2. I did a search in google and found below
> words in
> http://www.redhat.com/docs/manuals/linux/RHL-8.0-Manual/release-notes/x86/.
>
> Note that because of significant ABI fixes, the C++ compiler included in GCC
> 3.2 produces code that is not binary compatible with previous versions of
> GCC, including versions 3.1.x and 2.96. Additionally, there are ABI fixes
> for the C compiler related to long long bitfields and where
> __attribute__((aligned (xxx))) type definitions used as base type bitfields
> work differently than using __attribute__((aligned (xxx))) directly on the
> bitfield.
>
> I've made a patch according to this and tested on i386 machines with both
> gcc 2.96 and 3.2. However I am not sure it is complete or not. So would
> anyone like to double check the code or test it on other platforms (i.e.
> ppc, s390)?
>
> Another thing gcc changed is the __LINE__. It uses the last line number of a
> macro instead of the first now. Don't know why, but now the line number is
> the same as those of ppc and s390 :)
>
>
> diff -Nuar evlog/user/lib/template/template.c
> evlog-new/user/lib/template/template.c
> --- evlog/user/lib/template/template.c 2002-10-29 23:57:51.000000000 +0800
> +++ evlog-new/user/lib/template/template.c 2003-02-04
> 01:08:11.000000000 +0800
> @@ -2542,6 +2542,7 @@
> att->ta_flags |= EVL_ATTR_EXISTS;
> }
>
> +#define GCC_VERSION __GNUC__ * 100 + __GNUC_MINOR__
> /*
> * att is a (possibly unnamed) bit-field in template t. bfStart points to
> * the address of the bit-field storage unit currently being accumulated,
> @@ -2590,8 +2591,14 @@
> */
> adjustNextPerBitFields(notes, *bfStart, *bfOffset);
> if (bfBits > intBits) {
> +#if GCC_VERSION < 302 /* gcc < 3.2 */
> alignNextPtr(notes, t->tm_data, __alignof__(long
> long));
> +#endif
> } else {
> +#if GCC_VERSION >= 302 /* gcc >= 3.2 */
> + if ( (baseType(att) != TY_LONGLONG) &&
> + (baseType(att) != TY_ULONGLONG) )
> +#endif
> alignNextPtr(notes, t->tm_data,
> computeAttAlignment(att));
> }
> @@ -2600,6 +2607,7 @@
> }
>
> bytesRemaining = notes->pn_end - *bfStart;
> + bytesRemaining = notes->pn_end - *bfStart;
> stgUnitBytes = bitsToBytes(*bfOffset + bfBits);
> if (stgUnitBytes > bytesRemaining) {
> goto outOfData;
> diff -Nuar evlog/user/lib/test/defaultTest.oldgcc.out
> evlog-new/user/lib/test/defaultTest.oldgcc.out
> --- evlog/user/lib/test/defaultTest.oldgcc.out 1970-01-01
> 08:00:00.000000000 +0800
> +++ evlog-new/user/lib/test/defaultTest.oldgcc.out 2003-02-04 00:53:03.
> 000000000 +0800
> @@ -0,0 +1,20 @@
> +event type 1001:
> +defaultTest.c:54: This event record has a message string, but no further
> data.
> +
> +event type 1002:
> +defaultTest.c:60: This event record has a message string plus 3 ints.
> +00000000 0B 00 00 00 15 00 00 00 CE 07 00 00
> +event type 1003:
> +Hey! Something happened at line 67 of defaultTest.c:
> +Basically the same data as for event type 1002,
> +but formatted with a non-default template.
> +11/21/1998
> +event type 1004:
> +defaultTest.c:75: This event record has a message string, plus another
> string.
> +00000000 54 68 69 73 20 69 73 20 74 68 65 20 6F 74 68 65
> +00000010 72 20 73 74 72 69 6E 67 2E 00
> +event type 1003:
> +Hey! Something happened at line 82 of defaultTest.c:
> +This is another instance of event type 1003,
> +with a different message and different ints.
> +9/30/2000
> diff -Nuar evlog/user/lib/test/defaultTest.out
> evlog-new/user/lib/test/defaultTest.out
> --- evlog/user/lib/test/defaultTest.out 2002-07-25 04:15:40.000000000 +0800
> +++ evlog-new/user/lib/test/defaultTest.out 2003-02-04
> 00:54:28.000000000 +0800
> @@ -1,20 +1,20 @@
> event type 1001:
> -defaultTest.c:54: This event record has a message string, but no further
> data.
> +defaultTest.c:56: This event record has a message string, but no further
> data.
>
> event type 1002:
> -defaultTest.c:60: This event record has a message string plus 3 ints.
> +defaultTest.c:63: This event record has a message string plus 3 ints.
> 00000000 0B 00 00 00 15 00 00 00 CE 07 00 00
> event type 1003:
> -Hey! Something happened at line 67 of defaultTest.c:
> +Hey! Something happened at line 71 of defaultTest.c:
> Basically the same data as for event type 1002,
> but formatted with a non-default template.
> 11/21/1998
> event type 1004:
> -defaultTest.c:75: This event record has a message string, plus another
> string.
> +defaultTest.c:78: This event record has a message string, plus another
> string.
> 00000000 54 68 69 73 20 69 73 20 74 68 65 20 6F 74 68 65
> 00000010 72 20 73 74 72 69 6E 67 2E 00
> event type 1003:
> -Hey! Something happened at line 82 of defaultTest.c:
> +Hey! Something happened at line 86 of defaultTest.c:
> This is another instance of event type 1003,
> with a different message and different ints.
> 9/30/2000
> diff -Nuar evlog/user/lib/test/defaultTest.sh
> evlog-new/user/lib/test/defaultTest.sh
> --- evlog/user/lib/test/defaultTest.sh 2002-07-25 04:06:02.000000000 +0800
> +++ evlog-new/user/lib/test/defaultTest.sh 2003-02-04
> 01:39:52.000000000 +0800
> @@ -9,7 +9,13 @@
>
> if [ "$ARCH" = "i386" ]
> then
> - TEST_TEMPLATE=defaultTest.out
> + MAJOR=`gcc -dumpversion |cut -d'.' -f1`
> + MINOR=`gcc -dumpversion |cut -d'.' -f2`
> + if [ $MAJOR -eq 3 -a $MINOR -ge 2 -o $MAJOR -gt 3 ]; then
> + TEST_TEMPLATE=defaultTest.out
> + else
> + TEST_TEMPLATE=defaultTest.oldgcc.out
> + fi
> else
> TEST_TEMPLATE=defaultTest.$ARCH.out
> fi
> diff -Nuar evlog/user/Makefile evlog-new/user/Makefile
> --- evlog/user/Makefile 2002-12-16 10:35:09.000000000 +0800
> +++ evlog-new/user/Makefile 2003-02-04 01:28:45.000000000 +0800
> @@ -195,6 +195,7 @@
> install -m 755 ./lib/test/defaultTest $(STATEDIR)/test
> install -m 755 ./lib/test/defaultTest.sh $(STATEDIR)/test
> install -m 644 ./lib/test/defaultTest.out $(STATEDIR)/test
> + install -m 644 ./lib/test/defaultTest.oldgcc.out $(STATEDIR)/test
> install -m 644 ./lib/test/defaultTest.ia64.out $(STATEDIR)/test
> install -m 644 ./lib/test/defaultTest.ppc.out $(STATEDIR)/test
> install -m 644 ./lib/test/defaultTest.s390.out $(STATEDIR)/test
>
> Thanks,
> -Zhu Yi
>
>
> -------------------------------------------------------
> This SF.NET email is sponsored by:
> SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
> http://www.vasoftware.com
> _______________________________________________
> evlog-developers mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/evlog-developers
>
-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com