mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-16 02:33:28 +00:00
builder: Fix parsing of external ld.lld error messages
If `ld.lld` is a version-specific binary (e.g., `ld.lld-18`), then its error messages include the version. The parsing previously incorrectly assumed it would be unversioned.
This commit is contained in:
committed by
Ayke
parent
ff15b474fd
commit
16b0f4cc9a
+5
-5
@@ -114,8 +114,8 @@ func parseLLDErrors(text string) error {
|
|||||||
|
|
||||||
// Check for undefined symbols.
|
// Check for undefined symbols.
|
||||||
// This can happen in some cases like with CGo and //go:linkname tricker.
|
// This can happen in some cases like with CGo and //go:linkname tricker.
|
||||||
if matches := regexp.MustCompile(`^ld.lld: error: undefined symbol: (.*)\n`).FindStringSubmatch(message); matches != nil {
|
if matches := regexp.MustCompile(`^ld.lld(-[0-9]+)?: error: undefined symbol: (.*)\n`).FindStringSubmatch(message); matches != nil {
|
||||||
symbolName := matches[1]
|
symbolName := matches[2]
|
||||||
for _, line := range strings.Split(message, "\n") {
|
for _, line := range strings.Split(message, "\n") {
|
||||||
matches := regexp.MustCompile(`referenced by .* \(((.*):([0-9]+))\)`).FindStringSubmatch(line)
|
matches := regexp.MustCompile(`referenced by .* \(((.*):([0-9]+))\)`).FindStringSubmatch(line)
|
||||||
if matches != nil {
|
if matches != nil {
|
||||||
@@ -134,9 +134,9 @@ func parseLLDErrors(text string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check for flash/RAM overflow.
|
// Check for flash/RAM overflow.
|
||||||
if matches := regexp.MustCompile(`^ld.lld: error: section '(.*?)' will not fit in region '(.*?)': overflowed by ([0-9]+) bytes$`).FindStringSubmatch(message); matches != nil {
|
if matches := regexp.MustCompile(`^ld.lld(-[0-9]+)?: error: section '(.*?)' will not fit in region '(.*?)': overflowed by ([0-9]+) bytes$`).FindStringSubmatch(message); matches != nil {
|
||||||
region := matches[2]
|
region := matches[3]
|
||||||
n, err := strconv.ParseUint(matches[3], 10, 64)
|
n, err := strconv.ParseUint(matches[4], 10, 64)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Should not happen at all (unless it overflows an uint64 for some reason).
|
// Should not happen at all (unless it overflows an uint64 for some reason).
|
||||||
continue
|
continue
|
||||||
|
|||||||
Reference in New Issue
Block a user