https://sourceware.org/bugzilla/show_bug.cgi?id=32264
Bug ID: 32264
Summary: For Windows,`.CRT` section should be merged into
`.rdata`
Product: binutils
Version: unspecified
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: ld
Assignee: unassigned at sourceware dot org
Reporter: lh_mouse at 126 dot com
Target Milestone: ---
This program
(https://godbolt.org/z/rsoW7vKd8)
```
#include <stdio.h>
volatile int value __attribute__((__section__(".CRT"))) = 1;
int
main(void)
{
value = 2;
printf("value = %d\n", value);
}
```
compiles and runs fine with GCC + LD, but crashes with Clang + LLD.
The reason is that, for MSVC the `.CRT` section is special. It gets merged into
`.rdata` before output, which has two effects: One is that there is no such
section in the final executable, and the other is that it becomes read-only.
LLD implements this correctly, but LD doesn't.
--
You are receiving this mail because:
You are on the CC list for the bug.