libtool
[Top][All Lists]
Advanced

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

-dlopen self and optimizing away symbols


From: Albert Chin
Subject: -dlopen self and optimizing away symbols
Date: Wed, 16 Aug 2006 17:39:25 -0500
User-agent: Mutt/1.5.6i

Just built openldap-2.3.25 on HP-UX 11.23/IA. 'make check' fails
because a symbol wasn't available in the main binary which dlopen()'ed
a module that required the symbol. The main binary was built with
"-dlopen self". The problem is, after the symbols were extracted from
all .o objects that comprise the main binary, the main binary was then
linked with:
  /bin/sh ../..//libtool --mode=link cc -z +O2 +Onofltacc \
  +Olit=all +Oentrysched +DD64 +Odataprefetch +Onolimit +We901 \
  -L/opt/TWWfsw/libsasl21/lib/hpux64 \
  -L/opt/TWWfsw/libopenssl097/lib/hpux64 \
  -L/opt/TWWfsw/libdb42/lib/hpux64 \
  
-Wl,+b,/opt/TWWfsw/openldap2325lib/hpux64:/opt/TWWfsw/libdb42/lib/hpux64:/opt/TWWfsw/libsasl21/lib/hpux64:/opt/TWWfsw/libopenssl097/lib/hpux64
 \
  -dlopen self -o slapd main.o globals.o bconfig.o config.o daemon.o
  connection.o search.o ...
  rm -f .libs/slapd.nm .libs/slapd.nmS .libs/slapd.nmT
  creating .libs/slapdS.c
  generating symbol list for `slapd'
  extracting global C symbols from `main.o'
  extracting global C symbols from `globals.o'
  extracting global C symbols from `bconfig.o'
  extracting global C symbols from `config.o'
  extracting global C symbols from `daemon.o'
  ...
  (cd .libs && cc -z +O2 +Onofltacc +Olit=all +Oentrysched +DD64 +Odataprefetch 
+Onolimit +We901 -c  -DPIC "slapdS.c")
  cc -z +O2 +Onofltacc +Olit=all +Oentrysched +DD64 +Odataprefetch \
  +Onolimit +We901 -Wl,+b \
  
-Wl,/opt/TWWfsw/openldap2325lib/hpux64:/opt/TWWfsw/libdb42/lib/hpux64:/opt/TWWfsw/libsasl21/lib/hpux64:/opt/TWWfsw/libopenssl097/lib/hpux64
 \
  .libs/slapdS.o -o .libs/slapd main.o globals.o bconfig.o config.o \
  daemon.o ...

Unfortunately, the HP-UX 11.23/IA compiler, when generating
.libs/slapd, will optimize _away_ symbols that are not used by any of
the object files being linked:
  $ nm .libs/slapd | grep backend_add
  $ nm .libs/slapd | grep backend_group
  [947]    |   4611686018428014688|     176|FUNC |GLOB |0| .text|backend_group

  $ nm main.o globals.o bconfig.o config.o ... | grep backend_add
  [129]    |                     0|     800|FUNC |GLOB |0| .text|backend_add

  $ nm main.o globals.o bconfig.o config.o ... | grep backend_group
  [157]    |                     0|     176|FUNC |GLOB |0| .text|backend_group
  [71]     |                     0|       0|FUNC |GLOB |0| UNDEF|backend_group
  [43]     |                     0|       0|FUNC |GLOB |0| UNDEF|backend_group

How do we solve this? I suppose we could build without CFLAGS but then
we'd lose +DD64 for 64-bit objects.

-- 
albert chin (address@hidden)




reply via email to

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