PR ld/20880
* pe-dll.c (make_one): Use the hint if the ordinal is -1.
+2016-12-01 Rudy Y <rudyy.id@gmail.com>
+
+ PR ld/20880
+ * pe-dll.c (make_one): Use the hint if the ordinal is -1.
+
2016-12-01 Yury Norov <ynorov@caviumnetworks.com>
PR ld/20868
}
else
{
+ int ord;
+
/* { short, asciz } */
if (exp->its_name)
len = 2 + strlen (exp->its_name) + 1;
d6 = xmalloc (len);
id6->contents = d6;
memset (d6, 0, len);
- d6[0] = exp->hint & 0xff;
- d6[1] = exp->hint >> 8;
+
+ /* PR 20880: Use exp->hint as a backup, just in case exp->ordinal
+ contains an invalid value (-1). */
+ ord = (exp->ordinal >= 0) ? exp->ordinal : exp->hint;
+ d6[0] = ord;
+ d6[1] = ord >> 8;
+
if (exp->its_name)
strcpy ((char*) d6 + 2, exp->its_name);
else