aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1999-09-11 21:27:15 +0000
committerIan Lance Taylor <ian@airs.com>1999-09-11 21:27:15 +0000
commitb545f675c19fa314085ceebce218000f5abf81f4 (patch)
tree60bac587c513d474bb55c8ed5fe36bff9968c58a
parent2c546cd84f17951cb5ab77d8c304a3f6f56781e1 (diff)
downloadgdb-b545f675c19fa314085ceebce218000f5abf81f4.zip
gdb-b545f675c19fa314085ceebce218000f5abf81f4.tar.gz
gdb-b545f675c19fa314085ceebce218000f5abf81f4.tar.bz2
1999-09-11 Donn Terry <donn@interix.com>
* cofflink.c (_bfd_coff_link_input_bfd): If a symbol is stripped, don't write out the associated line numbers.
-rw-r--r--bfd/ChangeLog3
-rw-r--r--bfd/cofflink.c33
2 files changed, 27 insertions, 9 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 8e4212a..d6bd2fe 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -5,6 +5,9 @@
1999-09-11 Donn Terry <donn@interix.com>
+ * cofflink.c (_bfd_coff_link_input_bfd): If a symbol is stripped,
+ don't write out the associated line numbers.
+
* cofflink.c (_bfd_coff_write_global_sym): Handle section symbol
aux entries.
diff --git a/bfd/cofflink.c b/bfd/cofflink.c
index 1373e48..9344a04 100644
--- a/bfd/cofflink.c
+++ b/bfd/cofflink.c
@@ -2025,6 +2025,8 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
bfd_vma offset;
bfd_byte *eline;
bfd_byte *elineend;
+ bfd_byte *oeline;
+ boolean skipping;
/* FIXME: If SEC_HAS_CONTENTS is not for the section, then
build_link_order in ldwrite.c will not have created a
@@ -2046,7 +2048,9 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
offset = o->output_section->vma + o->output_offset - o->vma;
eline = finfo->linenos;
+ oeline = finfo->linenos;
elineend = eline + linesz * o->lineno_count;
+ skipping = false;
for (; eline < elineend; eline += linesz)
{
struct internal_lineno iline;
@@ -2066,11 +2070,13 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
if (indx < 0)
{
/* These line numbers are attached to a symbol
- which we are stripping. We should really
- just discard the line numbers, but that would
- be a pain because we have already counted
- them. */
- indx = 0;
+ which we are stripping. We must discard the
+ line numbers because reading them back with
+ no associated symbol (or associating them all
+ with symbol #0) will fail. We can't regain
+ the space in the output file, but at least
+ they're dense. */
+ skipping = true;
}
else
{
@@ -2109,23 +2115,32 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
is.n_type, is.n_sclass, 0,
is.n_numaux, auxptr);
}
+
+ skipping = false;
}
iline.l_addr.l_symndx = indx;
}
- bfd_coff_swap_lineno_out (output_bfd, (PTR) &iline, (PTR) eline);
+ if (!skipping)
+ {
+ bfd_coff_swap_lineno_out (output_bfd, (PTR) &iline,
+ (PTR) oeline);
+ oeline += linesz;
+ }
}
if (bfd_seek (output_bfd,
(o->output_section->line_filepos
+ o->output_section->lineno_count * linesz),
SEEK_SET) != 0
- || bfd_write (finfo->linenos, linesz, o->lineno_count,
- output_bfd) != linesz * o->lineno_count)
+ || (bfd_write (finfo->linenos, 1, oeline - finfo->linenos,
+ output_bfd)
+ != (bfd_size_type) (oeline - finfo->linenos)))
return false;
- o->output_section->lineno_count += o->lineno_count;
+ o->output_section->lineno_count +=
+ (oeline - finfo->linenos) / linesz;
}
}