Issue 070716.1: Encode High-PC as constant offset from Low-PC
PROPOSAL: DW_AT_high_pc encoded as a constant offset from the DW_AT_low_pc
Background:
Currently, an entity with the DW_AT_low_pc and DW_AT_high_pc attributes will end
p up with one relocation entry for each. For example:
DW_AT_low_pc -> somefunction
DW_AT_high_pc -> somefunction+350
or:
DW_AT_low_pc -> somefunction
DW_AT_high_pc -> .somefunction_end
Proposal:
This could be reduced to a single relocation entry by allowing the DW_AT_high_pc
attribute to be encoded as a constant offset from the DW_AT_low_pc. For
example:
DW_AT_low_pc -> somefunction
DW_AT_high_pc -> 350
or:
DW_AT_low_pc -> somefunction
DW_AT_high_pc -> .somefunction_end - somefunction (resolvable by the asm)
This was motivated by a desire to use this new encoding in the DW_TAG_frame_info
in the "CFI with abbrevs" proposal, but it seems generally useful, too.
Wording changes:
2.17.2:
When the set of addresses of a debugging information entry can be described as a
single contiguous range, the entry may have a DW_AT_low_pc and DW_AT_high_pc
pair of attributes. The value of the DW_AT_low_pc attribute is the relocated
address of the first instruction associated with the entity. The value of the
DW_AT_high_pc attribute represents the first location past the last instruction
associated with the entity. It is either the relocated address of that
location, or is a constant number of addressable units which, when added to the
DW_AT_low_pc value, produces that relocated address.
*The location represented by the high PC value may be beyond the last valid
instruction in the executable.*
[last paragraph remain the same]
Figure 20:
DW_AT_high_pc 0x12 address, constant