Skip to content

Shorten symbols by truncating the hash. #11247

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 1, 2014
Merged

Conversation

eddyb
Copy link
Member

@eddyb eddyb commented Dec 31, 2013

No description provided.

@alexcrichton
Copy link
Member

I may have missed the conversion, but why use base64 over hex? 64bits == 16 characters which doesn't seem that large (it's how big all the hashes used to be anyway).

@eddyb
Copy link
Member Author

eddyb commented Dec 31, 2013

The symbol length has been reduced and the hash is easier to ignore:

> nm --defined-only ./x*/stage1/lib/r*/x*/l*/libstd-*.so | grep -v 'expr_fn\|\.\.\|GCC' | c++filt | sort -R | head
0000000000109ac0 T fmt::rt::Piece::Piece::Argument::hqMrQ_xr.r5s$::v0.9.pre
0000000000121a14 R libc::consts::os::posix88::EKEYREJECTED::h.vIV0_KaexA$aE::v0.9.pre
00000000000863f0 T i32::Add$i32::add::h8W3PoE86stU$43aR::v0.9.pre
0000000000078520 T rt::global_heap::exchange_free_::hyPa8N3dH0UY$aZ::v0.9.pre
000000000008dba0 T u32::Default$u32::default::hITfgkj1OV_c$kOar::v0.9.pre
00000000000b0e10 T num::FromPrimitive$uint::from_uint::hZzVzAOkD6_w$JVa0::v0.9.pre
0000000000092390 T f32::Real$f32::ln_2::hcJ17WXwyr0E$BJaX::v0.9.pre
000000000008c230 T u16::CheckedDiv$u16::checked_div::htJ2QjTyy09I$jYaa::v0.9.pre
00000000000b0e90 T num::FromPrimitive$uint::from_u16::hKTglBKguS2A$JVa2::v0.9.pre
0000000000078600 t u32::glue_take::hRNP0EbNP9Rk$az

I'm considering rewriting back::link::sanitize to output C++ mangling-like encodings, to make symbols like these nicer:

_$LP$option..Option$LT$io..pipe..PipeStream$GT$$C$comm..SharedChan$LT$$LP$int$C$$UP$$x5bu8$x5d$RP$$GT$$RP$::glue_visit::ha2rl8hnzh3E$aY
sync..arc..ArcData$LT$sync..mpsc_queue..State$LT$$LP$int$C$$UP$$x5bu8$x5d$RP$$C$comm..Packet$GT$$GT$::glue_visit::hWLcjb4N7zVk$ab
_$UP$$SP$condition..Handler$LT$io..IoError$C$$LP$$RP$$GT$::glue_free::hszG7fICVwzI$ab

Though it will be hard without having the original (nested) type information (sanitize just gets a string now).

@eddyb
Copy link
Member Author

eddyb commented Dec 31, 2013

@alexcrichton It's not that bad with hex instead of base64, it seems (though you can tell the difference):

> nm --defined-only ./x*/stage1/lib/r*/x*/l*/libstd-*.so | grep -v 'expr_fn\|\.\.\|GCC\|str\|vtable' | c++filt | sort -R | head
0000000000098880 T f64::log2::h538bc4f03a4e4f8daM::v0.9.pre
0000000000111d60 T repr::Repr$int::write_repr::hffda9a03775c36faBsad::v0.9.pre
00000000000ffec0 t io::Reader::bytes::h96688705a1fe48ecam::v0.9.pre
0000000000124acc R libc::consts::os::sysconf::_SC_SYNCHRONIZED_IO::h757c915c4e1bfec5aI::v0.9.pre
00000000000b4b40 T num::FromPrimitive$u64::from_f32::hbebb3eb62bb65c6cMlaQ::v0.9.pre
00000000000b5ad0 T to_bytes::IterBytes$f32::iter_bytes::hdc01dc1017ca4c92P2ax::v0.9.pre
0000000000099b90 T f64::Exponential$f64::exp2::h165ce8970a5024afL4ay::v0.9.pre
0000000000093b70 T f32::atan::h835d81dcdb9e8aecaD::v0.9.pre
0000000000124ad8 R libc::consts::os::sysconf::_SC_MEMLOCK::h757c915c4e1bfec5aU::v0.9.pre
0000000000125cb0 R io::GroupWrite::hb29fe352308d0a41aF::v0.9.pre

@bors bors closed this Jan 1, 2014
@bors bors merged commit 4e75265 into rust-lang:master Jan 1, 2014
@eddyb eddyb deleted the symbol-cleanup branch January 1, 2014 12:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants