aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1999-09-11 22:33:45 +0000
committerIan Lance Taylor <ian@airs.com>1999-09-11 22:33:45 +0000
commit4cfec37b92f672f0b9d9cee334e83e201470654d (patch)
treedf5a44c00049adb8d835293a6eec913e9297615f
parent33d7d19757186703099a6fccaee20cb4cc77a6fa (diff)
downloadgdb-4cfec37b92f672f0b9d9cee334e83e201470654d.zip
gdb-4cfec37b92f672f0b9d9cee334e83e201470654d.tar.gz
gdb-4cfec37b92f672f0b9d9cee334e83e201470654d.tar.bz2
1999-09-11 Donn Terry <donn@interix.com>
* coffcode.h (coff_mkobject_hook): If COFF_WITH_PE, set HAS_DEBUG to the reverse of IMAGE_FILE_DEBUG_STRIPPED. (coff_write_object_contents): Set IMAGE_FILE_DEBUG_STRIPPED if there is no SEC_DEBUGGING section. * peicode.h (pe_mkobject_hook): Set HAS_DEBUG to the reverse of IMAGE_FILE_DEBUG_STRIPPED.
-rw-r--r--bfd/ChangeLog7
-rw-r--r--bfd/coffcode.h22
-rw-r--r--bfd/peicode.h3
3 files changed, 28 insertions, 4 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index ad22eb9..26ffe3d 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -7,6 +7,13 @@
1999-09-11 Donn Terry <donn@interix.com>
+ * coffcode.h (coff_mkobject_hook): If COFF_WITH_PE, set HAS_DEBUG
+ to the reverse of IMAGE_FILE_DEBUG_STRIPPED.
+ (coff_write_object_contents): Set IMAGE_FILE_DEBUG_STRIPPED if
+ there is no SEC_DEBUGGING section.
+ * peicode.h (pe_mkobject_hook): Set HAS_DEBUG to the reverse of
+ IMAGE_FILE_DEBUG_STRIPPED.
+
* pe-i386.c (COFF_LONG_FILENAMES): Define.
(COFF_SECTION_ALIGNMENT_ENTRIES): Define.
* pei-i386.c (COFF_LONG_FILENAMES): Define.
diff --git a/bfd/coffcode.h b/bfd/coffcode.h
index f18c2c9..9a6d014 100644
--- a/bfd/coffcode.h
+++ b/bfd/coffcode.h
@@ -1627,6 +1627,13 @@ coff_mkobject_hook (abfd, filehdr, aouthdr)
coff->flags = 0;
#endif
+#ifdef COFF_WITH_PE
+ /* FIXME: I'm not sure this is ever executed, since peicode.h
+ defines coff_mkobject_hook. */
+ if ((internal_f->f_flags & IMAGE_FILE_DEBUG_STRIPPED) == 0)
+ abfd->flags |= HAS_DEBUG;
+#endif
+
return (PTR) coff;
}
#endif
@@ -2902,6 +2909,7 @@ coff_write_object_contents (abfd)
asection *current;
boolean hasrelocs = false;
boolean haslinno = false;
+ boolean hasdebug = false;
file_ptr scn_base;
file_ptr reloc_base;
file_ptr lineno_base;
@@ -2992,18 +3000,17 @@ coff_write_object_contents (abfd)
current = current->next)
{
struct internal_scnhdr section;
-
-#ifdef COFF_WITH_PE
- /* If we've got a .reloc section, remember. */
+ boolean is_reloc_section = false;
#ifdef COFF_IMAGE_WITH_PE
if (strcmp (current->name, ".reloc") == 0)
{
+ is_reloc_section = true;
+ hasrelocs = true;
pe_data (abfd)->has_reloc_section = 1;
}
#endif
-#endif
internal_f.f_nscns++;
strncpy (section.s_name, current->name, SCNNMLEN);
@@ -3069,6 +3076,9 @@ coff_write_object_contents (abfd)
hasrelocs = true;
if (current->lineno_count != 0)
haslinno = true;
+ if ((current->flags & SEC_DEBUGGING) != 0
+ && ! is_reloc_section)
+ hasdebug = true;
#ifdef RS6000COFF_C
/* Indicate the use of an XCOFF overflow section header. */
@@ -3277,6 +3287,10 @@ coff_write_object_contents (abfd)
internal_f.f_flags |= F_LNNO;
if (abfd->flags & EXEC_P)
internal_f.f_flags |= F_EXEC;
+#ifdef COFF_IMAGE_WITH_PE
+ if (! hasdebug)
+ internal_f.f_flags |= IMAGE_FILE_DEBUG_STRIPPED;
+#endif
#ifndef COFF_WITH_PE
if (bfd_little_endian (abfd))
diff --git a/bfd/peicode.h b/bfd/peicode.h
index 3737a57..e7bab84 100644
--- a/bfd/peicode.h
+++ b/bfd/peicode.h
@@ -2106,6 +2106,9 @@ pe_mkobject_hook (abfd, filehdr, aouthdr)
if ((internal_f->f_flags & F_DLL) != 0)
pe->dll = 1;
+ if ((internal_f->f_flags & IMAGE_FILE_DEBUG_STRIPPED) == 0)
+ abfd->flags |= HAS_DEBUG;
+
#ifdef COFF_IMAGE_WITH_PE
if (aouthdr)
pe->pe_opthdr = ((struct internal_aouthdr *)aouthdr)->pe;