Subject: Re: Linux binaries compiled with libc-5.2.16
To: None <port-i386@NetBSD.ORG>
From: Koji Imada - je4owb/2 <koji@bimota.imada.math.human.nagoya-u.ac.jp>
List: port-i386
Date: 12/24/1995 22:05:49
 >> Has anyone else been able to run binaries with this library
 >> dependency?  I am not having any problem with 5.0.9 requirements,
 >> but the latest Linux Java fails to run with the 5.2.16 requirement.

And will require ld.so.1.7.12(ld-linux.so.1.7.12). This won't run on
NetBSD 1.1 too. This is caused by same probrem for Dynamic loader.

 >> This is a problem not with the libraries, but with the binaries themselves.
 >> The problem is this: in ELF there are no 'text' and 'data' segments in a binary
 >> ;
 >> there is just a collection of loadable sections. To fit this to the kernel's
 >> idea of an executable as present in memory, you need to find exactly one
 >> section that qualifies as a text segment, and one that qualifies as a data
 >> segment.

 >> Currently, this is done by assuming that r-x is meant a text segment, and
 >> rw- or rwx specifies a data segment. Not unlogical assumptions, looking
 >> at other formats.

I agree. But why executable bit is exists? This bit means wether this
segement is executable(text segment) or not?

 >> Unfortunately, the Linux ELF binaries you are talking about have 2 segments:
 >> one rwx and one rw-. The one with rwx protection is meant as the
text segment..

I read some part of Linux source code. When loading ELF binary, v1.2.*
kernel sets memory's protection to be rwx regardless of that's
sections attribute flags(r-x for text and rw- for data maybe). On
v1.3.*, kernel sets memory's protection to be same as that's sections
attribute flags. So new Linux ELF binaries protection changed(text
rwx, data rw-), I think. 

Linux ELF binary in slackware-3.0 has r-x for text segment and
rw- for data segment. And Linux ELF binary I got for JDK on Linux has
rwx for text segment and rw- for data segment.

Is it suitable to assume r-x or rwx for text segment and rw- for data
segment?

I changed exec_elf.c to reflect this assumption and this kernel can
run Linux ELF binary with ld-linux.so.1.7.12.

Also I found another problem with libc.so.5.2.16. I can't run programs 
dynamically linked with X libraries using libc.so.5.2.16. Both Stock
1.1 and Modified kernel can't run such programs.

Without libc.so.5.2.16 Stock 1.1 and My modified kernel can run
Dynamically linked Linux ELF gnuplot. But with libc.so.5.2.16,
gnuplot_x11 dumped core.

Is there anyone fighting with this problem?

Because of such problems, although I installed JDK for Linux, I can't
run Java programs using AWT. Only standard input/output oriented
program(Sun said these programs  is old-fashioned. :-) can
run. By the way, Compiler successfully run on my modified kernel. So I
compile Java applets and run it with netscape v2.0Beta2 for Linux :-).

That's very inconvenient.
--
Koji Imada - je4owb/2    koji@math.human.nagoya-u.ac.jp