[Dwarf-Discuss] DW_AT_segment and relocation

Michael Eager eager at eagerm.com
Thu Sep 26 14:11:52 PDT 2019

On 9/26/19 3:33 AM, Jayvee Neumann via Dwarf-Discuss wrote:
> Dear DWARF experts,
> I have a question regarding the attribute DW_AT_segment. I do not quite 
> understand how to handle it, yet.
> It can appear in a DIE (or its parent) whenever DW_AT_low_pc, 
> DW_AT_high_pc, DW_AT_ranges, DW_AT_entry_pc, or a location description 
> that evaluates to an Address are used.
> It can contain a location expression itself. So it can depend not only 
> on compile-time information but also on run-time information.
> Assume, I have an attribute DW_AT_low_pc. If there is no DW_AT_segment, 
> this attribute is simply the low_pc as it was determined during 
> compile-time. While debugging, this value has to be relocated if the 
> image had been relocated. If there is a DW_AT_segment expression is 
> relocation still necessary? Evaluating the expression could also 
> incorporate the usage of run-time information and relocated addresses 
> (i.e. the DS/CS/SS registers).
> I hope I was able to articulate my question well, English is not my 
> native language.
> Kind Regards
> Jayvee

Your question is quite clear, but we don't know the context.  What 
architecture are you working with and what ar you trying to do?

As Ron mentioned, AT_segment is intended to support architectures like 
the X86 where an address is composed of a [segment,offset] pair.  Most 
architectures do not use segments.

Michael Eager    eager at eagerm.com
1960 Park Blvd., Palo Alto, CA 94306

More information about the Dwarf-Discuss mailing list