You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by "George Gensure (JIRA)" <xe...@xml.apache.org> on 2010/02/23 20:40:28 UTC

[jira] Created: (XERCESC-1917) GCCDefs str[n]icmp prototype and symbol exposure

GCCDefs str[n]icmp prototype and symbol exposure
------------------------------------------------

                 Key: XERCESC-1917
                 URL: https://issues.apache.org/jira/browse/XERCESC-1917
             Project: Xerces-C++
          Issue Type: Bug
          Components: Build
    Affects Versions: 2.8.0
         Environment: linux x86_64 gcc
            Reporter: George Gensure


The stricmp and strnicmp prototypes provided as a workaround for those functions missing in gcc/glibc installations are defined in the global scope and without extern "C" qualifiers.  As a result, these are the *only* non-xerces_2_8 namespaced functions exposed by the shared library on linux.  I recognize that the compiler workarounds are included prior to the xercesc namespace definition, and as a compromise I'd be happy to see the definitions have their prototypes changed to be within an extern "C" block, as well as __attribute__((visibility("hidden"))) applied to their definitions.  The following diff applies cleanly to the 2.8 release and corrects my problem:

--- src/xercesc/util/Compilers/GCCDefs.hpp
+++ src/xercesc/util/Compilers/GCCDefs.hpp
@@ -130,8 +130,10 @@

 #if !defined(__CYGWIN__) && !defined(__MINGW32__)

+extern "C" {
 int stricmp(const char* const str1, const char* const  str2);
 int strnicmp(const char* const str1, const char* const  str2, const unsigned int count);
+}

 #endif // ! __CYGWIN__

--- src/xercesc/util/Compilers/GCCDefs.cpp
+++ src/xercesc/util/Compilers/GCCDefs.cpp
@@ -33,11 +33,13 @@

 #if !defined(__CYGWIN__) && !defined(__MINGW32__)

+__attribute__((visibility("hidden")))
 int stricmp(const char* const str1, const char* const  str2)
 {
  return strcasecmp(str1, str2);
 }

+__attribute__((visibility("hidden")))
 int strnicmp(const char* const str1, const char* const  str2, const unsigned int count)
 {
  if (count == 0)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org


[jira] Commented: (XERCESC-1917) GCCDefs str[n]icmp prototype and symbol exposure

Posted by "George Gensure (JIRA)" <xe...@xml.apache.org>.
    [ https://issues.apache.org/jira/browse/XERCESC-1917?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12837825#action_12837825 ] 

George Gensure commented on XERCESC-1917:
-----------------------------------------

Right, I wasn't suggesting that this be applied to the 3-series, just as a very simple patch to get the result that you have in 3 into the 2-series (without having to do major surgery to remove Compilers as you've done in 3).

As far as exposing the symbols in Xerces-C++, for me its a matter of completeness.  Their exposure is not documented anywhere in the Xerces API (nor would I expect it to be), and the nature of the exposure seems hackish: these are derivations of standard C library routines, why would they be exposed as C++ mangled symbols?  These are literally the only generally callable routines exposed by libxerces-c.so that are not properly namespaced, and I for one don't like having a 3rd party library I link against silently intercepting all my calls to 'printf' or 'qsort', or worse yet, causing symbol lookup ambiguity when an undocumented symbol matches the name of one I'm trying to build later in my toolchain.

Anyway, long rant aside, I'll give up hopes on 2.8 if this has been frozen.  Its the header definition in non-namespaced, non-extern "C" that's really a dealbreaker for me.

> GCCDefs str[n]icmp prototype and symbol exposure
> ------------------------------------------------
>
>                 Key: XERCESC-1917
>                 URL: https://issues.apache.org/jira/browse/XERCESC-1917
>             Project: Xerces-C++
>          Issue Type: Improvement
>          Components: Build
>    Affects Versions: 2.8.0
>         Environment: linux x86_64 gcc
>            Reporter: George Gensure
>            Priority: Minor
>
> The stricmp and strnicmp prototypes provided as a workaround for those functions missing in gcc/glibc installations are defined in the global scope and without extern "C" qualifiers.  As a result, these are the *only* non-xerces_2_8 namespaced functions exposed by the shared library on linux.  I recognize that the compiler workarounds are included prior to the xercesc namespace definition, and as a compromise I'd be happy to see the definitions have their prototypes changed to be within an extern "C" block, as well as __attribute__((visibility("hidden"))) applied to their definitions.  The following diff applies cleanly to the 2.8 release and corrects my problem:
> --- src/xercesc/util/Compilers/GCCDefs.hpp
> +++ src/xercesc/util/Compilers/GCCDefs.hpp
> @@ -130,8 +130,10 @@
>  #if !defined(__CYGWIN__) && !defined(__MINGW32__)
> +extern "C" {
>  int stricmp(const char* const str1, const char* const  str2);
>  int strnicmp(const char* const str1, const char* const  str2, const unsigned int count);
> +}
>  #endif // ! __CYGWIN__
> --- src/xercesc/util/Compilers/GCCDefs.cpp
> +++ src/xercesc/util/Compilers/GCCDefs.cpp
> @@ -33,11 +33,13 @@
>  #if !defined(__CYGWIN__) && !defined(__MINGW32__)
> +__attribute__((visibility("hidden")))
>  int stricmp(const char* const str1, const char* const  str2)
>  {
>   return strcasecmp(str1, str2);
>  }
> +__attribute__((visibility("hidden")))
>  int strnicmp(const char* const str1, const char* const  str2, const unsigned int count)
>  {
>   if (count == 0)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org


[jira] Updated: (XERCESC-1917) GCCDefs str[n]icmp prototype and symbol exposure

Posted by "Boris Kolpackov (JIRA)" <xe...@xml.apache.org>.
     [ https://issues.apache.org/jira/browse/XERCESC-1917?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Boris Kolpackov updated XERCESC-1917:
-------------------------------------

      Priority: Minor  (was: Major)
    Issue Type: Improvement  (was: Bug)

FYI, there are no plans to release any more versions in the 2-series. In the 3-series we use a similar workaround but in a cross-platform way, so this patch is not easily applicable. Also, what is the problem with having these symbols visible in the Xerces-C++ library?

> GCCDefs str[n]icmp prototype and symbol exposure
> ------------------------------------------------
>
>                 Key: XERCESC-1917
>                 URL: https://issues.apache.org/jira/browse/XERCESC-1917
>             Project: Xerces-C++
>          Issue Type: Improvement
>          Components: Build
>    Affects Versions: 2.8.0
>         Environment: linux x86_64 gcc
>            Reporter: George Gensure
>            Priority: Minor
>
> The stricmp and strnicmp prototypes provided as a workaround for those functions missing in gcc/glibc installations are defined in the global scope and without extern "C" qualifiers.  As a result, these are the *only* non-xerces_2_8 namespaced functions exposed by the shared library on linux.  I recognize that the compiler workarounds are included prior to the xercesc namespace definition, and as a compromise I'd be happy to see the definitions have their prototypes changed to be within an extern "C" block, as well as __attribute__((visibility("hidden"))) applied to their definitions.  The following diff applies cleanly to the 2.8 release and corrects my problem:
> --- src/xercesc/util/Compilers/GCCDefs.hpp
> +++ src/xercesc/util/Compilers/GCCDefs.hpp
> @@ -130,8 +130,10 @@
>  #if !defined(__CYGWIN__) && !defined(__MINGW32__)
> +extern "C" {
>  int stricmp(const char* const str1, const char* const  str2);
>  int strnicmp(const char* const str1, const char* const  str2, const unsigned int count);
> +}
>  #endif // ! __CYGWIN__
> --- src/xercesc/util/Compilers/GCCDefs.cpp
> +++ src/xercesc/util/Compilers/GCCDefs.cpp
> @@ -33,11 +33,13 @@
>  #if !defined(__CYGWIN__) && !defined(__MINGW32__)
> +__attribute__((visibility("hidden")))
>  int stricmp(const char* const str1, const char* const  str2)
>  {
>   return strcasecmp(str1, str2);
>  }
> +__attribute__((visibility("hidden")))
>  int strnicmp(const char* const str1, const char* const  str2, const unsigned int count)
>  {
>   if (count == 0)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org