mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-10 05:53:39 +00:00
builder: work around bug in DWARF paths in Clang
See bug: https://github.com/llvm/llvm-project/issues/117317
This commit is contained in:
committed by
Ron Evans
parent
9172cc15d2
commit
b76ea29520
+8
-1
@@ -12,6 +12,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"regexp"
|
"regexp"
|
||||||
|
"runtime"
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
@@ -194,11 +195,17 @@ func readProgramSizeFromDWARF(data *dwarf.Data, codeOffset, codeAlignment uint64
|
|||||||
if !prevLineEntry.EndSequence {
|
if !prevLineEntry.EndSequence {
|
||||||
// The chunk describes the code from prevLineEntry to
|
// The chunk describes the code from prevLineEntry to
|
||||||
// lineEntry.
|
// lineEntry.
|
||||||
|
path := prevLineEntry.File.Name
|
||||||
|
if runtime.GOOS == "windows" {
|
||||||
|
// Work around a Clang bug on Windows:
|
||||||
|
// https://github.com/llvm/llvm-project/issues/117317
|
||||||
|
path = strings.ReplaceAll(path, "\\\\", "\\")
|
||||||
|
}
|
||||||
line := addressLine{
|
line := addressLine{
|
||||||
Address: prevLineEntry.Address + codeOffset,
|
Address: prevLineEntry.Address + codeOffset,
|
||||||
Length: lineEntry.Address - prevLineEntry.Address,
|
Length: lineEntry.Address - prevLineEntry.Address,
|
||||||
Align: codeAlignment,
|
Align: codeAlignment,
|
||||||
File: prevLineEntry.File.Name,
|
File: path,
|
||||||
}
|
}
|
||||||
if line.Length != 0 {
|
if line.Length != 0 {
|
||||||
addresses = append(addresses, line)
|
addresses = append(addresses, line)
|
||||||
|
|||||||
Reference in New Issue
Block a user