aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/5l/obj.c
AgeCommit message (Collapse)Author
2012-02-195a, 5c, 5g, 5l: fix build for Linux/ARM.Shenghou Ma
ARM doesn't have the concept of scale, so I renamed the field Addr.scale to Addr.flag to better reflect its true meaning. R=rsc CC=golang-dev https://golang.org/cl/5687044
2012-02-19gc, ld: tag data as no-pointers and allocate in separate sectionRuss Cox
The garbage collector can avoid scanning this section, with reduces collection time as well as the number of false positives. Helps a little bit with issue 909, but certainly does not solve it. R=ken2 CC=golang-dev https://golang.org/cl/5671099
2012-02-085l: attempt to fix arm buildRob Pike
TBR=rsc R=golang-dev CC=golang-dev https://golang.org/cl/5647049
2012-02-075l, 6l, 8l: implement -X flagRuss Cox
R=golang-dev, iant CC=golang-dev https://golang.org/cl/5643050
2012-01-315l: make -v option output less nonessential clutterShenghou Ma
5l -v is for benchmarking various parts of the loader, but this code in obj.c will clutter the output. I only comment them out, because this is on par with 8l/6l. R=golang-dev CC=golang-dev https://golang.org/cl/5600046
2012-01-12ld: parse but do not implement -X flagRuss Cox
This will let programs invoking ld prepare for it. See issue 2676. R=iant CC=golang-dev https://golang.org/cl/5535044
2011-12-12gc: implement == on structs and arraysRuss Cox
To allow these types as map keys, we must fill in equal and hash functions in their algorithm tables. Structs or arrays that are "just memory", like [2]int, can and do continue to use the AMEM algorithm. Structs or arrays that contain special values like strings or interface values use generated functions for both equal and hash. The runtime helper func runtime.equal(t, x, y) bool handles the general equality case for x == y and calls out to the equal implementation in the algorithm table. For short values (<= 4 struct fields or array elements), the sequence of elementwise comparisons is inlined instead of calling runtime.equal. R=ken, mpimenov CC=golang-dev https://golang.org/cl/5451105
2011-07-185l: assume Linux binary, not Plan 9Russ Cox
R=bradfitz CC=golang-dev https://golang.org/cl/4767042
2011-07-18ld: allow seek within write bufferRuss Cox
Reduces number of write+seek's from 88516 to 2080 when linking godoc with 6l. Thanks to Alex Brainman for pointing out the many small writes. R=golang-dev, r, alex.brainman, robert.hencke CC=golang-dev https://golang.org/cl/4743043
2011-07-155a, 5c, 5l: fix for Plan 9 buildLucio De Re
5a/a.h: . Removed <u.h> and <lib.h>. . Made definition of EOF conditional. 5a/a.y: . Added <u.h> and <lib.h>. 5a/lex.c: . Added <u.h> and <lib.h>. . Dropped <ctype.h> (now in <u.h>). 5c/peep.c: . Removed unnecessary "return 0" statement. 5c/reg.c: . Added compilation condition around unused code. 5c/swt.c: . Removed unused "thestring" argument from Bprint() calls. 5l/asm.c: . Added USED() statements as required. . Adjusted a few format specifications. . Added compilation condition around unused code. 5l/l.h: . Dropped directory prefix from <../5l/5.out.h>. . Added varargck pragma for "I" and "i". 5l/obj.c: . Cascaded consecutive "if" statements. . Dropped unnecessary incrementation and assignments. 5l/pass.c: . Dropped unnecessary assignment. 5l/prof.c: . #if 0 converted to #ifdef NOTDEF. 5l/span.c: . Dropped unnecessary incrementation and assignments. R=golang-dev CC=golang-dev, rsc https://golang.org/cl/4752041
2011-06-095l: delete dead codeRuss Cox
Thumb code and ARM pre-V4 code is unused, unmaintained, and almost certainly wrong by now. Every time I try to change 5l I have to sort out what's dead code and what's not. 30% of lines of code in this directory deleted. R=ken2 CC=golang-dev https://golang.org/cl/4601049
2011-06-09math: add sqrt_arm.s and sqrtGoC.go as fallback to soft fp emulationFan Hongjian
5a: add SQRTF and SQRTD 5l: add ASQRTF and ASQRTD Use ARMv7 VFP VSQRT instruction to speed up math.Sqrt R=rsc, dave, m CC=golang-dev https://golang.org/cl/4551082
2011-05-215l: fix set but not used warningsDave Cheney
R=rsc, iant CC=golang-dev https://golang.org/cl/4538083
2011-05-165l: delete pre-ARMv4 instruction implementationsRuss Cox
Add implementation for addr<->reg short moves. Align large data, for ARM. R=ken2 CC=golang-dev https://golang.org/cl/4545050
2011-04-14libmach: fix warnings.Dave Cheney
Fixes #1706. R=adg, rsc CC=golang-dev https://golang.org/cl/4413051
2011-04-14ld: defend against some broken object filesRuss Cox
Fixes #1698. Fixes #1699. R=ken2 CC=golang-dev https://golang.org/cl/4419041
2011-02-24ld: weak symbolsRuss Cox
A reference to the address of weak.foo resolves at link time to the address of the symbol foo if foo would end up in the binary anyway, or to zero if foo would not be in the binary. For example: int xxx = 1; int yyy = 2; int weak·xxx; int weak·yyy; void main·main(void) { runtime·printf("%p %p %p\n", &xxx, &weak·xxx, &weak·yyy); } prints the same non-nil address twice, then 0 (because yyy is not referenced so it was dropped from the binary). This will be used by the reflection tables. R=iant CC=golang-dev https://golang.org/cl/4223044
2011-02-235l/6l/8l: use enums for header type and symbolic strings for -H option valuesAlex Brainman
Thanks to rsc for the suggestion. R=r CC=golang-dev https://golang.org/cl/4174060
2011-02-22ld: detect stack overflow due to NOSPLITRuss Cox
Fix problems found. On amd64, various library routines had bigger stack frames than expected, because large function calls had been added. runtime.assertI2T: nosplit stack overflow 120 assumed on entry to runtime.assertI2T 8 after runtime.assertI2T uses 112 0 on entry to runtime.newTypeAssertionError -8 on entry to runtime.morestack01 runtime.assertE2E: nosplit stack overflow 120 assumed on entry to runtime.assertE2E 16 after runtime.assertE2E uses 104 8 on entry to runtime.panic 0 on entry to runtime.morestack16 -8 after runtime.morestack16 uses 8 runtime.assertE2T: nosplit stack overflow 120 assumed on entry to runtime.assertE2T 16 after runtime.assertE2T uses 104 8 on entry to runtime.panic 0 on entry to runtime.morestack16 -8 after runtime.morestack16 uses 8 runtime.newselect: nosplit stack overflow 120 assumed on entry to runtime.newselect 56 after runtime.newselect uses 64 48 on entry to runtime.printf 8 after runtime.printf uses 40 0 on entry to vprintf -8 on entry to runtime.morestack16 runtime.selectdefault: nosplit stack overflow 120 assumed on entry to runtime.selectdefault 56 after runtime.selectdefault uses 64 48 on entry to runtime.printf 8 after runtime.printf uses 40 0 on entry to vprintf -8 on entry to runtime.morestack16 runtime.selectgo: nosplit stack overflow 120 assumed on entry to runtime.selectgo 0 after runtime.selectgo uses 120 -8 on entry to runtime.gosched On arm, 5c was tagging functions NOSPLIT that should not have been, like the recursive function printpanics: printpanics: nosplit stack overflow 124 assumed on entry to printpanics 112 after printpanics uses 12 108 on entry to printpanics 96 after printpanics uses 12 92 on entry to printpanics 80 after printpanics uses 12 76 on entry to printpanics 64 after printpanics uses 12 60 on entry to printpanics 48 after printpanics uses 12 44 on entry to printpanics 32 after printpanics uses 12 28 on entry to printpanics 16 after printpanics uses 12 12 on entry to printpanics 0 after printpanics uses 12 -4 on entry to printpanics R=r, r2 CC=golang-dev https://golang.org/cl/4188061
2011-02-18fix buildRuss Cox
pieces of an upcoming CL leaked into CL 4168056 TBR=r CC=golang-dev https://golang.org/cl/4180057
2011-02-18ld: drop rpathRuss Cox
Was required by old cgo but we don't generate stub .so files anymore. Update #1527. R=iant CC=golang-dev https://golang.org/cl/4168056
2011-02-01ld: Add -I option to set ELF interpreter.Ian Lance Taylor
R=rsc CC=golang-dev https://golang.org/cl/4080049
2011-01-205l: document -F, force it on old ARMsRuss Cox
Fixes #1341. R=ken2, r CC=golang-dev https://golang.org/cl/4006045
2010-11-03add hardware floating point.Ken Thompson
currently, softfloat does not work and there are some unsigned-to-float conversion errors. R=rsc CC=golang-dev https://golang.org/cl/2886041
2010-10-195l, 6l, 8l: link pclntab and symtab as ordinary rodata symbolsRuss Cox
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-195l, 6l, 8l: separate pass to fix addressesRuss Cox
Lay out code before data. R=ken2 CC=golang-dev https://golang.org/cl/2490043
2010-10-185l: data-relocatable code layoutRuss Cox
R=ken2 CC=golang-dev https://golang.org/cl/2479043
2010-10-175l: stop using R12 as SBRuss Cox
Because the SB is only good for 8k and Go programs tend to have much more data than that, SB doesn't save very much. A fmt.Printf-based hello world program has 360 kB text segment. Removing SB makes the text 500 bytes (0.14%) longer. R=ken2, r2, ken3 CC=golang-dev https://golang.org/cl/2487042
2010-10-145l, 6l, 8l: accumulate data image during importRuss Cox
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-13various: avoid %ld etcRuss Cox
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-135l, 6l, 8l: first pass cleanupRuss Cox
* 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-07-165l, 6l, 8l: reject invalid input filesRuss Cox
Fixes #925. Fixes #926. Fixes #927. Fixes #928. Fixes #929. Fixes #930. R=r CC=golang-dev https://golang.org/cl/1752044
2010-06-30cgo: use slash-free relative paths for .so referencesRuss Cox
The Makefile and cgo now rewrite / to _ when creating the path. The .so for gosqlite.googlecode.com/hg/sqlite is named cgo_gosqlite.googlecode.com_hg_sqlite.so, and then 6l and 8l both include a default rpath of $GOROOT/pkg/$GOOS_$GOARCH. This should make it easier to move binaries from one system to another. Fixes #857. R=iant, r CC=golang-dev https://golang.org/cl/1700048
2010-06-21ld: add -u flag to check safe bits; discard old -u, -x flagsRuss Cox
R=r, r2 CC=golang-dev https://golang.org/cl/1707043
2010-02-26Add -r option to 6l/8l/5l.Ian Lance Taylor
This permits more flexibility with cgo and swig in cases where the program is run on a machine other than the one on which it is built. Rather than storing the absolute path to the shared library in the DT_NEEDED entry, we can store just the name, and let the dynamic linker find it using DT_RUNPATH or the LD_LIBRARY_PATH environment variable. R=rsc CC=golang-dev https://golang.org/cl/223068
2010-02-10arm: fix build on androidRuss Cox
R=kaib CC=golang-dev https://golang.org/cl/206059
2010-02-08*l/*c: add -V flag to display version numberAndrew Gerrand
R=rsc CC=golang-dev https://golang.org/cl/204044
2010-02-03search for runtime.a in the package path instead of hardcodingKai Backman
the location. remove last remnants of broken -l flag. R=rsc CC=golang-dev https://golang.org/cl/201042
2010-02-03ld: include main and runtime in the library loopRuss Cox
Fixes #585. R=r CC=golang-dev https://golang.org/cl/195075
2010-01-25salvaging 183105 from dead clientKai Backman
a number of fixes for arm elf generation in 5l. -T now works as advertised, -D now works properly. R=rsc CC=golang-dev https://golang.org/cl/194076
2010-01-255l, 6l, 8l: accept only one object fileRuss Cox
(package main; others are pulled in automatically) R=ken2 CC=golang-dev https://golang.org/cl/194069
2010-01-25ld: do not load the same object file multiple times.Russ Cox
eliminates spurious multiple initialization errors. give more information in the multiple init errors that remain. Fixes #87. R=r CC=golang-dev https://golang.org/cl/194052
2010-01-22eliminate the package global name space assumption in object filesRuss Cox
5g/6g/8g: add import statements to export metadata, mapping package path to package name. recognize "" as the path of the package in export metadata. use "" as the path of the package in object symbol names. 5c/6c/8c, 5a/6a/8a: rewrite leading . to "". so that ·Sin means Sin in this package. 5l/6l/8l: rewrite "" in symbol names as object files are read. gotest: handle new symbol names. gopack: handle new import lines in export metadata. Collectively, these changes eliminate the assumption of a global name space in the object file formats. Higher level pieces such as reflect and the computation of type hashes still depend on the assumption; we're not done yet. R=ken2, r, ken3 CC=golang-dev https://golang.org/cl/186263
2010-01-19cleanup toward eliminating package global name spaceRuss Cox
* switch to real dot (.) instead of center dot (·) everywhere in object files. before it was half and half depending on where in the name it appeared. * in 6c/6a/etc identifiers, · can still be used but turns into . immediately. * in export metadata, replace package identifiers with quoted strings (still package names, not paths). R=ken2, r CC=golang-dev https://golang.org/cl/190076
2009-12-17 first stub for softfloats, intercepts float instructions and skipsKai Backman
them in the stream. R=rsc https://golang.org/cl/174052
2009-10-25 make 5l ignore multiple defs, remove use of multipleKai Backman
defs from embed1 and gotest R=rsc http://go/go-review/1014009
2009-10-08dupok, gcc compile fix, sync and syscall asm fixKai Backman
R=rsc APPROVED=rsc DELTA=27 (18 added, 0 deleted, 9 changed) OCL=35503 CL=35505
2009-10-07factor portable object+library bits out of 5l/6l/8l into ldRuss Cox
R=r DELTA=3214 (904 added, 2260 deleted, 50 changed) OCL=35425 CL=35427
2009-10-065l library loading, 64 bit entry pointsKai Backman
R=rsc APPROVED=rsc DELTA=58 (52 added, 3 deleted, 3 changed) OCL=35417 CL=35417
2009-08-18slashed warningsKai Backman
R=rsc APPROVED=rsc DELTA=35 (2 added, 1 deleted, 32 changed) OCL=33436 CL=33453