3 ms·
Interesting ... with section("text"), it crashes. With section(".text"), it works, but spews out this: <gibberish>.s: Assembler messages: <gibberish>.s
by byuu 10y ago
Interesting ... with section("text"), it crashes. With section(".text"), it works, but spews out this:
<gibberish>.s: Assembler messages:
<gibberish>.s:155: Warning: Ignoring changed section attributes for .text
However, it does compile and work :/
- JoshTriplett 10y ago"text" isn't the right section name; that'll create a new data section named "text", and then you'll segfault trying to execute out of a data section. Specifying ".text" causes the toolchain to attempt to create a data section named ".text", which causes the "changed section attributes" message; the array then correctly ends up in the executable ".text" section, though. I'd like to see a way to declare a section without attempting to make it a data section, but I think the compiler folks' answer to that would probably be "use a linker script". And I don't know a way to disable the warning.