This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: RFA: Some question I found while reviewing coffcode
- From: Kai Tietz <Kai dot Tietz at onevision dot com>
- To: Ian Lance Taylor <iant at google dot com>
- Cc: Binutils <binutils at sourceware dot org>, "Kai Tietz" <ktietz70 at googlemail dot com>
- Date: Tue, 13 Jan 2009 10:43:09 +0100
- Subject: Re: RFA: Some question I found while reviewing coffcode
binutils-owner@sourceware.org wrote on 13.01.2009 06:53:01:
> "Kai Tietz" <ktietz70@googlemail.com> writes:
>
> > while reviewing the coff code I found some problems in our current
> > implementation
>
> Note that you are discussing PE, not COFF. COFF is a much older
> object file format, PE is an extension.
Well, I am aware that COFF means typically just the object file format.
But PE/PE+ are imagefile formats based on COFF, not an extension IMHO.
> > 1) Treating of IMAGE_SCN_LNK_INFO
> > As coff spec says "The section contains comments or other
> > information. The .drectve section has this type. This is valid for
> > object files only." and "A section is a directive section if it has
> > the IMAGE_SCN_LNK_INFO flag set in the section header and has the
> > .drectve section name. The linker removes a .drectve section after
> > processing the information, so the section does not appear in the
> > image file that is being linked. "
> > At the moment are sections with the IMAGE_SCN_LNK_INFO flag mark as
> > SEC_DEBUGGING (when COFF_PAGE_SIZE is known). But at least for the
> > .drectve it should be SEC_EXCLUDE, IIUC.
>
> Yes. This should probably be set in process_def_file in ld/pe-dll.c.
I agree, that the interpretation of some of those linker directives can be
done in ld/pe-dll.c, but the real change here is in coffcode.h. Because
here it is marked as SEC_DEBUGGING, which means strip happily remove those
information, but IIUC they should be removed by ld itself.
> > 2) Treating of IMAGE_SCN_MEM_NOT_PAGED
> > Is untreated. For user mode this flag is not of much interest, but
> > for drivers and kernel mode things it is pretty important to mark
> > sections as not to be page-able Do we need here an addtional COFF
> > flag for this?
>
> I suppose you could add a new SEC_xxx flag for this--we already have
> COFF specific SEC_xxx flags. Or it might be possible to add a field
> to the coff_section_tdata struct.
Thanks for the suggestion. I think an additional field in
coff_section_tdata about the paging/loading behaviour for
DISCARDABLE/NOT_PAGED/PAGED would be best. I will prepare a patch for
this.
Cheers,
Kai
| (\_/) This is Bunny. Copy and paste Bunny
| (='.'=) into your signature to help him gain
| (")_(") world domination.