cmd/internal/obj: update callers to Linkline{fmt,hist} and remove

Does the TODOs added by https://golang.org/cl/7623.

Passes rsc.io/toolstash/buildall.

Change-Id: I23913a8f03834640e9795d48318febb3f88c10f9
Reviewed-on: https://go-review.googlesource.com/9160
Reviewed-by: Russ Cox <rsc@golang.org>
diff --git a/src/cmd/internal/gc/subr.go b/src/cmd/internal/gc/subr.go
index 74415be..33741c3 100644
--- a/src/cmd/internal/gc/subr.go
+++ b/src/cmd/internal/gc/subr.go
@@ -199,26 +199,32 @@
 	errorexit()
 }
 
-func linehist(file string, off int32, relative int) {
+func linehistpragma(file string) {
 	if Debug['i'] != 0 {
-		if file != "" {
-			if off < 0 {
-				fmt.Printf("pragma %s", file)
-			} else if off > 0 {
-				fmt.Printf("line %s", file)
-			} else {
-				fmt.Printf("import %s", file)
-			}
-		} else {
-			fmt.Printf("end of import")
-		}
-		fmt.Printf(" at line %v\n", Ctxt.Line(int(lexlineno)))
+		fmt.Printf("pragma %s at line %v\n", file, Ctxt.Line(int(lexlineno)))
 	}
+	Ctxt.AddImport(file)
+}
 
-	if off < 0 && file[0] != '/' && relative == 0 {
-		file = fmt.Sprintf("%s/%s", Ctxt.Pathname, file)
+func linehistpush(file string) {
+	if Debug['i'] != 0 {
+		fmt.Printf("import %s at line %v\n", file, Ctxt.Line(int(lexlineno)))
 	}
-	obj.Linklinehist(Ctxt, int(lexlineno), file, int(off))
+	Ctxt.LineHist.Push(int(lexlineno), file)
+}
+
+func linehistpop() {
+	if Debug['i'] != 0 {
+		fmt.Printf("end of import at line %v\n", Ctxt.Line(int(lexlineno)))
+	}
+	Ctxt.LineHist.Pop(int(lexlineno))
+}
+
+func linehistupdate(file string, off int) {
+	if Debug['i'] != 0 {
+		fmt.Printf("line %s at line %v\n", file, Ctxt.Line(int(lexlineno)))
+	}
+	Ctxt.LineHist.Update(int(lexlineno), file, off)
 }
 
 func setlineno(n *Node) int32 {
@@ -2345,7 +2351,7 @@
 	lineno = lexlineno
 	if genwrapper_linehistdone == 0 {
 		// All the wrappers can share the same linehist entry.
-		linehist("<autogenerated>", 0, 0)
+		linehistpush("<autogenerated>")
 
 		genwrapper_linehistdone = 1
 	}