diff --git a/ANNOUNCE b/ANNOUNCE index 37a01a71e..cc5019f91 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -93,6 +93,14 @@ Version 1.6.3beta07 [June 8, 2013] the optimizations ('check' vs 'api') are exposed in the public header files except that the new setting PNG_ARM_NEON_OPT documents how libpng makes the decision about whether or not to use the optimizations. + Protect symbol prefixing against CC/CPPFLAGS/CFLAGS useage. + Previous iOS/Xcode fixes for the ARM NEON optimizations moved the test + on __ARM_NEON__ from configure time to compile time. This breaks symbol + prefixing because the definition of the special png_init_filter_functions + call was hidden at configure time if the relevant compiler arguments are + passed in CFLAGS as opposed to CC. This change attempts to avoid all + the confusion that would result by declaring the init function even when + it is not used, so that it will always get prefixed. Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/CHANGES b/CHANGES index 4615e2be7..68ba609fc 100644 --- a/CHANGES +++ b/CHANGES @@ -4577,6 +4577,14 @@ Version 1.6.3beta07 [June 8, 2013] the optimizations ('check' vs 'api') are exposed in the public header files except that the new setting PNG_ARM_NEON_OPT documents how libpng makes the decision about whether or not to use the optimizations. + Protect symbol prefixing against CC/CPPFLAGS/CFLAGS useage. + Previous iOS/Xcode fixes for the ARM NEON optimizations moved the test + on __ARM_NEON__ from configure time to compile time. This breaks symbol + prefixing because the definition of the special png_init_filter_functions + call was hidden at configure time if the relevant compiler arguments are + passed in CFLAGS as opposed to CC. This change attempts to avoid all + the confusion that would result by declaring the init function even when + it is not used, so that it will always get prefixed. Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/pngpriv.h b/pngpriv.h index c42aed796..9729dac76 100644 --- a/pngpriv.h +++ b/pngpriv.h @@ -96,8 +96,16 @@ * done and this interferes with the handling of the ARM NEON optimizations, and * possibly other similiar optimizations. Put additional tests here; in general * this is needed when the same option can be changed at both compile time and - * run time depending on the target OS (i.e. iOS vs Android.) The changes have - * to occur here to get the symbol prefixing to work consistently. + * run time depending on the target OS (i.e. iOS vs Android.) + * + * NOTE: symbol prefixing does not pass $(CFLAGS) to the preprocessor, because + * this is not possible with certain compilers (Oracle SUN OS CC), as a result + * it is necessary to ensure that all extern functions that *might* be used + * regardless of $(CFLAGS) get declared in this file. The test on __ARM_NEON__ + * below is one example of this behavior because it is controlled by the + * presence or not of -mfpu=neon on the GCC command line, it is possible to do + * this in $(CC), e.g. "CC=gcc -mfpu=neon", but people who build libpng rarely + * do this. */ #ifndef PNG_ARM_NEON_OPT /* ARM NEON optimizations are being controlled by the compiler settings, @@ -115,7 +123,7 @@ #if PNG_ARM_NEON_OPT > 0 /* NEON optimizations are to be at least considered by libpng, enable the - * callbacks to do this. (This is what matters for the symbol prefixing.) + * callbacks to do this. */ # define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_neon #endif @@ -1941,14 +1949,22 @@ PNG_INTERNAL_FUNCTION(void, png_image_free, (png_imagep image), PNG_EMPTY); #endif /* SIMPLIFIED READ/WRITE */ +/* These are initialization functions for hardware specific PNG filter + * optimizations; list these here then select the appropriate one at compile + * time using the macro PNG_FILTER_OPTIMIZATIONS. If the macro is not defined + * the generic code is used. + */ #ifdef PNG_FILTER_OPTIMIZATIONS PNG_INTERNAL_FUNCTION(void, PNG_FILTER_OPTIMIZATIONS, (png_structp png_ptr, - unsigned int bpp), PNG_EMPTY); - /* This is the initialization function for hardware specific optimizations, - * one implementation (for ARM NEON machines) is contained in - * arm/filter_neon.c. It need not be defined - the generic code will be used - * if not. + unsigned int bpp), PNG_EMPTY); + /* Just declare the optimization that will be used */ +#else + /* List *all* the possible optimizations here - this branch is required if + * the builder of libpng passes the definition of PNG_FILTER_OPTIMIZATIONS in + * CFLAGS in place of CPPFLAGS *and* uses symbol prefixing. */ +PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_neon, + (png_structp png_ptr, unsigned int bpp), PNG_EMPTY); #endif /* Maintainer: Put new private prototypes here ^ */ diff --git a/scripts/pnglibconf.dfa b/scripts/pnglibconf.dfa index ae9f323c0..4dea09cec 100755 --- a/scripts/pnglibconf.dfa +++ b/scripts/pnglibconf.dfa @@ -119,7 +119,7 @@ logunsupported = 1 # # If you create a private DLL you need to define the following # macros in the file 'pngusr.h' and set -DPNG_USER_CONFIG for -# compilation (i.e. in CFLAGS.) +# compilation (i.e. in CPPFLAGS.) # #define PNG_USER_PRIVATEBUILD \ # # e.g. #define PNG_USER_PRIVATEBUILD "Build by MyCompany for xyz reasons." @@ -204,11 +204,11 @@ option SET_OPTION disabled # # ARM_NEON_OPT: unset: check at compile time (__ARM_NEON__ must be defined by # the compiler, typically as a result of specifying -# -mfpu=neon on the command line.) +# CC="gcc -mfpu=neon".) # 0: disable (even if the CPU has a NEON FPU.) # 1: check at run time (via ARM_NEON_{API,CHECK}) # 2: switch on unconditionally (inadvisable - instead pass -# -mfpu=neon to GCC in CFLAGS) +# -mfpu=neon to GCC in CC) # When building libpng avoid using any setting other than '0'; '1' is # set automatically when either 'API' or 'CHECK' are configured in, # '2' should not be necessary as -mfpu=neon will achieve the same