]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/ld: prepare for 64-bit ints
authorRuss Cox <rsc@golang.org>
Mon, 24 Sep 2012 18:59:09 +0000 (14:59 -0400)
committerRuss Cox <rsc@golang.org>
Mon, 24 Sep 2012 18:59:09 +0000 (14:59 -0400)
Use explicit IntSize constant instead of 4.

This CL does not change the meaning of int, but it should make
the eventual change of the meaning of int on amd64 a bit
smoother.

Update #2188.

R=ken, dave
CC=golang-dev
https://golang.org/cl/6554076

src/cmd/5l/l.h
src/cmd/6l/l.h
src/cmd/8l/l.h
src/cmd/ld/decodesym.c

index 17598d720cd7c3dcc638f7b4164a2df902ec5bd4..68b6478581615362bfe84d11207bdf3e4cc2e6a7 100644 (file)
@@ -37,6 +37,7 @@ enum
 {
        thechar = '5',
        PtrSize = 4,
+       IntSize = 4,
        FuncAlign = 4  // single-instruction alignment
 };
 
index 4e271c31fefe43456389bef9746ec6db27f6368d..408107f2cdf459043e38e85f0f6763fb234eaf61 100644 (file)
@@ -41,6 +41,7 @@ enum
 {
        thechar = '6',
        PtrSize = 8,
+       IntSize = 4,
        
        // Loop alignment constants:
        // want to align loop entry to LoopAlign-byte boundary,
index 75f1c070eadc0974fb8fc90628af20038fce7c4f..87b93c58fa0434a3af78b11fb40e9299c5372b51 100644 (file)
@@ -41,6 +41,7 @@ enum
 {
        thechar = '8',
        PtrSize = 4,
+       IntSize = 4,
        FuncAlign = 16
 };
 
index f3f91c34d88732ff40d672da90cfcb284fd0bb91..347835f8ca2a7ec89a90546131bd4a1192a1a385 100644 (file)
@@ -138,13 +138,13 @@ decodetype_funcdotdotdot(Sym *s)
 int
 decodetype_funcincount(Sym *s)
 {
-       return decode_inuxi(s->p + CommonSize+2*PtrSize, 4);
+       return decode_inuxi(s->p + CommonSize+2*PtrSize, IntSize);
 }
 
 int
 decodetype_funcoutcount(Sym *s)
 {
-       return decode_inuxi(s->p + CommonSize+3*PtrSize + 2*4, 4);
+       return decode_inuxi(s->p + CommonSize+3*PtrSize + 2*IntSize, IntSize);
 }
 
 Sym*
@@ -163,7 +163,7 @@ decodetype_funcouttype(Sym *s, int i)
 {
        Reloc *r;
 
-       r = decode_reloc(s, CommonSize + 2*PtrSize + 2*4);
+       r = decode_reloc(s, CommonSize + 2*PtrSize + 2*IntSize);
        if (r == nil)
                return nil;
        return decode_reloc_sym(r->sym, r->add + i * PtrSize);
@@ -173,7 +173,7 @@ decodetype_funcouttype(Sym *s, int i)
 int
 decodetype_structfieldcount(Sym *s)
 {
-       return decode_inuxi(s->p + CommonSize + PtrSize, 4);
+       return decode_inuxi(s->p + CommonSize + PtrSize, IntSize);
 }
 
 enum {
@@ -186,7 +186,7 @@ decodetype_structfieldname(Sym *s, int i)
        Reloc *r;
 
        // go.string."foo"  0x28 / 0x40
-       s = decode_reloc_sym(s, CommonSize + PtrSize + 2*4 + i*StructFieldSize);
+       s = decode_reloc_sym(s, CommonSize + PtrSize + 2*IntSize + i*StructFieldSize);
        if (s == nil)                   // embedded structs have a nil name.
                return nil;
        r = decode_reloc(s, 0);         // s has a pointer to the string data at offset 0
@@ -198,18 +198,18 @@ decodetype_structfieldname(Sym *s, int i)
 Sym*
 decodetype_structfieldtype(Sym *s, int i)
 {
-       return decode_reloc_sym(s, CommonSize + PtrSize + 2*4 + i*StructFieldSize + 2*PtrSize);
+       return decode_reloc_sym(s, CommonSize + PtrSize + 2*IntSize + i*StructFieldSize + 2*PtrSize);
 }
 
 vlong
 decodetype_structfieldoffs(Sym *s, int i)
 {
-       return decode_inuxi(s->p + CommonSize + PtrSize + 2*4 + i*StructFieldSize + 4*PtrSize, 4);
+       return decode_inuxi(s->p + CommonSize + PtrSize + 2*IntSize + i*StructFieldSize + 4*PtrSize, IntSize);
 }
 
 // InterfaceTYpe.methods.len
 vlong
 decodetype_ifacemethodcount(Sym *s)
 {
-       return decode_inuxi(s->p + CommonSize + PtrSize, 4);
+       return decode_inuxi(s->p + CommonSize + PtrSize, IntSize);
 }