summaryrefslogtreecommitdiffstats
path: root/binutils-2.25/ld/emultempl/pe.em
diff options
context:
space:
mode:
authorWolfgang Wiedmeyer <wolfgit@wiedmeyer.de>2017-02-11 23:05:05 (GMT)
committerWolfgang Wiedmeyer <wolfgit@wiedmeyer.de>2017-02-11 23:05:05 (GMT)
commit9843e01a9bc698b5803808438eb85bb5c46722c2 (patch)
tree30b7bd8627cbc63dd8485cdddd45a9268ccb16b0 /binutils-2.25/ld/emultempl/pe.em
parentb9a9d44e01a751423c42f7a52f23cd1576f515cf (diff)
parent9bf6cbf6dd88777719c5757922aff0190ec46539 (diff)
downloadtoolchain_binutils-9843e01a9bc698b5803808438eb85bb5c46722c2.zip
toolchain_binutils-9843e01a9bc698b5803808438eb85bb5c46722c2.tar.gz
toolchain_binutils-9843e01a9bc698b5803808438eb85bb5c46722c2.tar.bz2
Merge branch 'master' of https://android.googlesource.com/toolchain/binutils
Diffstat (limited to 'binutils-2.25/ld/emultempl/pe.em')
-rw-r--r--binutils-2.25/ld/emultempl/pe.em12
1 files changed, 8 insertions, 4 deletions
diff --git a/binutils-2.25/ld/emultempl/pe.em b/binutils-2.25/ld/emultempl/pe.em
index 979cc8b..f0ecbcf 100644
--- a/binutils-2.25/ld/emultempl/pe.em
+++ b/binutils-2.25/ld/emultempl/pe.em
@@ -1324,6 +1324,9 @@ write_build_id (bfd *abfd)
return TRUE;
}
+ const char * pdb_name = _bfd_XXi_get_codeview_pdb_name (abfd);
+ unsigned int pdb_name_length = strlen(pdb_name);
+
if (t->build_id.sec->contents == NULL)
t->build_id.sec->contents = (unsigned char *) xmalloc (t->build_id.sec->size);
contents = t->build_id.sec->contents;
@@ -1342,7 +1345,7 @@ write_build_id (bfd *abfd)
idd.MajorVersion = 0;
idd.MinorVersion = 0;
idd.Type = PE_IMAGE_DEBUG_TYPE_CODEVIEW;
- idd.SizeOfData = sizeof (CV_INFO_PDB70) + 1;
+ idd.SizeOfData = sizeof (CV_INFO_PDB70) + pdb_name_length + 1;
idd.AddressOfRawData = asec->vma - ib + link_order->offset
+ sizeof (struct external_IMAGE_DEBUG_DIRECTORY);
idd.PointerToRawData = asec->filepos + link_order->offset
@@ -1406,12 +1409,13 @@ setup_build_id (bfd *ibfd)
t->build_id.style = emit_build_id;
t->build_id.sec = s;
- /* Section is a fixed size:
+ /* Section is a variable size:
One IMAGE_DEBUG_DIRECTORY entry, of type IMAGE_DEBUG_TYPE_CODEVIEW,
pointing at a CV_INFO_PDB70 record containing the build-id, with a
- null byte for PdbFileName. */
+ null terminated string for PdbFileName. */
+
s->size = sizeof (struct external_IMAGE_DEBUG_DIRECTORY)
- + sizeof (CV_INFO_PDB70) + 1;
+ + sizeof (CV_INFO_PDB70) + strlen(_bfd_XXi_get_codeview_pdb_name(link_info.output_bfd)) + 1;
return TRUE;
}