summaryrefslogtreecommitdiff
path: root/src/liblink/list6.c
diff options
context:
space:
mode:
authorAnthony Martin <ality@pbrane.org>2014-01-09 19:01:08 -0800
committerAnthony Martin <ality@pbrane.org>2014-01-09 19:01:08 -0800
commitb4a26b28c23229782e2956d2b2e9dfd664207d8b (patch)
tree44226be95d17f223553c424ceb8857c49b295e32 /src/liblink/list6.c
parentf254d9665bdf5cc1046305965a172b66638697ae (diff)
downloadgo-b4a26b28c23229782e2956d2b2e9dfd664207d8b.tar.gz
liblink: adjust format verbs to avoid collisions
The %S and %N format verbs are used by cmd/gc to represent Sym and Node structures, respectively. In liblink, these two verbs are used only by the %D format routine and never referenced externally. This change will allow us to delete the duplicated code for the %A, %D, %P, and %R format routines in both the compiler and linker. R=golang-codereviews, rsc CC=golang-codereviews https://codereview.appspot.com/49720043
Diffstat (limited to 'src/liblink/list6.c')
-rw-r--r--src/liblink/list6.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/liblink/list6.c b/src/liblink/list6.c
index c7761949c..34a877e4e 100644
--- a/src/liblink/list6.c
+++ b/src/liblink/list6.c
@@ -34,11 +34,24 @@
#include <link.h>
#include "../cmd/6l/6.out.h"
+//
+// Format conversions
+// %A int Opcodes (instruction mnemonics)
+//
+// %D Addr* Addresses (instruction operands)
+// Flags: "%lD": seperate the high and low words of a constant by "-"
+//
+// %P Prog* Instructions
+//
+// %R int Registers
+//
+// %$ char* String constant addresses (for internal use only)
+
static int Aconv(Fmt *fp);
static int Dconv(Fmt *fp);
static int Pconv(Fmt *fp);
static int Rconv(Fmt *fp);
-static int Sconv(Fmt *fp);
+static int DSconv(Fmt *fp);
enum
{
@@ -50,7 +63,7 @@ listinit6(void)
{
fmtinstall('A', Aconv);
fmtinstall('P', Pconv);
- fmtinstall('S', Sconv);
+ fmtinstall('$', DSconv);
fmtinstall('D', Dconv);
fmtinstall('R', Rconv);
}
@@ -174,7 +187,7 @@ Dconv(Fmt *fp)
break;
case D_SCONST:
- sprint(str, "$\"%S\"", a->u.sval);
+ sprint(str, "$\"%$\"", a->u.sval);
break;
case D_ADDR:
@@ -337,7 +350,7 @@ Rconv(Fmt *fp)
}
static int
-Sconv(Fmt *fp)
+DSconv(Fmt *fp)
{
int i, c;
char str[STRINGSZ], *p, *a;