summaryrefslogtreecommitdiff
path: root/user/jkoenig/java.mdwn
blob: 90f5102881cdcbbb35a4e9f4a05563b1adf0576b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
[[!meta copyright="Copyright © 2011 Free Software Foundation, Inc."]]

[[!meta license="""[[!toggle id="license" text="GFDL 1.2+"]][[!toggleable
id="license" text="Permission is granted to copy, distribute and/or modify this
document under the terms of the GNU Free Documentation License, Version 1.2 or
any later version published by the Free Software Foundation; with no Invariant
Sections, no Front-Cover Texts, and no Back-Cover Texts.  A copy of the license
is included in the section entitled [[GNU Free Documentation
License|/fdl]]."]]"""]]

# Improve Java on Hurd (GSoC 2011)


## Description

The project consists in improving Java support on Hurd.
This includes porting OpenJDK,
creating low-level Java bindings for Mach and Hurd,
as well as creating Java libraries to help with translator development.

For details, see my original [[proposal]].


## Current status


### Apt repository

Modified Debian packages are available in this repository:

    deb http://jk.fr.eu.org/debian experimental/
    deb-src http://jk.fr.eu.org/debian experimental/


### Glibc signal code improvements

I have submitted
[preliminary patches](http://lists.gnu.org/archive/html/bug-hurd/2011-05/msg00182.html)
for global signal dispositions,
which I'm currently testing.
I have since fixed a few thinks and implemented `SA_SIGINFO`
(which is required by OpenJDK.)
My latest code is available on
[github](http://github.com/jeremie-koenig/glibc/commits/master-beware-rebase),
and modified Debian packages
are available in my apt repository.

One question is how the new symbols introduced by my patches
should be handled.
Weak symbols turned out to be impractical,
so I'm currently considering using a Debian-specific
symbol version in the interim period (`GLIBC_2.13_DEBIAN_7` so far).
The ultimate symbol version to be used will depend on
the time at which the patches get integrated upstream,
at which point we will alias the interim version
to the new one in debian packages.

I have modified libc0.3 to include a `deb-symbols(5)` file
so that we get an accurate libc dependency in `hurd` and other packages
when the symbols in question are pulled in.

Another issue which came up with OpenJDK is the expansion
by the dynamic linker of `$ORIGIN` in the `RPATH` header,
see below.

#### Plans

I will submit revised series for review later this week,
as well as matching Debian patches.
I expect only the last patch (implement global dispositions) will change,
and new ones will be added on top of it.


### Port OpenJDK

As suggested by [[tschwinge]], I have targeted OpenJDK 7 at first.
I don't expect it will be too hard to backport my patches to OpenJDK 6.
I have succeeded in building a working JIT-less ("zero") version,
although the dynamic linker issue must be worked around.
Porting Hotspot (the original just-in-time compiler of OpenJDK)
should not be too hard.
If that fails we can fall back on Shark
(a portable alternative JIT which uses LLVM).

The dynamic linker issue is as follows.
An executable-specific search path can be provided in the ELF RPATH header.
RPATH directories can include the special string `$ORIGIN`,
which is to be expanded to the directory the executable was loaded from.
OpenJDK's `java` command uses this feature to locate
the right `libjli.so` at runtime.
However,
on Hurd this information is not available to the dynamic linker
and as a consequence RPATH components which include `$ORIGIN`
are silently discarded.

This can be worked around by defining
the `LD_ORIGIN_PATH` environment variable.
(which have I used to build and test OpenJDK so far.)

#### Plans

I intend to fix the RPATH issue
by building on [[pochu]]'s `file_exec_file_name()` patches.

I have succeeded in building a Hotspot-enabled `libjvm.so`,
although the current toolchain issues
have so far prevented me from testing it.


### Java bindings for Mach

(just started.)