alexcrichton transferred Issue #539:
Looking at a recent-ish Firefox nightly, I see the following:
# Look at x86 cranelift symbols, sorted by (descending) size, in the .data.rel.ro section. froydnj@hawkeye:~$ readelf -sW firefox/libxul.so|grep cranelift |sort -k 3 -g -r |awk '$7 == 27 { print }' |grep OBJECT |grep x86 123872: 0000000007342048 9480 OBJECT LOCAL DEFAULT 27 _ZN17cranelift_codegen3isa3x8610enc_tables18RECIPE_CONSTRAINTS17h10c82bc0de555a21E 123849: 0000000007344550 3792 OBJECT LOCAL DEFAULT 27 _ZN17cranelift_codegen3isa3x8610enc_tables12RECIPE_NAMES17h54e6a911fe6097bbE 123866: 0000000007345c20 1896 OBJECT LOCAL DEFAULT 27 _ZN17cranelift_codegen3isa3x8610enc_tables17RECIPE_PREDICATES17hc3712077e222c860E 123908: 0000000007347da0 408 OBJECT LOCAL DEFAULT 27 _ZN17cranelift_codegen3isa3x868settings11DESCRIPTORS17h03dfd2ae0adf323dE 123854: 0000000007346388 120 OBJECT LOCAL DEFAULT 27 _ZN17cranelift_codegen3isa3x8610enc_tables15INST_PREDICATES17h3a3bab86e4a3b3e7E 123911: 0000000007347f38 96 OBJECT LOCAL DEFAULT 27 _ZN17cranelift_codegen3isa3x868settings8TEMPLATE17hdfd5aa2b6a7f01ecE 123922: 0000000007341ea8 48 OBJECT LOCAL DEFAULT 27 _ZN17cranelift_codegen3isa3x869registers9GPR8_DATA17h4c7c028be6f5b4d8E 123921: 0000000007341f68 48 OBJECT LOCAL DEFAULT 27 _ZN17cranelift_codegen3isa3x869registers9FPR8_DATA17h4d3540abe0a3bbe2E 123920: 0000000007341e18 48 OBJECT LOCAL DEFAULT 27 _ZN17cranelift_codegen3isa3x869registers9FLAG_DATA17h06234297cfb01581E 123919: 0000000007341f38 48 OBJECT LOCAL DEFAULT 27 _ZN17cranelift_codegen3isa3x869registers9ABCD_DATA17h231c9e2f56f02113E 123918: 0000000007341db8 48 OBJECT LOCAL DEFAULT 27 _ZN17cranelift_codegen3isa3x869registers8GPR_DATA17h327360c70468dbffE 123917: 0000000007341de8 48 OBJECT LOCAL DEFAULT 27 _ZN17cranelift_codegen3isa3x869registers8FPR_DATA17h3d44028fd0ecbabdE 123915: 0000000007341f08 48 OBJECT LOCAL DEFAULT 27 _ZN17cranelift_codegen3isa3x869registers25GPR8_ZERO_DEREF_SAFE_DATA17h743615e457b73283E 123914: 0000000007341e78 48 OBJECT LOCAL DEFAULT 27 _ZN17cranelift_codegen3isa3x869registers24GPR_ZERO_DEREF_SAFE_DATA17h82d7795ce9382dfbE 123913: 0000000007341ed8 48 OBJECT LOCAL DEFAULT 27 _ZN17cranelift_codegen3isa3x869registers20GPR8_DEREF_SAFE_DATA17h460e84f7bb9ca949E 123912: 0000000007341e48 48 OBJECT LOCAL DEFAULT 27 _ZN17cranelift_codegen3isa3x869registers19GPR_DEREF_SAFE_DATA17had1b3296ef50e9ebE 123916: 0000000007341f98 32 OBJECT LOCAL DEFAULT 27 _ZN17cranelift_codegen3isa3x869registers4INFO17h2a2b91216d7265ffE 123855: 0000000007345c00 32 OBJECT LOCAL DEFAULT 27 _ZN17cranelift_codegen3isa3x8610enc_tables16LEGALIZE_ACTIONS17h4ddebdf4d5a40777EThere's about 15k of symbols in
cranelift_codegen::isa::x86
that live in.data.rel.ro
, which renders them non-shareable. For Firefox's purposes, we'd really like to minimize the amount of data that lives in.data.rel.ro
, moving it to.rodata
if at all possible.The usual problem for data winding up in
.data.rel.ro
is data structures that contain slices, and indeed, forRECIPE_CONSTRAINTS
, theRecipeConstraints
structure has a couple slices in it. I haven't looked atRECIPE_NAMES
,RECIPE_PREDICATES
, and so forth, but I assume the problems are similar there.It would be great if things were shuffled around somehow so the data associated with these symbols could live in
.rodata
. unicode-rs/unicode-normalization#14 is one example of how we addressed this in another Rust library; I might have time to implement the same changes here, not sure though. We don't necessarily have to address all of these, but addressing the top five or so would make a big difference./cc @EricRahm
Last updated: Dec 23 2024 at 14:03 UTC