summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
authorRichard Lowe <richlowe@richlowe.net>2013-04-18 21:49:49 -0400
committerRichard Lowe <richlowe@richlowe.net>2013-05-03 11:51:51 -0400
commit6136c589445a3ea081bd34ab72db1060875b6bcc (patch)
treefe2c80921b4c5a1898974f410794c0998951eab0 /usr/src
parentd8fa96c3021236b21f47b84036cbe4f5d4854a06 (diff)
downloadillumos-joyent-6136c589445a3ea081bd34ab72db1060875b6bcc.tar.gz
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>
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/cmd/sgs/packages/common/SUNWonld-README1
-rw-r--r--usr/src/uts/intel/amd64/krtld/doreloc.c25
2 files changed, 17 insertions, 9 deletions
diff --git a/usr/src/cmd/sgs/packages/common/SUNWonld-README b/usr/src/cmd/sgs/packages/common/SUNWonld-README
index 2a6d570955..32672515c4 100644
--- a/usr/src/cmd/sgs/packages/common/SUNWonld-README
+++ b/usr/src/cmd/sgs/packages/common/SUNWonld-README
@@ -1646,3 +1646,4 @@ Bugid Risk Synopsis
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
diff --git a/usr/src/uts/intel/amd64/krtld/doreloc.c b/usr/src/uts/intel/amd64/krtld/doreloc.c
index a74f480f26..aac6f6dcc7 100644
--- a/usr/src/uts/intel/amd64/krtld/doreloc.c
+++ b/usr/src/uts/intel/amd64/krtld/doreloc.c
@@ -175,7 +175,13 @@ const Rel_entry reloc_table[R_AMD64_NUM] = {
* 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 @@ do_reloc_rtld(uchar_t rtype, uchar_t *off, Xword *value, const char *sym,
*/
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 @@ do_reloc_rtld(uchar_t rtype, uchar_t *off, Xword *value, const char *sym,
} 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)