all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Drazen Kacar <dave@willfork.com>
Subject: unexelf.c doesn't always work on Solaris
Date: Wed, 21 Aug 2002 02:54:58 +0200	[thread overview]
Message-ID: <20020821025458.A1646@raven.munich.redhat.com> (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
     |

                 reply	other threads:[~2002-08-21  0:54 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020821025458.A1646@raven.munich.redhat.com \
    --to=dave@willfork.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.