[Top][All Lists]

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

unexelf.c doesn't always work on Solaris

From: Drazen Kacar
Subject: unexelf.c doesn't always work on Solaris
Date: Wed, 21 Aug 2002 02:54:58 +0200


I've compiled Emacs 21.2 with gcc 3.2 on Solaris 8 and specified
LDFLAGS="-Wl,-zcombreloc". That's a linker flag which asks for some
optimizations, so the start-up will be faster.

With that in place, "emacs -batch" works, but starting Emacs without that
option ends in SIGSEGV. The problem is that the stuff in unexelf.c
doesn't know how to handle a single combined relocation section.

I could try to make it work, but the code is messy and I rather wouldn't.
A simple and elegant solution is to use Solaris dldump() function, like

#include <stdio.h>
#include <stdlib.h>
#include <dlfcn.h>

unexec (char *new_name, char *old_name, unsigned int data_start,
        unsigned int bss_start, unsigned int entry_address)
    if (dldump (0, new_name, RTLD_MEMORY))
        fprintf (stderr, "unexec(): dldump(%s): %s\n", new_name, dlerror());

    return 0;

With that in place everything works perfectly. You just need to add a
configure check for dldump() (it can be accessed on Solaris by linking in

 .-.   .-.    I don't work here. I'm a consultant.
(_  \ /  _)
     |        address@hidden

reply via email to

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