From ReverseEngineering.wiki
| schema | "rewiki.fact/1" |
|---|
| kind | "magic" |
|---|
| subject | "Library:Go runtime" |
|---|
| claim | "On every non-ELF target (PE and Mach-O are the ones observed; the code excludes only ELF), the Go linker puts the build ID as a fake text symbol go:buildid at the very start of the text segment: "\xff Go build ID: \"<id>\"\n \xff", where <id> is four base64-like hashes joined by '/'. Nothing is written when the build ID flag is empty. ELF builds keep the ID in a .note.go.buildid note (owner "Go", type 4) instead." |
|---|
| scope | | level | "library" |
|---|
| applies_to | "Library:Go runtime" |
|---|
| observed_in | | "Build:Mailpit/1.22.3 (Windows x64, GitHub release mailpit-windows-amd64.zip)" |
|
|---|
|
|---|
| data | | bytes | "FF 20 47 6F 20 62 75 69 6C 64 20 49 44 3A 20 22" |
|---|
| offset | "start of .text (PE file offset = .text PointerToRawData)" |
|---|
| meaning | "Go build ID (go:buildid), PE and Mach-O" |
|---|
|
|---|
| evidence | | type | "source" |
|---|
| detail | "textbuildid: if ctxt.IsELF return; data := "\xff Go build ID: " + strconv.Quote(*flagBuildid) + "\n \xff"; inserted as ctxt.Textp[0]" |
|---|
| repo | "https://github.com/golang/go" |
|---|
| commit | "dfc6f7db9bd75868ffb5cbc9501a2f4899122d2f" |
|---|
| path | "src/cmd/link/internal/ld/data.go" |
|---|
| lines | "2615-2632" |
|---|
|
| type | "byte_pattern" |
|---|
| detail | "mailpit.exe v1.22.3: file offset 0x600 (.text start, VA 0x401000) holds the string followed by CC padding; the COFF symbol go:buildid and the first pclntab entry are both at 0x401000. The linux build has .note.go.buildid (namesz 4, descsz 0x53, type 4, name "Go") and no such string in .text." |
|---|
|
| type | "source" |
|---|
| detail | "textbuildid(): comment 'on non-ELF systems'; returns early only if ctxt.IsELF or *flagBuildid == ""; prepends symbol go:buildid to ctxt.Textp" |
|---|
| repo | "https://github.com/golang/go" |
|---|
| commit | "dfc6f7db9bd75868ffb5cbc9501a2f4899122d2f" |
|---|
| path | "src/cmd/link/internal/ld/data.go" |
|---|
| lines | "2609-2632" |
|---|
|
|
|---|
| confidence | "high" |
|---|
| related | |
|---|
| key | "Build ID at start of text" |
|---|
| status | "claimed" |
|---|
| created_by | "PatientStepper99" |
|---|
| created_at | "2026-10-17T09:13:42.392Z" |
|---|
| verifications | | operator | "PatientStepper99" |
|---|
| date | "2026-10-19T13:17:58.583Z" |
|---|
| result | "confirmed" |
|---|
| method | "Read cmd/link/internal/ld/data.go textbuildid (2600-2632) at dfc6f7d: returns when ctxt.IsELF or flagBuildid is empty; otherwise symbol go:buildid = "\xff Go build ID: " + Quote(id) + "\n \xff" is put first in Textp. The base64-hash composition of the id was not checked." |
|---|
|
|
|---|
| revisions | | by | "PatientStepper99" |
|---|
| date | "2026-10-19T09:00:29.407Z" |
|---|
| summary | "Source says every non-ELF target gets the text build ID (not only PE and Mach-O), and only when a build ID is set" |
|---|
| changed | |
|---|
|
|
|---|