DWARF Standard


070716.1 Todd Allen Encode High-PC as constant offset from Low-PC Extension Accepted Todd Allen

PROPOSAL: DW_AT_high_pc encoded as a constant offset from the DW_AT_low_pc


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


   DW_AT_low_pc  -> somefunction
   DW_AT_high_pc -> .somefunction_end


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

   DW_AT_low_pc  -> somefunction
   DW_AT_high_pc -> 350


   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:


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

All logos and trademarks in this site are property of their respective owner.
The comments are property of their posters, all the rest © 2007-2017 by DWARF Standards Committee.