When generating an output from input SEC_MERGE|SEC_STRINGS sections with
different entsizes, we clear the SEC_MERGE|SEC_STRINGS bits. We also need
to clear entsize.
PR ld/33291
* ldlang.c (lang_add_section): Clearing entsize when clearing
SEC_MERGE|SEC_STRINGS.
* testsuite/ld-elf/pr33291.d: New file.
* testsuite/ld-elf/pr33291a.s: Likewise.
* testsuite/ld-elf/pr33291b.s: Likewise.
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
&& output->bfd_section->entsize != section->entsize))
{
output->bfd_section->flags &= ~ (SEC_MERGE | SEC_STRINGS);
+ output->bfd_section->entsize = 0;
flags &= ~ (SEC_MERGE | SEC_STRINGS);
}
}
--- /dev/null
+#source: pr33291a.s
+#source: pr33291b.s
+#ld: -shared
+#readelf: -S --wide
+#xfail: ![check_shared_lib_support]
+
+#...
+ \[[ 0-9]+\] \.rodata[ ]+PROGBITS[ ]+[0-9a-f]+ [0-9a-f]+ 0+9 00 +A +0 +0 +8
+#...
--- /dev/null
+ .globl foo
+ .section .rodata.cst8,"aM",%progbits,8
+ .p2align 3
+ .type foo, %object
+ .size foo, 8
+foo:
+ .quad 131073
+ .section .note.GNU-stack,"",%progbits
--- /dev/null
+ .globl bar
+ .section .rodata.cst1,"aM",%progbits,1
+ .type bar, %object
+ .size bar, 1
+bar:
+ .byte 1
+ .section .note.GNU-stack,"",%progbits