changeset 14021:1faa5bdf272f

3722 link-editor is over restrictive of R_AMD64_32 addends Reviewed by: Gordon Ross <gwr@nexenta.com> Reviewed by: Joshua M. Clulow <josh@sysmgr.org> Approved by: Robert Mustacchi <rm@joyent.com>
author Richard Lowe <richlowe@richlowe.net>
date Thu, 18 Apr 2013 21:49:49 -0400
parents 3843f7c5f635
children 19e11862653b
files usr/src/cmd/sgs/packages/common/SUNWonld-README usr/src/uts/intel/amd64/krtld/doreloc.c
diffstat 2 files changed, 17 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/cmd/sgs/packages/common/SUNWonld-README	Wed Apr 24 08:45:43 2013 -0800
+++ b/usr/src/cmd/sgs/packages/common/SUNWonld-README	Thu Apr 18 21:49:49 2013 -0400
@@ -1646,3 +1646,4 @@
 3451	archive libraries with no symbols shouldn't require a string table
 3616	SHF_GROUP sections should not be discarded via other COMDAT mechanisms
 3709	need sloppy relocation for GNU .debug_macro
+3722	link-editor is over restrictive of R_AMD64_32 addends
--- a/usr/src/uts/intel/amd64/krtld/doreloc.c	Wed Apr 24 08:45:43 2013 -0800
+++ b/usr/src/uts/intel/amd64/krtld/doreloc.c	Thu Apr 18 21:49:49 2013 -0400
@@ -175,7 +175,13 @@
  *		entry
  */
 
-#define	HIBITS	0xffffffff80000000ULL
+
+/*
+ * Bits that must be cleared or identical for a value to act as if extended in
+ * the given way.
+ */
+#define	ZEROEXBITS	0xffffffff00000000ULL
+#define	SIGNEXBITS	0xffffffff80000000ULL
 
 #if defined(_KERNEL)
 #define	lml	0		/* Needed by arglist of REL_ERR_* macros */
@@ -244,10 +250,11 @@
 		 */
 		if (rtype == R_AMD64_32) {
 			/*
-			 * Verify that this value will 'zero-extend', this
-			 * requires that the upper 33bits all be 'zero'.
+			 * Verify that this value will act as a zero-extended
+			 * unsigned 32 bit value.  That is, that the upper
+			 * 32 bits are zero.
 			 */
-			if ((*value & HIBITS) != 0) {
+			if ((*value & ZEROEXBITS) != 0) {
 				/*
 				 * To keep chkmsg() happy:
 				 *  MSG_INTL(MSG_REL_NOFIT)
@@ -258,12 +265,12 @@
 		} else if ((rtype == R_AMD64_32S) || (rtype == R_AMD64_PC32) ||
 		    (rtype == R_AMD64_GOTPCREL) || (rtype == R_AMD64_GOTPC32)) {
 			/*
-			 * Verify that this value will properly sign extend.
-			 * This is true of the upper 33bits are all either
-			 * 'zero' or all 'one'.
+			 * Verify that this value will act as a sign-extended
+			 * signed 32 bit value, that is that the upper 33 bits
+			 * are either all zero or all one.
 			 */
-			if (((*value & HIBITS) != HIBITS) &&
-			    ((*value & HIBITS) != 0)) {
+			if (((*value & SIGNEXBITS) != SIGNEXBITS) &&
+			    ((*value & SIGNEXBITS) != 0)) {
 				/*
 				 * To keep chkmsg() happy:
 				 *  MSG_INTL(MSG_REL_NOFIT)