https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77422
--- Comment #3 from H.J. Lu <hjl.tools at gmail dot com> --- (In reply to Jakub Jelinek from comment #2) > That doesn't make sense. The mergeable sections really need to be the same, > otherwise nothing gets merged. And, unused constants/strings in those can > be removed if nothing uses them, the linker has all the relocations into > them and can figure out what is used and what is unused. At least I thought > it was working properly from the introduction of mergeable sections in the > linker, though haven't tried to verify that. Linker section merge doesn't check how entries in mergeable sections are used. It simply collects all entries in mergeable sections which are kept in output. When a mergeable section has .section .rodata.foo.str1.1,"aMS",@progbits,1 .LC0: .string "bar\n" .LC1: .string "test\n" all entries in it will be included in output if any entry is kept. As far as mergeable constant concerned, there is no difference between .section .rodata.foo.str1.1,"aMS",@progbits,1 .LC0: .string "bar\n" .LC1: .string "test\n" vs .section .rodata.foo.str1.1.0,"aMS",@progbits,1 .LC0: .string "bar\n" .section .rodata.foo.str1.1.1,"aMS",@progbits,1 .LC1: .string "test\n" Both put the same 2 entries into the table.