aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/nm
AgeCommit message (Collapse)Author
2017-09-21cmd/nm: handle cgo archiveHiroshi Ioka
This CL also make cmd/nm accept PE object file. Fixes #21706 Change-Id: I4a528b7d53da1082e61523ebeba02c4c514a43a7 Reviewed-on: https://go-review.googlesource.com/64890 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-09-20cmd/nm: add test case for go archivesHiroshi Ioka
Also, rename some test cases, check (*os.File).Close For #21706 Change-Id: Ie60c4d345b2259736c823dc6001c08affcdd86e7 Reviewed-on: https://go-review.googlesource.com/64510 Reviewed-by: David Crawshaw <crawshaw@golang.org> Run-TryBot: David Crawshaw <crawshaw@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-02-14all: fix some printf format stringsJosh Bleecher Snyder
Appease vet. Change-Id: Ie88de08b91041990c0eaf2e15628cdb98d40c660 Reviewed-on: https://go-review.googlesource.com/36938 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-02-11cmd/nm: extend help text to document the flagsJaana Burcu Dogan
Change-Id: Ia2852666ef44e7ef0bba2360e92caccc83fd0e5c Reviewed-on: https://go-review.googlesource.com/36796 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-02-04cmd/nm: skip TestInternalLinkerCgoFile if no internal linking is supportedAlex Brainman
Fixes build. Change-Id: I2fee624c8a4b228bb9f2889e241ea016a317bb11 Reviewed-on: https://go-review.googlesource.com/36373 TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2017-02-04cmd/link: do not prefix external symbols with underscore on windows/386/cgoAlex Brainman
CL 18057 added underscore to most external pe symbols on windows/386/cgo. The CL changed runtime.epclntab and runtime.pclntab pe symbols into _runtime.pclntab and _runtime.epclntab, and now cmd/nm cannot find them. Revert correspondent CL 18057 changes, because most pe symbols do not need underscore prefix. This CL also removes code that added obj.SHOSTOBJ symbols explicitly, because each of those was also added via genasmsym call. These created duplicate pe symbols (like _GetProcAddress@8 and __GetProcAddress@8), and external linker would complain. This CL adds new test in cmd/nm to verify go programs built with cgo. Fixes #18416 Change-Id: I68b1be8fb631d95ec69bd485c77c79604fb23f26 Reviewed-on: https://go-review.googlesource.com/35076 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-10-04all: use sort.Slice where applicableBrad Fitzpatrick
I avoided anywhere in the compiler or things which might be used by the compiler in the future, since they need to build with Go 1.4. I also avoided anywhere where there was no benefit to changing it. I probably missed some. Updates #16721 Change-Id: Ib3c895ff475c6dec2d4322393faaf8cb6a6d4956 Reviewed-on: https://go-review.googlesource.com/30250 TryBot-Result: Gobot Gobot <gobot@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-08-30all: use testing.GoToolPath instead of "go"Keith Randall
This change makes sure that tests are run with the correct version of the go tool. The correct version is the one that we invoked with "go test", not the one that is first in our path. Fixes #16577 Change-Id: If22c8f8c3ec9e7c35d094362873819f2fbb8559b Reviewed-on: https://go-review.googlesource.com/28089 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-01all: make copyright headers consistent with one space after periodBrad Fitzpatrick
This is a subset of https://golang.org/cl/20022 with only the copyright header lines, so the next CL will be smaller and more reviewable. Go policy has been single space after periods in comments for some time. The copyright header template at: https://golang.org/doc/contribute.html#copyright also uses a single space. Make them all consistent. Change-Id: Icc26c6b8495c3820da6b171ca96a74701b4a01b0 Reviewed-on: https://go-review.googlesource.com/20111 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-06-16all: extract "can I exec?" check from tests into internal/testenvRuss Cox
Change-Id: I7b54be9d8b50b39e01c6be21f310ae9a10404e9d Reviewed-on: https://go-review.googlesource.com/10753 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: David Crawshaw <crawshaw@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-04-12cmd/nm: skip fork test on darwin/arm64David Crawshaw
Just like darwin/arm. Change-Id: Iabb6282f18548da43117ee60f7ad6e272502f09d Reviewed-on: https://go-review.googlesource.com/8825 Reviewed-by: Minux Ma <minux@golang.org>
2015-02-26cmd/nm: exclude Go tool test on darwin/armDavid Crawshaw
Change-Id: I44f1240a766f20de5997faca4f13f96af6da3534 Reviewed-on: https://go-review.googlesource.com/6190 Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2014-09-08build: adjustments for move from src/pkg to srcRuss Cox
This CL adjusts code referring to src/pkg to refer to src. Immediately after submitting this CL, I will submit a change doing 'hg mv src/pkg/* src'. That change will be too large to review with Rietveld but will contain only the 'hg mv'. This CL will break the build. The followup 'hg mv' will fix it. For more about the move, see golang.org/s/go14nopkg. LGTM=r R=r CC=golang-codereviews https://golang.org/cl/134570043
2014-08-07cmd/addr2line, cmd/nm: factor object reading into cmd/internal/objfileRuss Cox
To do in another CL: make cmd/objdump use cmd/internal/objfile too. There is a package placement decision in this CL: cmd/internal/objfile instead of internal/objfile. I chose to put internal under cmd to make clear (and enforce) that no standard library packages should use this (it's a bit dependency-heavy). LGTM=r R=r CC=golang-codereviews https://golang.org/cl/123910043
2014-07-08cmd/nm: skip test on android (no Go tool)David Crawshaw
LGTM=bradfitz R=golang-codereviews, bradfitz CC=golang-codereviews https://golang.org/cl/107590043
2014-05-20build: make nacl passRuss Cox
Add nacl.bash, the NaCl version of all.bash. It's a separate script because it builds a variant of package syscall with a large zip file embedded in it, containing all the input files needed for tests. Disable various tests new since the last round, mostly the ones using os/exec. Fixes #7945. LGTM=dave R=golang-codereviews, remyoudompheng, dave, bradfitz CC=golang-codereviews https://golang.org/cl/100590044
2014-05-14cmd/nm, cmd/objdump: fix elf symbol typesRuss Cox
Turns out elf.File.Sections is indexed by the actual section number, not the number minus one. I don't know why I thought the -1 was necessary. Fixes objdump test (and therefore build) on ELF systems. While we're here, fix bounds on gnuDump so that we don't crash when asked to disassemble outside the text segment. May fix Windows build or at least make the failure more interesting. TBR=iant CC=golang-codereviews https://golang.org/cl/92390043
2014-05-12cmd/nm: do not write to GOROOT testdata directories during TestNMAlex Brainman
LGTM=bradfitz R=bradfitz, 0intro CC=golang-codereviews https://golang.org/cl/95280043
2014-04-21cmd/nm: do not fail TestNM if symbol has less then 3 columns in nm outputAlex Brainman
Fixes #7829 LGTM=dave R=golang-codereviews, aram, dave CC=golang-codereviews https://golang.org/cl/89830043
2014-04-21cmd/nm: disable TestNM on darwin, linux and solarisAlex Brainman
Update #7829 LGTM=dave R=golang-codereviews, dave CC=golang-codereviews https://golang.org/cl/89810043
2014-04-21cmd/ld: correct addresses in windows pe symbol tableAlex Brainman
This should have been part of 36eb4a62fbb6, but I later discovered that addresses are all wrong. Appropriate test added now. LGTM=r R=golang-codereviews, r CC=golang-codereviews https://golang.org/cl/89470043
2014-04-19cmd/nm: print symbol sizes for windows pe executablesAlex Brainman
Fixes #6973 LGTM=r R=golang-codereviews, r CC=golang-codereviews https://golang.org/cl/88820043
2014-04-16cmd/nm: windows pe handling fixesAlex Brainman
- output absolute addresses, not relative; - accept negative section numbers. Update #6936 Fixes #7738 LGTM=rsc R=golang-codereviews, bradfitz, ruiu, rsc CC=golang-codereviews https://golang.org/cl/85240046
2014-01-22debug/plan9obj: implement parsing of Plan 9 a.out executablesDavid du Colombier
It implements parsing of the header and symbol table for both 32-bit and 64-bit Plan 9 binaries. The nm tool was updated to use this package. R=rsc, aram CC=golang-codereviews https://golang.org/cl/49970044
2014-01-08cmd/nm: add -sort=sizeRob Pike
When printing the size, we often want to sort on that key. Because it's used when looking for large things, make the sort go from largest to smallest. Perfect recreation of CL 45150044, which was lost to some blunder. R=golang-codereviews, gobot, rsc CC=golang-codereviews https://golang.org/cl/48500044
2013-12-27all: fix a few spelling errors in source commentsMartin Olsson
R=golang-codereviews, dave, iant CC=golang-codereviews https://golang.org/cl/45750044
2013-12-18cmd/nm: minor cleanup from previous CLRuss Cox
I forgot to apply Ian's suggestions before submitting CL 40600043. R=iant CC=golang-dev https://golang.org/cl/43560045
2013-12-16cmd/nm: reimplement in GoRuss Cox
The immediate goal is to support the new object file format, which libmach (nm's support library) does not understand. Rather than add code to libmach or reengineer liblink to support this new use, just write it in Go. The C version of nm reads the Plan 9 symbol table stored in Go binaries, now otherwise unused. This reimplementation uses the standard symbol table for the corresponding file format instead, bringing us one step closer to removing the Plan 9 symbol table from Go binaries. Tell cmd/dist not to build cmd/nm anymore. Tell cmd/go to install cmd/nm in the tool directory. R=golang-dev, r, iant, alex.brainman CC=golang-dev https://golang.org/cl/40600043
2013-09-16cmd/nm: make -S listing a bit more accurateRuss Cox
Hide container symbols like text and etext so that the individual pieces inside are shown instead. For example, if text and main.init have the same address, it was a toss-up which name was printed. R=golang-dev, iant CC=golang-dev https://golang.org/cl/13722046
2013-09-16cmd/nm: put the -S flag in the usage messageRob Pike
The -S flag reports symbol size, but is missing from the usage message. R=golang-dev, dsymonds CC=golang-dev https://golang.org/cl/13660046
2013-04-03cmd/nm: don't add filename elements for m symbolsAnthony Martin
The compilers used to generate only one 'm' symbol to record the stack frame size for each function. In cmd/nm, the 'm' and 'f' symbols are handled in the same switch case with a special exception for the symbol described above called ".frame". Now that the compilers emit additional 'm' symbols for precise garbage collection of the stack, the current logic is incorrect. cmd/nm will attempt to interpret these new 'm' symbols as 'f' symbols and add them to the file name index table. This fails with an out-of-memory condition when zenter encounters an 'm' symbol with a very large value (usually the .args symbol indicating a variadic NOSPLIT function). R=iant CC=dave, gobot, golang-dev, rsc https://golang.org/cl/7962045
2013-02-19cmd/godoc: use go/build to determine package and example filesRobert Griesemer
Also: - faster code for example extraction - simplify handling of command documentation: all "main" packages are treated as commands - various minor cleanups along the way For commands written in Go, any doc.go file containing documentation must now be part of package main (rather then package documentation), otherwise the documentation won't show up in godoc (it will still build, though). For commands written in C, documentation may still be in doc.go files defining package documentation, but the recommended way is to explicitly ignore those files with a +build ignore constraint to define package main. Fixes #4806. R=adg, rsc, dave, bradfitz CC=golang-dev https://golang.org/cl/7333046
2012-10-30gofmt: apply gofmt -w src miscRobert Griesemer
Remove trailing whitespace in comments. No other changes. R=r CC=golang-dev https://golang.org/cl/6815053
2012-09-13cmd/pack: rename __.SYMDEF to __.GOSYMDEFRuss Cox
This fixes a problem with ELF tools thinking they know the format of the symbol table, as we do not use any of the standard formats for that table. This change will probably annoy the Plan 9 users, but I believe there are other incompatibilities already that mean they have to use a Go-specific nm. Fixes #3473. R=golang-dev, iant CC=golang-dev https://golang.org/cl/6500117
2012-03-09doc: various update to command documentsShenghou Ma
1. consistent usage section (go tool xxx) 2. reformat cmd/ld document with minor correction document which -H flags are valid on which ld document -d flag can't be used on Windows. document -Hwindowsgui R=golang-dev, r, rsc CC=golang-dev https://golang.org/cl/5782043
2012-02-06build: delete make paraphernaliaRuss Cox
As a convenience to people working on the tools, leave Makefiles that invoke the go dist tool appropriately. They are not used during the build. R=golang-dev, bradfitz, n13m3y3r, gustavo CC=golang-dev https://golang.org/cl/5636050
2012-02-04docs: replace references to gofix etc. with tool invocationsRob Pike
R=rsc CC=golang-dev https://golang.org/cl/5630045
2012-01-29cmd/go: c tools not used during compilationRob Pike
cov, nm, pprof, prof R=rsc, r, rsc CC=golang-dev https://golang.org/cl/5576067
2011-06-19Make.ccmd: link with mach lib,Joe Poirier
remove explicit linking in make files R=golang-dev, r CC=golang-dev https://golang.org/cl/4629051
2011-03-08nm: document -S flagRuss Cox
R=r CC=golang-dev https://golang.org/cl/4247066
2010-12-10nm: silently ignore .o files in .a filesRuss Cox
Update #1334. R=r CC=golang-dev https://golang.org/cl/3553041
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-08-24build: $GOBIN defaults to $GOROOT/binRuss Cox
R=r CC=golang-dev https://golang.org/cl/1982049
2009-11-23go: makes it build for the case $GOROOT has whitespacesSergio Luis O. B. Correia
the bash scripts and makefiles for building go didn't take into account the fact $GOROOT / $GOBIN could both be directories containing whitespaces, and was not possible to build it in such a situation. this commit adjusts the various makefiles/scripts to make it aware of that possibility, and now it builds successfully when using a path with whitespaces as well. Fixes #115. R=rsc, dsymonds1 https://golang.org/cl/157067
2009-11-09tweak documentation of commandsRuss Cox
so that first sentence is better for cmd page. live at http://r45:3456/cmd/ R=gri, r http://go/go-review/1024034
2009-11-04stylistic issues in a couple of cmd docsRob Pike
R=rsc http://go/go-review/1017028
2009-11-03more command documentation, including nm and profRob Pike
R=rsc http://go/go-review/1017022
2009-10-03clean moreRuss Cox
R=r DELTA=40 (9 added, 3 deleted, 28 changed) OCL=35277 CL=35305
2009-09-08add -S flag to print size of symbolRuss Cox
R=r DELTA=24 (15 added, 0 deleted, 9 changed) OCL=34447 CL=34458
2009-08-14rename libmach_amd64 libmachRob Pike
R=rsc OCL=33273 CL=33276