This is the mail archive of the
mailing list for the binutils project.
Re: COMDAT section PE
- From: Nick Clifton <nickc at redhat dot com>
- To: Tamar Christina <tamar at zhox dot com>
- Cc: binutils <binutils at sourceware dot org>
- Date: Thu, 6 Apr 2017 16:55:48 +0100
- Subject: Re: COMDAT section PE
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=nickc at redhat dot com
- Dkim-filter: OpenDKIM Filter v2.11.0 mx1.redhat.com CA22783F38
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com CA22783F38
- References: <firstname.lastname@example.org>
> I'm trying to create a few COMDAT sections using PE.
> The documentation states that you can use a G type (group) with a comdat identifier on ELF,
> but doesn't state anything for PE. I've looked at the source and found that starting my section with
> .gnu.linkonce should work, but is this really the only way? I didn't want to have to change section names.
> Does it drop the .gnu.linkonce afterwards?
I think that what you want is the .linkonce assembler pseudo-op:
Mark the current section so that the linker only includes a single copy
of it. This may be used to include the same section in several
different object files, but ensure that the linker will only include it
once in the final output file. The `.linkonce' pseudo-op must be used
for each instance of the section. Duplicate sections are detected
based on the section name, so it should be unique.
This directive is only supported by a few object file formats; as of
this writing, the only object file format which supports it is the
Portable Executable format used on Windows NT.
The TYPE argument is optional. If specified, it must be one of the
following strings. For example:
Not all types may be supported on all object file formats.
Silently discard duplicate sections. This is the default.
Warn if there are duplicate sections, but still keep only one copy.
Warn if any of the duplicates have different sizes.
Warn if any of the duplicates do not have exactly the same