aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorRudy Y <rudyy.id@gmail.com>2016-12-01 14:43:36 +0000
committerNick Clifton <nickc@redhat.com>2016-12-01 14:43:36 +0000
commit4ee1d7e401a8c1aedfdc86aac7faa8267eab1e5c (patch)
tree0cfbbf1eb62cc0b015af081bda8dc8b9b888b2e4 /ld
parentcec4b2e3fee8ae2c41089fc7454da56f676f653c (diff)
downloadgdb-4ee1d7e401a8c1aedfdc86aac7faa8267eab1e5c.zip
gdb-4ee1d7e401a8c1aedfdc86aac7faa8267eab1e5c.tar.gz
gdb-4ee1d7e401a8c1aedfdc86aac7faa8267eab1e5c.tar.bz2
Fix generation of IDATA[6] for PE files.
PR ld/20880 * pe-dll.c (make_one): Use the hint if the ordinal is -1.
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog5
-rw-r--r--ld/pe-dll.c11
2 files changed, 14 insertions, 2 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 446a4af..65c2854 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,8 @@
+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
diff --git a/ld/pe-dll.c b/ld/pe-dll.c
index 055a6cf..9d87cd2 100644
--- a/ld/pe-dll.c
+++ b/ld/pe-dll.c
@@ -2266,6 +2266,8 @@ make_one (def_file_export *exp, bfd *parent, bfd_boolean include_jmp_stub)
}
else
{
+ int ord;
+
/* { short, asciz } */
if (exp->its_name)
len = 2 + strlen (exp->its_name) + 1;
@@ -2277,8 +2279,13 @@ make_one (def_file_export *exp, bfd *parent, bfd_boolean include_jmp_stub)
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