linking elf notes together on elf32-arm

Mark Wielaard mjw@redhat.com
Wed Jul 6 23:19:00 GMT 2011


Hi,

While trying to build a program that uses sdt elf notes on an elf32-arm
architecture I get the following error on the final link:
/usr/bin/ld: staprun-util.o: duplicate section `.note.stapsdt' has
different size

The different object files do have different sized note sections,
because they contain different things and so shouldn't be merged
together as duplicates.

This is because all elf notes are marked as link once in
bfd/elf32-arm.c:

/* Set the right machine number for an Arm ELF file.  */

static bfd_boolean
elf32_arm_section_flags (flags, hdr)
     flagword *flags;
     Elf_Internal_Shdr *hdr;
{
  if (hdr->sh_type == SHT_NOTE)
    *flags |= SEC_LINK_ONCE | SEC_LINK_DUPLICATES_SAME_CONTENTS;

  return TRUE;
}

That seems wrong to me. Why are all SHT_NOTE sections treated that way?
Should it be just some specific arm named ones?

It seems to have been introduced a long time ago:

2003-03-25  Stan Cox   <scox@redhat.com>
            Nick Clifton  <nickc@redhat.com>
           
   Contribute support for Intel's iWMMXt chip - an ARM variant:
[...]
   (elf32_arm_section_flags): New function: Set flags on note section.

Can anybody remember why that was, and how to make it so that "normal"
elf notes don't get merged?

Thanks,

Mark



More information about the Binutils mailing list