<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/133684>133684</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [x86] why llvm keep rodata.const section when compile with -fdata-sections
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          LukeSTM
      </td>
    </tr>
</table>

<pre>
    https://godbolt.org/z/r8ha9o9nf

```
#include <stdio.h>
#include <string.h> 
 
struct ss_t {
        int s_id;
        char msg[];
};

struct ss_t *mst_1;

void do_some_test(void)
{
        struct ss_t *mst_2;
        char buf[100];
        int fill_num=4;
        char tmp_str[40]="test stringssssssssss!";
        memcpy(buf,&fill_num,sizeof(int));
        memcpy(buf+sizeof(int), tmp_str, strlen(tmp_str) + 1); 
        mst_1=(struct ss_t *)buf;
 
        if (mst_1->s_id==4)
                printf("mst_1->s_id=%d,mst_1->msg=%s\n",mst_1->s_id,mst_1->msg);
}
```

![Image](https://github.com/user-attachments/assets/ffdba4a7-1a04-440d-98d2-1e21a974e239)

sorry, but i want know, why clang keep .rodata..L__const.do_some_test.tmp_str in sections. Constant could be expanded into movabsq instructions, and what would use .rodata..L__const.do_some_test.tmp_str? Dose it should be removed ?

![Image](https://github.com/user-attachments/assets/50fd1a2c-b4f0-4bb3-8d19-7807b8a83c2a)

</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJysVE2PozgQ_TXFxQLZZQhw4JCPibTS7Gn3HhnbBG-DncWmMz2_fmWg0z2ZWWkPGxGB6uO951clC-_N1WrdQHGA4pSIOfRuar7OL_qPP39PWqfemj6Emwe-BzwDnq9OtW4ImZuugOfvgOep6kXtatsB3cdnR7eH7gG5sXKYlSbAjz4o47Ie-JdfpCZjr0uOAN3Hvw_TLAPx_hIIlIcFvDY2EH8xCvgWkL2YyOivq_4tXL5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