Print this page
12399 kobj printf functions should be checked

@@ -20,10 +20,12 @@
  */
 
 /*
  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
+ *
+ * Copyright 2020 Joyent, Inc.
  */
 
 /*
  * x86 relocation code.
  */

@@ -156,11 +158,11 @@
                         return (-1);
                 }
                 if ((rtype > R_AMD64_NUM) || IS_TLS_INS(rtype)) {
                         _kobj_printf(ops, "krtld: invalid relocation type %d",
                             rtype);
-                        _kobj_printf(ops, " at 0x%llx:", off);
+                        _kobj_printf(ops, " at 0x%lx:", off);
                         _kobj_printf(ops, " file=%s\n", mp->filename);
                         err = 1;
                         continue;
                 }
 

@@ -177,12 +179,12 @@
                         Sym *   symp;
                         symp = (Sym *)
                             (mp->symtbl+(stndx * mp->symhdr->sh_entsize));
                         _kobj_printf(ops, "krtld:\t%s",
                             conv_reloc_amd64_type(rtype));
-                        _kobj_printf(ops, "\t0x%8llx", off);
-                        _kobj_printf(ops, " 0x%8llx", addend);
+                        _kobj_printf(ops, "\t0x%8lx", off);
+                        _kobj_printf(ops, " %8lld", (longlong_t)addend);
                         _kobj_printf(ops, "  %s\n",
                             (const char *)mp->strings + symp->st_name);
                 }
 #endif
 

@@ -252,12 +254,12 @@
                 if (IS_PC_RELATIVE(rtype))
                         value -= off;
 
 #ifdef  KOBJ_DEBUG
                 if (kobj_debug & D_RELOCATIONS) {
-                        _kobj_printf(ops, "krtld:\t\t\t\t0x%8llx", off);
-                        _kobj_printf(ops, " 0x%8llx\n", value);
+                        _kobj_printf(ops, "krtld:\t\t\t\t0x%8lx", off);
+                        _kobj_printf(ops, " 0x%8lx\n", value);
                 }
 #endif
 
                 if (do_reloc_krtld(rtype, (unsigned char *)off, &value,
                     (const char *)mp->strings + symref->st_name,