summaryrefslogtreecommitdiff
path: root/src/cmd/ld/lib.c
Commit message (Collapse)AuthorAgeFilesLines
* cmd/go, cmd/ld, runtime, os/user: TLS emulation for androidDavid Crawshaw2014-07-031-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Based on cl/69170045 by Elias Naur. There are currently several schemes for acquiring a TLS slot to save the g register. None of them appear to work for android. The closest are linux and darwin. Linux uses a linker TLS relocation. This is not supported by the android linker. Darwin uses a fixed offset, and calls pthread_key_create until it gets the slot it wants. As the runtime loads late in the android process lifecycle, after an arbitrary number of other libraries, we cannot rely on any particular slot being available. So we call pthread_key_create, take the first slot we are given, and put it in runtime.tlsg, which we turn into a regular variable in cmd/ld. Makes android/arm cgo binaries work. LGTM=minux R=elias.naur, minux, dave, josharian CC=golang-codereviews https://codereview.appspot.com/106380043
* all: remove 'extern register M *m' from runtimeRuss Cox2014-06-261-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The runtime has historically held two dedicated values g (current goroutine) and m (current thread) in 'extern register' slots (TLS on x86, real registers backed by TLS on ARM). This CL removes the extern register m; code now uses g->m. On ARM, this frees up the register that formerly held m (R9). This is important for NaCl, because NaCl ARM code cannot use R9 at all. The Go 1 macrobenchmarks (those with per-op times >= 10 ?s) are unaffected: BenchmarkBinaryTree17 5491374955 5471024381 -0.37% BenchmarkFannkuch11 4357101311 4275174828 -1.88% BenchmarkGobDecode 11029957 11364184 +3.03% BenchmarkGobEncode 6852205 6784822 -0.98% BenchmarkGzip 650795967 650152275 -0.10% BenchmarkGunzip 140962363 141041670 +0.06% BenchmarkHTTPClientServer 71581 73081 +2.10% BenchmarkJSONEncode 31928079 31913356 -0.05% BenchmarkJSONDecode 117470065 113689916 -3.22% BenchmarkMandelbrot200 6008923 5998712 -0.17% BenchmarkGoParse 6310917 6327487 +0.26% BenchmarkRegexpMatchMedium_1K 114568 114763 +0.17% BenchmarkRegexpMatchHard_1K 168977 169244 +0.16% BenchmarkRevcomp 935294971 914060918 -2.27% BenchmarkTemplate 145917123 148186096 +1.55% Minux previous reported larger variations, but these were caused by run-to-run noise, not repeatable slowdowns. Actual code changes by Minux. I only did the docs and the benchmarking. LGTM=dvyukov, iant, minux R=minux, josharian, iant, dave, bradfitz, dvyukov CC=golang-codereviews https://codereview.appspot.com/109050043
* cmd/ld: really import runtime/cgo for external linkIan Lance Taylor2014-05-201-0/+2
| | | | | | | | | Fixes issue 8032. LGTM=rsc R=rsc CC=golang-codereviews https://codereview.appspot.com/95580043
* cmd/ld: don't delete output binary if not "ordinary" file (redux).Mike Andrews2014-04-181-12/+19
| | | | | | | | | | | | | following on CL https://codereview.appspot.com/76810045 and issue 7563, i now see there's another "remove(outfile)" a few dozen lines down that also needs fixing. LGTM=iant R=golang-codereviews, iant CC=0intro, golang-codereviews, r https://codereview.appspot.com/89030043 Committer: Ian Lance Taylor <iant@golang.org>
* cmd/ld: don't pass -rdynamic to external linker if -static is usedIan Lance Taylor2014-04-161-0/+14
| | | | | | | | | Fixes issue 7800. LGTM=rsc R=rsc CC=golang-codereviews https://codereview.appspot.com/87790051
* cmd/ld: restore the call graph dumpAnthony Martin2014-04-161-0/+21
| | | | | | | | | | | | | | | Before the switch to liblink, the linkers accepted the -c flag to print the call graph. This change restores the functionality. This came in handy when I was trying to audit the use of SSE instructions inside the Plan 9 note handler. LGTM=rsc R=golang-codereviews, bradfitz, rsc CC=golang-codereviews https://codereview.appspot.com/73990043 Committer: Russ Cox <rsc@golang.org>
* liblink, cmd/ld: reenable nosplit checking and testRuss Cox2014-04-161-53/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The new code is adapted from the Go 1.2 nosplit code, but it does not have the bug reported in issue 7623: g% go run nosplit.go g% go1.2 run nosplit.go BUG rejected incorrectly: main 0 call f; f 120 linker output: # _/tmp/go-test-nosplit021064539 main.main: nosplit stack overflow 120 guaranteed after split check in main.main 112 on entry to main.f -8 after main.f uses 120 g% Fixes issue 6931. Fixes issue 7623. LGTM=iant R=golang-codereviews, iant, ality CC=golang-codereviews, r https://codereview.appspot.com/88190043
* cmd/ld: use TLS relocations on ELF systems in external linking modeRuss Cox2014-04-151-0/+1
| | | | | | | | | Fixes issue 7719. LGTM=iant R=iant CC=golang-codereviews https://codereview.appspot.com/87760050
* liblink: remove arch-specific constants from file formatRuss Cox2014-04-141-2/+2
| | | | | | | | | | | | | | | | The relocation and automatic variable types were using arch-specific numbers. Introduce portable enumerations instead. To the best of my knowledge, these are the only arch-specific bits left in the new object file format. Remove now, before Go 1.3, because file formats are forever. LGTM=iant R=iant CC=golang-codereviews https://codereview.appspot.com/87670044
* cmd/ld: pass -Qunused-arguments to clang during host linking.Shenghou Ma2014-03-291-1/+4
| | | | | | | LGTM=iant R=iant CC=golang-codereviews https://codereview.appspot.com/82140043
* cmd/ld: don't delete output binary if not "ordinary" file.Mike Andrews2014-03-291-2/+10
| | | | | | | | | | | | | | e.g., don't delete /dev/null. this fix inspired by gnu libiberty, unlink-if-ordinary.c. Fixes issue 7563 LGTM=iant R=golang-codereviews, iant, 0intro CC=golang-codereviews, r https://codereview.appspot.com/76810045 Committer: Ian Lance Taylor <iant@golang.org>
* cmd/ld: give acid a fighting chance at unwinding the stackAnthony Martin2014-03-121-0/+3
| | | | | | | | | | | | | | | | | Acid can't produce a stack trace without .frame symbols. Of course, it can only unwind through linear stacks but this is still better than nothing. (I wrote an acid func to do the full unwind a long time ago but lost it and haven't worked up the courage to write it again). Note that these will only be present in the native symbol table for Plan 9 binaries. LGTM=rsc R=rsc CC=golang-codereviews https://codereview.appspot.com/72450045
* all: final merge of NaCl treeRuss Cox2014-02-271-13/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This CL replays the following one CL from the rsc-go13nacl repo. This is the last replay CL: after this CL the main repo will have everything the rsc-go13nacl repo did. Changes made to the main repo after the rsc-go13nacl repo branched off probably mean that NaCl doesn't actually work after this CL, but all the code is now moved over and just needs to be redebugged. --- cmd/6l, cmd/8l, cmd/ld: support for Native Client See golang.org/s/go13nacl for design overview. This CL is publicly visible but not CC'ed to golang-dev, to avoid distracting from the preparation of the Go 1.2 release. This CL and the others will be checked into my rsc-go13nacl clone repo for now, and I will send CLs against the main repo early in the Go 1.3 development. R?khr https://codereview.appspot.com/15750044 --- LGTM=bradfitz, dave, iant R=dave, bradfitz, iant CC=golang-codereviews https://codereview.appspot.com/69040044
* cmd/cc, cmd/gc, cmd/ld: consolidate print format routinesAnthony Martin2014-02-121-0/+24
| | | | | | | | | | | | | | | We now use the %A, %D, %P, and %R routines from liblink across the board. Fixes issue 7178. Fixes issue 7055. LGTM=iant R=golang-codereviews, gobot, rsc, dave, iant, remyoudompheng CC=golang-codereviews https://codereview.appspot.com/49170043 Committer: Russ Cox <rsc@golang.org>
* include, linlink, cmd/6l, cmd/ld: part 1 of solaris/amd64 linker changes.Shenghou Ma2014-02-091-1/+3
| | | | | | | | | | 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://codereview.appspot.com/54210050
* cmd/ld: fix bug with "runtime/cgo" in external link modeIan Lance Taylor2014-01-301-10/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | In external link mode the linker explicitly adds the string constant "runtime/cgo". It adds the string constant using the same symbol name as the compiler, but a different format. The compiler assumes that the string data immediately follows the string header, but the linker puts the two in different sections. The result is bad string data when the compiler sees "runtime/cgo" used as a string constant. The compiler assumption is in datastring in [568]g/gobj.c. The linker layout is in addstrdata in ld/data.c. The compiler assumption is valid for string literals. The linker is not creating a string literal, so its assumption is also valid. There are a few ways to avoid this problem. This patch fixes it by only doing the fake import of runtime/cgo if necessary, and by only creating the string symbol if necessary. Fixes issue 7234. LGTM=dvyukov R=golang-codereviews, dvyukov, bradfitz CC=golang-codereviews https://codereview.appspot.com/58410043
* liblink, runtime: fix cgo on armRuss Cox2014-01-231-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The addition of TLS to ARM rewrote the MRC instruction differently depending on whether we were using internal or external linking mode. That's clearly not okay, since we don't know that during compilation, which is when we now generate the code. Also, because the change did not introduce a real MRC instruction but instead just macro-expanded it in the assembler, liblink is rewriting a WORD instruction that may actually be looking for that specific constant, which would lead to very unexpected results. It was also using one value that happened to be 8 where a different value that also happened to be 8 belonged. So the code was correct for those values but not correct in general, and very confusing. Throw it all away. Replace with the following. There is a linker-provided symbol runtime.tlsgm with a value (address) set to the offset from the hardware-provided TLS base register to the g and m storage. Any reference to that name emits an appropriate TLS relocation to be resolved by either the internal linker or the external linker, depending on the link mode. The relocation has exactly the semantics of the R_ARM_TLS_LE32 relocation, which is what the external linker provides. This symbol is only used in two routines, runtime.load_gm and runtime.save_gm. In both cases it is now used like this: MRC 15, 0, R0, C13, C0, 3 // fetch TLS base pointer MOVW $runtime?tlsgm(SB), R2 ADD R2, R0 // now R0 points at thread-local g+m storage It is likely that this change breaks the generation of shared libraries on ARM, because the MOVW needs to be rewritten to use the global offset table and a different relocation type. But let's get the supported functionality working again before we worry about unsupported functionality. LGTM=dave, iant R=iant, dave CC=golang-codereviews https://codereview.appspot.com/56120043
* cmd/gc, cmd/ld: fix Plan 9 warningsDavid du Colombier2014-01-221-2/+4
| | | | | | | | | | | warning: /usr/go/src/cmd/gc/obj.c:23 format mismatch -10d VLONG, arg 9 warning: /usr/go/src/cmd/gc/plive.c:1680 set and not used: printed warning: /usr/go/src/cmd/ld/lib.c:332 non-interruptable temporary warning: /usr/go/src/cmd/ld/lib.c:338 non-interruptable temporary R=rsc CC=golang-codereviews https://codereview.appspot.com/53820046
* cmd/ld: support archives larger than 2GIan Lance Taylor2014-01-211-3/+3
| | | | | | R=golang-codereviews, gobot, rsc CC=golang-codereviews https://codereview.appspot.com/53950043
* cmd/ld: make hostobj work on newer openbsdJoel Sing2013-12-201-0/+2
| | | | | | | | | | | | Make hostobj work on OpenBSD 5.3/5.4/-current - these have PIE enabled by default and linking fails since the Go linker generates objects that are neither PIC nor PIE. Fixes issue 5067 R=golang-dev, rsc CC=golang-dev https://codereview.appspot.com/7572049
* debug/goobj: expand package prefix correctlyRuss Cox2013-12-181-1/+2
| | | | | | R=r, bradfitz CC=golang-dev https://codereview.appspot.com/43480049
* cmd/gc: implement -pack flagRuss Cox2013-12-171-12/+9
| | | | | | | | | | | | | | | | | | | | | The -pack flag causes 5g, 6g, 8g to write a Go archive directly, instead of requiring the use of 'go tool pack' to convert the .5/.6/.8 to .a format. Writing directly avoids the copy and also avoids having the export data stored twice in the archive (once in __.PKGDEF, once in .5/.6/.8). A separate CL will enable the use of this flag by cmd/go. Other build systems that do not know about -pack will be unaffected. The changes to cmd/ld handle a minor simplification to the format: an unused section is removed. R=iant, r CC=golang-dev https://codereview.appspot.com/42880043
* cmd/ld: maintain correct headstring needed by windows port.Shenghou Ma2013-12-171-0/+1
| | | | | | | | | | | Fixes build for go_bootstrap. Fixes issue 6971. R=alex.brainman, mattn.jp, rsc CC=golang-dev https://codereview.appspot.com/43130043 Committer: Russ Cox <rsc@golang.org>
* cmd/ld: move instruction selection + layout into compilers, assemblersRuss Cox2013-12-161-35/+18
| | | | | | | | | | | | | | | | | | | | | - 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://codereview.appspot.com/39680043
* liblink: create new library based on linker codeRuss Cox2013-12-081-1192/+114
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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://codereview.appspot.com/35790044
* cmd/gc: support -installsuffix in the compiler and builderDave Day2013-10-031-5/+11
| | | | | | | | | | Add the -installsuffix flag to gc and {5,6,8}l, which overrides -race for the suffix if both are supplied. Pass this flag from the go tool for build and install. R=rsc CC=golang-dev https://codereview.appspot.com/14246044
* cmd/ld: fix "ld -s" to not discard pclntab.Shenghou Ma2013-09-201-3/+0
| | | | | | | | Fixes issue 6245. R=golang-dev, bradfitz, rsc CC=golang-dev https://codereview.appspot.com/13751045
* build: remove various uses of C undefined behaviorRuss Cox2013-09-091-3/+3
| | | | | | | | | | | | | | | | | | 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 issue 5764 Dave, can you please try again? R=golang-dev, bradfitz CC=golang-dev https://codereview.appspot.com/13334049
* cgo: enable cgo on dragonflyAulus Egnatius Varialus2013-09-041-0/+10
| | | | | | | | | | Enable cgo for dragonfly/386 and dragonfly/amd64. R=golang-dev, jsing, iant, bradfitz CC=golang-dev https://codereview.appspot.com/13247046 Committer: Ian Lance Taylor <iant@golang.org>
* cmd/ld: don't allocate unused garbage space in pclntab file tableIan Lance Taylor2013-09-041-1/+0
| | | | | | | | Fixes issue 6319. R=golang-dev, bradfitz CC=golang-dev https://codereview.appspot.com/13539043
* libbio, all cmd: consistently use BGETC/BPUTC instead of Bgetc/BputcDmitriy Vyukov2013-08-301-17/+7
| | | | | | | | | | | | | | | | | | | 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://codereview.appspot.com/12745047
* cmd/dist: fix darwin buildRuss Cox2013-08-141-3/+4
| | | | | | | | The TLS block on Darwin is not the same as on ELF. TBR=elias.naur CC=golang-dev https://codereview.appspot.com/12741044
* runtime.cmd/ld: Add ARM external linking and implement -shared in terms of ↵Elias Naur2013-08-141-13/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | external linking This CL is an aggregate of 10271047, 10499043, 9733044. Descriptions of each follow: 10499043 runtime,cmd/ld: Merge TLS symbols and teach 5l about ARM TLS This CL prepares for external linking support to ARM. The pseudo-symbols runtime.g and runtime.m are merged into a single runtime.tlsgm symbol. When external linking, the offset of a thread local variable is stored at a memory location instead of being embedded into a offset of a ldr instruction. With a single runtime.tlsgm symbol for both g and m, only one such offset is needed. The larger part of this CL moves TLS code from gcc compiled to internally compiled. The TLS code now uses the modern MRC instruction, and 5l is taught about TLS fallbacks in case the instruction is not available or appropriate. 10271047 This CL adds support for -linkmode external to 5l. For 5l itself, use addrel to allow for D_CALL relocations to be handled by the host linker. Of the cases listed in rsc's comment in issue 4069, only case 5 and 63 needed an update. One of the TODO: addrel cases was since replaced, and the rest of the cases are either covered by indirection through addpool (cases with LTO or LFROM flags) or stubs (case 74). The addpool cases are covered because addpool emits AWORD instructions, which in turn are handled by case 11. In the runtime, change the argv argument in the rt0* functions slightly to be a pointer to the argv list, instead of relying on a particular location of argv. 9733044 The -shared flag to 6l outputs a shared library, implemented in Go and callable from non-Go programs such as C. The main part of this CL change the thread local storage model. Go uses the fastest and least general mode, local exec. TLS data in shared libraries normally requires at least the local dynamic mode, however, this CL instead opts for using the initial exec mode. Initial exec mode is faster than local dynamic mode and can be used in linux since the linker has reserved a limited amount of TLS space for performance sensitive TLS code. Initial exec mode requires an extra load from the GOT table to determine the TLS offset. This penalty will not be paid if ld is not in -shared mode, since TLS accesses will be reduced to local exec. The elf sections .init_array and .rela.init_array are added to register the Go runtime entry with cgo at library load time. The "hidden" attribute is added to Cgo functions called from Go, since Go does not generate call through the GOT table, and adding non-GOT relocations for a global function is not supported by gcc. Cgo symbols don't need to be global and avoiding the GOT table is also faster. The changes to 8l are only removes code relevant to the old -shared mode where internal linking was used. This CL only address the low level linker work. It can be submitted by itself, but to be useful, the runtime changes in CL 9738047 is also needed. Design discussion at https://groups.google.com/forum/?fromgroups#!topic/golang-nuts/zmjXkGrEx6Q Fixes issue 5590. R=rsc CC=golang-dev https://codereview.appspot.com/12871044 Committer: Russ Cox <rsc@golang.org>
* runtime: reimplement reflect.call to not use stack splitting.Keith Randall2013-08-021-1/+1
| | | | | | R=golang-dev, r, khr, rsc CC=golang-dev https://codereview.appspot.com/12053043
* cmd/ld: report pclntab, funcdata sizes in 6l -v outputRuss Cox2013-08-011-5/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | Also move chatty recent additions to -v -v. For what it's worth: $ go build -o /dev/null -ldflags -v cmd/go ... 0.87 pclntab=1110836 bytes, funcdata total 69700 bytes ... $ This broke the ELF builds last time because I tried to dedup the funcdata in case the same funcdata was pointed at by multiple functions. That doesn't currently happen, so I've removed that test. If we start doing bitmap coalescing we'll need to figure out how to measure the size more carefully, but I think at that point the bitmaps will be an extra indirection away from the funcdata anyway, so the dedup I used before wouldn't help. R=ken2 CC=golang-dev https://codereview.appspot.com/12269043
* undo CL 12193043 / cc5858966b08Brad Fitzpatrick2013-07-311-15/+5
| | | | | | | | | | | | | | | | | | | | | | | | | Breaks all ELF builds. ??? original CL description cmd/ld: report pclntab, funcdata sizes in 6l -v output Also move chatty recent additions to -v -v. For what it's worth: $ go build -o /dev/null -ldflags -v cmd/godoc ... 0.73 pclntab=1259976 bytes, funcdata total 79788 bytes ... $ R=ken2 CC=cshapiro, golang-dev https://codereview.appspot.com/12193043 ??? R=rsc CC=golang-dev https://codereview.appspot.com/12202043
* cmd/ld: report pclntab, funcdata sizes in 6l -v outputRuss Cox2013-07-311-5/+15
| | | | | | | | | | | | | | | | Also move chatty recent additions to -v -v. For what it's worth: $ go build -o /dev/null -ldflags -v cmd/godoc ... 0.73 pclntab=1259976 bytes, funcdata total 79788 bytes ... $ R=ken2 CC=cshapiro, golang-dev https://codereview.appspot.com/12193043
* cmd/ld: fix warnings on Plan 9David du Colombier2013-07-221-8/+6
| | | | | | | | | | | | | | | src/cmd/ld/lib.c:1379 set and not used: p src/cmd/ld/lib.c:1426 format mismatch 6llux INT, arg 3 src/cmd/ld/lib.c:1437 format mismatch 6llux INT, arg 3 src/cmd/ld/lib.c:1456 format mismatch 6llux INT, arg 3 src/cmd/ld/lib.c:1477 format mismatch 6llux INT, arg 3 src/cmd/ld/lib.c:1459 set and not used: started R=golang-dev, rsc CC=golang-dev https://codereview.appspot.com/11615044 Committer: Russ Cox <rsc@golang.org>
* cmd/ld, runtime: remove unused fields from FuncRuss Cox2013-07-191-8/+1
| | | | | | R=golang-dev, r CC=golang-dev https://codereview.appspot.com/11604043
* cmd/gc, cmd/ld: fix build: remove unused var, use correct var in printfIan Lance Taylor2013-07-191-1/+1
| | | | | | | | Fixes issue 5924. R=golang-dev, khr, rsc CC=golang-dev https://codereview.appspot.com/11606043
* runtime: use funcdata to supply garbage collection informationRuss Cox2013-07-191-24/+7
| | | | | | | | | | | | | This CL introduces a FUNCDATA number for runtime-specific garbage collection metadata, changes the C and Go compilers to emit that metadata, and changes the runtime to expect it. The old pseudo-instructions that carried this information are gone, as is the linker code to process them. R=golang-dev, dvyukov, cshapiro CC=golang-dev https://codereview.appspot.com/11406044
* runtime: cleanup: use ArgsSizeUnknown to mark all functionsKeith Randall2013-07-191-6/+3
| | | | | | | | | | | | whose argument size is unknown (C vararg functions, and assembly code without an explicit specification). We used to use 0 to mean "unknown" and 1 to mean "zero". Now we use ArgsSizeUnknown (0x80000000) to mean "unknown". R=golang-dev, rsc CC=golang-dev https://codereview.appspot.com/11590043
* cmd/ld: refine test for history stack pop (fix Windows build)Russ Cox2013-07-181-4/+14
| | | | | | | | | | | This should fix the Windows build, or at least what's breaking it at the moment. Fixes issue 5904. TBR=golang-dev CC=golang-dev https://codereview.appspot.com/11519044
* cmd/ld, runtime: use new contiguous pcln tableRuss Cox2013-07-181-182/+90
| | | | | | R=golang-dev, r, dave CC=golang-dev https://codereview.appspot.com/11494043
* cmd/ld: trivial: fix unused parameter pedantryDave Cheney2013-07-181-0/+3
| | | | | | R=golang-dev, r, rsc CC=golang-dev https://codereview.appspot.com/11436043
* cmd/ld, runtime: new in-memory symbol table formatRuss Cox2013-07-161-0/+614
| | | | | | | | | | | | | | | | | Design at http://golang.org/s/go12symtab. This enables some cleanup of the garbage collector metadata that will be done in future CLs. This CL does not move the old symtab and pclntab back into an unmapped section of the file. That's a bit tricky and will be done separately. Fixes issue 4020. R=golang-dev, dave, cshapiro, iant, r CC=golang-dev, nigeltao https://codereview.appspot.com/11085043
* cmd/ld: place read-only data in non-executable segmentRuss Cox2013-07-111-0/+11
| | | | | | R=golang-dev, dave, r CC=golang-dev, nigeltao https://codereview.appspot.com/10713043
* cmd/ld: trivial: fix unhandled switch caseDave Cheney2013-07-081-0/+3
| | | | | | | | Fix warning found by clang 3.3. R=rsc, r CC=golang-dev https://codereview.appspot.com/11022043
* cmd/ld: fix line numbers when using fieldtrackRuss Cox2013-06-251-1/+1
| | | | | | | | | | | | | | | | | | | | USEFIELD is a special kind of NOP, so treat it like a NOP when generating the pc-ln table. There are more invasive fixes that could be applied here. I am going for minimum number of lines changed. The smallest test case we know of is five distinct Go files in four packages, and the bug only happens with GOEXPERIMENT=fieldtrack enabled, which we don't normally build with, so the test would never run meaningfully anyway. Fixes issue 5762. R=golang-dev, bradfitz CC=golang-dev https://codereview.appspot.com/10495044
* cmd/ld: supply -s to gcc if -s is passed.Shenghou Ma2013-06-121-1/+4
| | | | | | | | Fixes issue 5463. R=golang-dev, iant CC=golang-dev https://codereview.appspot.com/9239045