Subject: Re: Dynamic linking is go (again)
To: None <marcus@mc.pp.se>
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
List: port-dreamcast
Date: 07/05/2003 05:58:26
In article <yf9vfuichv4.fsf@mc.pp.se>
marcus@mc.pp.se wrote:

> Hm, you mean dynamic executables?  Well, here's the two I have been
> using as test cases, they are linked dynamically against the libc.so
> that was in the dynkit:  <URL:http://mc.pp.se/dc/files/dyntestbins.tar.gz>

Hmm, both executables work fine with ld.elf_so and libc.so.12.100
built by my cross toolchain. I'll check libgcc.a and linker setting etc.

> > - libexec/ld.elf_so/arch/sh3/mdreloc.c lacks some function declarations
> >   (and copyright notice).
> 
> Which function declarations?

I got the following warnings:
---
/usr/local/bin/shle--netbsdelf-gcc -O  -Wall -Wstrict-prototypes \
-Wmissing-prototypes -Wpointer-arith -Wno-sign-compare -Wno-uninitialized  \
-Werror   -fpic -DELFSIZE=32 -DLIBDIR=\"/usr/lib\" \
-D_PATH_RTLD=\"/libexec/ld.elf_so\" -I/usr/src/libexec/ld.elf_so \
-DRTLD_LOADER -D_RTLD_SOURCE -nostdinc -isystem \
/export/NetBSD/dreamcast/root/usr/include  -c \
/usr/src/libexec/ld.elf_so/arch/sh3/mdreloc.c
/usr/src/libexec/ld.elf_so/arch/sh3/mdreloc.c:20: \
warning: no previous prototype for `_rtld_relocate_nonplt_self'
/usr/src/libexec/ld.elf_so/arch/sh3/mdreloc.c:185: \
warning: function declaration isn't a prototype
/usr/src/libexec/ld.elf_so/arch/sh3/mdreloc.c:211: \
warning: function declaration isn't a prototype
*** Error code 1

Stop.
nbmake: stopped in /usr/src/libexec/ld.elf_so
---

I applied the following patch:

--- arch/sh3/mdreloc.c.0	2003-07-05 05:50:17.000000000 +0900
+++ arch/sh3/mdreloc.c	2003-07-04 01:05:12.000000000 +0900
@@ -7,6 +7,9 @@
 #include "rtld.h"
 
 void _rtld_bind_start(void);
+void _rtld_relocate_nonplt_self(Elf_Dyn *, Elf_Addr);
+caddr_t _rtld_bind(const Obj_Entry *, Elf_Word);
+int _rtld_relocate_plt_object(const Obj_Entry *, const Elf_Rela *, caddr_t *);
 
 void
 _rtld_setup_pltgot(const Obj_Entry *obj)


---
Izumi Tsutsui
tsutsui@ceres.dti.ne.jp