Subject: Re: why does 'ld -n' generate programs that get an immediate 'Abort' on -current?
To: None <email@example.com>
From: Christos Zoulas <firstname.lastname@example.org>
Date: 07/15/2001 20:57:03
In article <20010715181609.532A6136@proven.weird.com>,
Greg A. Woods <tech-toolchain@NetBSD.ORG> wrote:
I just fixed the elf loader to deal with -n binaries. Just cvs
update and bake a new kernel. The basic problem was that the loader
would try to use pagedvn for unaligned objects, causing the vmcmd
to fail and the executable to abort. Your hello.c example now works.
>Now that's _really_ weird!
>However luckily I discovered right away that this also causes a -DDEBUG
>kernel to complain:
>Jul 15 13:59:28 proven /netbsd: vmcmd = 0x8048080/0xa000 @ 0x80
>Jul 15 13:59:28 proven /netbsd: execve: vmcmd 0 failed: 22
>$ errno 22
>#define EINVAL 22 /* Invalid argument */
>Hmmm..... what's that about? It appears this function-pointer call in
>kern_exec.c fails during the creating of the VM segments for the new
> error = (*vcp->ev_proc)(p, vcp);
>Now I'm not well enough versed in the VM bits of NetBSD so that's about
>as far as I think I can go without further hints....
>Turns out this happens on -current i386 and sparc but not 1.3.3 sparc,
>so this is beginning to look like either an ELF or maybe a UVM issue.
>Now I'd forgotten all about '-n', but it seems it's still in GNU ld:
> -n sets the text segment to be read only, and NMAGIC
> is written if possible.
>But why would this cause an instant abort before main() on NetBSD ELF?
>Is, as the syslog message suggests, the -current kernel incapable of
>running binaries created with '-n', and if so, why? Can it be fixed?
>Or should it just be documented? Should I send-pr? Or should this move
> Greg A. Woods
>+1 416 218-0098 VE3TCP <email@example.com> <firstname.lastname@example.org>
>Planix, Inc. <email@example.com>; Secrets of the Weird <firstname.lastname@example.org>