Print this page
5270 ld(1) cannot handle CIE version 3 in .eh_frame

@@ -19,10 +19,11 @@
  * CDDL HEADER END
  */
 
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2014 Nexenta Systems, Inc.
  */
 
 #include        <string.h>
 #include        <stdio.h>
 #include        <sys/types.h>

@@ -407,19 +408,14 @@
                                  * this is a FDE entry and the 'id' is the
                                  * CIE pointer.
                                  */
                                 if (id == 0) {
                                         uint_t  cieversion;
-                                        /*
-                                         * The only CIE version supported
-                                         * is '1' - quick sanity check
-                                         * here.
-                                         */
                                         cieversion = data[off + ndx];
                                         ndx += 1;
                                         /* BEGIN CSTYLED */
-                                        if (cieversion != 1) {
+                                        if (cieversion != 1 && cieversion != 3) {
                                             ld_eprintf(ofl, ERR_FATAL,
                                                 MSG_INTL(MSG_UNW_BADCIEVERS),
                                                 isp->is_file->ifl_name,
                                                 isp->is_name, off);
                                             return (S_ERROR);

@@ -580,10 +576,11 @@
                          * CIE pointer.
                          */
                         if (id == 0) {
                                 char    *cieaugstr;
                                 uint_t  cieaugndx;
+                                uint_t  cieversion;
 
                                 ciePflag = 0;
                                 cieRflag = 0;
                                 /*
                                  * We need to drill through the CIE

@@ -590,14 +587,12 @@
                                  * to find the Rflag.  It's the Rflag
                                  * which describes how the FDE code-pointers
                                  * are encoded.
                                  */
 
-                                /*
-                                 * burn through version
-                                 */
-                                ndx++;
+                                cieversion = data[off + ndx];
+                                ndx += 1;
 
                                 /*
                                  * augstr
                                  */
                                 cieaugstr = (char *)(&data[off + ndx]);

@@ -610,12 +605,14 @@
                                 (void) sleb_extract(&data[off], &ndx);
 
                                 /*
                                  * retreg
                                  */
+                                if (cieversion == 1)
                                 ndx++;
-
+                                else
+                                        (void) uleb_extract(&data[off], &ndx);
                                 /*
                                  * we walk through the augmentation
                                  * section now looking for the Rflag
                                  */
                                 for (cieaugndx = 0; cieaugstr[cieaugndx];