On Tue, May 15, 2018 at 12:56:22PM -0700, Julius Werner wrote: > > I think you are asking for per-function constant pool sections. Because > > we generally cannot avoid the need of a constant pool and dependent > > on the target that is always global. Note with per-function constant > > pools you will not benefit from constant pool entry merging across > > functions. I'm also not aware of any non-target-specific (and thus not > > implemented on some targets) option to get these. > > Thanks, yeah, that sounds like what I need. Is there any way to get that > behavior today, even for a specific target? (I'm mostly interested in > x86_64, armv7 and aarch64.) And are you saying that there are some targets > for which it would be impossible to provide this behavior? Or just that > it's not implemented for all targets today?
For aarch64 there is -mpc-relative-literal-loads, I think that will do what you want. This option is implied by -mcmodel=tiny which you may want anyway, if your code is small enough. Segher