FAQ
Reviewers: iant,

Message:
Hello iant (cc: golang-dev@googlegroups.com),

I'd like you to review this change to
https://code.google.com/p/go/


Description:
cmd/nm: minor cleanup from previous CL

I forgot to apply Ian's suggestions before submitting CL 40600043.

Please review this at https://codereview.appspot.com/43560045/

Affected files (+12, -11 lines):
    M src/cmd/nm/doc.go
    M src/cmd/nm/elf.go
    M src/cmd/nm/goobj.go
    M src/cmd/nm/nm.go


Index: src/cmd/nm/doc.go
===================================================================
--- a/src/cmd/nm/doc.go
+++ b/src/cmd/nm/doc.go
@@ -13,6 +13,8 @@
   //
   // T text (code) segment symbol
   // t static text segment symbol
+// R read-only data segment symbol
+// r static read-only data segment symbol
   // D data segment symbol
   // d static data segment symbol
   // B bss segment symbol
Index: src/cmd/nm/elf.go
===================================================================
--- a/src/cmd/nm/elf.go
+++ b/src/cmd/nm/elf.go
@@ -47,6 +47,9 @@
       sym.Code = 'D'
      }
     }
+ if elf.ST_BIND(s.Info) == elf.STB_LOCAL {
+ sym.Code += 'a' - 'A'
+ }
     syms = append(syms, sym)
    }

Index: src/cmd/nm/goobj.go
===================================================================
--- a/src/cmd/nm/goobj.go
+++ b/src/cmd/nm/goobj.go
@@ -42,7 +42,7 @@
     case goobj.SBSS, goobj.SNOPTRBSS, goobj.STLSBSS:
      sym.Code = 'B'
     case goobj.SXREF, goobj.SMACHOSYMSTR, goobj.SMACHOSYMTAB,
goobj.SMACHOINDIRECTPLT, goobj.SMACHOINDIRECTGOT, goobj.SFILE,
goobj.SFILEPATH, goobj.SCONST, goobj.SDYNIMPORT, goobj.SHOSTOBJ:
- sym.Code = 'X'
+ sym.Code = 'X' // should not see
     }
     if s.Version != 0 {
      sym.Code += 'a' - 'A'
Index: src/cmd/nm/nm.go
===================================================================
--- a/src/cmd/nm/nm.go
+++ b/src/cmd/nm/nm.go
@@ -24,6 +24,8 @@
    sortOrder = flag.String("sort", "name", "")
    printSize = flag.Bool("size", false, "")
    printType = flag.Bool("type", false, "")
+
+ filePrefix = false
   )

   func init() {
@@ -64,6 +66,7 @@
    }

    args := flag.Args()
+ filePrefix = len(args) > 1
    if len(args) == 0 {
     flag.Usage()
    }
@@ -136,6 +139,9 @@

    w := bufio.NewWriter(os.Stdout)
    for _, sym := range syms {
+ if filePrefix {
+ fmt.Fprintf(w, "%s:\t", file)
+ }
     if sym.Code == 'U' {
      fmt.Fprintf(w, "%8s", "")
     } else {
@@ -153,16 +159,6 @@
    w.Flush()
   }

-func filter(syms []Sym, ok func(Sym) bool) []Sym {
- out := syms[:0]
- for _, sym := range syms {
- if ok(sym) {
- out = append(out, sym)
- }
- }
- return out
-}
-
   type byAddr []Sym

   func (x byAddr) Len() int { return len(x) }


--

---
You received this message because you are subscribed to the Google Groups "golang-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

  • Iant at Dec 18, 2013 at 3:08 pm
    LGTM

    https://codereview.appspot.com/43560045/

    --

    ---
    You received this message because you are subscribed to the Google Groups "golang-dev" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Rsc at Dec 18, 2013 at 6:29 pm
    *** Submitted as
    https://code.google.com/p/go/source/detail?r=036ad527e08a ***

    cmd/nm: minor cleanup from previous CL

    I forgot to apply Ian's suggestions before submitting CL 40600043.

    R=iant
    CC=golang-dev
    https://codereview.appspot.com/43560045


    https://codereview.appspot.com/43560045/

    --

    ---
    You received this message because you are subscribed to the Google Groups "golang-dev" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-dev @
categoriesgo
postedDec 18, '13 at 2:28a
activeDec 18, '13 at 6:29p
posts3
users2
websitegolang.org

2 users in discussion

Rsc: 2 posts Iant: 1 post

People

Translate

site design / logo © 2022 Grokbase