Commit 1b9049b5 authored by Michael Hudson-Doyle's avatar Michael Hudson-Doyle Committed by Brad Fitzpatrick

cmd/internal/ld: make ELF constants explicit

c2go produced accurate but complex constant definitions like
"ElfSymBindLocal  = 0 + iota - 67" which break when any constants
are added above them in the list. Change them to explicit values
in separate blocks by class. I wrote a little program (using awk)
to dump the values of the constants:

    https://gist.github.com/mwhudson/82f82008279a38ce584e

and confirmed that its output before and after this change is the
same.

Change-Id: Ib4aea4a0d688a16cdcb76af4715d1a97ec0f013c
Reviewed-on: https://go-review.googlesource.com/6581
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
parent 0153137a
...@@ -37,94 +37,124 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN ...@@ -37,94 +37,124 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.
*/ */
const ( const (
ElfClassNone = 0 + iota ElfClassNone = 0
ElfClass32 ElfClass32 = 1
ElfClass64 ElfClass64 = 2
ElfDataNone = 0 + iota - 3 )
ElfDataLsb
ElfDataMsb const (
ElfTypeNone = 0 + iota - 6 ElfDataNone = 0
ElfTypeRelocatable ElfDataLsb = 1
ElfTypeExecutable ElfDataMsb = 2
ElfTypeSharedObject )
ElfTypeCore
ElfMachNone = 0 + iota - 11 const (
ElfMach32100 ElfTypeNone = 0
ElfMachSparc ElfTypeRelocatable = 1
ElfMach386 ElfTypeExecutable = 2
ElfMach68000 ElfTypeSharedObject = 3
ElfMach88000 ElfTypeCore = 4
ElfMach486 )
ElfMach860
ElfMachMips const (
ElfMachS370 ElfMachNone = 0
ElfMachMipsLe ElfMach32100 = 1
ElfMachParisc = 15 ElfMachSparc = 2
ElfMachVpp500 = 17 + iota - 23 ElfMach386 = 3
ElfMachSparc32Plus ElfMach68000 = 4
ElfMach960 ElfMach88000 = 5
ElfMachPower ElfMach486 = 6
ElfMachPower64 ElfMach860 = 7
ElfMachS390 ElfMachMips = 8
ElfMachV800 = 36 + iota - 29 ElfMachS370 = 9
ElfMachFr20 ElfMachMipsLe = 10
ElfMachRh32 ElfMachParisc = 15
ElfMachRce ElfMachVpp500 = 17
ElfMachArm ElfMachSparc32Plus = 18
ElfMachAlpha ElfMach960 = 19
ElfMachSH ElfMachPower = 20
ElfMachSparc9 ElfMachPower64 = 21
ElfMachAmd64 = 62 ElfMachS390 = 22
ElfAbiNone = 0 ElfMachV800 = 36
ElfAbiSystemV = 0 + iota - 39 ElfMachFr20 = 37
ElfAbiHPUX ElfMachRh32 = 38
ElfAbiNetBSD ElfMachRce = 39
ElfAbiLinux ElfMachArm = 40
ElfAbiSolaris = 6 + iota - 43 ElfMachAlpha = 41
ElfAbiAix ElfMachSH = 42
ElfAbiIrix ElfMachSparc9 = 43
ElfAbiFreeBSD ElfMachAmd64 = 62
ElfAbiTru64 )
ElfAbiModesto
ElfAbiOpenBSD const (
ElfAbiNone = 0
ElfAbiSystemV = 0
ElfAbiHPUX = 1
ElfAbiNetBSD = 2
ElfAbiLinux = 3
ElfAbiSolaris = 6
ElfAbiAix = 7
ElfAbiIrix = 8
ElfAbiFreeBSD = 9
ElfAbiTru64 = 10
ElfAbiModesto = 11
ElfAbiOpenBSD = 12
ElfAbiARM = 97 ElfAbiARM = 97
ElfAbiEmbedded = 255 ElfAbiEmbedded = 255
ElfSectNone = 0 + iota - 52 )
ElfSectProgbits
ElfSectSymtab const (
ElfSectStrtab ElfSectNone = 0
ElfSectRela ElfSectProgbits = 1
ElfSectHash ElfSectSymtab = 2
ElfSectDynamic ElfSectStrtab = 3
ElfSectNote ElfSectRela = 4
ElfSectNobits ElfSectHash = 5
ElfSectRel ElfSectDynamic = 6
ElfSectShlib ElfSectNote = 7
ElfSectDynsym ElfSectNobits = 8
ElfSectRel = 9
ElfSectShlib = 10
ElfSectDynsym = 11
ElfSectFlagWrite = 0x1 ElfSectFlagWrite = 0x1
ElfSectFlagAlloc = 0x2 ElfSectFlagAlloc = 0x2
ElfSectFlagExec = 0x4 ElfSectFlagExec = 0x4
ElfSymBindLocal = 0 + iota - 67 )
ElfSymBindGlobal
ElfSymBindWeak const (
ElfSymTypeNone = 0 + iota - 70 ElfSymBindLocal = 0
ElfSymTypeObject ElfSymBindGlobal = 1
ElfSymTypeFunc ElfSymBindWeak = 2
ElfSymTypeSection )
ElfSymTypeFile
const (
ElfSymTypeNone = 0
ElfSymTypeObject = 1
ElfSymTypeFunc = 2
ElfSymTypeSection = 3
ElfSymTypeFile = 4
)
const (
ElfSymShnNone = 0 ElfSymShnNone = 0
ElfSymShnAbs = 0xFFF1 ElfSymShnAbs = 0xFFF1
ElfSymShnCommon = 0xFFF2 ElfSymShnCommon = 0xFFF2
ElfProgNone = 0 + iota - 78 )
ElfProgLoad
ElfProgDynamic const (
ElfProgInterp ElfProgNone = 0
ElfProgNote ElfProgLoad = 1
ElfProgShlib ElfProgDynamic = 2
ElfProgPhdr ElfProgInterp = 3
ElfProgFlagExec = 0x1 ElfProgNote = 4
ElfProgFlagWrite = 0x2 ElfProgShlib = 5
ElfProgFlagRead = 0x4 ElfProgPhdr = 6
ElfProgFlagExec = 0x1
ElfProgFlagWrite = 0x2
ElfProgFlagRead = 0x4
)
const (
ElfNotePrStatus = 1 ElfNotePrStatus = 1
ElfNotePrFpreg = 2 ElfNotePrFpreg = 2
ElfNotePrPsinfo = 3 ElfNotePrPsinfo = 3
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment