1
0
mirror of https://github.com/golang/go synced 2024-10-03 09:21:21 -06:00
go/src/cmd/6l
Russ Cox 0cb0f6d090 cmd/ld: support for linking with host linker
A step toward a fix for issue 4069.

To allow linking with arbitrary host object files, add a linker mode
that can generate a host object file instead of an executable.
Then the host linker can be invoked to generate the final executable.

This CL adds a new -hostobj flag that instructs the linker to write
a host object file instead of an executable.

That is, this works:

        go tool 6g x.go
        go tool 6l -hostobj -o x.o x.6
        ld -e _rt0_amd64_linux x.o
        ./a.out

as does:

        go tool 8g x.go
        go tool 8l -hostld ignored -o x.o x.8
        ld -m elf_i386 -e _rt0_386_linux x.o
        ./a.out

Because 5l was never updated to use the standard relocation scheme,
it will take more work to get this working on ARM.

This is a checkpoint of the basic functionality. It does not work
with cgo yet, and cgo is the main reason for the change.
The command-line interface will likely change too.
The gc linker has other information that needs to be returned to
the caller for use when invoking the host linker besides the single
object file.

R=iant, iant
CC=golang-dev
https://golang.org/cl/7060044
2013-01-31 14:11:32 -08:00
..
6.out.h cmd/gc, cmd/ld: struct field tracking 2012-11-02 00:17:21 -04:00
asm.c cmd/ld: support for linking with host linker 2013-01-31 14:11:32 -08:00
doc.go 5l, 6l, 8l: implement -X flag 2012-02-07 16:46:33 -05:00
l.h 6l/5l: PIC and shared library support for the linkers. 2013-01-30 08:46:56 -08:00
list.c 5l, 6l, 8l: link pclntab and symtab as ordinary rodata symbols 2010-10-19 18:07:19 -04:00
Makefile build: delete make paraphernalia 2012-02-06 13:34:25 -05:00
mkenam 5l, 6l, 8l: drop use of ed during build 2011-06-27 12:03:19 -04:00
obj.c cmd/ld: support for linking with host linker 2013-01-31 14:11:32 -08:00
optab.c cmd/gc, cmd/ld: struct field tracking 2012-11-02 00:17:21 -04:00
pass.c cmd/6l, cmd/8l: add -Z flag to zero stack frame on entry 2012-12-22 11:20:17 -05:00
prof.c 6a, 6c, 6l: fix for Plan 9 build 2011-07-15 11:58:39 -04:00
span.c 6l/5l: PIC and shared library support for the linkers. 2013-01-30 08:46:56 -08:00