@@ -175,7 +175,13 @@ const Rel_entry reloc_table[R_AMD64_NUM] = {
175
175
* entry
176
176
*/
177
177
178
- #define HIBITS 0xffffffff80000000ULL
178
+
179
+ /*
180
+ * Bits that must be cleared or identical for a value to act as if extended in
181
+ * the given way.
182
+ */
183
+ #define ZEROEXBITS 0xffffffff00000000ULL
184
+ #define SIGNEXBITS 0xffffffff80000000ULL
179
185
180
186
#if defined(_KERNEL )
181
187
#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,
244
250
*/
245
251
if (rtype == R_AMD64_32 ) {
246
252
/*
247
- * Verify that this value will 'zero-extend', this
248
- * requires that the upper 33bits all be 'zero'.
253
+ * Verify that this value will act as a zero-extended
254
+ * unsigned 32 bit value. That is, that the upper
255
+ * 32 bits are zero.
249
256
*/
250
- if ((* value & HIBITS ) != 0 ) {
257
+ if ((* value & ZEROEXBITS ) != 0 ) {
251
258
/*
252
259
* To keep chkmsg() happy:
253
260
* MSG_INTL(MSG_REL_NOFIT)
@@ -258,12 +265,12 @@ do_reloc_rtld(uchar_t rtype, uchar_t *off, Xword *value, const char *sym,
258
265
} else if ((rtype == R_AMD64_32S ) || (rtype == R_AMD64_PC32 ) ||
259
266
(rtype == R_AMD64_GOTPCREL ) || (rtype == R_AMD64_GOTPC32 )) {
260
267
/*
261
- * Verify that this value will properly sign extend.
262
- * This is true of the upper 33bits are all either
263
- * ' zero' or all ' one' .
268
+ * Verify that this value will act as a sign-extended
269
+ * signed 32 bit value, that is that the upper 33 bits
270
+ * are either all zero or all one.
264
271
*/
265
- if (((* value & HIBITS ) != HIBITS ) &&
266
- ((* value & HIBITS ) != 0 )) {
272
+ if (((* value & SIGNEXBITS ) != SIGNEXBITS ) &&
273
+ ((* value & SIGNEXBITS ) != 0 )) {
267
274
/*
268
275
* To keep chkmsg() happy:
269
276
* MSG_INTL(MSG_REL_NOFIT)
0 commit comments