Hi splashscreen/build maintainers,

I'm using a non-standard gnu toolchain to build OpenJDK7,
and I got errors linking libsplashscreen.so:

../../../build/linux-i586/tmp/sun/sun.awt/splashscreen/obj/png.o: In
function `png_init_mmx_flags':
png.c:(.text+0xbb): undefined reference to `png_mmx_support'

(and many other undefined references)

What's up with that?

The gcc command includes "-z defs", explicitly asking
for an error with unresolved references.
Seems like good software engineering.
I wonder if the behavior of "-z defs" has changed...

Some detective work shows the missing
symbols being defined in pnggccrd.c.
Why isn't that being found?

Ahh, the list of files to be compiled in
make/sun/splashscreen/FILES_c.gmk
is incomplete.  We just need to add in pnggccrd.c....

Not so fast.  New compile errors rear their ugly head:

../../../src/share/native/sun/awt/libpng/pnggccrd.c: In function
'png_squelch_warnings':
../../../src/share/native/sun/awt/libpng/pnggccrd.c:390: error:
assignment of read-only variable '_const4'

The ironically named and long suffering function
png_squelch_warnings is trying to assign a read-only variable to itself.
That's not a good idea.

Newer version of libpng have tried to fix png_squelch_warnings,
but have finally squelched png_squelch_warnings itself by
annihilating it from the code base.

Anyways, please:
- review the change below
- file a bug
- let me know which forest to push this into (awt or build?)

BTW, upgrading to the latest libpng probably *is* a good idea.
Also, the icedtea folks simply link against the system libs,
which is a good idea in the context of distro development,
but might not work when trying to produce
"portable binaries".

Thanks,

Martin


# HG changeset patch
# User martin
# Date 1219537969 25200
# Node ID e02349ef40196557bd2561754e51f3c977d1e009
# Parent  af4668faae426222f072827ced8522e9c22ea18a
6666666: libsplashscreen.so unresolved link-time references
Summary: Compile forgotten source file pnggccrd.c, fix warnings
Reviewed-by:

diff --git a/make/sun/splashscreen/FILES_c.gmk
b/make/sun/splashscreen/FILES_c.gmk
--- a/make/sun/splashscreen/FILES_c.gmk
+++ b/make/sun/splashscreen/FILES_c.gmk
@@ -33,6 +33,7 @@
        splashscreen_sys.c \
        png.c \
        pngerror.c \
+       pnggccrd.c \
        pngget.c \
        pngmem.c  \
        pngpread.c \
diff --git a/src/share/native/sun/awt/libpng/pnggccrd.c
b/src/share/native/sun/awt/libpng/pnggccrd.c
--- a/src/share/native/sun/awt/libpng/pnggccrd.c
+++ b/src/share/native/sun/awt/libpng/pnggccrd.c
@@ -278,9 +278,9 @@
 int PNGAPI png_mmx_support(void);

 #ifdef PNG_USE_LOCAL_ARRAYS
-const static int FARDATA png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0};
-const static int FARDATA png_pass_inc[7]   = {8, 8, 4, 4, 2, 2, 1};
-const static int FARDATA png_pass_width[7] = {8, 4, 4, 2, 2, 1, 1};
+static const int FARDATA png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0};
+static const int FARDATA png_pass_inc[7]   = {8, 8, 4, 4, 2, 2, 1};
+static const int FARDATA png_pass_width[7] = {8, 4, 4, 2, 2, 1, 1};
 #endif

 #if defined(PNG_MMX_CODE_SUPPORTED)
@@ -339,30 +339,30 @@
 static int _unmask;
 #endif

-const static unsigned long long _mask8_0  = 0x0102040810204080LL;
-
-const static unsigned long long _mask16_1 = 0x0101020204040808LL;
-const static unsigned long long _mask16_0 = 0x1010202040408080LL;
-
-const static unsigned long long _mask24_2 = 0x0101010202020404LL;
-const static unsigned long long _mask24_1 = 0x0408080810101020LL;
-const static unsigned long long _mask24_0 = 0x2020404040808080LL;
-
-const static unsigned long long _mask32_3 = 0x0101010102020202LL;
-const static unsigned long long _mask32_2 = 0x0404040408080808LL;
-const static unsigned long long _mask32_1 = 0x1010101020202020LL;
-const static unsigned long long _mask32_0 = 0x4040404080808080LL;
-
-const static unsigned long long _mask48_5 = 0x0101010101010202LL;
-const static unsigned long long _mask48_4 = 0x0202020204040404LL;
-const static unsigned long long _mask48_3 = 0x0404080808080808LL;
-const static unsigned long long _mask48_2 = 0x1010101010102020LL;
-const static unsigned long long _mask48_1 = 0x2020202040404040LL;
-const static unsigned long long _mask48_0 = 0x4040808080808080LL;
-
-const static unsigned long long _const4   = 0x0000000000FFFFFFLL;
-//const static unsigned long long _const5 = 0x000000FFFFFF0000LL;
// NOT USED
-const static unsigned long long _const6   = 0x00000000000000FFLL;
+static const unsigned long long _mask8_0  = 0x0102040810204080LL;
+
+static const unsigned long long _mask16_1 = 0x0101020204040808LL;
+static const unsigned long long _mask16_0 = 0x1010202040408080LL;
+
+static const unsigned long long _mask24_2 = 0x0101010202020404LL;
+static const unsigned long long _mask24_1 = 0x0408080810101020LL;
+static const unsigned long long _mask24_0 = 0x2020404040808080LL;
+
+static const unsigned long long _mask32_3 = 0x0101010102020202LL;
+static const unsigned long long _mask32_2 = 0x0404040408080808LL;
+static const unsigned long long _mask32_1 = 0x1010101020202020LL;
+static const unsigned long long _mask32_0 = 0x4040404080808080LL;
+
+static const unsigned long long _mask48_5 = 0x0101010101010202LL;
+static const unsigned long long _mask48_4 = 0x0202020204040404LL;
+static const unsigned long long _mask48_3 = 0x0404080808080808LL;
+static const unsigned long long _mask48_2 = 0x1010101010102020LL;
+static const unsigned long long _mask48_1 = 0x2020202040404040LL;
+static const unsigned long long _mask48_0 = 0x4040808080808080LL;
+
+static const unsigned long long _const4   = 0x0000000000FFFFFFLL;
+//static const unsigned long long _const5 = 0x000000FFFFFF0000LL;
// NOT USED
+static const unsigned long long _const6   = 0x00000000000000FFLL;

 // These are used in the row-filter routines and should/would be local
 //  variables if not for gcc addressing limitations.
@@ -380,31 +380,6 @@
 void /* PRIVATE */
 png_squelch_warnings(void)
 {
-#ifdef PNG_THREAD_UNSAFE_OK
-   _dif = _dif;
-   _patemp = _patemp;
-   _pbtemp = _pbtemp;
-   _pctemp = _pctemp;
-   _MMXLength = _MMXLength;
-#endif
-   _const4  = _const4;
-   _const6  = _const6;
-   _mask8_0  = _mask8_0;
-   _mask16_1 = _mask16_1;
-   _mask16_0 = _mask16_0;
-   _mask24_2 = _mask24_2;
-   _mask24_1 = _mask24_1;
-   _mask24_0 = _mask24_0;
-   _mask32_3 = _mask32_3;
-   _mask32_2 = _mask32_2;
-   _mask32_1 = _mask32_1;
-   _mask32_0 = _mask32_0;
-   _mask48_5 = _mask48_5;
-   _mask48_4 = _mask48_4;
-   _mask48_3 = _mask48_3;
-   _mask48_2 = _mask48_2;
-   _mask48_1 = _mask48_1;
-   _mask48_0 = _mask48_0;
 }
 #endif /* PNG_MMX_CODE_SUPPORTED */

Reply via email to