all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* unexelf.c doesn't always work on Solaris
@ 2002-08-21  0:54 Drazen Kacar
  0 siblings, 0 replies; only message in thread
From: Drazen Kacar @ 2002-08-21  0:54 UTC (permalink / raw)


Hi,

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
this:

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

int
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());
        exit(1);
    }

    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
libdl).

-- 
 .-.   .-.    I don't work here. I'm a consultant.
(_  \ /  _)
     |        dave@willfork.com
     |

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-08-21  0:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-08-21  0:54 unexelf.c doesn't always work on Solaris Drazen Kacar

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.