Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22162

Why gcc place a large constant array to ".rwdata" section rather than ".rodata" section?

$
0
0
/* 0xFFFFFFFF * 256*/#define test_256X0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, ... 0xFFFFFFFF

After compiling, the const array is placed in ".rwdata" section rather than ".rodata" section, and I don't know why.

After google and searching the stackoverflow site, there is no specified answer. Does any one know why or how to ask compiler(or linker) to output warning message when "placing constant data into non-read-only section"? thanks.

PS. I resolve my problem by add attribure((section(".rodata")))

__attribure__((section(".rodata"))) volatile const int TEST_ro[512] = {test_256X, test_256X};

PS. I use linaor-gcc compiler for arm core


Viewing all articles
Browse latest Browse all 22162

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>