3 ms·
I'm fairly certain that the C standard doesn't specify that string literals should be placed into .rodata, just that changing mutating them is UB.
by Pay08 7mo ago
I'm fairly certain that the C standard doesn't specify that string literals should be placed into .rodata, just that changing mutating them is UB.
- tialaramex 7mo agoThat's true, the systems where C was created do not have the relevant features, and I would expect they can't even "protect" that text so that although it's UB it would have worked fifty years ago to attempt the mutation whereas today that will segfault on a Unix.
- Pay08 7mo agoCompilers could choose to not place the literals into .rodata. Honestly, I don't know why it isn't at least an option on modern implementations.