feature request: a linker option to avoid merging variables from separate object files into shared cache lines
Mateusz Guzik
mjguzik@gmail.com
Tue Nov 5 11:23:27 GMT 2024
On Tue, Nov 5, 2024 at 11:18 AM Florian Weimer <fweimer@redhat.com> wrote:
>
> * David Brown via Gcc:
>
> > I would have thought it would be better as part of the compiler. For
> > each compilation unit, you generate one or more data sections
> > depending on the variable initialisations, compiler options and target
> > (.bss, .data, .rodata, .sbss, etc.). If the compiler has
> > "-align-object-data-section=64" in effect, then you could add ".align
> > 64" to the start and the end of each section. As far as I can see,
> > that would give the effect the OP is looking for in a simple manner
> > that can also be different for different translation units in the same
> > program (which would be hard to do with a linker flag). And if this
> > is a flag in gcc, then it will work for any ld-compatible linker
> > (gold, mold, etc.).
>
> I agree it's more of a compiler flag from an implementation perspective.
> There's another aspect that supports this: I don't think we want to do
> this for data sections that we use to implement vague linkage. Bumping
> the alignment for them could be really wasteful and probably not what
> the programmer intends.
>
Huh, this fell to the wayside on my end due to $reallife.
Anyhow I have 0 opinion where this should be implemented, I'm merely
interested in the feature showing up.
I believe I made a good enough case to justify its existence, but I
don't know if anyone can be bothered to follow through with it -- I
for one have 0 cycles spare for this one. That said someone(tm)
picking it up would be most welcome. :)
Cheers,
--
Mateusz Guzik <mjguzik gmail.com>
More information about the Gcc
mailing list