Subject: vaddr of shared libs
To: None <port-mips@netbsd.org>
From: Simon Burge <simonb@netbsd.org>
List: port-mips
Date: 04/20/2000 00:32:47
Folks,

A while ago Chuck Silvers pointed out that MIPS shared libs have virtual
addresses starting at 0x5ffe0000.  Especially puzzling, since we load
the libraries at 0x2000000...  From my 1.4.2 box:


	vlad:~ 6> objdump --all /usr/lib/libc.so | head -15

	/usr/lib/libc.so:     file format elf32-littlemips
	/usr/lib/libc.so
	architecture: mips:3000, flags 0x00000150:
	HAS_SYMS, DYNAMIC, D_PAGED
	start address 0x5ffea920

	Program Header:
	0x70000000 off    0x00000100 vaddr 0x5ffe0100 paddr 0x5ffe0100 align 2**4
		 filesz 0x00000018 memsz 0x00000018 flags r--
	    LOAD off    0x00000000 vaddr 0x5ffe0000 paddr 0x5ffe0000 align 2**12
		 filesz 0x0009969c memsz 0x0009969c flags r-x
	    LOAD off    0x000996a0 vaddr 0x600b96a0 paddr 0x600b96a0 align 2**12
		 filesz 0x00003750 memsz 0x0000c750 flags rw-
	 DYNAMIC off    0x00000120 vaddr 0x5ffe0120 paddr 0x5ffe0120 align 2**4

I had a search around the 'net and couldn't find any explanation for this.
Some SGI thing?

Anyway, I've been running with the following patch (ie, the start
address is 0, just like everything else in the known world) and have
rebuilt the world many times since the start of February.  From
my -current box:

	mona:pmax/compile/MONA 28> objdump --all /usr/lib/libc.so | head -15

	/usr/lib/libc.so:     file format elf32-littlemips
	/usr/lib/libc.so
	architecture: mips:3000, flags 0x00000150:
	HAS_SYMS, DYNAMIC, D_PAGED
	start address 0x0000e650

	Program Header:
	0x70000000 off    0x00000100 vaddr 0x00000100 paddr 0x00000100 align 2**4
		 filesz 0x00000018 memsz 0x00000018 flags r--
	    LOAD off    0x00000000 vaddr 0x00000000 paddr 0x00000000 align 2**12
		 filesz 0x000a5d34 memsz 0x000a5d34 flags r-x
	    LOAD off    0x000a5d40 vaddr 0x000e5d40 paddr 0x000e5d40 align 2**12
		 filesz 0x00003da4 memsz 0x0000eab0 flags rw-
	 DYNAMIC off    0x00000120 vaddr 0x00000120 paddr 0x00000120 align 2**4


Can anyone see any problems committing this?

Simon.
--
Index: elf32bmip.sh
===================================================================
RCS file: /cvsroot/gnusrc/gnu/dist/ld/emulparams/elf32bmip.sh,v
retrieving revision 1.1.1.2
diff -p -u -r1.1.1.2 elf32bmip.sh
--- elf32bmip.sh	1999/02/02 19:53:52	1.1.1.2
+++ elf32bmip.sh	2000/04/19 14:24:52
@@ -6,7 +6,6 @@ TEXT_START_ADDR=0x0400000
 DATA_ADDR=0x10000000
 MAXPAGESIZE=0x40000
 NONPAGED_TEXT_START_ADDR=0x0400000
-SHLIB_TEXT_START_ADDR=0x5ffe0000
 TEXT_DYNAMIC=
 INITIAL_READONLY_SECTIONS='.reginfo : { *(.reginfo) }'
 OTHER_TEXT_SECTIONS='*(.mips16.fn.*) *(.mips16.call.*)'
Index: elf32bsmip.sh
===================================================================
RCS file: /cvsroot/gnusrc/gnu/dist/ld/emulparams/elf32bsmip.sh,v
retrieving revision 1.1.1.1
diff -p -u -r1.1.1.1 elf32bsmip.sh
--- elf32bsmip.sh	1999/02/02 19:53:52	1.1.1.1
+++ elf32bsmip.sh	2000/04/19 14:24:52
@@ -6,7 +6,6 @@ TEXT_START_ADDR=0x0400000
 DATA_ADDR=0x10000000
 MAXPAGESIZE=0x40000
 NONPAGED_TEXT_START_ADDR=0x0400000
-SHLIB_TEXT_START_ADDR=0x5ffe0000
 TEXT_DYNAMIC=
 INITIAL_READONLY_SECTIONS='.reginfo : { *(.reginfo) }'
 OTHER_TEXT_SECTIONS='*(.mips16.fn.*) *(.mips16.call.*)'
Index: elf32ebmip.sh
===================================================================
RCS file: /cvsroot/gnusrc/gnu/dist/ld/emulparams/elf32ebmip.sh,v
retrieving revision 1.1.1.2
diff -p -u -r1.1.1.2 elf32ebmip.sh
--- elf32ebmip.sh	1999/02/02 19:53:52	1.1.1.2
+++ elf32ebmip.sh	2000/04/19 14:24:52
@@ -5,7 +5,6 @@ LITTLE_OUTPUT_FORMAT="elf32-littlemips"
 TEXT_START_ADDR=0x0400000
 MAXPAGESIZE=0x40000
 NONPAGED_TEXT_START_ADDR=0x0400000
-SHLIB_TEXT_START_ADDR=0x5ffe0000
 INITIAL_READONLY_SECTIONS='.reginfo : { *(.reginfo) }'
 OTHER_TEXT_SECTIONS='*(.mips16.fn.*) *(.mips16.call.*)'
 OTHER_GOT_SYMBOLS='
Index: elf32elmip.sh
===================================================================
RCS file: /cvsroot/gnusrc/gnu/dist/ld/emulparams/elf32elmip.sh,v
retrieving revision 1.1.1.2
diff -p -u -r1.1.1.2 elf32elmip.sh
--- elf32elmip.sh	1999/02/02 19:53:52	1.1.1.2
+++ elf32elmip.sh	2000/04/19 14:24:52
@@ -5,7 +5,6 @@ LITTLE_OUTPUT_FORMAT="elf32-littlemips"
 TEXT_START_ADDR=0x0400000
 MAXPAGESIZE=0x40000
 NONPAGED_TEXT_START_ADDR=0x0400000
-SHLIB_TEXT_START_ADDR=0x5ffe0000
 INITIAL_READONLY_SECTIONS='.reginfo : { *(.reginfo) }'
 OTHER_TEXT_SECTIONS='*(.mips16.fn.*) *(.mips16.call.*)'
 OTHER_GOT_SYMBOLS='
Index: elf32lmip.sh
===================================================================
RCS file: /cvsroot/gnusrc/gnu/dist/ld/emulparams/elf32lmip.sh,v
retrieving revision 1.1.1.2
diff -p -u -r1.1.1.2 elf32lmip.sh
--- elf32lmip.sh	1999/02/02 19:53:53	1.1.1.2
+++ elf32lmip.sh	2000/04/19 14:24:52
@@ -6,7 +6,6 @@ TEXT_START_ADDR=0x0400000
 DATA_ADDR=0x10000000
 MAXPAGESIZE=0x40000
 NONPAGED_TEXT_START_ADDR=0x0400000
-SHLIB_TEXT_START_ADDR=0x5ffe0000
 TEXT_DYNAMIC=
 INITIAL_READONLY_SECTIONS='.reginfo : { *(.reginfo) }'
 OTHER_TEXT_SECTIONS='*(.mips16.fn.*) *(.mips16.call.*)'
Index: elf32lsmip.sh
===================================================================
RCS file: /cvsroot/gnusrc/gnu/dist/ld/emulparams/elf32lsmip.sh,v
retrieving revision 1.1.1.1
diff -p -u -r1.1.1.1 elf32lsmip.sh
--- elf32lsmip.sh	1999/02/02 19:53:53	1.1.1.1
+++ elf32lsmip.sh	2000/04/19 14:24:52
@@ -6,7 +6,6 @@ TEXT_START_ADDR=0x0400000
 DATA_ADDR=0x10000000
 MAXPAGESIZE=0x40000
 NONPAGED_TEXT_START_ADDR=0x0400000
-SHLIB_TEXT_START_ADDR=0x5ffe0000
 TEXT_DYNAMIC=
 INITIAL_READONLY_SECTIONS='.reginfo : { *(.reginfo) }'
 OTHER_TEXT_SECTIONS='*(.mips16.fn.*) *(.mips16.call.*)'