* [PATCH][gdb/testsuite] Make fission use shared_abbrev in dwarf assembler
@ 2020-11-05 16:39 Tom de Vries
0 siblings, 0 replies; only message in thread
From: Tom de Vries @ 2020-11-05 16:39 UTC (permalink / raw)
To: gdb-patches
Hi,
When using dwarf assembly to generate multiple fission CUs, each CU
gets its own abbreviation table, starting at a generated label.
That doesn't work however, the labels are silently ignored and instead
constant 0 is used. For more details, see PRs:
- gcc PR97713 - "[gsplit-dwarf] label generated for .debug_abbrev.dwo offset,
corresponding relocation ignored by objcopy --extract-dwo"
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97713
- binutils PR26841 - "objcopy --extract-dwo silently drops relocation"
https://sourceware.org/bugzilla/show_bug.cgi?id=26841
Fix this by forcing shared_abbrev for fission CUs in the dwarf assembler.
Any comments?
Thanks,
- Tom
[gdb/testsuite] Make fission use shared_abbrev in dwarf assembler
gdb/testsuite/ChangeLog:
2020-11-05 Tom de Vries <tdevries@suse.de>
* lib/dwarf.exp (cu): Add first/last values to fission option.
Make fission imply share_abbrev.
---
gdb/testsuite/lib/dwarf.exp | 36 ++++++++++++++++++++++++++++++++----
1 file changed, 32 insertions(+), 4 deletions(-)
diff --git a/gdb/testsuite/lib/dwarf.exp b/gdb/testsuite/lib/dwarf.exp
index 40d0648826..7bb745c71d 100644
--- a/gdb/testsuite/lib/dwarf.exp
+++ b/gdb/testsuite/lib/dwarf.exp
@@ -1041,7 +1041,10 @@ namespace eval Dwarf {
# default = 4
# addr_size n - the size of addresses in bytes: 4, 8, or default
# default = default
- # fission 0|1 - boolean indicating if generating Fission debug info
+ # fission 0|first|1|last
+ # - non-zero indicating generation of Fission debug info.
+ # The first and last CU in the series are marked
+ # using first and last.
# default = 0
# share_abbrev 0|first|1|last
# - non-zero indicating that a series of CUs shares the same
@@ -1065,6 +1068,7 @@ namespace eval Dwarf {
set _cu_version 4
set _cu_addr_size default
set fission 0
+ set fission_mode 0
set share_abbrev 0
set section ".debug_info"
set _abbrev_section ".debug_abbrev"
@@ -1075,7 +1079,12 @@ namespace eval Dwarf {
is_64 { set is_64 $value }
version { set _cu_version $value }
addr_size { set _cu_addr_size $value }
- fission { set fission $value }
+ fission {
+ if { ![string eq $value 0] } {
+ set fission 1
+ set fission_mode $value
+ }
+ }
share_abbrev { set share_abbrev $value }
default { error "unknown option $name" }
}
@@ -1097,6 +1106,17 @@ namespace eval Dwarf {
set cu_num [incr _cu_count]
+ # Any _abbrev_label in a .dwo file resolves to an abbrev offset of '0'
+ # (See binutils PR26841 - "objcopy --extract-dwo silently drops
+ # relocation"). So, we need to either:
+ # - count the abbrev table size for each CU and emit a constant abbrev
+ # offset, or
+ # - have all the fission CUs share the same abbrev table
+ # We do the latter here.
+ if { $fission } {
+ set share_abbrev $fission_mode
+ }
+
set init_abbrev \
[expr [string equal $share_abbrev 0] \
|| [string equal $share_abbrev first]]
@@ -1104,8 +1124,16 @@ namespace eval Dwarf {
[expr [string equal $share_abbrev 0] \
|| [string equal $share_abbrev last]]
+
if { $init_abbrev } {
- set _abbrev_label [_compute_label "abbrev${cu_num}_begin"]
+ if { $fission } {
+ # Labels in dwo files currently don't work (see binutils
+ # PR26841), and resolve to a 0 offset. To make that clear,
+ # use a hardcoded 0 instead of a label.
+ set _abbrev_label 0
+ } else {
+ set _abbrev_label [_compute_label "abbrev${cu_num}_begin"]
+ }
set _abbrev_num 1
}
@@ -1125,7 +1153,7 @@ namespace eval Dwarf {
_op .${_cu_offset_size}byte $_abbrev_label Abbrevs
_op .byte $_cu_addr_size "Pointer size"
- if { $init_abbrev } {
+ if { $init_abbrev && $_abbrev_label != 0 } {
_defer_output $_abbrev_section {
define_label $_abbrev_label
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-11-05 16:40 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-05 16:39 [PATCH][gdb/testsuite] Make fission use shared_abbrev in dwarf assembler Tom de Vries
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox