public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* COMDAT section PE
@ 2017-03-27 19:27 Tamar Christina
  2017-04-06 15:55 ` Nick Clifton
  0 siblings, 1 reply; 2+ messages in thread
From: Tamar Christina @ 2017-03-27 19:27 UTC (permalink / raw)
  To: binutils

Hi All,

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?

Thanks,
Tamar

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: COMDAT section PE
  2017-03-27 19:27 COMDAT section PE Tamar Christina
@ 2017-04-06 15:55 ` Nick Clifton
  0 siblings, 0 replies; 2+ messages in thread
From: Nick Clifton @ 2017-04-06 15:55 UTC (permalink / raw)
  To: Tamar Christina; +Cc: binutils

Hi Tamar,

> 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?

No.

I think that what you want is the .linkonce assembler pseudo-op:


  .linkonce [TYPE]
  ================

  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:
     .linkonce same_size
   Not all types may be supported on all object file formats.

  `discard'
     Silently discard duplicate sections.  This is the default.

  `one_only'
     Warn if there are duplicate sections, but still keep only one copy.

  `same_size'
     Warn if any of the duplicates have different sizes.

  `same_contents'
     Warn if any of the duplicates do not have exactly the same
     contents.


Cheers
  Nick

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-04-06 15:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-27 19:27 COMDAT section PE Tamar Christina
2017-04-06 15:55 ` Nick Clifton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).