This is the mail archive of the 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]

Re: Map "" and ".text.unlikely" input section prefixes to separate output sections.

On Fri, Dec 21, 2012 at 10:29 AM, H.J. Lu <> wrote:
> On Fri, Dec 21, 2012 at 7:46 AM, Ian Lance Taylor <> wrote:
>> On Fri, Dec 21, 2012 at 7:38 AM, H.J. Lu <> wrote:
>>> On Thu, Dec 20, 2012 at 10:26 PM, Ian Lance Taylor <> wrote:
>>>> On Thu, Dec 20, 2012 at 2:38 PM, Cary Coutant <> wrote:
>>>>> This patch fixes the problems I've been seeing. It sets the "may sort
>>>>> attached input sections" flag for the .text section, which ensures
>>>>> that we track all input sections for that output section. The problem
>>>>> was that we can't start tracking input sections in mid-stream. We may
>>>>> not want to do this unconditionally for .text, so maybe you'll want a
>>>>> linker option to enable this reordering?
>>>> Thanks for tracking this down.
>>>> It would be nice to avoid doing it for .text, but I don't see how to
>>>> do that while remaining compatible with GNU ld.
>>>> I reimplemented this code in a different way that I think fits in
>>>> better with the existing section ordering code.  Committed to
>>>> mainline.
>>>> Ian
>>>> 2012-12-20  Ian Lance Taylor  <>
>>>>         * (Layout::special_ordering_of_input_section): New
>>>>         function.
>>>>         (Layout::layout): If input section requires special ordering, must
>>>>         sort input sections.
>>>>         (Layout::make_output_section): May sort .text input sections.
>>>>         (Layout::is_section_name_prefix_grouped): Remove.
>>>>         * layout.h (class Layout): Declare
>>>>         special_ordering_of_input_section.  Don't declare
>>>>         is_section_name_prefix_grouped.
>>>>         * (Output_section::add_input_section): Revert last
>>>>         change.
>>>>         (Output_section::Input_section_sort::match_file_name): Don't crash
>>>>         if called on output section data.
>>>>         (Output_section::Input_section_sort_compare): Sort based on
>>>>         special ordering.
>>>>         (Output_section::Input_section_sort_section_order_index_compare):
>>>>         Revert last patch.
>>>>         (Output_section::sort_attached_input_sections): Likewise.
>>> It doesn't fix regressions with x32 gold:
>>> `echo g++ -mx32  -W -Wall    -Werror -D_LARGEFILE_SOURCE
>>> -D_FILE_OFFSET_BITS=64 -fmerge-constants   -static-libstdc++
>>> -static-libgcc  -o incremental_test_2 | sed -e
>>> 's/-Wp,-D_FORTIFY_SOURCE=[0-9][0-9]*//'` -Wl,--incremental-update
>>> -Bgcctestdir/ two_file_test_tmp_2.o two_file_test_1b_ndebug.o
>>> two_file_test_2_ndebug.o two_file_test_main_ndebug.o
>>> gcctestdir/ld: internal error in convert_types, at
>>> /export/gnu/import/git/binutils/gold/gold.h:192
>>> collect2: error: ld returned 1 exit status
>>> make[3]: *** [incremental_test_2] Error 1
>> I don't really see how that could be related to this patch series.  I
>> don't have an x32 system so I also can't debug this.  Can you show a
>> backtrace at the point of failure?  You can set a breakpoint on
>> gold::do_gold_unreachable.
>> Ian

Backtrace with -O0:

(gdb) bt
#0  gold::do_gold_unreachable (
    filename=0x8367b0 "/export/gnu/import/git/binutils/gold/gold.h",
    function=0x83781b <unsigned int gold::convert_types<unsigned int,
unsigned long long>(unsigned long long)::__FUNCTION__>
    at /export/gnu/import/git/binutils/gold/
#1  0x0043f4d4 in gold::convert_types<unsigned int, unsigned long long> (
    at /export/gnu/import/git/binutils/gold/gold.h:192
#2  0x004e4eb1 in gold::Sized_relobj<32, false>::do_set_section_offset (
    this=0xc83160, shndx=7, off=18446744073709551050)
    at /export/gnu/import/git/binutils/gold/object.h:1937
#3  0x004d95af in gold::Relobj::set_section_offset (this=0xc83160, shndx=7,
    at /export/gnu/import/git/binutils/gold/object.h:1172
#4  0x00680bdb in
(this=0xffff8a90, address=4195370, file_offset=250,
    at /export/gnu/import/git/binutils/gold/
#5  0x00690eec in gold::Output_section::add_input_section<32, false> (
    this=0xc5f350, layout=0xffff9670, object=0xc83160, shndx=7,
    secname=0xf7ff867e ".text._Z4f13iv", shdr=..., reloc_shndx=0,
    at /export/gnu/import/git/binutils/gold/
---Type <return> to continue, or q <return> to quit---
#6  0x0061ed1c in gold::Layout::layout<32, false> (this=0xffff9670,
    object=0xc83160, shndx=7, name=0xf7ff867e ".text._Z4f13iv", shdr=...,
    reloc_shndx=0, off=0xffff8c80)
    at /export/gnu/import/git/binutils/gold/
#7  0x0063987d in gold::Sized_relobj_file<32, false>::layout_section (
    this=0xc83160, layout=0xffff9670, shndx=7,
    name=0xf7ff867e ".text._Z4f13iv", shdr=..., reloc_shndx=0, reloc_type=0)
    at /export/gnu/import/git/binutils/gold/
#8  0x00636065 in gold::Sized_relobj_file<32, false>::do_layout (
    this=0xc83160, symtab=0xffff94f0, layout=0xffff9670, sd=0xc61ad0)
    at /export/gnu/import/git/binutils/gold/

#9  0x00578ab9 in gold::Object::layout (this=0xc83160, symtab=0xffff94f0,
    layout=0xffff9670, sd=0xc61ad0)
    at /export/gnu/import/git/binutils/gold/object.h:570
#10 0x006e641c in gold::Add_symbols::run (this=0xc83440)
    at /export/gnu/import/git/binutils/gold/
#11 0x0076d0c7 in gold::Workqueue::find_and_run_task (this=0xffff92d0,
    thread_number=0) at /export/gnu/import/git/binutils/gold/
#12 0x0076d713 in gold::Workqueue::process (this=0xffff92d0, thread_number=0)
    at /export/gnu/import/git/binutils/gold/
#13 0x0040347a in main (argc=37, argv=0xffffcbb4)
    at /export/gnu/import/git/binutils/gold/


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