return 1;
}
+/* Return true when ADDR is the maximum address, when addresses are
+ POINTER_SIZE bytes long. */
+
+static bfd_boolean
+is_max_address (dwarf_vma addr, unsigned int pointer_size)
+{
+ dwarf_vma mask = ~(~(dwarf_vma) 1 << (pointer_size * 8 - 1));
+ return ((addr & mask) == mask);
+}
+
/* Display a location list from a normal (ie, non-dwo) .debug_loc section. */
static void
printf (" %8.8lx ", off);
- /* Note: we use sign extension here in order to be sure that we can detect
- the -1 escape value. Sign extension into the top 32 bits of a 32-bit
- address will not affect the values that we display since we always show
- hex values, and always the bottom 32-bits. */
SAFE_BYTE_GET_AND_INC (begin, start, pointer_size, section_end);
SAFE_BYTE_GET_AND_INC (end, start, pointer_size, section_end);
}
/* Check base address specifiers. */
- if (begin == (dwarf_vma) -1 && end != (dwarf_vma) -1)
+ if (is_max_address (begin, pointer_size)
+ && !is_max_address (end, pointer_size))
{
base_address = end;
print_dwarf_vma (begin, pointer_size);
dwarf_vma begin;
dwarf_vma end;
- /* Note: we use sign extension here in order to be sure that
- we can detect the -1 escape value. Sign extension into the
- top 32 bits of a 32-bit address will not affect the values
- that we display since we always show hex values, and always
- the bottom 32-bits. */
SAFE_BYTE_GET_AND_INC (begin, start, pointer_size, finish);
if (start >= finish)
break;
}
/* Check base address specifiers. */
- if (begin == (dwarf_vma) -1 && end != (dwarf_vma) -1)
+ if (is_max_address (begin, pointer_size)
+ && !is_max_address (end, pointer_size))
{
base_address = end;
print_dwarf_vma (begin, pointer_size);