aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCherry Zhang <cherryyz@google.com>2020-09-03 12:26:10 -0400
committerCherry Zhang <cherryyz@google.com>2020-09-03 21:49:52 +0000
commite61d17d3b9ccf4c3e8ac87add9d74da7afa76488 (patch)
treea1e50556650b382c8a7df1a68307dba30f9c6ab7
parentae658cb19a265f3f4694cd4aec508b4565bda6aa (diff)
downloadgo-e61d17d3b9ccf4c3e8ac87add9d74da7afa76488.tar.gz
go-e61d17d3b9ccf4c3e8ac87add9d74da7afa76488.zip
cmd/link: MACHOPLT is executable
The PLT stubs are executable. Put it together with executable sections, instead of read-only data sections. Change-Id: I3818414aa0b87c6968c6c7eccce19b0db7c43193 Reviewed-on: https://go-review.googlesource.com/c/go/+/253018 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com>
-rw-r--r--src/cmd/link/internal/ld/data.go2
-rw-r--r--src/cmd/link/internal/sym/symkind.go2
-rw-r--r--src/cmd/link/internal/sym/symkind_string.go24
3 files changed, 14 insertions, 14 deletions
diff --git a/src/cmd/link/internal/ld/data.go b/src/cmd/link/internal/ld/data.go
index dc7096ea8c..85ce7d8fb7 100644
--- a/src/cmd/link/internal/ld/data.go
+++ b/src/cmd/link/internal/ld/data.go
@@ -1787,6 +1787,7 @@ func (state *dodataState) allocateDataSections(ctxt *Link) {
Errorf(nil, "dodata found an sym.STEXT symbol: %s", culprit)
}
state.allocateSingleSymSections(&Segtext, sym.SELFRXSECT, sym.SRODATA, 04)
+ state.allocateSingleSymSections(&Segtext, sym.SMACHOPLT, sym.SRODATA, 05)
/* read-only data */
sect = state.allocateNamedDataSection(segro, ".rodata", sym.ReadOnly, 04)
@@ -1810,7 +1811,6 @@ func (state *dodataState) allocateDataSections(ctxt *Link) {
/* read-only ELF, Mach-O sections */
state.allocateSingleSymSections(segro, sym.SELFROSECT, sym.SRODATA, 04)
- state.allocateSingleSymSections(segro, sym.SMACHOPLT, sym.SRODATA, 04)
// There is some data that are conceptually read-only but are written to by
// relocations. On GNU systems, we can arrange for the dynamic linker to
diff --git a/src/cmd/link/internal/sym/symkind.go b/src/cmd/link/internal/sym/symkind.go
index 3e47d9a8e4..c176d5e208 100644
--- a/src/cmd/link/internal/sym/symkind.go
+++ b/src/cmd/link/internal/sym/symkind.go
@@ -41,6 +41,7 @@ const (
Sxxx SymKind = iota
STEXT
SELFRXSECT
+ SMACHOPLT
// Read-only sections.
STYPE
@@ -52,7 +53,6 @@ const (
SFUNCTAB
SELFROSECT
- SMACHOPLT
// Read-only sections with relocations.
//
diff --git a/src/cmd/link/internal/sym/symkind_string.go b/src/cmd/link/internal/sym/symkind_string.go
index 47b2406e28..34cb314bd5 100644
--- a/src/cmd/link/internal/sym/symkind_string.go
+++ b/src/cmd/link/internal/sym/symkind_string.go
@@ -1,4 +1,4 @@
-// Code generated by "stringer -type=SymKindstringer -type=SymKind"; DO NOT EDIT.
+// Code generated by "stringer -type=SymKind"; DO NOT EDIT.
package sym
@@ -11,15 +11,15 @@ func _() {
_ = x[Sxxx-0]
_ = x[STEXT-1]
_ = x[SELFRXSECT-2]
- _ = x[STYPE-3]
- _ = x[SSTRING-4]
- _ = x[SGOSTRING-5]
- _ = x[SGOFUNC-6]
- _ = x[SGCBITS-7]
- _ = x[SRODATA-8]
- _ = x[SFUNCTAB-9]
- _ = x[SELFROSECT-10]
- _ = x[SMACHOPLT-11]
+ _ = x[SMACHOPLT-3]
+ _ = x[STYPE-4]
+ _ = x[SSTRING-5]
+ _ = x[SGOSTRING-6]
+ _ = x[SGOFUNC-7]
+ _ = x[SGCBITS-8]
+ _ = x[SRODATA-9]
+ _ = x[SFUNCTAB-10]
+ _ = x[SELFROSECT-11]
_ = x[STYPERELRO-12]
_ = x[SSTRINGRELRO-13]
_ = x[SGOSTRINGRELRO-14]
@@ -68,9 +68,9 @@ func _() {
_ = x[SABIALIAS-57]
}
-const _SymKind_name = "SxxxSTEXTSELFRXSECTSTYPESSTRINGSGOSTRINGSGOFUNCSGCBITSSRODATASFUNCTABSELFROSECTSMACHOPLTSTYPERELROSSTRINGRELROSGOSTRINGRELROSGOFUNCRELROSGCBITSRELROSRODATARELROSFUNCTABRELROSTYPELINKSITABLINKSSYMTABSPCLNTABSFirstWritableSBUILDINFOSELFSECTSMACHOSMACHOGOTSWINDOWSSELFGOTSNOPTRDATASINITARRSDATASXCOFFTOCSBSSSNOPTRBSSSLIBFUZZER_EXTRA_COUNTERSTLSBSSSXREFSMACHOSYMSTRSMACHOSYMTABSMACHOINDIRECTPLTSMACHOINDIRECTGOTSFILEPATHSDYNIMPORTSHOSTOBJSUNDEFEXTSDWARFSECTSDWARFCUINFOSDWARFCONSTSDWARFFCNSDWARFABSFCNSDWARFTYPESDWARFVARSDWARFRANGESDWARFLOCSDWARFLINESSABIALIAS"
+const _SymKind_name = "SxxxSTEXTSELFRXSECTSMACHOPLTSTYPESSTRINGSGOSTRINGSGOFUNCSGCBITSSRODATASFUNCTABSELFROSECTSTYPERELROSSTRINGRELROSGOSTRINGRELROSGOFUNCRELROSGCBITSRELROSRODATARELROSFUNCTABRELROSTYPELINKSITABLINKSSYMTABSPCLNTABSFirstWritableSBUILDINFOSELFSECTSMACHOSMACHOGOTSWINDOWSSELFGOTSNOPTRDATASINITARRSDATASXCOFFTOCSBSSSNOPTRBSSSLIBFUZZER_EXTRA_COUNTERSTLSBSSSXREFSMACHOSYMSTRSMACHOSYMTABSMACHOINDIRECTPLTSMACHOINDIRECTGOTSFILEPATHSDYNIMPORTSHOSTOBJSUNDEFEXTSDWARFSECTSDWARFCUINFOSDWARFCONSTSDWARFFCNSDWARFABSFCNSDWARFTYPESDWARFVARSDWARFRANGESDWARFLOCSDWARFLINESSABIALIAS"
-var _SymKind_index = [...]uint16{0, 4, 9, 19, 24, 31, 40, 47, 54, 61, 69, 79, 88, 98, 110, 124, 136, 148, 160, 173, 182, 191, 198, 206, 220, 230, 238, 244, 253, 261, 268, 278, 286, 291, 300, 304, 313, 337, 344, 349, 361, 373, 390, 407, 416, 426, 434, 443, 453, 465, 476, 485, 497, 507, 516, 527, 536, 547, 556}
+var _SymKind_index = [...]uint16{0, 4, 9, 19, 28, 33, 40, 49, 56, 63, 70, 78, 88, 98, 110, 124, 136, 148, 160, 173, 182, 191, 198, 206, 220, 230, 238, 244, 253, 261, 268, 278, 286, 291, 300, 304, 313, 337, 344, 349, 361, 373, 390, 407, 416, 426, 434, 443, 453, 465, 476, 485, 497, 507, 516, 527, 536, 547, 556}
func (i SymKind) String() string {
if i >= SymKind(len(_SymKind_index)-1) {