You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.2 KiB
Diff
37 lines
1.2 KiB
Diff
From ef30d58213cf765d0e02eb3b4e151b170fb9fd6b Mon Sep 17 00:00:00 2001
|
|
From: pagran <pagran@protonmail.com>
|
|
Date: Mon, 9 Jan 2023 13:30:00 +0100
|
|
Subject: [PATCH 1/3] add custom magic value
|
|
|
|
---
|
|
cmd/link/internal/ld/pcln.go | 13 +++++++++++++
|
|
1 file changed, 13 insertions(+)
|
|
|
|
diff --git a/cmd/link/internal/ld/pcln.go b/cmd/link/internal/ld/pcln.go
|
|
index 5734b92507..0f95ad928b 100644
|
|
--- a/cmd/link/internal/ld/pcln.go
|
|
+++ b/cmd/link/internal/ld/pcln.go
|
|
@@ -263,6 +263,19 @@ func (state *pclntab) generatePCHeader(ctxt *Link) {
|
|
if off != size {
|
|
panic(fmt.Sprintf("pcHeader size: %d != %d", off, size))
|
|
}
|
|
+
|
|
+ // Use garble prefix in variable names to minimize collision risk
|
|
+ garbleMagicStr := os.Getenv("GARBLE_LINK_MAGIC")
|
|
+ if garbleMagicStr == "" {
|
|
+ panic("[garble] magic value must be set")
|
|
+ }
|
|
+ var garbleMagicVal uint32
|
|
+ // Use fmt package instead of strconv to avoid importing a new package
|
|
+ if _, err := fmt.Sscan(garbleMagicStr, &garbleMagicVal); err != nil {
|
|
+ panic(fmt.Errorf("[garble] invalid magic value %s: %v", garbleMagicStr, err))
|
|
+ }
|
|
+
|
|
+ header.SetUint32(ctxt.Arch, 0, garbleMagicVal)
|
|
}
|
|
|
|
state.pcheader = state.addGeneratedSym(ctxt, "runtime.pcheader", size, writeHeader)
|
|
--
|
|
2.43.0
|
|
|