On Thu, Aug 17, 2006 at 07:42:00AM +0200, Ralf Wildenhues wrote: > * Albert Chin wrote on Thu, Aug 17, 2006 at 12:39:25AM CEST: > > 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". > > > 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: > > Which compiler option causes it to optimize away the symbols?
+O2. +O1 and no optimization seem to be ok. > Which linker option is that translated to? +O2 passes +Oprocelim to ld. > > How do we solve this? I suppose we could build without CFLAGS but then > > we'd lose +DD64 for 64-bit objects. > > Probably adding a linker flag at the end to undo the dangerous setting > should be safest, given there is such a flag. > > But say, why is -Wl,-E not passed to the link line? It should be > export_dynamic_flag_spec. And it should have the desired effect: > | -E Mark all symbols defined by a program for export > | to shared libraries. In a +compat mode link, ld > | marks only those symbols that are actually > | referenced by a shared library seen at link time. > | In a +std link, all symbols are exported by > | default, so -E is not necessary to make symbols > | visible. However, it has an additional side > | effect of identifying all exported symbols as > | necessary, so that they will not be removed when > | using dead code elimination (+Oprocelim). Because -export-dynamic is not specified. > Otherwise, -Wl,+Onoprocelim should be the hammer we're looking for, I > guess; but that should not even be necessary, given above documentation > (from ld(1)). Well, export_dynamic_flag_spec isn't even looked at when -dlopen self is being handled. Maybe it should and only use the -dlopen self code when export_dynamic_flag_spec is empty? If not, looks like we'll need to add +Onoprocelim to the cc command-line for HP-UX. What's the best way to do this? A new variable? -- albert chin ([EMAIL PROTECTED]) _______________________________________________ http://lists.gnu.org/mailman/listinfo/libtool