libtool
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: HEAD and HP-UX C++ compiler


From: libtool-patches
Subject: Re: HEAD and HP-UX C++ compiler
Date: Thu, 20 Sep 2001 09:38:24 -0500
User-agent: Mutt/1.2.5i

On Wed, Sep 19, 2001 at 10:03:12PM -0500, address@hidden wrote:
> From HEAD:
> ...
> checking how to run the C++ preprocessor... aCC -E
> checking the maximum length of command line arguments... 393217
> checking command to parse /usr/ccs/bin/nm -p output from cc object...  failed
> ...
> 
> Problem is, with HP C++, A.03.30 (A.03.31 is the latest):
> 
> $ aCC -o conftest conftest.cc conftstm.o
> Error 352: "conftest.cc", line 23 # Cannot take the address of main.
>       {"main", (lt_ptr_t) &main},
>                            ^^^^  
>   $ cat conftest.cc
> #ifdef __cplusplus
> extern "C" {
> #endif
> 
> extern char nm_test_var;
> extern int main();
> extern int nm_test_func();
> #if defined (__STDC__) && __STDC__
> # define lt_ptr_t void *
> #else
> # define lt_ptr_t char *
> # define const
> #endif
> 
> /* The mapping between symbol names and symbols. */
> const struct {
>   const char *name;
>   lt_ptr_t address;
> }
> lt_preloaded_symbols[] =
> {
>   {"nm_test_var", (lt_ptr_t) &nm_test_var},
>   {"main", (lt_ptr_t) &main},
>   {"nm_test_func", (lt_ptr_t) &nm_test_func},
>   {0, (lt_ptr_t) 0}
> };
> 
> #ifdef __cplusplus
> }
> #endif
> 
> So, do we ignore main on HP-UX with aCC? BTW, G++ 3.0.1 failes too.
> Solaris C++ (5.3) works fine.

Here's a patch for this. Note that I tried, as a solution, changing
the default lt_cv_sys_global_symbol_to_cdecl to:
  sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e \
  's/^$symcode* .* \(.*\)$/extern char \1;/p'
as we should mark functions with a (). This worked on Solaris, HP-UX,
Tru64 UNIX, and IRIX but not on AIX. Given the following program:
  void foo(){int a=1;}
  int un_test;
  int in_test=1;

AIX xlc does:
  $ xlc -c a.c
  $ nm -Bg a.o
         0 T .foo
        44 D foo
        56 D in_test
        60 B un_test

If we could have the sed magic change this to (on output):
  T foo foo
  D in_test in_test
  D un_test un_test
then we'd be set but that requires us to keep state and I can't see a
quick hack to do this.

-- 
albert chin (address@hidden)

-- snip snip
2001-09-20  Albert Chin-A-Young <address@hidden>

        * libtool.m4: Don't include main() when testing for
        command to parse $NM output because some C++ compilers
        don't allow you to take the address of main (e.g. HP-UX aCC).

Index: libtool.m4
===================================================================
RCS file: /cvsroot/libtool/libtool/libtool.m4,v
retrieving revision 1.231
diff -u -3 -p -r1.231 libtool.m4
--- libtool.m4  2001/09/11 00:22:48     1.231
+++ libtool.m4  2001/09/20 13:38:10
@@ -3741,7 +3741,7 @@ extern "C" {
 
 EOF
          # Now generate the symbol file.
-         eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" >> 
conftest.$ac_ext'
+         eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main 
>> conftest.$ac_ext'
 
          cat <<EOF >> conftest.$ac_ext
 #if defined (__STDC__) && __STDC__
@@ -3759,7 +3759,7 @@ const struct {
 lt_preloaded_symbols[[]] =
 {
 EOF
-         sed "s/^$symcode$symcode* \(.*\) \(.*\)$/  {\"\2\", (lt_ptr_t) 
\&\2},/" < "$nlist" >> conftest.$ac_ext
+         sed "s/^$symcode$symcode* \(.*\) \(.*\)$/  {\"\2\", (lt_ptr_t) 
\&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext
          cat <<\EOF >> conftest.$ac_ext
   {0, (lt_ptr_t) 0}
 };
@@ -4721,7 +4721,7 @@ EOF



reply via email to

[Prev in Thread] Current Thread [Next in Thread]