https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120391

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
```
        .section        .rodata.str1.1,"aMS",@progbits,1
        .type   _ZL2c2, @object
        .size   _ZL2c2, 7
_ZL2c2:
        .string "world!"
        .section        .rodata.str1.8,"aMS",@progbits,1
        .align 8
        .type   _ZL2c1, @object
        .size   _ZL2c1, 13
_ZL2c1:
        .string "Hello world!"

```

With -fmerge-all-constants, the variables are emitted into the mergable
sections. So there is nothing for GCC to do here. 

The problem for x86_64 ABI, since c1 is larger than 8, it has an alignment for
8. Note the `.8` in the section name there.

So on aarch64 we get:
```
        .section        .rodata.str1.1,"aMS",@progbits,1
        .type   _ZL2c2, %object
        .size   _ZL2c2, 7
_ZL2c2:
        .string "world!"
        .type   _ZL2c1, %object
        .size   _ZL2c1, 13
_ZL2c1:
        .string "Hello world!"
```

Which then the linker can/will merge.

So this comes down to ABI requirements of x86_64.

Reply via email to