Subject: Re: -current brokenness with dynamic executables
To: Christos Zoulas <christos@zoulas.com>
From: Simon Burge <simonb@telstra.com.au>
List: current-users
Date: 01/06/1999 12:06:48
On Tue, 5 Jan 1999 09:17:40 GMT  Christos Zoulas wrote:

> In article <199901050424.PAA19387@balrog.supp.cpr.itg.telecom.com.au>
>   simonb@telstra.com.au (Simon Burge) writes:
> 
> >I'm still getting over holidays and catching up on mail.  Did any signal
> >stuff change recently (the PSIG in the first ktrace)?  If I get no
> >leads, I'll look at this further tomorrow...
> 
> It might have to do with my recent changes to exec_elf32.c to recognize
> the NetBSD elf pnote signature. I doubt it though...

Um, exec_elf32.c is the problem.  Rev 1.39 of exec_elf32.c works, 1.40
doesn't.  I'm not gonna pretend to understand what the diff does, but
here's some info that may or may not help:

	mona:/tmp 37> objdump --headers hello

	hello:     file format elf32-littlemips

	Sections:
	Idx Name          Size      VMA       LMA       File off  Algn
	  0 .interp       00000017  00400134  00400134  00000134  2**0
			  CONTENTS, ALLOC, LOAD, READONLY, DATA
	  1 .note.netbsd.ident 00000034  0040014c  0040014c  0000014c  2**2
			  CONTENTS, ALLOC, LOAD, READONLY, DATA
	  2 .reginfo      00000018  00400180  00400180  00000180  2**4
			  CONTENTS, ALLOC, LOAD, READONLY, DATA
	  3 .dynamic      000000a8  004001a0  004001a0  000001a0  2**4
			  CONTENTS, ALLOC, LOAD, READONLY, DATA
	  4 .dynsym       00000340  00400380  00400380  00000380  2**4
			  CONTENTS, ALLOC, LOAD, READONLY, DATA
	  5 .dynstr       00000123  00400250  00400250  00000250  2**4
			  CONTENTS, ALLOC, LOAD, READONLY, DATA
	  6 .hash         0000016c  004006c0  004006c0  000006c0  2**4
			  CONTENTS, ALLOC, LOAD, READONLY, DATA
	  7 .rodata       000000a0  00400830  00400830  00000830  2**4
			  CONTENTS, ALLOC, LOAD, READONLY, DATA
	  8 .init         00000070  004008d0  004008d0  000008d0  2**2
			  CONTENTS, ALLOC, LOAD, READONLY, CODE
	  9 .text         000006a0  00400940  00400940  00000940  2**4
			  CONTENTS, ALLOC, LOAD, READONLY, CODE
	 10 .fini         00000048  00400fe0  00400fe0  00000fe0  2**2
			  CONTENTS, ALLOC, LOAD, READONLY, CODE
	 11 .data         00000020  10011030  10011030  00001030  2**4
			  CONTENTS, ALLOC, LOAD, DATA
	 12 .rld_map      00000004  10011050  10011050  00001050  2**2
			  CONTENTS, ALLOC, LOAD, DATA
	 13 .ctors        00000008  10011054  10011054  00001054  2**2
			  CONTENTS, ALLOC, LOAD, DATA
	 14 .dtors        00000008  1001105c  1001105c  0000105c  2**2
			  CONTENTS, ALLOC, LOAD, DATA
	 15 .got          00000094  10011070  10011070  00001070  2**4
			  CONTENTS, ALLOC, LOAD, DATA
	 16 .sbss         00000008  10011104  10011104  00001104  2**2
			  ALLOC
	 17 .bss          00000000  10011110  10011110  00001108  2**4
			  ALLOC
	 18 .compact_rel  00000024  10011f2c  10011f2c  00001108  2**2
			  CONTENTS, READONLY
	mona:/tmp 38> objdump --full-contents -j .note.netbsd.ident hello

	hello:     file format elf32-littlemips

	Contents of section .note.netbsd.ident:
	 40014c 07000000 04000000 01000000 4e657442  ............NetB
	 40015c 53440000 830c0300 07000000 07000000  SD..............
	 40016c 02000000 4e657442 53440000 6e657462  ....NetBSD..netb
	 40017c 73640000                             sd..            


Also, I _don't_ need Castor's patch, for either stripped or non-stripped
binaries either:

	mona:/tmp 16> cat hello.c
	main()
	{
		printf("Hello world!\n");
		exit(0);
	}
	mona:/tmp 17> cc -o hello hello.c
	mona:/tmp 18> ./hello 
	Hello world!
	mona:/tmp 19> strip hello
	mona:/tmp 20> ./hello
	Hello world!
	mona:/tmp 21> 

Castor mentions it might be a problem with his toolchain - I'm running
with the current in-tree toolchain as of early December (egcs-1.1.1
pre-release, bintuils 2.8.1).

Simon.