[binutils-gdb/binutils-2_35-branch] DWARF: Check version >= 3 for DW_FORM_ref_addr

H.J. Lu hjl@sourceware.org
Mon Mar 22 17:07:27 GMT 2021


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=d8768ca6a736699e67e85e395b0b6e8058704456

commit d8768ca6a736699e67e85e395b0b6e8058704456
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Thu Mar 18 18:34:38 2021 -0700

    DWARF: Check version >= 3 for DW_FORM_ref_addr
    
    Check version >= 3, instead of version == 3 || version == 4, for
    DW_FORM_ref_addr.
    
    bfd/
    
            PR ld/27587
            * dwarf2.c (read_attribute_value): Check version >= 3 for
            DW_FORM_ref_addr.
    
    (cherry picked from commit 51f6e7a9f4210aed0f8156c1d2e348de6f96f37d)

Diff:
---
 bfd/ChangeLog | 6 ++++++
 bfd/dwarf2.c  | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 13d36704607..2ef920052cd 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2021-03-22  H.J. Lu  <hongjiu.lu@intel.com>
+
+	PR ld/27587
+	* dwarf2.c (read_attribute_value): Check version >= 3 for
+	DW_FORM_ref_addr.
+
 2021-01-30  Nick Clifton  <nickc@redhat.com>
 
 	* development.sh (development): Set to true.
diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c
index 767e9731199..c7561cdeeec 100644
--- a/bfd/dwarf2.c
+++ b/bfd/dwarf2.c
@@ -1182,7 +1182,7 @@ read_attribute_value (struct attribute *  attr,
     case DW_FORM_ref_addr:
       /* DW_FORM_ref_addr is an address in DWARF2, and an offset in
 	 DWARF3.  */
-      if (unit->version == 3 || unit->version == 4)
+      if (unit->version >= 3)
 	{
 	  if (unit->offset_size == 4)
 	    attr->u.val = read_4_bytes (unit->abfd, info_ptr, info_ptr_end);


More information about the Binutils-cvs mailing list