Commit graph

63 commits

Author SHA1 Message Date
Shenghou Ma 6ebf59b953 include, linlink, cmd/6l, cmd/ld: part 1 of solaris/amd64 linker changes.
rsc suggested that we split the whole linker changes into three parts.
This is the first one, mostly dealing with adding Hsolaris.

LGTM=iant
R=golang-codereviews, iant, dave
CC=golang-codereviews
https://golang.org/cl/54210050
2014-02-09 16:45:38 -05:00
Jeff Sickel f69391dd9e liblink: include missing pragmas for plan9 formatter
R=rsc, r, 0intro
CC=golang-codereviews
https://golang.org/cl/36060047
2014-01-22 06:23:19 +01:00
Ian Lance Taylor 6111dc4e71 liblink: check for symgrow size too large
Many calls to symgrow pass a vlong value.  Change the function
to not implicitly truncate, and to instead give an error if
the value is too large.

R=golang-codereviews, gobot, rsc
CC=golang-codereviews
https://golang.org/cl/54010043
2014-01-21 06:12:54 -08:00
Russ Cox 06c0280440 libmach: use different names for different Ureg types
Everything was doing this already with #defines.
Do it right.

R=golang-codereviews, jsing, 0intro, iant
CC=golang-codereviews
https://golang.org/cl/49090043
2014-01-08 20:37:27 -05:00
David du Colombier 43108ee53a libmach: use Go's ureg headers on Plan 9
The CL 49090043 renamed Ureg structures to Ureg386,
    UregArm and UregAmd64. This broke build on Plan 9,
    since ureg_x86.h includes /386/include/ureg.h, which
    declares a structure named Ureg instead of Ureg386.

R=golang-codereviews, bradfitz
CC=golang-codereviews, rsc
https://golang.org/cl/49260043
2014-01-08 23:34:11 +01:00
Russ Cox 4890502af6 liblink: use explicit field for globl duplicate detection
Overloading size leads to problems if clients
try to set up an LSym by hand.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/44140043
2013-12-18 19:36:14 -05:00
Russ Cox a9f6db58ce cmd/ld: move instruction selection + layout into compilers, assemblers
- new object file reader/writer (liblink/objfile.c)
- remove old object file writing routines
- add pcdata iterator
- remove all trace of "line number stack" and "path fragments" from
  object files, linker (!!!)
- dwarf now writes a single "compilation unit" instead of one per package

This CL disables the check for chains of no-split functions that
could overflow the stack red zone. A future CL will attack the problem
of reenabling that check (issue 6931).

This CL is just the liblink and cmd/ld changes.
There are minor associated adjustments in CL 37030045.
Each depends on the other.

R=golang-dev, dave, iant
CC=golang-dev
https://golang.org/cl/39680043
2013-12-16 12:51:58 -05:00
David du Colombier 4321beba85 liblink, cmd/gc: fix incompatible type signatures on Plan 9
R=ality, golang-dev, r, rsc
CC=golang-dev
https://golang.org/cl/39640043
2013-12-10 08:42:41 -05:00
Anthony Martin 66c32384dd build: do not use the host's libbio on Plan 9
R=jas, lucio.dere, rsc
CC=golang-dev
https://golang.org/cl/14604047
2013-12-09 18:39:58 -05:00
David du Colombier b9bed39714 liblink: fix Plan 9 build
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/39280043
2013-12-09 07:55:53 -05:00
Russ Cox 7d507dc6e6 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
2013-12-08 22:49:37 -05:00
Russ Cox 7d734d9252 build: remove various uses of C undefined behavior
If you thought gcc -ansi -pedantic was pedantic, just wait
until you meet clang -fsanitize=undefined.

I think this addresses all the reported "errors", but we'll
need another run to be sure.

all.bash still passes.

Update #5764

Dave, can you please try again?

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/13334049
2013-09-09 15:07:23 -04:00
Dmitriy Vyukov 79dca0327e libbio, all cmd: consistently use BGETC/BPUTC instead of Bgetc/Bputc
Also introduce BGET2/4, BPUT2/4 as they are widely used.
Slightly improve BGETC/BPUTC implementation.
This gives ~5% CPU time improvement on go install -a -p1 std.
Before:
real		user		sys
0m23.561s	0m16.625s	0m5.848s
0m23.766s	0m16.624s	0m5.846s
0m23.742s	0m16.621s	0m5.868s
after:
0m22.999s	0m15.841s	0m5.889s
0m22.845s	0m15.808s	0m5.850s
0m22.889s	0m15.832s	0m5.848s

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/12745047
2013-08-30 15:46:12 +04:00
Ian Lance Taylor e88478f1e0 include/plan9: define size_t to fix build breakage
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/10760043
2013-06-28 12:16:33 -07:00
Anthony Martin 636169405c build: add intptr typedef for Plan 9
Revision 01810e5c68e9 added the following to src/pkg/runtime/stack.h:

        StackPreempt = (uintptr)(intptr)0xffffade,

The typedef for intptr is defined in two places:

        1. src/pkg/runtime/runtime.h for use by the runtime

        2. include/u.h for use by the compilers and linkers

On Plan 9, we don't use include/u.h but instead augment the host's
u.h with extra typedefs. These are in include/plan9/GOARCH/u.h.

We forgot to add intptr. It didn't cause a problem until now since
that typedef was never used outside the runtime.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/10023043
2013-06-04 16:21:04 -07:00
Anthony Martin b40d98562f build: remove special definition of Runemax on Plan 9
The Bell Labs distribution now supports 21-bit runes.

R=golang-dev, akumar
CC=golang-dev
https://golang.org/cl/9249045
2013-06-01 12:03:21 -07:00
Shenghou Ma 6289dccf8b include: add a README file
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/9392049
2013-05-22 18:51:15 +08:00
David du Colombier ad95b7d23c include/plan9/libc.h: fix Plan 9 build
Add missing getgoextlinkenabled(void) declaration
in Plan 9 libc.h. This function was added as part
of CL #8183043.

R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/8191043
2013-03-30 19:05:00 +08:00
Ian Lance Taylor 3197be4807 cmd/dist, cmd/ld: GO_EXTLINK_ENABLED=0 defaults to -linkmode=internal
Change build system to set GO_EXTLINK_ENABLED=0 by default for
OS X 10.6, since the system linker has a bug and can not
handle the object files generated by 6l.

Fixes #5130.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8183043
2013-03-29 16:33:35 -07:00
Russ Cox 0f1b488093 build: fix for 32-bit windows builds on 64-bit windows system
Thanks to jon.forums@ for the fix.

Fixes #5051.

R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/7813045
2013-03-15 12:30:14 -04:00
Russ Cox 7610a0552f lib9: add mktempdir, removeall, runprog
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7523043
2013-03-06 15:48:28 -05:00
Russ Cox 6d888f1e1b build: clang support
This works with at least one version of clang
that existed at one moment in time.
No guarantees about clangs past or future.

To try:
        CC=clang all.bash

It does not work with the Xcode clang,
because that clang fails at printing a useful answer
to:
        clang -print-libgcc-file-name
The clang that works prints a full path name for
that command, not just "libgcc.a".

Fixes #4713.

R=iant, minux.ma
CC=golang-dev
https://golang.org/cl/7323068
2013-02-15 13:37:43 -08:00
Akshat Kumar 660c4cde9c include: Plan 9: hide any previous definition of Runemax
Runemax is already defined in libc on 64-bit version of
Plan 9, but is not defined on other versions.
To accommodate, we make sure to rename any previous
instance of Runemax and re-define it subsequently.

R=rsc, ality, rminnich
CC=golang-dev
https://golang.org/cl/7232059
2013-01-30 07:56:08 -08:00
Lucio De Re 39ffa83fdb build: add missing function declarations for Plan 9
R=golang-dev, minux.ma, rsc, ality, seed
CC=golang-dev
https://golang.org/cl/7034052
2013-01-11 16:58:46 -08:00
Russ Cox cbbc6a102d cmd/5l, cmd/6l, cmd/8l, cmd/cc, cmd/gc: new flag parsing
This CL adds a flag parser that matches the semantics of Go's
package flag. It also changes the linkers and compilers to use
the new flag parser.

Command lines that used to work, like
        8c -FVw
        6c -Dfoo
        5g -I/foo/bar
now need to be split into separate arguments:
        8c -F -V -w
        6c -D foo
        5g -I /foo/bar
The new spacing will work with both old and new tools.

The new parser also allows = for arguments, as in
        6c -D=foo
        5g -I=/foo/bar
but that syntax will not work with the old tools.

In addition to matching standard Go binary flag parsing,
the new flag parser generates more detailed usage messages
and opens the door to long flag names.

The recently added gc flag -= has been renamed -complete.

R=remyoudompheng, daniel.morsing, minux.ma, iant
CC=golang-dev
https://golang.org/cl/7035043
2013-01-06 15:24:47 -05:00
Rémy Oudompheng 9afb34b42e cmd/dist, cmd/8g: implement GO386=387/sse to choose FPU flavour.
A new environment variable GO386 is introduced to choose between
code generation targeting 387 or SSE2. No auto-detection is
performed and the setting defaults to 387 to preserve previous
behaviour.

The patch is a reorganization of CL6549052 by rsc.

Fixes #3912.

R=minux.ma, rsc
CC=golang-dev
https://golang.org/cl/6962043
2013-01-02 22:55:23 +01:00
Carl Mastrangelo 148154b7e7 lib9: remove unreferenced externs and getuser()
R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/6820115
2012-11-08 09:39:24 -05:00
Shenghou Ma 77e42e2108 lib9, cmd/dist, cmd/5l: embed GOARM into cmd/5l and auto detect GOARM
R=rsc, dave
CC=golang-dev
https://golang.org/cl/6638043
2012-10-22 14:26:36 +08:00
Lucio De Re 1e4515a323 build: u.h for plan9 arm
R=golang-dev, minux.ma, ality
CC=golang-dev
https://golang.org/cl/6743052
2012-10-21 17:04:07 -04:00
Akshat Kumar a72bebf6e1 src: Add support for 64-bit version of Plan 9
This set of changes extends the Plan 9 support
to include the AMD64 architecture and should
work on all versions of Plan 9.

R=golang-dev, rminnich, noah.evans, rsc, minux.ma, npe
CC=akskuma, golang-dev, jfflore, noah.evans
https://golang.org/cl/6479052
2012-08-31 13:21:13 -04:00
Anthony Martin 7ac03695f8 build: remove unnecessary pragmas
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5629055
2012-02-06 12:45:23 -05:00
Anthony Martin cc777490fb build: add include files for Plan 9
Previously, I had made available a tarball of
the modified system headers that were necessary
to build on Plan 9 but that was only a stopgap.
I think this method is much better since no
files outside of $GOROOT will have to be added
or modified during the build process.

Also, this is just the first step. I'll change
the build to reference these files in another CL
(that also contains a few more Makefile changes).

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5552056
2012-01-31 18:14:44 -08:00
Christopher Nielsen d10126a622 os: OS-dependent bits to support NetBSD.
R=golang-dev, jsing
CC=golang-dev
https://golang.org/cl/5482068
2011-12-15 12:19:19 -05:00
Russ Cox 3f4a91d778 lib9: add ctime
ctime differs across Unix vs Plan 9 so add to portability library

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5363043
2011-11-07 13:15:16 -05:00
Russ Cox 7b04471dfa gopack: change archive file name length back to 16
This CL grew the archive file name length from 16 to 64:

        changeset:   909:58574851d792
        user:        Russ Cox <rsc@golang.org>
        date:        Mon Oct 20 13:53:56 2008 -0700

Back then, every x.go file in a package became an x.6 file
in the archive.  It was important to be able to allow the
use of long Go source file names, hence the increase in size.

Today, all Go source files compile into a single _go_.6 file
regardless of their names, so the archive file name length
no longer needs to be long.  The longer name causes some
problems on Plan 9, where the native archive format is the
same but with 16-byte names, so revert back to 16.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5333050
2011-11-01 00:29:16 -04:00
Hector Chu aed2c06dcb 5a, 5c, 6a, 6c, 8a, 8c: fix Windows file paths
Verified with objdump -W.

R=alex.brainman, rsc
CC=golang-dev
https://golang.org/cl/4974061
2011-09-07 15:49:56 -04:00
Mateusz Czapliński eae0a48cf5 libmach: support reading symbols from Windows .exe for nm
Fixes #979.

R=rsc, alex.brainman
CC=golang-dev, vcc.163
https://golang.org/cl/4894051
2011-08-29 14:25:43 -04:00
Hector Chu 1d6ae53cc2 fix windows/amd64 build with newest mingw-w64
R=alex.brainman, golang-dev
CC=golang-dev
https://golang.org/cl/4968048
2011-08-29 16:17:08 +10:00
Lucio De Re eb3f2083f9 build: define getcallerpc in u.h (fix for Plan 9 build)
. By defining getcallerpc(x) as __builtin_return_address(0)
  here, it becomes possible to use the Plan 9 compatible form
  when compiling using GCC.  The alternative is to add conditional
  compilation based on the compiler identity in "cmd/8g/gsubr.c"
  to distinguish between the two cases.

R=golang-dev
CC=golang-dev, rsc
https://golang.org/cl/4800048
2011-07-25 13:45:44 -04:00
Wei Guangjing ee14fbdf34 build: fixes for mingw-w64
R=rsc
CC=golang-dev
https://golang.org/cl/4742042
2011-07-25 13:39:01 -04:00
Lucio De Re 340251e43d build: fix header files for Plan 9
The "elf.h" header changes involve only comments, the released
Plan 9 C preprocessing function does not cope with multiline
comments following the #define keyword.  All multiline comments
have been moved to the line above the associated definition.
Sigh!  Fixing the Plan 9 compiler is not an option.

<time.h> does not exist in the Plan 9 Native library.  I have
moved it from src/cmd/ld/pe.h to include/u.h. RSC correctly points
out that this copy of <u.h> is not the one used to compile the
Go release on Plan 9 platforms.

R=golang-dev
CC=golang-dev, rsc
https://golang.org/cl/4574042
2011-06-14 14:14:11 -04:00
Joe Poirier bf3f768955 windows: replace remaining __MINGW32__ instances with _WIN32
R=rsc, brainman
CC=golang-dev
https://golang.org/cl/4146041
2011-02-08 15:42:52 -05:00
Joe Poirier b57ffae094 cov and prof: implement windows version (just function stubs and build mods)
R=brainman, rsc
CC=golang-dev
https://golang.org/cl/1676054
2010-07-30 11:47:11 +10:00
Russ Cox 491a3ca5b7 gc: fix SIGBUS
R=ken2
CC=golang-dev
https://golang.org/cl/1906042
2010-07-28 18:21:50 -07:00
Dean Prichard 49c4256913 Fix *l/*c -V flag segfault
*l/*c -V will segfault on macos without this trivial fix.

R=adg
CC=golang-dev
https://golang.org/cl/205042
2010-02-08 11:53:27 -08:00
Russ Cox 38430213f5 libc: add goos, goarch, goroot. fixes build
TBR=r
CC=golang-dev
https://golang.org/cl/190059
2010-01-19 09:08:05 -08:00
Hector Chu cd9d72ba9e Ports of lib9, libbio and libmach to Windows.
R=rsc
https://golang.org/cl/157159
2009-11-30 11:53:11 -08:00
Russ Cox fcb9387089 support for 5.out files
R=kaib
DELTA=1262  (1247 added, 7 deleted, 8 changed)
OCL=35907
CL=35909
2009-10-19 22:33:56 -07:00
Russ Cox 04a77ac78c convert C runtime to 32-bit runes;
rune now unsigned.

R=r
DELTA=10  (1 added, 0 deleted, 9 changed)
OCL=34140
CL=34146
2009-08-31 16:38:50 -07:00
Rob Pike 00274a13cb rename libmach_amd64 libmach
R=rsc
OCL=33273
CL=33276
2009-08-14 10:46:04 -07:00