Summary: | gold crashes when generating build-id for a large .so | ||
---|---|---|---|
Product: | binutils | Reporter: | Guillaume Morin <guillaume> |
Component: | gold | Assignee: | Cary Coutant <ccoutant> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | ian, jim |
Priority: | P2 | ||
Version: | 2.24 | ||
Target Milestone: | --- | ||
Host: | Target: | ||
Build: | Last reconfirmed: |
Description
Guillaume Morin
2015-01-08 20:00:21 UTC
Thanks for the excellent analysis! I'm guessing you're also using --compress-debug-sections. Turning that off would also be another workaround. Cary, you are correct, I am using --compress-debug-sections here. I have encountered this problem, too. Is a patch coming soon, or should I pursue a workaround? Thanks for tending binutils! > I have encountered this problem, too.
> Is a patch coming soon, or should I pursue a workaround?
I've been working on fixing this, but it's going to take some time.
Workarounds are to use a different --build-id option (anything but "tree"), or to turn off --compress-debug-sections. (You can always use objcopy to compress the debug sections after the link if you need that.)
Glad you're on it. Thanks for the info. The master branch has been updated by Cary Coutant <ccoutant@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=9c7fe3c5c2c9e4c3571c253cf77341e3f6adf94c commit 9c7fe3c5c2c9e4c3571c253cf77341e3f6adf94c Author: Cary Coutant <ccoutant@gmail.com> Date: Tue Jun 2 09:45:24 2015 -0700 PR 17819: Fix --build-id=tree when using --compress-debug-sections. When --build-id=tree is selected, gold would schedule a set of tasks to run to compute md5 hashes in parallel on chunks of the file. The scheduling was done before the Write_after_input_sections_task ran, so if we are compressing debug sections, the output file will change size and be remapped to a new address, sometimes causing the build id computation to crash, but even when it doesn't crash, it wouldn't include the debug information in the hash computation. This patch delays the scheduling of the md5 tasks until after Write_after_input_sections_task. gold/ PR gold/17819 * gold.cc (queue_final_tasks): When --build-id=tree, queue a separate task to schedule the build id computation. * layout.cc (Hash_task::Hash_task): Remove build_id_blocker, add Output_file and offset. (Hash_task::run): Get and release the input views. (Hash_task::is_runnable): Always return NULL (always runnable). (Layout::queue_build_id_tasks): Remove. (Layout::write_build_id): Add array_of_hashes and size_of_hashes parameters; use them instead of class members. (Build_id_task_runner::run): New function. (Close_task_runner::run): Pass array_of_hashes and size_of_hashes to write_build_id. * layout.h (Layout::queue_build_id_tasks): Remove. (Layout::write_build_id): Add array_of_hashes and size_of_hashes parameters. (Layout::array_of_hashes_): Remove. (Layout::size_of_array_of_hashes_): Remove. (Layout::input_view_): Remove. (Build_id_task_runner): New class. (Close_task_runner::Close_task_runner): Add array_of_hashes and size_of_hashes parameters. (Close_task_runner::array_of_hashes_): New data member. (Close_task_runner::size_of_hashes_): New data member. * testsuite/Makefile.am (flagstest_compress_debug_sections_and_build_id_tree): New test. * testsuite/Makefile.in: Regenerate. Fixed on trunk. |