A quick question about high/low_pc and linkonce sections

Vladimir Prus ghost@cs.msu.su
Fri Jul 1 10:52:00 GMT 2005


Jie Zhang wrote:

> Hi,
> 
> This is a piece of code from dwarf2read.c, near the end of
> dwarf2_get_pc_bounds ().
> 
>   /* When using the GNU linker, .gnu.linkonce. sections are used to
>      eliminate duplicate copies of functions and vtables and such.
>      The linker will arbitrarily choose one and discard the others.
>      The AT_*_pc values for such functions refer to local labels in
>      these sections.  If the section from that file was discarded, the
>      labels are not in the output, so the relocs get a value of 0.
>      If this is a discarded function, mark the pc bounds as invalid,
>      so that GDB will ignore it.  */
>   if (low == 0 && (bfd_get_file_flags (obfd) & HAS_RELOC) == 0)
>     return 0;
> 
> 
> Isn't "high == 0" much better than "low == 0"? It's possible that a
> valid DW_AT_low_pc is 0.

For the record, I've run into this problem myself and had to patch it
around. For my target, "lowpc" is always 0.

Also, the same logic is present at the end of the read_partial_die function.

- Volodya



More information about the Gdb mailing list