|
liblink: create new library based on linker code
There is an enormous amount of code moving around in this CL,
but the code is the same, and it is invoked in the same ways.
This CL is preparation for the new linker structure, not the new
structure itself.
The new library's definition is in include/link.h.
The main change is the use of a Link structure to hold all the
linker-relevant state, replacing the smattering of global variables.
The Link structure should both make it clearer which state must
be carried around and make it possible to parallelize more easily
later.
The main body of the linker has moved into the architecture-independent
cmd/ld directory. That includes the list of known header types, so the
distinction between Hplan9x32 and Hplan9x64 is removed (no other
header type distinguished 32- and 64-bit formats), and code for unused
formats such as ipaq kernels has been deleted.
The code being deleted from 5l, 6l, and 8l reappears in liblink or in ld.
Because multiple files are being merged in the liblink directory,
it is not possible to show the diffs nicely in hg.
The Prog and Addr structures have been unified into an
architecture-independent form and moved to link.h, where they will
be shared by all tools: the assemblers, the compilers, and the linkers.
The unification makes it possible to write architecture-independent
traversal of Prog lists, among other benefits.
The Sym structures cannot be unified: they are too fundamentally
different between the linker and the compilers. Instead, liblink defines
an LSym - a linker Sym - to be used in the Prog and Addr structures,
and the linker now refers exclusively to LSyms. The compilers will
keep using their own syms but will fill out the corresponding LSyms in
the Prog and Addr structures.
Although code from 5l, 6l, and 8l is now in a single library, the
code has been arranged so that only one architecture needs to
be linked into a particular program: 5l will not contain the code
needed for x86 instruction layout, for example.
The object file writing code in liblink/obj.c is from cmd/gc/obj.c.
Preparation for golang.org/s/go13linker work.
This CL does not build by itself. It depends on 35740044
and will be submitted at the same time.
Total comments: 22
Total comments: 4
|
Unified diffs |
Side-by-side diffs |
Delta from patch set |
Stats (+11924 lines, -24290 lines) |
Patch |
|
A |
include/link.h
|
View
|
1
2
3
4
5
|
1 chunk |
+567 lines, -0 lines |
0 comments
|
Download
|
|
M |
include/u.h
|
View
|
1
2
3
4
5
|
1 chunk |
+2 lines, -0 lines |
0 comments
|
Download
|
|
M |
src/cmd/5l/5.out.h
|
View
|
1
2
3
4
5
|
1 chunk |
+35 lines, -44 lines |
0 comments
|
Download
|
|
M |
src/cmd/5l/asm.c
|
View
|
1
3
4
5
|
28 chunks |
+105 lines, -1388 lines |
0 comments
|
Download
|
|
M |
src/cmd/5l/l.h
|
View
|
1
2
3
4
5
|
5 chunks |
+43 lines, -307 lines |
0 comments
|
Download
|
|
M |
src/cmd/5l/list.c
|
View
|
1
3
4
5
|
9 chunks |
+18 lines, -22 lines |
0 comments
|
Download
|
|
M |
src/cmd/5l/noop.c
|
View
|
1
3
4
5
|
1 chunk |
+3 lines, -668 lines |
0 comments
|
Download
|
|
M |
src/cmd/5l/obj.c
|
View
|
1
2
3
4
5
|
4 chunks |
+8 lines, -716 lines |
0 comments
|
Download
|
|
R |
src/cmd/5l/optab.c
|
View
|
1
3
4
5
|
1 chunk |
+0 lines, -277 lines |
0 comments
|
Download
|
|
R |
src/cmd/5l/pass.c
|
View
|
1
3
4
5
|
1 chunk |
+0 lines, -409 lines |
0 comments
|
Download
|
|
R |
src/cmd/5l/prof.c
|
View
|
1
3
4
5
|
1 chunk |
+0 lines, -211 lines |
0 comments
|
Download
|
|
R |
src/cmd/5l/softfloat.c
|
View
|
1
3
4
5
|
1 chunk |
+0 lines, -91 lines |
0 comments
|
Download
|
|
M |
src/cmd/6l/6.out.h
|
View
|
1
2
3
4
5
|
1 chunk |
+0 lines, -12 lines |
0 comments
|
Download
|
|
M |
src/cmd/6l/asm.c
|
View
|
1
3
4
5
|
22 chunks |
+97 lines, -137 lines |
0 comments
|
Download
|
|
M |
src/cmd/6l/l.h
|
View
|
1
2
3
4
5
|
3 chunks |
+25 lines, -340 lines |
0 comments
|
Download
|
|
M |
src/cmd/6l/list.c
|
View
|
1
3
4
5
|
4 chunks |
+11 lines, -11 lines |
0 comments
|
Download
|
|
M |
src/cmd/6l/obj.c
|
View
|
1
2
3
4
5
|
6 chunks |
+6 lines, -664 lines |
0 comments
|
Download
|
|
R |
src/cmd/6l/optab.c
|
View
|
1
2
3
4
5
|
1 chunk |
+0 lines, -1372 lines |
0 comments
|
Download
|
|
R |
src/cmd/6l/prof.c
|
View
|
1
3
4
5
|
1 chunk |
+0 lines, -171 lines |
0 comments
|
Download
|
|
M |
src/cmd/8l/8.out.h
|
View
|
1
2
3
4
5
|
1 chunk |
+0 lines, -12 lines |
0 comments
|
Download
|
|
M |
src/cmd/8l/asm.c
|
View
|
1
3
4
5
|
24 chunks |
+95 lines, -248 lines |
0 comments
|
Download
|
|
M |
src/cmd/8l/l.h
|
View
|
1
2
3
4
5
|
3 chunks |
+26 lines, -305 lines |
0 comments
|
Download
|
|
M |
src/cmd/8l/list.c
|
View
|
1
3
4
5
|
5 chunks |
+11 lines, -11 lines |
0 comments
|
Download
|
|
M |
src/cmd/8l/obj.c
|
View
|
1
2
3
4
5
|
6 chunks |
+8 lines, -666 lines |
0 comments
|
Download
|
|
R |
src/cmd/8l/optab.c
|
View
|
1
2
3
4
5
|
1 chunk |
+0 lines, -1032 lines |
0 comments
|
Download
|
|
R |
src/cmd/8l/prof.c
|
View
|
1
3
4
5
|
1 chunk |
+0 lines, -173 lines |
0 comments
|
Download
|
|
M |
src/cmd/ld/data.c
|
View
|
1
3
4
5
|
40 chunks |
+101 lines, -436 lines |
0 comments
|
Download
|
|
M |
src/cmd/ld/decodesym.c
|
View
|
1
3
4
5
|
7 chunks |
+31 lines, -31 lines |
0 comments
|
Download
|
|
M |
src/cmd/ld/dwarf.h
|
View
|
1
3
4
5
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
src/cmd/ld/dwarf.c
|
View
|
1
3
4
5
|
24 chunks |
+43 lines, -43 lines |
0 comments
|
Download
|
|
M |
src/cmd/ld/elf.h
|
View
|
1
3
4
5
|
3 chunks |
+7 lines, -7 lines |
0 comments
|
Download
|
|
M |
src/cmd/ld/elf.c
|
View
|
1
3
4
5
|
26 chunks |
+92 lines, -92 lines |
0 comments
|
Download
|
|
M |
src/cmd/ld/go.c
|
View
|
1
3
4
5
|
17 chunks |
+25 lines, -58 lines |
0 comments
|
Download
|
|
M |
src/cmd/ld/ldelf.c
|
View
|
1
3
4
5
|
10 chunks |
+21 lines, -21 lines |
0 comments
|
Download
|
|
M |
src/cmd/ld/ldmacho.c
|
View
|
1
3
4
5
|
9 chunks |
+17 lines, -17 lines |
0 comments
|
Download
|
|
M |
src/cmd/ld/ldpe.c
|
View
|
1
3
4
5
|
8 chunks |
+18 lines, -18 lines |
0 comments
|
Download
|
|
M |
src/cmd/ld/lib.h
|
View
|
1
2
3
4
5
|
7 chunks |
+124 lines, -259 lines |
0 comments
|
Download
|
|
M |
src/cmd/ld/lib.c
|
View
|
1
2
3
4
5
|
32 chunks |
+119 lines, -1197 lines |
0 comments
|
Download
|
|
M |
src/cmd/ld/macho.c
|
View
|
1
3
4
5
|
16 chunks |
+53 lines, -53 lines |
0 comments
|
Download
|
|
A |
src/cmd/ld/pass.c
|
View
|
1
3
4
5
|
1 chunk |
+104 lines, -0 lines |
0 comments
|
Download
|
|
A |
src/cmd/ld/pcln.c
|
View
|
1
3
4
5
|
1 chunk |
+258 lines, -0 lines |
0 comments
|
Download
|
|
M |
src/cmd/ld/pe.h
|
View
|
1
3
4
5
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
src/cmd/ld/pe.c
|
View
|
1
3
4
5
|
12 chunks |
+20 lines, -20 lines |
0 comments
|
Download
|
|
A |
src/cmd/ld/pobj.c
|
View
|
1
2
3
4
5
|
1 chunk |
+223 lines, -0 lines |
0 comments
|
Download
|
|
M |
src/cmd/ld/symtab.c
|
View
|
1
3
4
5
|
15 chunks |
+25 lines, -25 lines |
0 comments
|
Download
|
|
A |
src/liblink/Makefile
|
View
|
1
2
3
4
5
|
1 chunk |
+5 lines, -0 lines |
0 comments
|
Download
|
|
M |
src/liblink/asm5.c
|
View
|
1
2
3
4
5
|
28 chunks |
+1799 lines, -293 lines |
0 comments
|
Download
|
|
M |
src/liblink/asm6.c
|
View
|
1
2
3
4
5
|
40 chunks |
+1927 lines, -484 lines |
0 comments
|
Download
|
|
M |
src/liblink/asm8.c
|
View
|
1
2
3
4
5
|
30 chunks |
+1454 lines, -390 lines |
0 comments
|
Download
|
|
A |
src/liblink/data.c
|
View
|
1
2
3
4
5
|
1 chunk |
+366 lines, -0 lines |
0 comments
|
Download
|
|
A |
src/liblink/go.c
|
View
|
1
2
3
4
5
|
1 chunk |
+74 lines, -0 lines |
0 comments
|
Download
|
|
M |
src/liblink/ld.c
|
View
|
1
2
3
4
5
|
8 chunks |
+371 lines, -2334 lines |
0 comments
|
Download
|
|
M |
src/liblink/obj.c
|
View
|
1
2
3
4
5
|
5 chunks |
+261 lines, -198 lines |
0 comments
|
Download
|
|
M |
src/liblink/obj5.c
|
View
|
1
2
3
4
5
|
13 chunks |
+971 lines, -492 lines |
0 comments
|
Download
|
|
M |
src/liblink/obj6.c
|
View
|
1
2
3
4
5
|
8 chunks |
+880 lines, -793 lines |
0 comments
|
Download
|
|
M |
src/liblink/obj8.c
|
View
|
1
2
3
4
5
|
8 chunks |
+754 lines, -675 lines |
0 comments
|
Download
|
|
M |
src/liblink/pass.c
|
View
|
1
2
3
4
5
|
1 chunk |
+52 lines, -928 lines |
0 comments
|
Download
|
|
M |
src/liblink/pcln.c
|
View
|
1
2
3
4
5
|
10 chunks |
+152 lines, -2389 lines |
0 comments
|
Download
|
|
M |
src/liblink/rdobj5.c
|
View
|
1
2
3
4
5
|
12 chunks |
+188 lines, -411 lines |
0 comments
|
Download
|
|
M |
src/liblink/rdobj6.c
|
View
|
1
2
3
4
5
|
14 chunks |
+129 lines, -436 lines |
0 comments
|
Download
|
|
M |
src/liblink/rdobj8.c
|
View
|
1
2
3
4
5
|
13 chunks |
+131 lines, -457 lines |
0 comments
|
Download
|
|
M |
src/liblink/sym.c
|
View
|
1
2
3
4
5
|
2 chunks |
+67 lines, -2444 lines |
0 comments
|
Download
|
Total messages: 6
|