File tree Expand file tree Collapse file tree 5 files changed +26
-11
lines changed Expand file tree Collapse file tree 5 files changed +26
-11
lines changed Original file line number Diff line number Diff line change 1- .PHONY : all test
1+ .PHONY : all test testbinaries
22
33all : test
44
5- testdata/repro :
5+ testbinaries :
66cd testdata && make
77
88dwarf-relocation-golang-bug : main.go
99go build
1010
11- test : testdata/repro dwarf-relocation-golang-bug
11+ test : testbinaries dwarf-relocation-golang-bug
12+ @echo " -------------------------"
13+ @./test.sh testdata/good
1214@echo
13- @echo " Running test"
14- @./test.sh
15+ @echo " -------------------------"
16+ @./test.sh testdata/bad
17+ @echo " -------------------------"
Original file line number Diff line number Diff line change @@ -4,10 +4,11 @@ import (
44"debug/elf"
55"fmt"
66"log"
7+ "os"
78)
89
910func main () {
10- file , err := elf .Open ("testdata/repro" )
11+ file , err := elf .Open (os . Args [ 1 ] )
1112if err != nil {
1213log .Fatal (err )
1314}
Original file line number Diff line number Diff line change 11#! /bin/bash -eu
2+ set -o pipefail
23
4+ file=" $1 "
5+
6+ echo " Testing ${file} ..."
37echo " Actual ranges:"
4- llvm-dwarfdump testdata/repro --name=repro.c | grep -A2 DW_AT_ranges | tail -2 | sed ' s/))/)/' | tr -d ' '
8+ llvm-dwarfdump ${file} --name=repro.c | grep -A2 DW_AT_ranges | tail -2 | sed -e ' s/0x0*/0x/g ' -e ' s/))/)/' | tr -d ' '
59
610echo
711echo " Ranges derived from Golang's debug/elf + debug/dwarf"
8- ./dwarf-relocation-golang-bug
12+ ./dwarf-relocation-golang-bug ${file}
913
Original file line number Diff line number Diff line change 1- repro
1+ good
2+ bad
Original file line number Diff line number Diff line change 11.PHONY : all
22
3- repro : repro.c repro.ld
3+ all : bad good
4+
5+ bad : repro.c repro.ld
46# The following command will likely print a warning (about a missing -T option), which should be ignored.
57# Removing the warning would require passing a fully-fledged linker script to bypass gcc's default.
6- gcc -g $^ -Wl,--emit-relocs -o $@
8+ gcc -g $^ -Wl,--emit-relocs -Wl,--discard-none -o $@
9+
10+ good : repro.c repro.ld
11+ # Same, but without --emit-relocs
12+ gcc -g $^ -o $@
713
You can’t perform that action at this time.
0 commit comments