This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[patch]: Correct interpretation of IMAGE_SCN_MEM_DISCARDABLE in coffcode.h
- From: "Kai Tietz" <ktietz70 at googlemail dot com>
- To: Binutils <binutils at sourceware dot org>
- Date: Sat, 10 Jan 2009 13:00:45 +0100
- Subject: [patch]: Correct interpretation of IMAGE_SCN_MEM_DISCARDABLE in coffcode.h
Hello,
While reading COFF spec and verifying current bfd implementation of
it, I found a spec violation in coffcode.h. It assumes that all
discardable sections (beside .reloc) are debugging sections. This
isn't true. It is true, that .debug* sections .reloc and .arch are
discardable, but spec doesn't tell that the discardable flag means
debug.
This misinterpretation leads to some troubles for the ReactOS project
as I learned.
ChangeLog
2008-01-10 Kai Tietz <kai.tietz@onevision.com>
* coffcode.h (styp_to_sec_flags): Correct interpretation of
IMAGE_SCN_MEM_DISCARDABLE.
Is this patch ok for apply?
Cheers,
Kai
--
| (\_/) This is Bunny. Copy and paste
| (='.'=) Bunny into your signature to help
| (")_(") him gain world domination
Index: src/bfd/coffcode.h
===================================================================
--- src.orig/bfd/coffcode.h
+++ src/bfd/coffcode.h
@@ -1069,10 +1069,10 @@ styp_to_sec_flags (bfd *abfd,
sec_flags &= ~ SEC_READONLY;
break;
case IMAGE_SCN_MEM_DISCARDABLE:
- /* The MS PE spec sets the DISCARDABLE flag on .reloc sections
- but we do not want them to be labelled as debug section, since
- then strip would remove them. */
- if (! CONST_STRNEQ (name, ".reloc"))
+ /* The MS PE spec says, that just .debug sections are debug sections,
+ but the DISCARDABLE flag has not the meaning of being debug.
+ So just set SEC_DEBUGGING for them. */
+ if (CONST_STRNEQ (name, ".debug"))
sec_flags |= SEC_DEBUGGING;
break;
case IMAGE_SCN_MEM_SHARED: