This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: 2002-04-28's 3.1 branch's libjava won't build on GNU/Linux/sparc


On Wed, May 01, 2002 at 02:35:06AM -0300, Alexandre Oliva wrote:
> On May  1, 2002, "David S. Miller" <davem@redhat.com> wrote:
> 
> > Turns out there is nothing for me to fix, GLIBC-2.2.4 or later
> > is actually required for this platform for other reasons
> > (unaligned relocations not handled properly by ld.so)
> 
> But if you depend on being able to call __libc_sigaction, odds are
> that it won't work on glibc 2.3, that AFAIK will actually make
> internal symbols unavailable for linking.

Well, it will work, but i forbidden and you e.g. won't be able to package
such libgcj with rpm.
BTW: It is libgcj.so which has the __libc_sigaction@@GLIBC_PRIVATE
reference, so basically all Java binaries are screwed up.

I'll make a patch for glibc to add -fexceptions to pthread_sighandler*
routines, but in the mean time, something like:
libc_handle = dlopen (LIBC_SO_NAME, RTLD_LAZY);
libc_sigaction = dlsym (libc_handle, "sigaction");
dlclose (libc_handle);

(where LIBC_SO_NAME would be determined by configure (e.g. through ldd
some_trivial_program linked with proper multi-lib options))
or something like:

#include <link.h>
#include <stddef.h>
#include <string.h>

#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) \
    || (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2 && defined(DT_CONFIG))

static const char *libc_so_path;

static int
mtf_libc_iterate_callback (struct dl_phdr_info * info, size_t size, void * ptr)
{
       const char *p;
       if (size < offsetof(struct dl_phdr_info, dlpi_phdr))
               return -1;
       if (info->dlpi_name == NULL)
               return 0;
       p = strstr(info->dlpi_name, "/libc.so.");
       if (p != NULL)
       {
               if (! libc_so_path
                   || strncmp (info->dlpi_name, "/lib/", 5) == 0)
                       libc_so_path = info->dlpi_name;
       }
       return 0;
}

  if (dl_iterate_phdr (mtf_libc_iterate_callback, NULL) < 0)
    error ("Couldn't iterate over shared libraries");
  if (libc_so_path == NULL)
    error ("Couldn't find libc.so");
  libc_handle = dlopen (libc_so_path, RTLD_LAZY);
  libc_sigaction = dlsym (libc_handle, "sigaction");
  dlclose (libc_handle);

#endif

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]