Closed Bug 1484406 Opened 7 years ago Closed 7 years ago

rust-size doesn't understand lld-link binaries

Categories

(Firefox Build System :: General, defect)

defect
Not set
normal

Tracking

(firefox64 fixed)

RESOLVED FIXED
mozilla64
Tracking Status
firefox64 --- fixed

People

(Reporter: away, Assigned: erahm)

References

Details

Attachments

(1 file)

Or maybe this subtraction does something surprising https://github.com/luser/rust-size/blob/master/src/main.rs#L97
Example output for xul.dll: > 04:12:22 INFO - Getting output from command: ['z:\\build\\build\\src\\rust-size\\rust-size.exe', 'z:\\build\\build\\src\\obj-firefox\\dist\\bin\\xul.dll'] > 04:12:22 INFO - Copy/paste: z:\build\build\src\rust-size\rust-size.exe z:\build\build\src\obj-firefox\dist\bin\xul.dll > 04:12:22 INFO - Reading from file tmpfile_stdout > 04:12:22 INFO - Output received: > 04:12:22 INFO - { > 04:12:22 INFO - "Text": { > 04:12:22 INFO - ".00cfg": 32, > 04:12:22 INFO - ".gfids": 56, > 04:12:22 INFO - ".orpc": 46, > 04:12:22 INFO - ".pdata": 1578348, > 04:12:22 INFO - ".rdata": 10756468, > 04:12:22 INFO - ".reloc": 651380, > 04:12:22 INFO - ".rodata": 11708384, > 04:12:22 INFO - ".rsrc": 9424, > 04:12:22 INFO - ".text": 67240293, > 04:12:22 INFO - "_text32": 220440 > 04:12:22 INFO - }, > 04:12:22 INFO - "Data": { > 04:12:22 INFO - ".data": 270336, > 04:12:22 INFO - ".tls": 1024 > 04:12:22 INFO - }, > 04:12:22 INFO - "Bss": { > 04:12:22 INFO - ".bss": 4295580490 > 04:12:22 INFO - } > 04:12:22 INFO - } Seems okay for other binaries: > 04:12:22 INFO - Getting output from command: ['z:\\build\\build\\src\\rust-size\\rust-size.exe', 'z:\\build\\build\\src\\obj-firefox\\dist\\bin\\mozavutil.dll'] > 04:12:22 INFO - Copy/paste: z:\build\build\src\rust-size\rust-size.exe z:\build\build\src\obj-firefox\dist\bin\mozavutil.dll > 04:12:22 INFO - Reading from file tmpfile_stdout > 04:12:22 INFO - Output received: > 04:12:22 INFO - { > 04:12:22 INFO - "Text": { > 04:12:22 INFO - ".00cfg": 32, > 04:12:22 INFO - ".gfids": 8, > 04:12:22 INFO - ".pdata": 3564, > 04:12:22 INFO - ".rdata": 98656, > 04:12:22 INFO - ".reloc": 1824, > 04:12:22 INFO - ".rodata": 32, > 04:12:22 INFO - ".rsrc": 896, > 04:12:22 INFO - ".text": 107638 > 04:12:22 INFO - }, > 04:12:22 INFO - "Data": { > 04:12:22 INFO - ".data": 512 > 04:12:22 INFO - }, > 04:12:22 INFO - "Bss": { > 04:12:22 INFO - ".bss": 55468 > 04:12:22 INFO - } > 04:12:22 INFO - }
Gerald ran into an issue locally which helps narrow things down. It looks like an issue with subtraction as David mentioned in comment 1. It's surprising we have a smaller virtual size for a writable chunk. I'll see if I can narrow down which section it is locally. > $ RUST_BACKTRACE=1 cargo run ..\\..\\obj-mc-dbg\\dist\\bin\\xul.dll > Finished dev [unoptimized + debuginfo] target(s) in 0.10s > Running `target\debug\rust-size.exe '..\..\obj-mc-dbg\dist\bin\xul.dll'` > thread 'main' panicked at 'attempt to subtract with overflow', src\main.rs:97:33 > stack backtrace: > [...] > 9: core::panicking::panic > at C:\projects\rust\src\libcore\panicking.rs:53 > 10: rust_size::sections::{{closure}} > at .\src\main.rs:97 > 11: core::ops::function::impls::{{impl}}::call_once<(goblin::pe::section_table::SectionTable*),closure> > at C:\projects\rust\src\libcore\ops\function.rs:271 > 12: core::option::Option<goblin::pe::section_table::SectionTable*>::map<goblin::pe::section_table::SectionTable*,(alloc::string::String, u64, rust_size::Section),mut closure*> > at C:\projects\rust\src\libcore\option.rs:414 > 13: core::iter::{{impl}}::next<(alloc::string::String, u64, rust_size::Section),core::slice::Iter<goblin::pe::section_table::SectionTable>,closure> > at C:\projects\rust\src\libcore\iter\mod.rs:1326 > 14: alloc::vec::{{impl}}::spec_extend<(alloc::string::String, u64, rust_size::Section),core::iter::Map<core::slice::Iter<goblin::pe::section_table::SectionTable>, closure>> > at C:\projects\rust\src\liballoc\vec.rs:1880 > 15: alloc::vec::{{impl}}::from_iter<(alloc::string::String, u64, rust_size::Section),core::iter::Map<core::slice::Iter<goblin::pe::section_table::SectionTable>, closure>> > at C:\projects\rust\src\liballoc\vec.rs:1863 > 16: alloc::vec::{{impl}}::from_iter<(alloc::string::String, u64, rust_size::Section),core::iter::Map<core::slice::Iter<goblin::pe::section_table::SectionTable>, closure>> > at C:\projects\rust\src\liballoc\vec.rs:1749 > 17: core::iter::iterator::Iterator::collect<core::iter::Map<core::slice::Iter<goblin::pe::section_table::SectionTable>, closure>,alloc::vec::Vec<(alloc::string::String, u64, rust_size::Section)>> > at C:\projects\rust\src\libcore\iter\iterator.rs:1419 > 18: rust_size::sections > at .\src\main.rs:89 > 19: rust_size::real_main > at .\src\main.rs:160 > 20: rust_size::main > at .\src\main.rs:170 > [...] > error: process didn't exit successfully: `target\debug\rust-size.exe ..\..\obj-mc-dbg\dist\bin\xul.dll` (exit code: 101)
It appears to be choking on the '.tls' section which has an on disk size of 1024 and in memory size of 986. Running `gsize` on it just shows a value of 0 for .bss.
This updates the rust-size build to reference the latest version [1] that includes a work-around for calculating the .bss of a PE file that has a writable section with a smaller on-disk size than in-memory size. [1] https://github.com/luser/rust-size/commit/ab659d93b1faba95307df952aefe3fbed3583669
Attachment #9007095 - Flags: review?(mh+mozilla)
Assignee: nobody → erahm
Status: NEW → ASSIGNED
Comment on attachment 9007095 [details] [diff] [review] Update rust-size version Review of attachment 9007095 [details] [diff] [review]: ----------------------------------------------------------------- Relatedly, could we move this repo under the mozilla project on github?
Attachment #9007095 - Flags: review?(mh+mozilla) → review+
(In reply to Mike Hommey [:glandium] from comment #6) > Comment on attachment 9007095 [details] [diff] [review] > Update rust-size version > > Review of attachment 9007095 [details] [diff] [review]: > ----------------------------------------------------------------- > > Relatedly, could we move this repo under the mozilla project on github? Filed https://github.com/luser/rust-size/issues/2, presumably Ted can move it.
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla64
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: