I know some projects have managed to have all functions end up in IROM by default so I knew it would be possible and dove into it.
All sources say you can't fix this in the compiler (for a complete source file), that's a pity, it would be the neatest solution IMHO.
But you can do it in the linker script. You can't say: put all references to .text.* into IROM, because all libraries assume .text functions go to IRAM. It will make your image crash. So I've done some experimenting, got it working, in a few steps also less and less complex. I think I now have the simplest solution (but feedback appreciated).
1) add to linker script, in the "irom0_0_seg" segment section the following line (exact position isn't that important):
:*.o(.literal .text .literal.* .text.*)
2) add to linker script, in the "iram1_0_seg" segment section the following line (exact position isn't that important):
:*.o(.iram_text .iram_text.*)
3) define this macro and use it where appropriate:
#define iram __attribute__((section(".iram_text")))
That should be enough, really!