Skip to content

Commit 6dd1aeb

Browse files
committed
Fix argument parsing bug, fix 1.19 and 1.17 moduldata fallthroughs
1 parent cb029c6 commit 6dd1aeb

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ func main() {
441441
os.Exit(0)
442442
}
443443

444-
if flag.NArg() == 1 {
444+
if flag.NArg() != 1 {
445445
fmt.Println(TextToJson("error", "filepath must be provided as first argument"))
446446
os.Exit(1)
447447
}

objfile/objfile.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,8 +284,8 @@ func (e *Entry) ModuleDataTable(pclntabVA uint64, runtimeVersion string, version
284284
continue
285285
}
286286

287-
// there's really only 3 main versions for these internal runtime changes 1.2 (<= 1.15), 1.16 (<= 1.17), 1.18 (>= 1.18)
288-
// this routine needs the pclntab version, NOT the go runtime version (ex: go 1.15 generates 1.2 style tables)
287+
// there's really only a few versions of the structure. Multiple runtime versions share the same binary layout,
288+
// with some higher versions using the same layout as versions before it.
289289
switch version {
290290
case "1.24":
291291
fallthrough
@@ -523,6 +523,8 @@ func (e *Entry) ModuleDataTable(pclntabVA uint64, runtimeVersion string, version
523523
moduleData.ITablinks.Capacity = uint64(module.Itablinks.Capacity)
524524
return secStart, moduleData, err
525525
}
526+
case "1.19":
527+
fallthrough
526528
case "1.18":
527529
if is64bit {
528530
var module ModuleData118_64
@@ -638,6 +640,8 @@ func (e *Entry) ModuleDataTable(pclntabVA uint64, runtimeVersion string, version
638640
moduleData.ITablinks.Capacity = uint64(module.Itablinks.Capacity)
639641
return secStart, moduleData, err
640642
}
643+
case "1.17":
644+
fallthrough
641645
case "1.16":
642646
if is64bit {
643647
var module ModuleData116_64

0 commit comments

Comments
 (0)