The current gcc only generates ELF type info for undefined symbol for
HPUX. This information is useful for linker to detect possible run-time
problems at link-time. Here is an example:

[EMAIL PROTECTED] mismatch]$ cat foo.c
#include <stdio.h>

extern void bar (void);

int times;

int
main ()
{
  printf ("times: %d\n", times);
  bar ();

  return 0;
}
[EMAIL PROTECTED] mismatch]$ cat bar.c
#include <stdio.h>
#include <sys/times.h>

void
bar (void)
{
  struct tms buf;
  clock_t ticks = times (&buf);
  printf ("Ticks: %ld\n", (long) ticks);
}
[EMAIL PROTECTED] mismatch]$ make
gcc -O -g   -c -o foo.o foo.c
gcc -O -g -fPIC   -c -o bar.o bar.c
gcc -o libbar.so -shared bar.o
gcc -o foo foo.o libbar.so -Wl,-rpath,.
./foo
times: 0
make: *** [all] Segmentation fault

If linker knows "times" referenced by libbar.so is a function, it can
avoid the run-time problem.


H.J.

Reply via email to