aboutsummaryrefslogtreecommitdiff
path: root/bfd/peicode.h
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1999-09-12 00:30:27 +0000
committerIan Lance Taylor <ian@airs.com>1999-09-12 00:30:27 +0000
commitcb43721da5d2e451a068fc3397b89ec1f47ce2bc (patch)
treeb84634985c22d5e591833c198e072d11ef1d0772 /bfd/peicode.h
parent5933bdc9a1882e0d81d8da7b869c5339b6bf2fc4 (diff)
downloadgdb-cb43721da5d2e451a068fc3397b89ec1f47ce2bc.zip
gdb-cb43721da5d2e451a068fc3397b89ec1f47ce2bc.tar.gz
gdb-cb43721da5d2e451a068fc3397b89ec1f47ce2bc.tar.bz2
1999-09-11 Donn Terry <donn@interix.com>
* peicode.h (coff_swap_scnhdr_in): If COFF_IMAGE_WITH_PE, the get the overflow of the s_nlnno field from the s_nreloc field. * peigen.c (_bfd_pei_swap_scnhdr_out): If doing a final link, swap the s_nlnno overflow of the .text section into the s_nreloc field.
Diffstat (limited to 'bfd/peicode.h')
-rw-r--r--bfd/peicode.h16
1 files changed, 14 insertions, 2 deletions
diff --git a/bfd/peicode.h b/bfd/peicode.h
index 605b1c0..0b6bde4 100644
--- a/bfd/peicode.h
+++ b/bfd/peicode.h
@@ -215,8 +215,20 @@ coff_swap_scnhdr_in (abfd, ext, in)
GET_SCNHDR_LNNOPTR (abfd, (bfd_byte *) scnhdr_ext->s_lnnoptr);
scnhdr_int->s_flags = bfd_h_get_32(abfd, (bfd_byte *) scnhdr_ext->s_flags);
- scnhdr_int->s_nreloc = bfd_h_get_16(abfd, (bfd_byte *) scnhdr_ext->s_nreloc);
- scnhdr_int->s_nlnno = bfd_h_get_16(abfd, (bfd_byte *) scnhdr_ext->s_nlnno);
+ /* MS handles overflow of line numbers by carrying into the reloc
+ field (it appears). Since it's supposed to be zero for PE
+ *IMAGE* format, that's safe. This is still a bit iffy. */
+#ifdef COFF_IMAGE_WITH_PE
+ scnhdr_int->s_nlnno =
+ (bfd_h_get_16 (abfd, (bfd_byte *) scnhdr_ext->s_nlnno)
+ + (bfd_h_get_16 (abfd, (bfd_byte *) scnhdr_ext->s_nreloc) << 16));
+ scnhdr_int->s_nreloc = 0;
+#else
+ scnhdr_int->s_nreloc = bfd_h_get_16 (abfd,
+ (bfd_byte *) scnhdr_ext->s_nreloc);
+ scnhdr_int->s_nlnno = bfd_h_get_16 (abfd,
+ (bfd_byte *) scnhdr_ext->s_nlnno);
+#endif
if (scnhdr_int->s_vaddr != 0)
{