pcc wrote:

That's a fair point, I was also concerned about the number of options required 
here. We do need some way to communicate the preferred alignment separately 
from the minimum alignment. Without this, almost no sections would be eligible 
for jump table relaxation the way things work now.

An alternative approach would be to communicate both alignments in the object 
file. That way, the optimization would work by default with no flags passed to 
clang or lld but more work would be needed on the toolchain side. What I had in 
mind was that sh_addralign would contain the preferred alignment (which would 
also be controlled by -falign-functions), and we would introduce  a new 
LLVM-specific ELF section type containing an array of (relocation pointing to 
section, minimum alignment) pairs.

Another possibility is that we go back to the approach from the initial 
prototype of #147424 where the relocation from the jump table section gives the 
linker permission to reduce the alignment, but this is a bit of a hack and may 
cause problems e.g. if the code generator embeds constants in the code section 
that are read with movaps.

Let me know what you think.

https://github.com/llvm/llvm-project/pull/149448
_______________________________________________
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to