Incorrect use of SEC_MERGE in tc-ppc.c

Jakub Jelinek jakub@redhat.com
Wed Nov 27 08:53:00 GMT 2002


Hi!

tc-ppc.c (ppc_cleanup) does:

    /* Create the .PPC.EMB.apuinfo section.  */
    apuinfo_secp = subseg_new (".PPC.EMB.apuinfo", 0);
    bfd_set_section_flags (stdoutput,
                           apuinfo_secp,
                           SEC_HAS_CONTENTS | SEC_READONLY | SEC_MERGE);

yet never sets apuinfo_secp->entsize.
This is wrong, every SHF_MERGE section must have non-zero sh_entsize,
either it is the size of each constant, or if SHF_STRINGS is set too
it is size of character in the strings.
As .PPC.EMB.apuinfo is not fixed size section, there is no suitable
entsize value though.
If you want to merge .PPC.EMB.apuinfo sections from a.o and b.o iff
they are the same size and have same content, then more work is needed,
like instead of creating .PPC.EMB.apuinfo section create
e.g. .PPC.EMB.apuinfo.<ppc_apuinfo_num> section with SEC_MERGE
and apuinfo_secp->entsize = 20 + ppc_apuinfo_num * 4.
Then also linker script needs to be tweaked, so that it has
.PPC.EMB.apuinfo : { *(.PPC.EMB.apuinfo .PPC.EMB.apuinfo.*) }
for non-relocatable build.
If some other merging is wanted instead, please explain what exactly.

	Jakub



More information about the Binutils mailing list