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. R=iant CC=golang-dev https://golang.org/cl/35790044
Showing
include/link.h
0 → 100644
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
src/cmd/5l/optab.c
deleted
100644 → 0
This diff is collapsed.
src/cmd/5l/pass.c
deleted
100644 → 0
This diff is collapsed.
src/cmd/5l/span.c
deleted
100644 → 0
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
src/cmd/6l/span.c
deleted
100644 → 0
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
src/cmd/8l/span.c
deleted
100644 → 0
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
src/cmd/ld/pcln.c
0 → 100644
This diff is collapsed.
This diff is collapsed.
src/cmd/ld/pobj.c
0 → 100644
This diff is collapsed.
This diff is collapsed.
src/liblink/Makefile
0 → 100644
src/liblink/asm5.c
0 → 100644
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
src/liblink/data.c
0 → 100644
This diff is collapsed.
src/liblink/go.c
0 → 100644
This diff is collapsed.
src/liblink/ld.c
0 → 100644
This diff is collapsed.
src/liblink/obj.c
0 → 100644
This diff is collapsed.
src/liblink/obj5.c
0 → 100644
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
src/liblink/pcln.c
0 → 100644
This diff is collapsed.
src/liblink/rdobj5.c
0 → 100644
This diff is collapsed.
src/liblink/rdobj6.c
0 → 100644
This diff is collapsed.
src/liblink/rdobj8.c
0 → 100644
This diff is collapsed.
This diff is collapsed.
Please register or sign in to comment