This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[GOLD][PATCH] Fix potential object locking problems in ARM backend.


Hi,

   This patch fixes a number of potential object locking problems in
the ARM backend.  These problems are not real in the send that the
changed code run single-threaded.  I changed the interface of
Target::relax to pass the layout task so that target specific
relaxation code can use it to lock objects.  There are a few places
where we used to just access objects without locking but there is no
convenient way of passing a task.  I changed those places to use
cached data created earlier when locking is possible.  That increases
the memory foot-print a bit unfortunately.  This is tested by running
the full test suite for arm-linux-gnueabi in qemu.  All but 3 tests
passed and I believe those 3 were existing failure related to RELRO
segment.

  I did not include Cary's assert in this patch because I am not sure
if the other back-ends and uncommonly used code are all correctly
locking objects.

-Doug


2010-11-08  Doug Kwan  <dougkwan@google.com>

        * arm.cc (Arm_exidx_merge_section::build_contents): New method.
        (Arm_exidx_merge_section::section_contents_): New data member.
        (Arm_input_section::Arm_input_section): Initialize original_contents_.
        (Arm_input_section::~Arm_input_section): De-allocate memory.
        (Arm_input_section::original_contents_): New data member.
        (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
        in parameters instead of calling Object::section_contents without
        locking.
        (Arm_output_section::group_section): New parameter TASK.  Pass it
        to callees that need locking objects.
        (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
        to lock EXIDX input sections. Call
        Arm_exidx_merged_section::build_contents to create merged section
        contents.
        (Arm_output_section::create_stub_group): New parameter TASK.  Use it
        to lock object of stub table owner.
        (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
        TEXT_SIZE to initialize data member TEXT_SIZE_.
        (Arm_exidx_input_section::addralign): Fix typo in comment.
        (Arm_exidx_input_section::text_size): New method.
        (Target_arm::do_relax): New parameter TASK.  Pass it to callees
        that require locking objects.  Lock objects before scanning for stubs
        and updating local symbols.
        (Arm_input_section<big_endian>::init): Copy contents of original
        input section.
        (Arm_input_section<big_endian>::do_write): Use saved contents of
        original input section instead of calling Object::section_contents
        without locking.
        (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
        size without calling Object::section_size().
        (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
        for size.  Allocate a buffer for merged EXIDX entries.
        (Arm_exidx_merged_section::build_contents): New method.
        (Arm_exidx_merged_section::do_write): Move merge section contents
        building code to Arm_exidx_merged_section::build_contetns.  Write
        out contetns in buffer instead of building it on the fly.
        (Arm_relobj::make_exidx_input_section): Also pass text section size
        to Arm_exidx_input_section constructor.
        (Arm_relobj::do_read_symbols): Fix memory leak.
        (Arm_dynobj::do_read_symbols): Fix memory leak.
        * layout.cc (Layout::finalize): Pass TASK to Target::relax().
        * target.h: (class Task): Add forward declaration.
        (Target::relax): Add new parameter TASK and pass it to
        Target::do_relax().
        (Target::do_relax):: New parameter TASK.

Attachment: patch-locking.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]