Support the easiest of the new v4 form flavors.
diff --git a/libdw/ChangeLog b/libdw/ChangeLog
index 8e580e2..cd30872 100644
--- a/libdw/ChangeLog
+++ b/libdw/ChangeLog
@@ -1,5 +1,10 @@
 2009-07-16  Roland McGrath  <roland@redhat.com>
 
+	* dwarf_formudata.c (__libdw_formptr): Handle DW_FORM_sec_offset,
+	reject others when CU's version > 3.
+
+	* dwarf_formflag.c: Handle DW_FORM_flag_present.
+
 	* dwarf.h: Add DW_OP_{implicit,stack}_value from DWARF 4 draft.
 	Also DW_TAG_type_unit and DW_TAG_rvalue_reference_type.
 	Also DW_AT_signature, DW_AT_main_subprogram, DW_AT_data_bit_offset,
diff --git a/libdw/dwarf_formflag.c b/libdw/dwarf_formflag.c
index 4e57c3a..fb60c8e 100644
--- a/libdw/dwarf_formflag.c
+++ b/libdw/dwarf_formflag.c
@@ -1,5 +1,5 @@
 /* Return flag represented by attribute.
-   Copyright (C) 2004 Red Hat, Inc.
+   Copyright (C) 2004-2009 Red Hat, Inc.
    This file is part of Red Hat elfutils.
    Written by Ulrich Drepper <drepper@redhat.com>, 2004.
 
@@ -64,6 +64,12 @@
   if (attr == NULL)
     return -1;
 
+  if (attr->form == DW_FORM_flag_present)
+    {
+      *return_bool = true;
+      return 0;
+    }
+
   if (unlikely (attr->form != DW_FORM_flag))
     {
       __libdw_seterrno (DWARF_E_NO_FLAG);
diff --git a/libdw/dwarf_formudata.c b/libdw/dwarf_formudata.c
index 04f04aa..d9d0a1c 100644
--- a/libdw/dwarf_formudata.c
+++ b/libdw/dwarf_formudata.c
@@ -1,5 +1,5 @@
 /* Return unsigned constant represented by attribute.
-   Copyright (C) 2003, 2005 Red Hat, Inc.
+   Copyright (C) 2003-2009 Red Hat, Inc.
    This file is part of Red Hat elfutils.
    Written by Ulrich Drepper <drepper@redhat.com>, 2003.
 
@@ -71,6 +71,15 @@
     }
 
   Dwarf_Word offset;
+  if (attr->form == DW_FORM_sec_offset)
+    {
+      if (__libdw_read_offset (attr->cu->dbg, IDX_debug_info, attr->valp,
+			       attr->cu->offset_size, &offset, sec_index, 0))
+	return NULL;
+    }
+  else if (attr->cu->version > 3)
+    goto invalid;
+
   switch (attr->form)
     {
     case DW_FORM_data4:
@@ -90,6 +99,7 @@
   unsigned char *endp = d->d_buf + d->d_size;
   if (unlikely (readp >= endp))
     {
+    invalid:
       __libdw_seterrno (DWARF_E_INVALID_DWARF);
       return NULL;
     }