1
0
mirror of https://github.com/golang/go synced 2024-10-04 13:21:22 -06:00
Commit Graph

130 Commits

Author SHA1 Message Date
Russ Cox
8ec6f7cd11 ld: ignore stab symbols
Makes 6l work better on OS X 10.5.

Fixes #1352.
Fixes #1353.

R=r
CC=golang-dev
https://golang.org/cl/3661042
2010-12-17 10:03:43 -08:00
Russ Cox
01464cf956 ld: allow relocations pointing at ELF .bss symbols
R=r, r2
CC=golang-dev
https://golang.org/cl/3710042
2010-12-17 09:53:50 -08:00
Russ Cox
1116ec4f20 ld: text segment should not be writable
R=adg
CC=golang-dev
https://golang.org/cl/3708041
2010-12-15 19:29:53 -08:00
Alex Brainman
f8b7eda5f6 8l: remove unneeded windows check
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/3691042
2010-12-16 12:19:59 +11:00
Russ Cox
33405ecc86 fix freebsd build
R=iant, r
CC=dho, golang-dev
https://golang.org/cl/3687041
2010-12-15 17:20:26 -05:00
Russ Cox
0c54225b51 remove nacl
The recent linker changes broke NaCl support
a month ago, and there are no known users of it.

The NaCl code can always be recovered from the
repository history.

R=adg, r
CC=golang-dev
https://golang.org/cl/3671042
2010-12-15 11:49:23 -05:00
Luuk van Dijk
7a4ce23d65 [68]l and runtime: GDB support for interfaces and goroutines.
R=rsc
CC=golang-dev
https://golang.org/cl/3477041
2010-12-15 12:00:43 +01:00
Russ Cox
88cf5564fc ld: missing prototype
R=ken2
CC=golang-dev
https://golang.org/cl/3620041
2010-12-13 15:26:52 -05:00
Russ Cox
c7c16175e0 ld: allow .o files with no symbols
Don't crash in dwarf for foreign functions.

R=ken2
CC=golang-dev
https://golang.org/cl/3576043
2010-12-13 10:05:07 -05:00
Wei Guangjing
e04ef7769e Fix windows build.
R=brainman, rsc
CC=golang-dev
https://golang.org/cl/3533041
2010-12-13 16:41:02 +11:00
Eoghan Sherry
40ff071e9b 5g/8g, 8l, ld, prof: fix output of 32-bit values
If an %lld argument can be 32 or 64 bits wide, cast to vlong.
If always 32 bits, drop the ll.
Fixes #1336.

R=brainman, rsc
CC=golang-dev
https://golang.org/cl/3580041
2010-12-12 14:40:19 -05:00
Russ Cox
839abc2ea7 5l (and 6l, 8l, ld): more arm build fixes
R=ken2
CC=golang-dev
https://golang.org/cl/3521041
2010-12-08 15:44:59 -05:00
Russ Cox
f5690004c2 6l, 8l: support for linking ELF and Mach-O .o files
More support for references to dynamic symbols,
including full GOT and PLT for ELF objects.

For Mach-O everything ends up in the GOT: dealing
with the real lazy PLT is too hard for now so we punt.

R=iant, iant2
CC=golang-dev
https://golang.org/cl/3491042
2010-12-08 13:56:43 -05:00
Russ Cox
cf42a45587 ld: reading of Mach-O object files
R=iant
CC=golang-dev
https://golang.org/cl/3431045
2010-12-08 13:53:24 -05:00
Russ Cox
8132f1d016 6l, 8l: minor changes & cleanup
R=ken2, ken3
CC=golang-dev
https://golang.org/cl/3505041
2010-12-08 13:53:07 -05:00
Russ Cox
4d8d6d5cda ld: reading of ELF object files
R=iant
CC=golang-dev
https://golang.org/cl/3507041
2010-12-08 13:52:59 -05:00
Russ Cox
7431a3165e ld: re-add ELF symbol tables
R=iant
CC=golang-dev
https://golang.org/cl/3506041
2010-12-08 13:52:50 -05:00
Eoghan Sherry
63544c4754 ld: fix dwarf decoding of 64-bit reflect values
R=rsc
CC=golang-dev
https://golang.org/cl/3002041
2010-12-07 17:20:52 -05:00
Wei Guangjing
70deac67cf 8l : add dynimport to import table in Windows PE, initial make cgo dll work.
R=rsc, brainman, Joe Poirier, mattn
CC=golang-dev
https://golang.org/cl/2166041
2010-12-07 15:28:33 -05:00
Yuval Pavel Zholkover
8221eb9103 8l, runtime: fix Plan 9 386 build.
8l was broken by commit 7ac0d2eed9, it caused .data to be page aligned in the file - which is not how Plan 9 expects things to be.
Also .rodata was layed out in a similar fashion.

Not sure when signame was introduced, but added a stub.
Removed the symo assignment in asm.c as it is not currently used.

Fix runtime breakage after commit 629c065d36 which prefixes all external symbols with runtime·.

R=rsc
CC=golang-dev
https://golang.org/cl/2674041
2010-12-06 16:38:28 -05:00
Luuk van Dijk
9a71bb00bb [68]l: generate debug info for builtin structured types. prettyprinting in gdb.
R=rsc
CC=golang-dev
https://golang.org/cl/3309041
2010-12-03 19:19:33 +01:00
Luuk van Dijk
f08baa38f8 [68]l: correct dwarf location for globals and ranges for arrays.
R=rsc
CC=golang-dev
https://golang.org/cl/3306042
2010-11-29 19:25:33 +01:00
Luuk van Dijk
fbd92dba96 6l/8l: generate dwarf variable names with disambiguating suffix.
R=rsc
CC=golang-dev
https://golang.org/cl/2733042
2010-11-08 19:48:21 +01:00
Ian Lance Taylor
d2d650bdc9 Use future official DWARF language code for Go.
http://dwarfstd.org/ShowIssue.php?issue=101014.1&type=open

Informally accepted for future DWARF 5.

R=lvd
CC=golang-dev, rsc
https://golang.org/cl/2881042
2010-11-04 08:45:25 -07:00
Alex Brainman
8f8f625cb1 8l: pe generation fixes
Restore ability to have different file and
section alignment in generated pe file.

Stop generating .bss pe section, it is
part of .data now.

Some code refactoring.

R=rsc, vcc
CC=golang-dev
https://golang.org/cl/2731041
2010-11-02 10:56:56 +11:00
Luuk van Dijk
4228e62259 6l/8l: global and local variables and type info.
R=rsc
CC=golang-dev
https://golang.org/cl/2201044
2010-10-24 23:07:52 +02:00
Russ Cox
e5e9211071 5l, 6l, 8l: introduce sub-symbols
Sub-symbols are laid out inside a larger symbol
but can be addressed directly.

Use to make Mach-O pointer array not a special case.

Will use later to describe ELF sections.

Glimpses of the beginning of ELF loading.

R=ken2
CC=golang-dev
https://golang.org/cl/2623043
2010-10-22 15:27:50 -04:00
Russ Cox
49084db386 ld: abandon symbol-driven archive loading
Load the entire archive file instead.
Reduces I/O by avoiding additional passes
through libraries to resolve symbols.
Go packages always need all the files anyway
(most often, all 1 of them).

R=ken2
CC=golang-dev
https://golang.org/cl/2613042
2010-10-21 11:39:47 -04:00
Russ Cox
69188ad9bb arm: prop up software floating point
Just enough to make mov instructions work,
which in turn is enough to make strconv work
when it avoids any floating point calculations.
That makes a bunch of other packages pass
their tests.

Should suffice until hardware floating point
is available.

Enable package tests that now pass
(some due to earlier fixes).

Looks like there is a new integer math bug
exposed in the fmt and json tests.

R=ken2
CC=golang-dev
https://golang.org/cl/2638041
2010-10-21 06:56:20 +02:00
Alex Brainman
5e4963d9e8 8l: fix windows build
R=rsc
CC=golang-dev
https://golang.org/cl/2595041
2010-10-20 14:06:00 +11:00
Russ Cox
d5dffb9f29 8l: fix references to INITDAT in windows pe.c
R=ken2
CC=golang-dev
https://golang.org/cl/2588041
2010-10-19 18:17:07 -04:00
Russ Cox
19fd5c787f 5l, 6l, 8l: link pclntab and symtab as ordinary rodata symbols
That is, move the pc/ln table and the symbol table
into the read-only data segment.  This eliminates
the need for a special load command to map the
symbol table into memory, which makes the
information available on systems that couldn't handle
the magic load to 0x99000000, like NaCl and ARM QEMU
and Linux without config_highmem=y.  It also
eliminates an #ifdef and some clumsy code to
find the symbol table on Windows.

The bad news is that the binary appears to be bigger
than it used to be.  This is not actually the case, though:
the same amount of data is being mapped into memory
as before, and the tables are still read-only, so they're
still shared across multiple instances of the binary as
they were before.  The difference is just that the tables
aren't squirreled away in some section that "size" doesn't
know to look at.

This is a checkpoint.
It probably breaks Windows and breaks NaCl more
than it used to be broken, but those will be fixed.
The logic involving -s needs to be revisited too.

Fixes #871.

R=ken2
CC=golang-dev
https://golang.org/cl/2587041
2010-10-19 18:07:19 -04:00
Russ Cox
01df088f8d 5l, 6l, 8l: separate pass to fix addresses
Lay out code before data.

R=ken2
CC=golang-dev
https://golang.org/cl/2490043
2010-10-19 13:08:17 -04:00
Luuk van Dijk
a647f59c1f [68]l: proper end of instruction ranges in dwarf.
R=rsc
CC=golang-dev
https://golang.org/cl/2542042
2010-10-17 22:35:55 +02:00
Luuk van Dijk
cc9e6b5cdb [68]l: fix off by one instruction in dwarf frame unwinding.
R=rsc
CC=golang-dev
https://golang.org/cl/2543043
2010-10-17 21:13:55 +02:00
Wei Guangjing
77eb94c032 8l: fix windows build.
R=rsc, brainman
CC=golang-dev
https://golang.org/cl/2543042
2010-10-15 23:37:14 -04:00
Russ Cox
6e18e8c82f 8l: blind attempt to fix windows build
or at least gather more information

R=ken2
CC=golang-dev
https://golang.org/cl/2515042
2010-10-15 15:29:25 -04:00
Russ Cox
9c20485268 6l: function at a time code layout
Also change the span-dependent jump algorithm
to use fewer iterations:

* resolve forward jumps at their targets (comefrom list)
* mark jumps as small or big and only do small->big
* record whether a jump failed to be encodable

These changes mean that a function with only small
jumps can be laid out in a single iteration, and the
vast majority of functions take just two iterations.
I was seeing a maximum of 5 iterations before; the
max now is 3 and there are fewer that get even that far.

R=ken2
CC=golang-dev
https://golang.org/cl/2537041
2010-10-15 15:18:47 -04:00
Russ Cox
be2c2120d0 5l, 6l, 8l: accumulate data image during import
Using explicit relocations internally, we can
represent the data for a particular symbol as
an initialized block of memory instead of a
linked list of ADATA instructions.  The real
goal here is to be able to hand off some of the
relocations to the dynamic linker when interacting
with system libraries, but a pleasant side effect is
that the memory image is much more compact
than the ADATA list, so the linkers use less memory.

R=ken2
CC=golang-dev
https://golang.org/cl/2512041
2010-10-14 23:48:40 -04:00
Russ Cox
d9c989fa25 various: avoid %ld etc
The Plan 9 tools assume that long is 32 bits.
We converted all instances of long to int32 when
importing the code but missed the print formats.
Because int32 is always int on the compilers we use,
it is never correct to use %lux, %ld, etc.  Convert to %ux, %d, etc.

(It matters because on 64-bit gcc, long is 64 bits,
so we were printing 32-bit quantities with 64-bit formats.)

R=ken2
CC=golang-dev
https://golang.org/cl/2491041
2010-10-13 16:20:22 -04:00
Russ Cox
085be1740a 5l, 6l, 8l: first pass cleanup
* Maintain Sym* list for text with individual
  prog lists instead of using one huge list and
  overloading p->pcond.
* Comment what each file is for.
* Move some output code from span.c to asm.c.
* Move profiling into prof.c, symbol table into symtab.c.
* Move mkfwd to ld/lib.c.
* Throw away dhog dynamic loading code.
* Throw away Alef become.
* Fix printing of WORD instructions in 5l -a.

Goal here is to be able to handle each piece of text or data
as a separate piece, both to make it easier to load the
occasional .o file and also to make it possible to split the
work across multiple threads.

R=ken2, r, ken3
CC=golang-dev
https://golang.org/cl/2335043
2010-10-13 15:51:21 -04:00
Russ Cox
d42903119b 5l, 6l, 8l: indent, outdent
This is entirely adding and removing tabs.
It looks weird but will make the diffs for the
next change easier to read.

R=ken2
CC=golang-dev
https://golang.org/cl/2490041
2010-10-13 15:19:53 -04:00
Jim McGrath
8a1b2e59ef 6l: work with OS X nm/otool
6l was skipping emitting the (2 byte) symbol table if there were no imported or exported
symbols. You can't just drop the symbol table entirely - the linker dies if you have
a linkedit section but no table. You can omit the linkedit section or both the linkedit
and the dlyd parts in the right circumstances, but that seems much more risky to me.

R=rsc
CC=golang-dev
https://golang.org/cl/2421042
2010-10-12 16:52:17 -04:00
Russ Cox
054be1b6c3 ld: be less picky about bad line number info
Fixes #1175.

R=lvd
CC=golang-dev
https://golang.org/cl/2439041
2010-10-11 16:21:03 -04:00
Jim McGrath
3d0726b04d 6l: correct offset for __nl_symbol_ptr in Mach-O.
Fixes malformed object message from nm etc.
Fixes #1180.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/2390042
2010-10-11 14:45:01 -04:00
Jim McGrath
0f6926474f 6l: fix Mach-O LC_RPATH
Fixes #1177.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/2387042
2010-10-11 14:39:41 -04:00
Luuk van Dijk
2ad521c19a [568]a: precise linenumbers for statements.
R=rsc, ken2, r, rsc1
CC=golang-dev
https://golang.org/cl/2297042
2010-10-07 11:13:06 +02:00
Russ Cox
30edda690f ld: share asmlc
R=ken2
CC=golang-dev
https://golang.org/cl/2373043
2010-10-06 09:52:54 -04:00
Russ Cox
05cc83bf4e various: appease the ubuntu gcc monster
Silence warnings about not checking
return values from read and write system calls.

R=r, r2
CC=golang-dev
https://golang.org/cl/2258045
2010-09-28 13:00:13 -04:00
Ken Thompson
103d756663 loader fix
static init redo

R=rsc
CC=golang-dev
https://golang.org/cl/2254041
2010-09-20 14:23:25 -07:00