(for background, Understanding the x64 code models - Eli Bendersky's website explains the various x86-64 code models)
x86-64’s medium code model places some data in “large” data sections, further away from text. clang currently treats all data as large. However, gcc has
-mlarge-data-threshold, which defaults to 65535, meaning gcc treats data smaller than that number of bytes as small, and data larger than that as large. We can use the cheaper small code model instruction sequence to access “small” data and use the more expensive instruction sequence to access “large” data.
With [clang] Add -mlarge-data-threshold for x86_64 medium code model by aeubanks · Pull Request #66839 · llvm/llvm-project · GitHub, we now have
-mlarge-data-threshold in clang. Currently it’s at 0 to match the previous clang behavior of treating all data as large. This RFC is proposing that we match gcc’s default of 65535. You can pass
-mlarge-data-threshold=0 to get the previous clang behavior. Are there any concerns with doing this?