Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(44)

Issue 7060044: code review 7060044: cmd/ld: support for linking with host linker (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years, 6 months ago by rsc
Modified:
12 years, 5 months ago
Reviewers:
dave
CC:
iant, iant2, golang-dev
Visibility:
Public.

Description

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.

Patch Set 1 #

Patch Set 2 : diff -r bcc567c00842 https://go.googlecode.com/hg/ #

Patch Set 3 : diff -r f483bfe81114 https://go.googlecode.com/hg/ #

Patch Set 4 : diff -r 12562bcfba22 https://go.googlecode.com/hg/ #

Patch Set 5 : diff -r 12562bcfba22 https://go.googlecode.com/hg/ #

Total comments: 16

Patch Set 6 : diff -r 1af88804d685 https://code.google.com/p/go/ #

Patch Set 7 : diff -r 1af88804d685 https://go.googlecode.com/hg #

Patch Set 8 : diff -r e7f267e20b7f https://go.googlecode.com/hg #

Unified diffs Side-by-side diffs Delta from patch set Stats (+340 lines, -13 lines) Patch
M src/cmd/5l/asm.c View 1 2 3 4 5 6 4 chunks +34 lines, -0 lines 0 comments Download
M src/cmd/6l/asm.c View 1 2 3 4 5 2 chunks +34 lines, -0 lines 0 comments Download
M src/cmd/6l/obj.c View 1 2 3 4 5 6 2 chunks +10 lines, -0 lines 0 comments Download
M src/cmd/8l/asm.c View 1 2 3 4 5 2 chunks +32 lines, -0 lines 0 comments Download
M src/cmd/8l/obj.c View 1 2 3 4 5 6 2 chunks +10 lines, -0 lines 0 comments Download
M src/cmd/ld/data.c View 1 2 3 2 chunks +20 lines, -2 lines 0 comments Download
M src/cmd/ld/elf.h View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
M src/cmd/ld/elf.c View 1 2 3 4 5 6 8 chunks +180 lines, -11 lines 0 comments Download
M src/cmd/ld/lib.h View 1 2 3 4 5 6 3 chunks +4 lines, -0 lines 0 comments Download
M src/cmd/ld/lib.c View 1 2 3 4 5 6 1 chunk +13 lines, -0 lines 0 comments Download
M src/cmd/ld/symtab.c View 1 2 1 chunk +2 lines, -0 lines 0 comments Download

Messages

Total messages: 8
rsc
Hello iant (cc: golang-dev@googlegroups.com), I'd like you to review this change to https://go.googlecode.com/hg/
12 years, 6 months ago (2013-01-06 22:28:43 UTC) #1
iant
LGTM https://codereview.appspot.com/7060044/diff/1009/src/cmd/6l/obj.c File src/cmd/6l/obj.c (right): https://codereview.appspot.com/7060044/diff/1009/src/cmd/6l/obj.c#newcode135 src/cmd/6l/obj.c:135: sysfatal("cannot use -hostobj with output header type"); This ...
12 years, 6 months ago (2013-01-07 22:14:59 UTC) #2
rsc
https://codereview.appspot.com/7060044/diff/1009/src/cmd/6l/obj.c File src/cmd/6l/obj.c (right): https://codereview.appspot.com/7060044/diff/1009/src/cmd/6l/obj.c#newcode135 src/cmd/6l/obj.c:135: sysfatal("cannot use -hostobj with output header type"); On 2013/01/07 ...
12 years, 5 months ago (2013-01-31 03:00:58 UTC) #3
iant
For some reason I'm not seeing the changes, e.g., to 6l/obj.c.
12 years, 5 months ago (2013-01-31 17:28:32 UTC) #4
rsc
Uploaded now. I was going to submit but merging with the shared object changes has ...
12 years, 5 months ago (2013-01-31 17:31:23 UTC) #5
iant2
LGTM On Thu, Jan 31, 2013 at 9:31 AM, Russ Cox <rsc@golang.org> wrote: > Uploaded ...
12 years, 5 months ago (2013-01-31 17:55:43 UTC) #6
rsc
*** Submitted as https://code.google.com/p/go/source/detail?r=98034d036d03 *** cmd/ld: support for linking with host linker A step toward ...
12 years, 5 months ago (2013-01-31 22:11:37 UTC) #7
dave_cheney.net
12 years, 5 months ago (2013-02-01 00:08:09 UTC) #8
This appears to have broken the non linux 386 builders.

On Fri, Feb 1, 2013 at 9:11 AM,  <rsc@golang.org> wrote:
> *** Submitted as
> https://code.google.com/p/go/source/detail?r=98034d036d03 ***
>
> 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://codereview.appspot.com/7060044
>
>
> https://codereview.appspot.com/7060044/
>
> --
>
> ---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.
>
>
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b