This is an automated email from the ASF dual-hosted git repository. sjanc pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/mynewt-newt.git
commit 95b884f312a6a4c4116f5c4877ac79dd0db28d63 Author: Szymon Janc <[email protected]> AuthorDate: Wed Oct 21 10:31:33 2026 +0200 newt: Fix truncation of symbol addresses and sizes Symbol addresses and sizes parsed from objdump output were limited to 32 bits and then converted to int. On a 32-bit host every address at or above 0x80000000 became negative, and on any host symbols of 64-bit targets, such as native sim builds, failed to parse. Store them as uint64 and parse the full 64-bit values. ParseObjectLine() in the toolchain package is a copy of the builder's parser and gets the same change. In the map file size report parse section sizes with a 32-bit limit, as they are accumulated in uint32 counters, instead of truncating larger values. Assisted-by: Claude:claude-opus-5-5 --- newt/builder/library.go | 8 ++++---- newt/builder/size.go | 2 +- newt/symbol/symbol.go | 4 ++-- newt/toolchain/compiler.go | 8 ++++---- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/newt/builder/library.go b/newt/builder/library.go index b2551293..e54d2812 100644 --- a/newt/builder/library.go +++ b/newt/builder/library.go @@ -71,7 +71,7 @@ func parseObjectLine(line string, r *regexp.Regexp) (error, *symbol.SymbolInfo) si.Name = data[5] - v, err := strconv.ParseUint(data[1], 16, 32) + v, err := strconv.ParseUint(data[1], 16, 64) if err != nil { util.StatusMessage(util.VERBOSITY_DEFAULT, @@ -79,9 +79,9 @@ func parseObjectLine(line string, r *regexp.Regexp) (error, *symbol.SymbolInfo) return nil, nil } - si.Loc = int(v) + si.Loc = v - v, err = strconv.ParseUint(data[4], 16, 32) + v, err = strconv.ParseUint(data[4], 16, 64) if err != nil { util.StatusMessage(util.VERBOSITY_DEFAULT, @@ -89,7 +89,7 @@ func parseObjectLine(line string, r *regexp.Regexp) (error, *symbol.SymbolInfo) return nil, nil } - si.Size = int(v) + si.Size = v si.Code = data[2] si.Section = data[3] diff --git a/newt/builder/size.go b/newt/builder/size.go index 04debad2..60b21c51 100644 --- a/newt/builder/size.go +++ b/newt/builder/size.go @@ -313,7 +313,7 @@ func ParseMapFileSizes(fileName string) (map[string]*PkgSize, error) { if err != nil { continue } - size, err := strconv.ParseUint(sizeStr, 0, 64) + size, err := strconv.ParseUint(sizeStr, 0, 32) if err != nil { continue } diff --git a/newt/symbol/symbol.go b/newt/symbol/symbol.go index d40cfc79..3f0cccba 100644 --- a/newt/symbol/symbol.go +++ b/newt/symbol/symbol.go @@ -35,8 +35,8 @@ type SymbolInfo struct { Code string Section string Ext string - Size int - Loc int + Size uint64 + Loc uint64 } type SymbolMap map[string]SymbolInfo diff --git a/newt/toolchain/compiler.go b/newt/toolchain/compiler.go index 63da81eb..e7953288 100644 --- a/newt/toolchain/compiler.go +++ b/newt/toolchain/compiler.go @@ -1709,7 +1709,7 @@ func ParseObjectLine(line string, r *regexp.Regexp) (error, *symbol.SymbolInfo) si.Name = data[5] - v, err := strconv.ParseUint(data[1], 16, 32) + v, err := strconv.ParseUint(data[1], 16, 64) if err != nil { util.StatusMessage(util.VERBOSITY_DEFAULT, @@ -1717,9 +1717,9 @@ func ParseObjectLine(line string, r *regexp.Regexp) (error, *symbol.SymbolInfo) return nil, nil } - si.Loc = int(v) + si.Loc = v - v, err = strconv.ParseUint(data[4], 16, 32) + v, err = strconv.ParseUint(data[4], 16, 64) if err != nil { util.StatusMessage(util.VERBOSITY_DEFAULT, @@ -1727,7 +1727,7 @@ func ParseObjectLine(line string, r *regexp.Regexp) (error, *symbol.SymbolInfo) return nil, nil } - si.Size = int(v) + si.Size = v si.Code = data[2] si.Section = data[3]
