FAQ
Reviewers: iant,

Message:
Hello iant, iant@golang.org (cc: golang-dev@googlegroups.com),

I'd like you to review this change to
https://code.google.com/p/go/


Description:
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.

Please review this at https://codereview.appspot.com/35790044/

Affected files (+11916, -24285 lines):
    A include/link.h
    M include/u.h
    M src/cmd/5l/5.out.h
    M src/cmd/5l/asm.c
    M src/cmd/5l/l.h
    M src/cmd/5l/list.c
    M src/cmd/5l/noop.c
    M src/cmd/5l/obj.c
    R src/cmd/5l/optab.c
    R src/cmd/5l/pass.c
    R src/cmd/5l/prof.c
    R src/cmd/5l/softfloat.c
    M src/cmd/6l/6.out.h
    M src/cmd/6l/asm.c
    M src/cmd/6l/l.h
    M src/cmd/6l/list.c
    M src/cmd/6l/obj.c
    R src/cmd/6l/optab.c
    R src/cmd/6l/prof.c
    M src/cmd/8l/8.out.h
    M src/cmd/8l/asm.c
    M src/cmd/8l/l.h
    M src/cmd/8l/list.c
    M src/cmd/8l/obj.c
    R src/cmd/8l/optab.c
    R src/cmd/8l/prof.c
    M src/cmd/ld/data.c
    M src/cmd/ld/decodesym.c
    M src/cmd/ld/dwarf.c
    M src/cmd/ld/dwarf.h
    M src/cmd/ld/elf.c
    M src/cmd/ld/elf.h
    M src/cmd/ld/go.c
    M src/cmd/ld/ldelf.c
    M src/cmd/ld/ldmacho.c
    M src/cmd/ld/ldpe.c
    M src/cmd/ld/lib.c
    M src/cmd/ld/lib.h
    M src/cmd/ld/macho.c
    A src/cmd/ld/pass.c
    A src/cmd/ld/pcln.c
    M src/cmd/ld/pe.c
    M src/cmd/ld/pe.h
    A src/cmd/ld/pobj.c
    M src/cmd/ld/symtab.c
    A src/liblink/Makefile
    M src/liblink/asm5.c
    M src/liblink/asm6.c
    M src/liblink/asm8.c
    A src/liblink/data.c
    A src/liblink/go.c
    M src/liblink/ld.c
    M src/liblink/obj.c
    M src/liblink/obj5.c
    M src/liblink/obj6.c
    M src/liblink/obj8.c
    M src/liblink/pass.c
    M src/liblink/pcln.c
    M src/liblink/rdobj5.c
    M src/liblink/rdobj6.c
    M src/liblink/rdobj8.c
    M src/liblink/sym.c


--

---
You received this message because you are subscribed to the Google Groups "golang-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-dev @
categoriesgo
postedDec 4, '13 at 7:23p
activeDec 4, '13 at 7:23p
posts1
users1
websitegolang.org

1 user in discussion

Rsc: 1 post

People

Translate

site design / logo © 2021 Grokbase