Discussion:
Map ".text.hot" and ".text.unlikely" input section prefixes to separate output sections.
Sriraman Tallam
2011-09-13 21:58:33 UTC
Permalink
Hi,

Sections prefixed with ".text.hot", ".text.unlikely" and
".text.startup" should map to separate output sections so that they
can be grouped together. The following simple patch does this. Alright
to submit?

Thanks,
-Sri.

* layout.cc (Layout::section_name_mapping): Map ".text.hot" and
".text.unlikely", and ".text.startup" input section prefixes to
separate output sections.

Index: layout.cc
===================================================================
RCS file: /cvs/src/src/gold/layout.cc,v
retrieving revision 1.219
diff -u -r1.219 layout.cc
--- layout.cc 27 Aug 2011 01:28:17 -0000 1.219
+++ layout.cc 13 Sep 2011 21:55:36 -0000
@@ -4437,6 +4437,9 @@
#define MAPPING_INIT(f, t) { f, sizeof(f) - 1, t, sizeof(t) - 1 }
const Layout::Section_name_mapping Layout::section_name_mapping[] =
{
+ MAPPING_INIT(".text.hot.", ".text.hot"),
+ MAPPING_INIT(".text.unlikely.", ".text.unlikely"),
+ MAPPING_INIT(".text.startup.", ".text.startup"),
MAPPING_INIT(".text.", ".text"),
MAPPING_INIT(".rodata.", ".rodata"),
MAPPING_INIT(".data.rel.ro.local", ".data.rel.ro.local"),
Ian Lance Taylor
2011-09-13 22:32:32 UTC
Permalink
Sriraman Tallam <***@google.com> writes:

> Sections prefixed with ".text.hot", ".text.unlikely" and
> ".text.startup" should map to separate output sections so that they
> can be grouped together. The following simple patch does this. Alright
> to submit?

The GNU linker puts all .text.hot input sections into the .text output
section. It just groups them together. I would prefer to do that in
gold, too. Your patch would create a .text.hot output section, which is
not what I would like to see.

Ideally gold should group all input sections with the same name
together, regardless of what output section they are going to. I
believe this can be done in Output_section::add_input_section if we
preserve the name in Input_section_list. The main drawback is that this
may mean giving up on the current optimization of not building an
Input_section_list.

Ian
Ian Lance Taylor
2012-11-17 01:19:01 UTC
Permalink
On Wed, Nov 14, 2012 at 5:06 PM, Sriraman Tallam <***@google.com> wrote:
>
> I finally got around to doing this in a way you suggested a while
> back, that is sorting text sections within the output section rather
> than creating separate output sections. Patch attached.

That is clever, and I admit it is more or less what GNU ld does, but I
don't think it's the right approach. I don't want us to have to add a
special case to the linker every time somebody thinks of a new idea in
the compiler--that is the problem with the approach that GNU ld is
using.

I would rather do this:

>> Ideally gold should group all input sections with the same name
>> together, regardless of what output section they are going to. I
>> believe this can be done in Output_section::add_input_section if we
>> preserve the name in Input_section_list. The main drawback is that this
>> may mean giving up on the current optimization of not building an
>> Input_section_list.

Here is one way to do it. Add a hash table to Output_section mapping
input section names to section order indexes. in
Output_section::add_input_section, if the input section name is not
the same as the output section name, look up the input section name in
the new hash table. If it is there, use the section order index. If
it is not there, pick a new section order index, and insert it in the
hash table. Set the sort field as needed. Throw away all the hash
tables in Layout::finalize--we won't need them after that, and they
may be big.

If you implement this, please measure the effect on linker time for
some big files. if it is too slow we may not be able to do it.

Ian
Sriraman Tallam
2012-11-19 20:26:11 UTC
Permalink
Hi Ian,

On Fri, Nov 16, 2012 at 5:19 PM, Ian Lance Taylor <***@google.com> wrote:
> On Wed, Nov 14, 2012 at 5:06 PM, Sriraman Tallam <***@google.com> wrote:
>>
>> I finally got around to doing this in a way you suggested a while
>> back, that is sorting text sections within the output section rather
>> than creating separate output sections. Patch attached.
>
> That is clever, and I admit it is more or less what GNU ld does, but I
> don't think it's the right approach. I don't want us to have to add a
> special case to the linker every time somebody thinks of a new idea in
> the compiler--that is the problem with the approach that GNU ld is
> using.
>
> I would rather do this:
>
>>> Ideally gold should group all input sections with the same name
>>> together, regardless of what output section they are going to. I
>>> believe this can be done in Output_section::add_input_section if we
>>> preserve the name in Input_section_list. The main drawback is that this
>>> may mean giving up on the current optimization of not building an
>>> Input_section_list.
>
> Here is one way to do it. Add a hash table to Output_section mapping
> input section names to section order indexes. in
> Output_section::add_input_section, if the input section name is not
> the same as the output section name, look up the input section name in
> the new hash table.

Do you mean looking up the entire input section name or just the
interesting prefix? If it is the entire name I do not fully follow how
this would group sections with the same prefix.

If it is just the prefix, I think the issue with this approach is what
to look for in the hash table when presented with a section name. Lets
say function foo is in section ".text.hot.foo.isra.4". How do we tell
".text.hot" is interesting and not ".text.hot.foo.isra" quickly?,
without having to look up the hash table multiple times.

Thanks,
-Sri.


If it is there, use the section order index. If
> it is not there, pick a new section order index, and insert it in the
> hash table. Set the sort field as needed. Throw away all the hash
> tables in Layout::finalize--we won't need them after that, and they
> may be big.
>
> If you implement this, please measure the effect on linker time for
> some big files. if it is too slow we may not be able to do it.
>
> Ian
Alan Modra
2012-11-19 22:52:23 UTC
Permalink
On Fri, Nov 16, 2012 at 05:19:01PM -0800, Ian Lance Taylor wrote:
> On Wed, Nov 14, 2012 at 5:06 PM, Sriraman Tallam <***@google.com> wrote:
> >> Ideally gold should group all input sections with the same name

I strongly disagree. Grouping sections with the same name is a bad
idea, unless the name gives you some infomation from the compiler (as
it does with .text.hot* et al). The problem with grouping sections
with the same name is that with -ffunction-sections objects, you'll
potentially move functions away from their callers, losing cache
locality. The canonical example is a number of object files with
static "setup" functions. These will all have code in .text.setup,
but there is no good reason to group these sections.

--
Alan Modra
Australia Development Lab, IBM
Ian Lance Taylor
2012-11-20 00:52:16 UTC
Permalink
On Mon, Nov 19, 2012 at 2:52 PM, Alan Modra <***@gmail.com> wrote:
> On Fri, Nov 16, 2012 at 05:19:01PM -0800, Ian Lance Taylor wrote:
>> On Wed, Nov 14, 2012 at 5:06 PM, Sriraman Tallam <***@google.com> wrote:
>> >> Ideally gold should group all input sections with the same name
>
> I strongly disagree. Grouping sections with the same name is a bad
> idea, unless the name gives you some infomation from the compiler (as
> it does with .text.hot* et al). The problem with grouping sections
> with the same name is that with -ffunction-sections objects, you'll
> potentially move functions away from their callers, losing cache
> locality. The canonical example is a number of object files with
> static "setup" functions. These will all have code in .text.setup,
> but there is no good reason to group these sections.

That is a good point.

Unfortunately it leaves us adding more special cases for section
names, which I really dislike. Is there any happy medium?

Ian
Alan Modra
2012-11-20 02:03:52 UTC
Permalink
On Mon, Nov 19, 2012 at 04:52:16PM -0800, Ian Lance Taylor wrote:
> Unfortunately it leaves us adding more special cases for section
> names, which I really dislike. Is there any happy medium?

I understand the dislike, but I don't see an alternative. We should
have spoken up before the hot/cold support was added to gcc. I also
dislike the fact that -ffunction-sections can generate section names
that match the names chosen for hot/cold sections.

--
Alan Modra
Australia Development Lab, IBM
H.J. Lu
2012-11-20 03:06:02 UTC
Permalink
On Mon, Nov 19, 2012 at 6:03 PM, Alan Modra <***@gmail.com> wrote:
> On Mon, Nov 19, 2012 at 04:52:16PM -0800, Ian Lance Taylor wrote:
>> Unfortunately it leaves us adding more special cases for section
>> names, which I really dislike. Is there any happy medium?
>
> I understand the dislike, but I don't see an alternative. We should
> have spoken up before the hot/cold support was added to gcc. I also
> dislike the fact that -ffunction-sections can generate section names
> that match the names chosen for hot/cold sections.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24201

--
H.J.
Cary Coutant
2013-07-15 17:57:20 UTC
Permalink
>>> Unfortunately it leaves us adding more special cases for section
>>> names, which I really dislike. Is there any happy medium?
>>
>> I understand the dislike, but I don't see an alternative. We should
>> have spoken up before the hot/cold support was added to gcc. I also
>> dislike the fact that -ffunction-sections can generate section names
>> that match the names chosen for hot/cold sections.
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24201

Is it truly too late to fix this? It would help to have a more
rigorous way of naming these sections. I'd like to modify HJ's old
idea from that PR slightly, and suggest a naming scheme like this when
-ffunction-sections is on:

.text.class.function

Where "class" can be "hot", "unlikely", "startup", "exit", or just the
empty string. With -ffunction-sections off, the ".function" would be
omitted and names would look like they do now. (The same scheme can be
applied to ".data" and other sections.)

The linkers would assign input sections to output sections by the
first component, group input sections within the output section by the
second component, and ignore the third component (with the option to
provide explicit section reordering options based on the full input
section name).

-cary
Sriraman Tallam
2012-11-20 17:50:39 UTC
Permalink
On Mon, Nov 19, 2012 at 4:52 PM, Ian Lance Taylor <***@google.com> wrote:
> On Mon, Nov 19, 2012 at 2:52 PM, Alan Modra <***@gmail.com> wrote:
>> On Fri, Nov 16, 2012 at 05:19:01PM -0800, Ian Lance Taylor wrote:
>>> On Wed, Nov 14, 2012 at 5:06 PM, Sriraman Tallam <***@google.com> wrote:
>>> >> Ideally gold should group all input sections with the same name
>>
>> I strongly disagree. Grouping sections with the same name is a bad
>> idea, unless the name gives you some infomation from the compiler (as
>> it does with .text.hot* et al). The problem with grouping sections
>> with the same name is that with -ffunction-sections objects, you'll
>> potentially move functions away from their callers, losing cache
>> locality. The canonical example is a number of object files with
>> static "setup" functions. These will all have code in .text.setup,
>> but there is no good reason to group these sections.
>
> That is a good point.
>
> Unfortunately it leaves us adding more special cases for section
> names, which I really dislike. Is there any happy medium?

gold now has multiple ways to reorder functions. There is the
--section-ordering-file option, there is the plugin interface, and
also the reordering via linker scripts. So, instead of adding another
way to sort text sections, I was wondering instead if we could just
use the --section-ordering-file mechanism. I can initialize the data
structures to do this ordering by default. Is this a reasonable idea?

Thanks,
-Sri.


>
> Ian
Ian Lance Taylor
2012-11-20 18:00:46 UTC
Permalink
On Tue, Nov 20, 2012 at 9:50 AM, Sriraman Tallam <***@google.com> wrote:
> On Mon, Nov 19, 2012 at 4:52 PM, Ian Lance Taylor <***@google.com> wrote:
>> On Mon, Nov 19, 2012 at 2:52 PM, Alan Modra <***@gmail.com> wrote:
>>> On Fri, Nov 16, 2012 at 05:19:01PM -0800, Ian Lance Taylor wrote:
>>>> On Wed, Nov 14, 2012 at 5:06 PM, Sriraman Tallam <***@google.com> wrote:
>>>> >> Ideally gold should group all input sections with the same name
>>>
>>> I strongly disagree. Grouping sections with the same name is a bad
>>> idea, unless the name gives you some infomation from the compiler (as
>>> it does with .text.hot* et al). The problem with grouping sections
>>> with the same name is that with -ffunction-sections objects, you'll
>>> potentially move functions away from their callers, losing cache
>>> locality. The canonical example is a number of object files with
>>> static "setup" functions. These will all have code in .text.setup,
>>> but there is no good reason to group these sections.
>>
>> That is a good point.
>>
>> Unfortunately it leaves us adding more special cases for section
>> names, which I really dislike. Is there any happy medium?
>
> gold now has multiple ways to reorder functions. There is the
> --section-ordering-file option, there is the plugin interface, and
> also the reordering via linker scripts. So, instead of adding another
> way to sort text sections, I was wondering instead if we could just
> use the --section-ordering-file mechanism. I can initialize the data
> structures to do this ordering by default. Is this a reasonable idea?

Sure, if it works, and if using the --section-ordering-file option
doesn't discard the defaults unnecessarily.

Ian
Sriraman Tallam
2012-11-21 03:08:29 UTC
Permalink
Hi Ian,

On Tue, Nov 20, 2012 at 10:00 AM, Ian Lance Taylor <***@google.com> wrote:
> On Tue, Nov 20, 2012 at 9:50 AM, Sriraman Tallam <***@google.com> wrote:
>> On Mon, Nov 19, 2012 at 4:52 PM, Ian Lance Taylor <***@google.com> wrote:
>>> On Mon, Nov 19, 2012 at 2:52 PM, Alan Modra <***@gmail.com> wrote:
>>>> On Fri, Nov 16, 2012 at 05:19:01PM -0800, Ian Lance Taylor wrote:
>>>>> On Wed, Nov 14, 2012 at 5:06 PM, Sriraman Tallam <***@google.com> wrote:
>>>>> >> Ideally gold should group all input sections with the same name
>>>>
>>>> I strongly disagree. Grouping sections with the same name is a bad
>>>> idea, unless the name gives you some infomation from the compiler (as
>>>> it does with .text.hot* et al). The problem with grouping sections
>>>> with the same name is that with -ffunction-sections objects, you'll
>>>> potentially move functions away from their callers, losing cache
>>>> locality. The canonical example is a number of object files with
>>>> static "setup" functions. These will all have code in .text.setup,
>>>> but there is no good reason to group these sections.
>>>
>>> That is a good point.
>>>
>>> Unfortunately it leaves us adding more special cases for section
>>> names, which I really dislike. Is there any happy medium?
>>
>> gold now has multiple ways to reorder functions. There is the
>> --section-ordering-file option, there is the plugin interface, and
>> also the reordering via linker scripts. So, instead of adding another
>> way to sort text sections, I was wondering instead if we could just
>> use the --section-ordering-file mechanism. I can initialize the data
>> structures to do this ordering by default. Is this a reasonable idea?
>
> Sure, if it works, and if using the --section-ordering-file option
> doesn't discard the defaults unnecessarily.

I have attached the new patch. This is slightly different from the old
patch in that:

* It does not create a new sort method. The existing method for
section_ordering is modified.
* It sorts text sections only when it finds atleast one section with
the special prefix.

Thanks,
-Sri.

>
> Ian
Ian Lance Taylor
2012-12-19 01:39:43 UTC
Permalink
On Tue, Nov 20, 2012 at 7:08 PM, Sriraman Tallam <***@google.com> wrote:

> * layout.cc (Layout::is_section_name_prefix_grouped): New function.
> * layout.h (Layout::is_section_name_prefix_grouped): New function.
> * output.cc (Output_section::add_input_section): Check if section
> name contains special prefix. Keep input sections to sort such
> sections.
> (Output_section::Input_section_sort_section_order_index_compare
> ::operator()): Group sections according to prefixes.
> * (Output_section::sort_attached_input_sections): Add condition
> to Input_section_entry constructor call.
> * testsuite/Makefile.am (text_section_grouping): New test.
> * testsuite/Makefile.in: Regenerate.
> * testsuite/text_section_grouping.cc: New file.
> * testsuite/text_section_grouping.sh: New file.


> + // If it is a text section use the following order:
> + // .text.unlikely, .text.startup, .text.hot.
> + const char* section_prefix [] =
> + {
> + ".text.unlikely",
> + ".text.startup",
> + ".text.hot"
> + };

Please mention in the comment that this should match
Layout::is_section_name_prefix_grouped.

This is OK with that change.

Thanks, and sorry for the long delay.

Ian
Sriraman Tallam
2012-12-19 02:57:26 UTC
Permalink
On Tue, Dec 18, 2012 at 5:39 PM, Ian Lance Taylor <***@google.com> wrote:
> On Tue, Nov 20, 2012 at 7:08 PM, Sriraman Tallam <***@google.com> wrote:
>
>> * layout.cc (Layout::is_section_name_prefix_grouped): New function.
>> * layout.h (Layout::is_section_name_prefix_grouped): New function.
>> * output.cc (Output_section::add_input_section): Check if section
>> name contains special prefix. Keep input sections to sort such
>> sections.
>> (Output_section::Input_section_sort_section_order_index_compare
>> ::operator()): Group sections according to prefixes.
>> * (Output_section::sort_attached_input_sections): Add condition
>> to Input_section_entry constructor call.
>> * testsuite/Makefile.am (text_section_grouping): New test.
>> * testsuite/Makefile.in: Regenerate.
>> * testsuite/text_section_grouping.cc: New file.
>> * testsuite/text_section_grouping.sh: New file.
>
>
>> + // If it is a text section use the following order:
>> + // .text.unlikely, .text.startup, .text.hot.
>> + const char* section_prefix [] =
>> + {
>> + ".text.unlikely",
>> + ".text.startup",
>> + ".text.hot"
>> + };
>
> Please mention in the comment that this should match
> Layout::is_section_name_prefix_grouped.
>
> This is OK with that change.

Made the change and committed the patch.

Thanks,
-Sri.

>
> Thanks, and sorry for the long delay.
>
> Ian
Ian Lance Taylor
2012-12-19 19:51:06 UTC
Permalink
On Tue, Dec 18, 2012 at 6:57 PM, Sriraman Tallam <***@google.com> wrote:
> On Tue, Dec 18, 2012 at 5:39 PM, Ian Lance Taylor <***@google.com> wrote:
>> On Tue, Nov 20, 2012 at 7:08 PM, Sriraman Tallam <***@google.com> wrote:
>>
>>> * layout.cc (Layout::is_section_name_prefix_grouped): New function.
>>> * layout.h (Layout::is_section_name_prefix_grouped): New function.
>>> * output.cc (Output_section::add_input_section): Check if section
>>> name contains special prefix. Keep input sections to sort such
>>> sections.
>>> (Output_section::Input_section_sort_section_order_index_compare
>>> ::operator()): Group sections according to prefixes.
>>> * (Output_section::sort_attached_input_sections): Add condition
>>> to Input_section_entry constructor call.
>>> * testsuite/Makefile.am (text_section_grouping): New test.
>>> * testsuite/Makefile.in: Regenerate.
>>> * testsuite/text_section_grouping.cc: New file.
>>> * testsuite/text_section_grouping.sh: New file.
>>
>>
>>> + // If it is a text section use the following order:
>>> + // .text.unlikely, .text.startup, .text.hot.
>>> + const char* section_prefix [] =
>>> + {
>>> + ".text.unlikely",
>>> + ".text.startup",
>>> + ".text.hot"
>>> + };
>>
>> Please mention in the comment that this should match
>> Layout::is_section_name_prefix_grouped.
>>
>> This is OK with that change.
>
> Made the change and committed the patch.

I'm seeing a number of testsuite failures that I don't see when I
revert your patch. In fact the linker doesn't seem to work properly
at all, in that the bootstrap test fails. Could you look into that?
Thanks.

Ian

make libgoldtest.a object_unittest binary_unittest leb128_unittest
icf_virtual_function_folding_test basic_test basic_pic_test
basic_static_test basic_static_pic_test basic_pie_test
constructor_test constructor_static_test two_file_test
two_file_pic_test two_file_static_test two_file_shared_1_test
two_file_shared_2_test two_file_shared_1_pic_2_test
two_file_shared_2_pic_1_test two_file_same_shared_test
two_file_separate_shared_12_test two_file_separate_shared_21_test
two_file_relocatable_test two_file_pie_test two_file_strip_test
two_file_same_shared_strip_test common_test_1 common_test_2
exception_test exception_shared_1_test exception_shared_2_test
exception_same_shared_test exception_separate_shared_12_test
exception_separate_shared_21_test exception_static_test weak_test
weak_undef_test weak_alias_test weak_plt copy_test tls_test
tls_pic_test tls_pie_test tls_pie_pic_test tls_shared_test
tls_shared_ie_test tls_shared_gd_to_ie_test
tls_shared_gnu2_gd_to_ie_test tls_shared_gnu2_test tls_static_test
tls_static_pic_test many_sections_test many_sections_r_test initpri1
initpri2 initpri3a flagstest_o_specialfile
flagstest_compress_debug_sections
flagstest_o_specialfile_and_compress_debug_sections
flagstest_o_ttext_1 ver_test ver_test_2 ver_test_6 ver_test_8
ver_test_9 ver_test_11 ver_test_12 protected_1 protected_2 relro_test
relro_now_test relro_strip_test relro_script_test script_test_1
script_test_2 justsyms justsyms_exec binary_test script_test_3
tls_phdrs_script_test tls_script_test thin_archive_test_1
thin_archive_test_2 plugin_test_1 plugin_test_2 plugin_test_3
plugin_test_4 plugin_test_5 plugin_test_6 plugin_test_7 plugin_test_8
exclude_libs_test local_labels_test discard_locals_test large
permission_test searched_file_test ifuncmain1static
ifuncmain1picstatic ifuncmain1 ifuncmain1pic ifuncmain1vis
ifuncmain1vispic ifuncmain1staticpic ifuncmain1pie ifuncmain1vispie
ifuncmain1staticpie ifuncmain2static ifuncmain2picstatic ifuncmain2
ifuncmain2pic ifuncmain3 ifuncmain4static ifuncmain4picstatic
ifuncmain4 ifuncmain5static ifuncmain5picstatic ifuncmain5
ifuncmain5pic ifuncmain5staticpic ifuncmain5pie ifuncmain6pie
ifuncmain7static ifuncmain7picstatic ifuncmain7 ifuncmain7pic
ifuncmain7pie ifuncvar start_lib_test incremental_test_2
incremental_test_3 incremental_test_4 incremental_test_5
incremental_test_6 incremental_copy_test incremental_common_test_1
incremental_comdat_test_1 \
incremental_test.sh gc_comdat_test.sh gc_tls_test.sh
gc_orphan_section_test.sh pr14265.sh icf_test.sh
icf_keep_unique_test.sh icf_safe_test.sh icf_safe_so_test.sh
final_layout.sh text_section_grouping.sh
icf_preemptible_functions_test.sh icf_string_merge_test.sh
icf_sht_rel_addend_test.sh two_file_shared.sh weak_plt.sh debug_msg.sh
undef_symbol.sh ver_test_1.sh ver_test_2.sh ver_test_4.sh
ver_test_5.sh ver_test_7.sh ver_test_10.sh relro_test.sh
ver_matching_test.sh script_test_3.sh script_test_4.sh
script_test_5.sh script_test_6.sh script_test_7.sh script_test_8.sh
script_test_9.sh dynamic_list.sh plugin_test_1.sh plugin_test_2.sh
plugin_test_3.sh plugin_test_4.sh plugin_test_6.sh plugin_test_7.sh
plugin_final_layout.sh exclude_libs_test.sh discard_locals_test.sh
hidden_test.sh retain_symbols_file_test.sh no_version_test.sh
strong_ref_weak_def.sh dyn_weak_ref.sh memory_test.sh
script_test_10.sh split_x86_64.sh dwp_test_1.sh dwp_test_2.sh
incremental_test.stdout gc_comdat_test.stdout gc_tls_test.stdout
gc_orphan_section_test.stdout pr14265.stdout icf_test.stdout
icf_keep_unique_test.stdout icf_safe_test_1.stdout
icf_safe_test_2.stdout icf_safe_so_test_1.stdout
icf_safe_so_test_2.stdout final_layout.stdout
text_section_grouping.stdout icf_preemptible_functions_test.stdout
icf_string_merge_test.stdout icf_sht_rel_addend_test.stdout
two_file_shared.dbg weak_plt_shared.so debug_msg.err
debug_msg_cdebug.err debug_msg_so.err debug_msg_ndebug.err
undef_symbol.err flagstest_o_ttext_2 ver_test_1.syms ver_test_2.syms
ver_test_4.syms ver_test_5.syms ver_test_7.syms ver_test_10.syms
protected_3.err relro_test.stdout ver_matching_test.stdout
script_test_3.stdout script_test_4.stdout script_test_5.stdout
script_test_6.stdout script_test_7.stdout script_test_8.stdout
script_test_9.stdout dynamic_list.stdout plugin_test_1.err
plugin_test_2.err plugin_test_3.err plugin_test_4.err
plugin_test_6.err plugin_test_7.err plugin_test_7.syms
plugin_test_9.err plugin_final_layout.stdout
plugin_final_layout_readelf.stdout exclude_libs_test.syms
discard_locals_test.syms discard_locals_relocatable_test1.syms
discard_locals_relocatable_test2.syms hidden_test.err
retain_symbols_file_test.stdout no_version_test.stdout
strong_ref_weak_def.stdout dyn_weak_ref.stdout memory_test.stdout
script_test_10.stdout split_x86_64_1.stdout split_x86_64_2.stdout
split_x86_64_3.stdout split_x86_64_4.stdout split_x86_64_r.stdout
dwp_test_1.stdout dwp_test_2.stdout
make[4]: Entering directory
`/usr/local/google/iant/gold/gold-objdir/gold/testsuite'
make[4]: `libgoldtest.a' is up to date.
make[4]: `object_unittest' is up to date.
make[4]: `binary_unittest' is up to date.
make[4]: `leb128_unittest' is up to date.
make[4]: `icf_virtual_function_folding_test' is up to date.
make[4]: `basic_test' is up to date.
make[4]: `basic_pic_test' is up to date.
make[4]: `basic_static_test' is up to date.
make[4]: `basic_static_pic_test' is up to date.
make[4]: `basic_pie_test' is up to date.
make[4]: `constructor_test' is up to date.
make[4]: `constructor_static_test' is up to date.
make[4]: `two_file_test' is up to date.
make[4]: `two_file_pic_test' is up to date.
make[4]: `two_file_static_test' is up to date.
make[4]: `two_file_shared_1_test' is up to date.
make[4]: `two_file_shared_2_test' is up to date.
make[4]: `two_file_shared_1_pic_2_test' is up to date.
make[4]: `two_file_shared_2_pic_1_test' is up to date.
make[4]: `two_file_same_shared_test' is up to date.
make[4]: `two_file_separate_shared_12_test' is up to date.
make[4]: `two_file_separate_shared_21_test' is up to date.
make[4]: `two_file_relocatable_test' is up to date.
make[4]: `two_file_pie_test' is up to date.
make[4]: `two_file_strip_test' is up to date.
make[4]: `two_file_same_shared_strip_test' is up to date.
make[4]: `common_test_1' is up to date.
make[4]: `common_test_2' is up to date.
make[4]: `exception_test' is up to date.
make[4]: `exception_shared_1_test' is up to date.
make[4]: `exception_shared_2_test' is up to date.
make[4]: `exception_same_shared_test' is up to date.
make[4]: `exception_separate_shared_12_test' is up to date.
make[4]: `exception_separate_shared_21_test' is up to date.
make[4]: `exception_static_test' is up to date.
make[4]: `weak_test' is up to date.
make[4]: `weak_undef_test' is up to date.
make[4]: `weak_alias_test' is up to date.
make[4]: `weak_plt' is up to date.
make[4]: `copy_test' is up to date.
g++ -W -Wall -Werror -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
-fmerge-constants -g -O2 -Bgcctestdir/ -o tls_test tls_test.o
tls_test_file2.o tls_test_main.o tls_test_c.o -lpthread -lz
gcctestdir/ld: internal error in write_sections, at ../../src/gold/reloc.cc:830
collect2: ld returned 1 exit status
make[4]: *** [tls_test] Error 1
make[4]: `tls_pic_test' is up to date.
make[4]: `tls_pie_test' is up to date.
make[4]: `tls_pie_pic_test' is up to date.
make[4]: `tls_shared_test' is up to date.
make[4]: `tls_shared_ie_test' is up to date.
make[4]: `tls_shared_gd_to_ie_test' is up to date.
make[4]: `tls_shared_gnu2_gd_to_ie_test' is up to date.
make[4]: `tls_shared_gnu2_test' is up to date.
make[4]: `tls_static_test' is up to date.
make[4]: `tls_static_pic_test' is up to date.
make[4]: `many_sections_test' is up to date.
make[4]: `many_sections_r_test' is up to date.
make[4]: `initpri1' is up to date.
gcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -fmerge-constants -g -O2
-Bgcctestdir/ -Wl,--ctors-in-init-array -o initpri2 initpri2.o -lz
gcctestdir/ld: internal error in write_sections, at ../../src/gold/reloc.cc:830
collect2: ld returned 1 exit status
make[4]: *** [initpri2] Error 1
make[4]: `initpri3a' is up to date.
make[4]: `flagstest_o_specialfile' is up to date.
make[4]: `flagstest_compress_debug_sections' is up to date.
make[4]: `flagstest_o_specialfile_and_compress_debug_sections' is up to date.
make[4]: `flagstest_o_ttext_1' is up to date.
make[4]: `ver_test' is up to date.
make[4]: `ver_test_2' is up to date.
make[4]: `ver_test_6' is up to date.
make[4]: `ver_test_8' is up to date.
make[4]: `ver_test_9' is up to date.
make[4]: `ver_test_11' is up to date.
make[4]: `ver_test_12' is up to date.
make[4]: `protected_1' is up to date.
make[4]: `protected_2' is up to date.
make[4]: `relro_test' is up to date.
make[4]: `relro_now_test' is up to date.
make[4]: `relro_strip_test' is up to date.
make[4]: `relro_script_test' is up to date.
make[4]: `script_test_1' is up to date.
make[4]: `script_test_2' is up to date.
make[4]: `justsyms' is up to date.
make[4]: `justsyms_exec' is up to date.
make[4]: `binary_test' is up to date.
make[4]: `script_test_3' is up to date.
make[4]: `tls_phdrs_script_test' is up to date.
make[4]: `tls_script_test' is up to date.
make[4]: `thin_archive_test_1' is up to date.
make[4]: `thin_archive_test_2' is up to date.
make[4]: `plugin_test_1' is up to date.
make[4]: `plugin_test_2' is up to date.
make[4]: `plugin_test_3' is up to date.
make[4]: `plugin_test_4' is up to date.
make[4]: `plugin_test_5' is up to date.
make[4]: `plugin_test_6' is up to date.
make[4]: `plugin_test_7' is up to date.
make[4]: `plugin_test_8' is up to date.
make[4]: `exclude_libs_test' is up to date.
make[4]: `local_labels_test' is up to date.
make[4]: `discard_locals_test' is up to date.
make[4]: `large' is up to date.
make[4]: `permission_test' is up to date.
make[4]: `searched_file_test' is up to date.
make[4]: `ifuncmain1static' is up to date.
make[4]: `ifuncmain1picstatic' is up to date.
make[4]: `ifuncmain1' is up to date.
make[4]: `ifuncmain1pic' is up to date.
make[4]: `ifuncmain1vis' is up to date.
make[4]: `ifuncmain1vispic' is up to date.
make[4]: `ifuncmain1staticpic' is up to date.
make[4]: `ifuncmain1pie' is up to date.
make[4]: `ifuncmain1vispie' is up to date.
make[4]: `ifuncmain1staticpie' is up to date.
make[4]: `ifuncmain2static' is up to date.
make[4]: `ifuncmain2picstatic' is up to date.
make[4]: `ifuncmain2' is up to date.
make[4]: `ifuncmain2pic' is up to date.
make[4]: `ifuncmain3' is up to date.
make[4]: `ifuncmain4static' is up to date.
make[4]: `ifuncmain4picstatic' is up to date.
gcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -fmerge-constants -g -O2
-Bgcctestdir/ -o ifuncmain4 ifuncmain4.o -lz
gcctestdir/ld: internal error in write_sections, at ../../src/gold/reloc.cc:830
collect2: ld returned 1 exit status
make[4]: *** [ifuncmain4] Error 1
make[4]: `ifuncmain5static' is up to date.
make[4]: `ifuncmain5picstatic' is up to date.
make[4]: `ifuncmain5' is up to date.
make[4]: `ifuncmain5pic' is up to date.
make[4]: `ifuncmain5staticpic' is up to date.
make[4]: `ifuncmain5pie' is up to date.
make[4]: `ifuncmain6pie' is up to date.
make[4]: `ifuncmain7static' is up to date.
make[4]: `ifuncmain7picstatic' is up to date.
make[4]: `ifuncmain7' is up to date.
make[4]: `ifuncmain7pic' is up to date.
make[4]: `ifuncmain7pie' is up to date.
make[4]: `ifuncvar' is up to date.
make[4]: `start_lib_test' is up to date.
make[4]: `incremental_test_2' is up to date.
make[4]: `incremental_test_3' is up to date.
make[4]: `incremental_test_4' is up to date.
make[4]: `incremental_test_5' is up to date.
make[4]: `incremental_test_6' is up to date.
make[4]: `incremental_copy_test' is up to date.
make[4]: `incremental_common_test_1' is up to date.
make[4]: `incremental_comdat_test_1' is up to date.
make[4]: Nothing to be done for
`../../../src/gold/testsuite/incremental_test.sh'.
make[4]: Nothing to be done for `../../../src/gold/testsuite/gc_comdat_test.sh'.
make[4]: Nothing to be done for `../../../src/gold/testsuite/gc_tls_test.sh'.
make[4]: Nothing to be done for
`../../../src/gold/testsuite/gc_orphan_section_test.sh'.
make[4]: Nothing to be done for `../../../src/gold/testsuite/pr14265.sh'.
make[4]: Nothing to be done for `../../../src/gold/testsuite/icf_test.sh'.
make[4]: Nothing to be done for
`../../../src/gold/testsuite/icf_keep_unique_test.sh'.
make[4]: Nothing to be done for `../../../src/gold/testsuite/icf_safe_test.sh'.
make[4]: Nothing to be done for
`../../../src/gold/testsuite/icf_safe_so_test.sh'.
make[4]: Nothing to be done for `../../../src/gold/testsuite/final_layout.sh'.
make[4]: Nothing to be done for
`../../../src/gold/testsuite/text_section_grouping.sh'.
make[4]: Nothing to be done for
`../../../src/gold/testsuite/icf_preemptible_functions_test.sh'.
make[4]: Nothing to be done for
`../../../src/gold/testsuite/icf_string_merge_test.sh'.
make[4]: Nothing to be done for
`../../../src/gold/testsuite/icf_sht_rel_addend_test.sh'.
make[4]: Nothing to be done for
`../../../src/gold/testsuite/two_file_shared.sh'.
make[4]: Nothing to be done for `../../../src/gold/testsuite/weak_plt.sh'.
make[4]: Nothing to be done for `../../../src/gold/testsuite/debug_msg.sh'.
make[4]: Nothing to be done for `../../../src/gold/testsuite/undef_symbol.sh'.
make[4]: Nothing to be done for `../../../src/gold/testsuite/ver_test_1.sh'.
make[4]: Nothing to be done for `../../../src/gold/testsuite/ver_test_2.sh'.
make[4]: Nothing to be done for `../../../src/gold/testsuite/ver_test_4.sh'.
make[4]: Nothing to be done for `../../../src/gold/testsuite/ver_test_5.sh'.
make[4]: Nothing to be done for `../../../src/gold/testsuite/ver_test_7.sh'.
make[4]: Nothing to be done for `../../../src/gold/testsuite/ver_test_10.sh'.
make[4]: Nothing to be done for `../../../src/gold/testsuite/relro_test.sh'.
make[4]: Nothing to be done for
`../../../src/gold/testsuite/ver_matching_test.sh'.
make[4]: Nothing to be done for `../../../src/gold/testsuite/script_test_3.sh'.
make[4]: Nothing to be done for `../../../src/gold/testsuite/script_test_4.sh'.
make[4]: Nothing to be done for `../../../src/gold/testsuite/script_test_5.sh'.
make[4]: Nothing to be done for `../../../src/gold/testsuite/script_test_6.sh'.
make[4]: Nothing to be done for `../../../src/gold/testsuite/script_test_7.sh'.
make[4]: Nothing to be done for `../../../src/gold/testsuite/script_test_8.sh'.
make[4]: Nothing to be done for `../../../src/gold/testsuite/script_test_9.sh'.
make[4]: Nothing to be done for `../../../src/gold/testsuite/dynamic_list.sh'.
make[4]: Nothing to be done for `../../../src/gold/testsuite/plugin_test_1.sh'.
make[4]: Nothing to be done for `../../../src/gold/testsuite/plugin_test_2.sh'.
make[4]: Nothing to be done for `../../../src/gold/testsuite/plugin_test_3.sh'.
make[4]: Nothing to be done for `../../../src/gold/testsuite/plugin_test_4.sh'.
make[4]: Nothing to be done for `../../../src/gold/testsuite/plugin_test_6.sh'.
make[4]: Nothing to be done for `../../../src/gold/testsuite/plugin_test_7.sh'.
make[4]: Nothing to be done for
`../../../src/gold/testsuite/plugin_final_layout.sh'.
make[4]: Nothing to be done for
`../../../src/gold/testsuite/exclude_libs_test.sh'.
make[4]: Nothing to be done for
`../../../src/gold/testsuite/discard_locals_test.sh'.
make[4]: Nothing to be done for `../../../src/gold/testsuite/hidden_test.sh'.
make[4]: Nothing to be done for
`../../../src/gold/testsuite/retain_symbols_file_test.sh'.
make[4]: Nothing to be done for
`../../../src/gold/testsuite/no_version_test.sh'.
make[4]: Nothing to be done for
`../../../src/gold/testsuite/strong_ref_weak_def.sh'.
make[4]: Nothing to be done for `../../../src/gold/testsuite/dyn_weak_ref.sh'.
make[4]: Nothing to be done for `../../../src/gold/testsuite/memory_test.sh'.
make[4]: Nothing to be done for `../../../src/gold/testsuite/script_test_10.sh'.
make[4]: Nothing to be done for `../../../src/gold/testsuite/split_x86_64.sh'.
make[4]: Nothing to be done for `../../../src/gold/testsuite/dwp_test_1.sh'.
make[4]: Nothing to be done for `../../../src/gold/testsuite/dwp_test_2.sh'.
make[4]: `incremental_test.stdout' is up to date.
make[4]: `gc_comdat_test.stdout' is up to date.
make[4]: `gc_tls_test.stdout' is up to date.
make[4]: `gc_orphan_section_test.stdout' is up to date.
make[4]: `pr14265.stdout' is up to date.
make[4]: `icf_test.stdout' is up to date.
make[4]: `icf_keep_unique_test.stdout' is up to date.
make[4]: `icf_safe_test_1.stdout' is up to date.
make[4]: `icf_safe_test_2.stdout' is up to date.
make[4]: `icf_safe_so_test_1.stdout' is up to date.
make[4]: `icf_safe_so_test_2.stdout' is up to date.
make[4]: `final_layout.stdout' is up to date.
make[4]: `text_section_grouping.stdout' is up to date.
make[4]: `icf_preemptible_functions_test.stdout' is up to date.
make[4]: `icf_string_merge_test.stdout' is up to date.
make[4]: `icf_sht_rel_addend_test.stdout' is up to date.
make[4]: `two_file_shared.dbg' is up to date.
make[4]: `weak_plt_shared.so' is up to date.
make[4]: `debug_msg.err' is up to date.
make[4]: `debug_msg_cdebug.err' is up to date.
make[4]: `debug_msg_so.err' is up to date.
make[4]: `debug_msg_ndebug.err' is up to date.
make[4]: `undef_symbol.err' is up to date.
make[4]: `flagstest_o_ttext_2' is up to date.
make[4]: `ver_test_1.syms' is up to date.
make[4]: `ver_test_2.syms' is up to date.
make[4]: `ver_test_4.syms' is up to date.
make[4]: `ver_test_5.syms' is up to date.
make[4]: `ver_test_7.syms' is up to date.
make[4]: `ver_test_10.syms' is up to date.
make[4]: `protected_3.err' is up to date.
make[4]: `relro_test.stdout' is up to date.
make[4]: `ver_matching_test.stdout' is up to date.
make[4]: `script_test_3.stdout' is up to date.
make[4]: `script_test_4.stdout' is up to date.
make[4]: `script_test_5.stdout' is up to date.
make[4]: `script_test_6.stdout' is up to date.
make[4]: `script_test_7.stdout' is up to date.
make[4]: `script_test_8.stdout' is up to date.
make[4]: `script_test_9.stdout' is up to date.
make[4]: `dynamic_list.stdout' is up to date.
make[4]: `plugin_test_1.err' is up to date.
make[4]: `plugin_test_2.err' is up to date.
make[4]: `plugin_test_3.err' is up to date.
make[4]: `plugin_test_4.err' is up to date.
make[4]: `plugin_test_6.err' is up to date.
make[4]: Nothing to be done for `plugin_test_7.err'.
make[4]: `plugin_test_7.syms' is up to date.
make[4]: `plugin_test_9.err' is up to date.
make[4]: `plugin_final_layout.stdout' is up to date.
make[4]: `plugin_final_layout_readelf.stdout' is up to date.
make[4]: `exclude_libs_test.syms' is up to date.
make[4]: `discard_locals_test.syms' is up to date.
make[4]: `discard_locals_relocatable_test1.syms' is up to date.
make[4]: `discard_locals_relocatable_test2.syms' is up to date.
make[4]: `hidden_test.err' is up to date.
make[4]: `retain_symbols_file_test.stdout' is up to date.
make[4]: `no_version_test.stdout' is up to date.
make[4]: `strong_ref_weak_def.stdout' is up to date.
make[4]: `dyn_weak_ref.stdout' is up to date.
make[4]: `memory_test.stdout' is up to date.
make[4]: `script_test_10.stdout' is up to date.
make[4]: `split_x86_64_1.stdout' is up to date.
make[4]: `split_x86_64_2.stdout' is up to date.
make[4]: `split_x86_64_3.stdout' is up to date.
make[4]: `split_x86_64_4.stdout' is up to date.
make[4]: `split_x86_64_r.stdout' is up to date.
make[4]: `dwp_test_1.stdout' is up to date.
make[4]: `dwp_test_2.stdout' is up to date.
make[4]: Leaving directory
`/usr/local/google/iant/gold/gold-objdir/gold/testsuite'
make[3]: *** [check-am] Error 2
make[3]: Leaving directory
`/usr/local/google/iant/gold/gold-objdir/gold/testsuite'
make[2]: *** [check] Error 2
make[2]: Leaving directory
`/usr/local/google/iant/gold/gold-objdir/gold/testsuite'
make[2]: Entering directory `/usr/local/google/iant/gold/gold-objdir/gold'
make ld1 ld2 ld1-r ld2-r
make[3]: Entering directory `/usr/local/google/iant/gold/gold-objdir/gold'
g++ -W -Wall -Werror -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
-frandom-seed=ld2 -g -O2 -Bgcctestdir2/ -o ld2 main.o i386.o x86_64.o
sparc.o powerpc.o arm.o arm-reloc-property.o tilegx.o libgold.a
../libiberty/libiberty.a -ldl -lz
(null): internal error in options, at ../../src/gold/parameters.h:92
collect2: ld returned 1 exit status
make[3]: *** [ld2] Error 1
make[3]: `ld1-r' is up to date.
gcctestdir2-r/ld -o libgold-2-r.o -r --whole-archive libgold.a
(null): internal error in ~Task_list, at ../../src/gold/token.h:44
make[3]: *** [libgold-2-r.o] Error 1
make[3]: Target `ld2-r' not remade because of errors.
make[3]: Leaving directory `/usr/local/google/iant/gold/gold-objdir/gold'
make[2]: *** [check-am] Error 2
make[2]: Leaving directory `/usr/local/google/iant/gold/gold-objdir/gold'
make[1]: *** [check-recursive] Error 1
make[1]: Target `check' not remade because of errors.
make[1]: Leaving directory `/usr/local/google/iant/gold/gold-objdir/gold'
make: *** [check-gold] Error 2
Sriraman Tallam
2012-12-19 20:12:43 UTC
Permalink
On Wed, Dec 19, 2012 at 11:51 AM, Ian Lance Taylor <***@google.com> wrote:
> On Tue, Dec 18, 2012 at 6:57 PM, Sriraman Tallam <***@google.com> wrote:
>> On Tue, Dec 18, 2012 at 5:39 PM, Ian Lance Taylor <***@google.com> wrote:
>>> On Tue, Nov 20, 2012 at 7:08 PM, Sriraman Tallam <***@google.com> wrote:
>>>
>>>> * layout.cc (Layout::is_section_name_prefix_grouped): New function.
>>>> * layout.h (Layout::is_section_name_prefix_grouped): New function.
>>>> * output.cc (Output_section::add_input_section): Check if section
>>>> name contains special prefix. Keep input sections to sort such
>>>> sections.
>>>> (Output_section::Input_section_sort_section_order_index_compare
>>>> ::operator()): Group sections according to prefixes.
>>>> * (Output_section::sort_attached_input_sections): Add condition
>>>> to Input_section_entry constructor call.
>>>> * testsuite/Makefile.am (text_section_grouping): New test.
>>>> * testsuite/Makefile.in: Regenerate.
>>>> * testsuite/text_section_grouping.cc: New file.
>>>> * testsuite/text_section_grouping.sh: New file.
>>>
>>>
>>>> + // If it is a text section use the following order:
>>>> + // .text.unlikely, .text.startup, .text.hot.
>>>> + const char* section_prefix [] =
>>>> + {
>>>> + ".text.unlikely",
>>>> + ".text.startup",
>>>> + ".text.hot"
>>>> + };
>>>
>>> Please mention in the comment that this should match
>>> Layout::is_section_name_prefix_grouped.
>>>
>>> This is OK with that change.
>>
>> Made the change and committed the patch.
>
> I'm seeing a number of testsuite failures that I don't see when I
> revert your patch. In fact the linker doesn't seem to work properly
> at all, in that the bootstrap test fails. Could you look into that?
> Thanks.

I will take a look now. Surprisingly, no tests fail for me.

-Sri.


>
> Ian
>
> make libgoldtest.a object_unittest binary_unittest leb128_unittest
> icf_virtual_function_folding_test basic_test basic_pic_test
> basic_static_test basic_static_pic_test basic_pie_test
> constructor_test constructor_static_test two_file_test
> two_file_pic_test two_file_static_test two_file_shared_1_test
> two_file_shared_2_test two_file_shared_1_pic_2_test
> two_file_shared_2_pic_1_test two_file_same_shared_test
> two_file_separate_shared_12_test two_file_separate_shared_21_test
> two_file_relocatable_test two_file_pie_test two_file_strip_test
> two_file_same_shared_strip_test common_test_1 common_test_2
> exception_test exception_shared_1_test exception_shared_2_test
> exception_same_shared_test exception_separate_shared_12_test
> exception_separate_shared_21_test exception_static_test weak_test
> weak_undef_test weak_alias_test weak_plt copy_test tls_test
> tls_pic_test tls_pie_test tls_pie_pic_test tls_shared_test
> tls_shared_ie_test tls_shared_gd_to_ie_test
> tls_shared_gnu2_gd_to_ie_test tls_shared_gnu2_test tls_static_test
> tls_static_pic_test many_sections_test many_sections_r_test initpri1
> initpri2 initpri3a flagstest_o_specialfile
> flagstest_compress_debug_sections
> flagstest_o_specialfile_and_compress_debug_sections
> flagstest_o_ttext_1 ver_test ver_test_2 ver_test_6 ver_test_8
> ver_test_9 ver_test_11 ver_test_12 protected_1 protected_2 relro_test
> relro_now_test relro_strip_test relro_script_test script_test_1
> script_test_2 justsyms justsyms_exec binary_test script_test_3
> tls_phdrs_script_test tls_script_test thin_archive_test_1
> thin_archive_test_2 plugin_test_1 plugin_test_2 plugin_test_3
> plugin_test_4 plugin_test_5 plugin_test_6 plugin_test_7 plugin_test_8
> exclude_libs_test local_labels_test discard_locals_test large
> permission_test searched_file_test ifuncmain1static
> ifuncmain1picstatic ifuncmain1 ifuncmain1pic ifuncmain1vis
> ifuncmain1vispic ifuncmain1staticpic ifuncmain1pie ifuncmain1vispie
> ifuncmain1staticpie ifuncmain2static ifuncmain2picstatic ifuncmain2
> ifuncmain2pic ifuncmain3 ifuncmain4static ifuncmain4picstatic
> ifuncmain4 ifuncmain5static ifuncmain5picstatic ifuncmain5
> ifuncmain5pic ifuncmain5staticpic ifuncmain5pie ifuncmain6pie
> ifuncmain7static ifuncmain7picstatic ifuncmain7 ifuncmain7pic
> ifuncmain7pie ifuncvar start_lib_test incremental_test_2
> incremental_test_3 incremental_test_4 incremental_test_5
> incremental_test_6 incremental_copy_test incremental_common_test_1
> incremental_comdat_test_1 \
> incremental_test.sh gc_comdat_test.sh gc_tls_test.sh
> gc_orphan_section_test.sh pr14265.sh icf_test.sh
> icf_keep_unique_test.sh icf_safe_test.sh icf_safe_so_test.sh
> final_layout.sh text_section_grouping.sh
> icf_preemptible_functions_test.sh icf_string_merge_test.sh
> icf_sht_rel_addend_test.sh two_file_shared.sh weak_plt.sh debug_msg.sh
> undef_symbol.sh ver_test_1.sh ver_test_2.sh ver_test_4.sh
> ver_test_5.sh ver_test_7.sh ver_test_10.sh relro_test.sh
> ver_matching_test.sh script_test_3.sh script_test_4.sh
> script_test_5.sh script_test_6.sh script_test_7.sh script_test_8.sh
> script_test_9.sh dynamic_list.sh plugin_test_1.sh plugin_test_2.sh
> plugin_test_3.sh plugin_test_4.sh plugin_test_6.sh plugin_test_7.sh
> plugin_final_layout.sh exclude_libs_test.sh discard_locals_test.sh
> hidden_test.sh retain_symbols_file_test.sh no_version_test.sh
> strong_ref_weak_def.sh dyn_weak_ref.sh memory_test.sh
> script_test_10.sh split_x86_64.sh dwp_test_1.sh dwp_test_2.sh
> incremental_test.stdout gc_comdat_test.stdout gc_tls_test.stdout
> gc_orphan_section_test.stdout pr14265.stdout icf_test.stdout
> icf_keep_unique_test.stdout icf_safe_test_1.stdout
> icf_safe_test_2.stdout icf_safe_so_test_1.stdout
> icf_safe_so_test_2.stdout final_layout.stdout
> text_section_grouping.stdout icf_preemptible_functions_test.stdout
> icf_string_merge_test.stdout icf_sht_rel_addend_test.stdout
> two_file_shared.dbg weak_plt_shared.so debug_msg.err
> debug_msg_cdebug.err debug_msg_so.err debug_msg_ndebug.err
> undef_symbol.err flagstest_o_ttext_2 ver_test_1.syms ver_test_2.syms
> ver_test_4.syms ver_test_5.syms ver_test_7.syms ver_test_10.syms
> protected_3.err relro_test.stdout ver_matching_test.stdout
> script_test_3.stdout script_test_4.stdout script_test_5.stdout
> script_test_6.stdout script_test_7.stdout script_test_8.stdout
> script_test_9.stdout dynamic_list.stdout plugin_test_1.err
> plugin_test_2.err plugin_test_3.err plugin_test_4.err
> plugin_test_6.err plugin_test_7.err plugin_test_7.syms
> plugin_test_9.err plugin_final_layout.stdout
> plugin_final_layout_readelf.stdout exclude_libs_test.syms
> discard_locals_test.syms discard_locals_relocatable_test1.syms
> discard_locals_relocatable_test2.syms hidden_test.err
> retain_symbols_file_test.stdout no_version_test.stdout
> strong_ref_weak_def.stdout dyn_weak_ref.stdout memory_test.stdout
> script_test_10.stdout split_x86_64_1.stdout split_x86_64_2.stdout
> split_x86_64_3.stdout split_x86_64_4.stdout split_x86_64_r.stdout
> dwp_test_1.stdout dwp_test_2.stdout
> make[4]: Entering directory
> `/usr/local/google/iant/gold/gold-objdir/gold/testsuite'
> make[4]: `libgoldtest.a' is up to date.
> make[4]: `object_unittest' is up to date.
> make[4]: `binary_unittest' is up to date.
> make[4]: `leb128_unittest' is up to date.
> make[4]: `icf_virtual_function_folding_test' is up to date.
> make[4]: `basic_test' is up to date.
> make[4]: `basic_pic_test' is up to date.
> make[4]: `basic_static_test' is up to date.
> make[4]: `basic_static_pic_test' is up to date.
> make[4]: `basic_pie_test' is up to date.
> make[4]: `constructor_test' is up to date.
> make[4]: `constructor_static_test' is up to date.
> make[4]: `two_file_test' is up to date.
> make[4]: `two_file_pic_test' is up to date.
> make[4]: `two_file_static_test' is up to date.
> make[4]: `two_file_shared_1_test' is up to date.
> make[4]: `two_file_shared_2_test' is up to date.
> make[4]: `two_file_shared_1_pic_2_test' is up to date.
> make[4]: `two_file_shared_2_pic_1_test' is up to date.
> make[4]: `two_file_same_shared_test' is up to date.
> make[4]: `two_file_separate_shared_12_test' is up to date.
> make[4]: `two_file_separate_shared_21_test' is up to date.
> make[4]: `two_file_relocatable_test' is up to date.
> make[4]: `two_file_pie_test' is up to date.
> make[4]: `two_file_strip_test' is up to date.
> make[4]: `two_file_same_shared_strip_test' is up to date.
> make[4]: `common_test_1' is up to date.
> make[4]: `common_test_2' is up to date.
> make[4]: `exception_test' is up to date.
> make[4]: `exception_shared_1_test' is up to date.
> make[4]: `exception_shared_2_test' is up to date.
> make[4]: `exception_same_shared_test' is up to date.
> make[4]: `exception_separate_shared_12_test' is up to date.
> make[4]: `exception_separate_shared_21_test' is up to date.
> make[4]: `exception_static_test' is up to date.
> make[4]: `weak_test' is up to date.
> make[4]: `weak_undef_test' is up to date.
> make[4]: `weak_alias_test' is up to date.
> make[4]: `weak_plt' is up to date.
> make[4]: `copy_test' is up to date.
> g++ -W -Wall -Werror -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
> -fmerge-constants -g -O2 -Bgcctestdir/ -o tls_test tls_test.o
> tls_test_file2.o tls_test_main.o tls_test_c.o -lpthread -lz
> gcctestdir/ld: internal error in write_sections, at ../../src/gold/reloc.cc:830
> collect2: ld returned 1 exit status
> make[4]: *** [tls_test] Error 1
> make[4]: `tls_pic_test' is up to date.
> make[4]: `tls_pie_test' is up to date.
> make[4]: `tls_pie_pic_test' is up to date.
> make[4]: `tls_shared_test' is up to date.
> make[4]: `tls_shared_ie_test' is up to date.
> make[4]: `tls_shared_gd_to_ie_test' is up to date.
> make[4]: `tls_shared_gnu2_gd_to_ie_test' is up to date.
> make[4]: `tls_shared_gnu2_test' is up to date.
> make[4]: `tls_static_test' is up to date.
> make[4]: `tls_static_pic_test' is up to date.
> make[4]: `many_sections_test' is up to date.
> make[4]: `many_sections_r_test' is up to date.
> make[4]: `initpri1' is up to date.
> gcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror
> -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -fmerge-constants -g -O2
> -Bgcctestdir/ -Wl,--ctors-in-init-array -o initpri2 initpri2.o -lz
> gcctestdir/ld: internal error in write_sections, at ../../src/gold/reloc.cc:830
> collect2: ld returned 1 exit status
> make[4]: *** [initpri2] Error 1
> make[4]: `initpri3a' is up to date.
> make[4]: `flagstest_o_specialfile' is up to date.
> make[4]: `flagstest_compress_debug_sections' is up to date.
> make[4]: `flagstest_o_specialfile_and_compress_debug_sections' is up to date.
> make[4]: `flagstest_o_ttext_1' is up to date.
> make[4]: `ver_test' is up to date.
> make[4]: `ver_test_2' is up to date.
> make[4]: `ver_test_6' is up to date.
> make[4]: `ver_test_8' is up to date.
> make[4]: `ver_test_9' is up to date.
> make[4]: `ver_test_11' is up to date.
> make[4]: `ver_test_12' is up to date.
> make[4]: `protected_1' is up to date.
> make[4]: `protected_2' is up to date.
> make[4]: `relro_test' is up to date.
> make[4]: `relro_now_test' is up to date.
> make[4]: `relro_strip_test' is up to date.
> make[4]: `relro_script_test' is up to date.
> make[4]: `script_test_1' is up to date.
> make[4]: `script_test_2' is up to date.
> make[4]: `justsyms' is up to date.
> make[4]: `justsyms_exec' is up to date.
> make[4]: `binary_test' is up to date.
> make[4]: `script_test_3' is up to date.
> make[4]: `tls_phdrs_script_test' is up to date.
> make[4]: `tls_script_test' is up to date.
> make[4]: `thin_archive_test_1' is up to date.
> make[4]: `thin_archive_test_2' is up to date.
> make[4]: `plugin_test_1' is up to date.
> make[4]: `plugin_test_2' is up to date.
> make[4]: `plugin_test_3' is up to date.
> make[4]: `plugin_test_4' is up to date.
> make[4]: `plugin_test_5' is up to date.
> make[4]: `plugin_test_6' is up to date.
> make[4]: `plugin_test_7' is up to date.
> make[4]: `plugin_test_8' is up to date.
> make[4]: `exclude_libs_test' is up to date.
> make[4]: `local_labels_test' is up to date.
> make[4]: `discard_locals_test' is up to date.
> make[4]: `large' is up to date.
> make[4]: `permission_test' is up to date.
> make[4]: `searched_file_test' is up to date.
> make[4]: `ifuncmain1static' is up to date.
> make[4]: `ifuncmain1picstatic' is up to date.
> make[4]: `ifuncmain1' is up to date.
> make[4]: `ifuncmain1pic' is up to date.
> make[4]: `ifuncmain1vis' is up to date.
> make[4]: `ifuncmain1vispic' is up to date.
> make[4]: `ifuncmain1staticpic' is up to date.
> make[4]: `ifuncmain1pie' is up to date.
> make[4]: `ifuncmain1vispie' is up to date.
> make[4]: `ifuncmain1staticpie' is up to date.
> make[4]: `ifuncmain2static' is up to date.
> make[4]: `ifuncmain2picstatic' is up to date.
> make[4]: `ifuncmain2' is up to date.
> make[4]: `ifuncmain2pic' is up to date.
> make[4]: `ifuncmain3' is up to date.
> make[4]: `ifuncmain4static' is up to date.
> make[4]: `ifuncmain4picstatic' is up to date.
> gcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror
> -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -fmerge-constants -g -O2
> -Bgcctestdir/ -o ifuncmain4 ifuncmain4.o -lz
> gcctestdir/ld: internal error in write_sections, at ../../src/gold/reloc.cc:830
> collect2: ld returned 1 exit status
> make[4]: *** [ifuncmain4] Error 1
> make[4]: `ifuncmain5static' is up to date.
> make[4]: `ifuncmain5picstatic' is up to date.
> make[4]: `ifuncmain5' is up to date.
> make[4]: `ifuncmain5pic' is up to date.
> make[4]: `ifuncmain5staticpic' is up to date.
> make[4]: `ifuncmain5pie' is up to date.
> make[4]: `ifuncmain6pie' is up to date.
> make[4]: `ifuncmain7static' is up to date.
> make[4]: `ifuncmain7picstatic' is up to date.
> make[4]: `ifuncmain7' is up to date.
> make[4]: `ifuncmain7pic' is up to date.
> make[4]: `ifuncmain7pie' is up to date.
> make[4]: `ifuncvar' is up to date.
> make[4]: `start_lib_test' is up to date.
> make[4]: `incremental_test_2' is up to date.
> make[4]: `incremental_test_3' is up to date.
> make[4]: `incremental_test_4' is up to date.
> make[4]: `incremental_test_5' is up to date.
> make[4]: `incremental_test_6' is up to date.
> make[4]: `incremental_copy_test' is up to date.
> make[4]: `incremental_common_test_1' is up to date.
> make[4]: `incremental_comdat_test_1' is up to date.
> make[4]: Nothing to be done for
> `../../../src/gold/testsuite/incremental_test.sh'.
> make[4]: Nothing to be done for `../../../src/gold/testsuite/gc_comdat_test.sh'.
> make[4]: Nothing to be done for `../../../src/gold/testsuite/gc_tls_test.sh'.
> make[4]: Nothing to be done for
> `../../../src/gold/testsuite/gc_orphan_section_test.sh'.
> make[4]: Nothing to be done for `../../../src/gold/testsuite/pr14265.sh'.
> make[4]: Nothing to be done for `../../../src/gold/testsuite/icf_test.sh'.
> make[4]: Nothing to be done for
> `../../../src/gold/testsuite/icf_keep_unique_test.sh'.
> make[4]: Nothing to be done for `../../../src/gold/testsuite/icf_safe_test.sh'.
> make[4]: Nothing to be done for
> `../../../src/gold/testsuite/icf_safe_so_test.sh'.
> make[4]: Nothing to be done for `../../../src/gold/testsuite/final_layout.sh'.
> make[4]: Nothing to be done for
> `../../../src/gold/testsuite/text_section_grouping.sh'.
> make[4]: Nothing to be done for
> `../../../src/gold/testsuite/icf_preemptible_functions_test.sh'.
> make[4]: Nothing to be done for
> `../../../src/gold/testsuite/icf_string_merge_test.sh'.
> make[4]: Nothing to be done for
> `../../../src/gold/testsuite/icf_sht_rel_addend_test.sh'.
> make[4]: Nothing to be done for
> `../../../src/gold/testsuite/two_file_shared.sh'.
> make[4]: Nothing to be done for `../../../src/gold/testsuite/weak_plt.sh'.
> make[4]: Nothing to be done for `../../../src/gold/testsuite/debug_msg.sh'.
> make[4]: Nothing to be done for `../../../src/gold/testsuite/undef_symbol.sh'.
> make[4]: Nothing to be done for `../../../src/gold/testsuite/ver_test_1.sh'.
> make[4]: Nothing to be done for `../../../src/gold/testsuite/ver_test_2.sh'.
> make[4]: Nothing to be done for `../../../src/gold/testsuite/ver_test_4.sh'.
> make[4]: Nothing to be done for `../../../src/gold/testsuite/ver_test_5.sh'.
> make[4]: Nothing to be done for `../../../src/gold/testsuite/ver_test_7.sh'.
> make[4]: Nothing to be done for `../../../src/gold/testsuite/ver_test_10.sh'.
> make[4]: Nothing to be done for `../../../src/gold/testsuite/relro_test.sh'.
> make[4]: Nothing to be done for
> `../../../src/gold/testsuite/ver_matching_test.sh'.
> make[4]: Nothing to be done for `../../../src/gold/testsuite/script_test_3.sh'.
> make[4]: Nothing to be done for `../../../src/gold/testsuite/script_test_4.sh'.
> make[4]: Nothing to be done for `../../../src/gold/testsuite/script_test_5.sh'.
> make[4]: Nothing to be done for `../../../src/gold/testsuite/script_test_6.sh'.
> make[4]: Nothing to be done for `../../../src/gold/testsuite/script_test_7.sh'.
> make[4]: Nothing to be done for `../../../src/gold/testsuite/script_test_8.sh'.
> make[4]: Nothing to be done for `../../../src/gold/testsuite/script_test_9.sh'.
> make[4]: Nothing to be done for `../../../src/gold/testsuite/dynamic_list.sh'.
> make[4]: Nothing to be done for `../../../src/gold/testsuite/plugin_test_1.sh'.
> make[4]: Nothing to be done for `../../../src/gold/testsuite/plugin_test_2.sh'.
> make[4]: Nothing to be done for `../../../src/gold/testsuite/plugin_test_3.sh'.
> make[4]: Nothing to be done for `../../../src/gold/testsuite/plugin_test_4.sh'.
> make[4]: Nothing to be done for `../../../src/gold/testsuite/plugin_test_6.sh'.
> make[4]: Nothing to be done for `../../../src/gold/testsuite/plugin_test_7.sh'.
> make[4]: Nothing to be done for
> `../../../src/gold/testsuite/plugin_final_layout.sh'.
> make[4]: Nothing to be done for
> `../../../src/gold/testsuite/exclude_libs_test.sh'.
> make[4]: Nothing to be done for
> `../../../src/gold/testsuite/discard_locals_test.sh'.
> make[4]: Nothing to be done for `../../../src/gold/testsuite/hidden_test.sh'.
> make[4]: Nothing to be done for
> `../../../src/gold/testsuite/retain_symbols_file_test.sh'.
> make[4]: Nothing to be done for
> `../../../src/gold/testsuite/no_version_test.sh'.
> make[4]: Nothing to be done for
> `../../../src/gold/testsuite/strong_ref_weak_def.sh'.
> make[4]: Nothing to be done for `../../../src/gold/testsuite/dyn_weak_ref.sh'.
> make[4]: Nothing to be done for `../../../src/gold/testsuite/memory_test.sh'.
> make[4]: Nothing to be done for `../../../src/gold/testsuite/script_test_10.sh'.
> make[4]: Nothing to be done for `../../../src/gold/testsuite/split_x86_64.sh'.
> make[4]: Nothing to be done for `../../../src/gold/testsuite/dwp_test_1.sh'.
> make[4]: Nothing to be done for `../../../src/gold/testsuite/dwp_test_2.sh'.
> make[4]: `incremental_test.stdout' is up to date.
> make[4]: `gc_comdat_test.stdout' is up to date.
> make[4]: `gc_tls_test.stdout' is up to date.
> make[4]: `gc_orphan_section_test.stdout' is up to date.
> make[4]: `pr14265.stdout' is up to date.
> make[4]: `icf_test.stdout' is up to date.
> make[4]: `icf_keep_unique_test.stdout' is up to date.
> make[4]: `icf_safe_test_1.stdout' is up to date.
> make[4]: `icf_safe_test_2.stdout' is up to date.
> make[4]: `icf_safe_so_test_1.stdout' is up to date.
> make[4]: `icf_safe_so_test_2.stdout' is up to date.
> make[4]: `final_layout.stdout' is up to date.
> make[4]: `text_section_grouping.stdout' is up to date.
> make[4]: `icf_preemptible_functions_test.stdout' is up to date.
> make[4]: `icf_string_merge_test.stdout' is up to date.
> make[4]: `icf_sht_rel_addend_test.stdout' is up to date.
> make[4]: `two_file_shared.dbg' is up to date.
> make[4]: `weak_plt_shared.so' is up to date.
> make[4]: `debug_msg.err' is up to date.
> make[4]: `debug_msg_cdebug.err' is up to date.
> make[4]: `debug_msg_so.err' is up to date.
> make[4]: `debug_msg_ndebug.err' is up to date.
> make[4]: `undef_symbol.err' is up to date.
> make[4]: `flagstest_o_ttext_2' is up to date.
> make[4]: `ver_test_1.syms' is up to date.
> make[4]: `ver_test_2.syms' is up to date.
> make[4]: `ver_test_4.syms' is up to date.
> make[4]: `ver_test_5.syms' is up to date.
> make[4]: `ver_test_7.syms' is up to date.
> make[4]: `ver_test_10.syms' is up to date.
> make[4]: `protected_3.err' is up to date.
> make[4]: `relro_test.stdout' is up to date.
> make[4]: `ver_matching_test.stdout' is up to date.
> make[4]: `script_test_3.stdout' is up to date.
> make[4]: `script_test_4.stdout' is up to date.
> make[4]: `script_test_5.stdout' is up to date.
> make[4]: `script_test_6.stdout' is up to date.
> make[4]: `script_test_7.stdout' is up to date.
> make[4]: `script_test_8.stdout' is up to date.
> make[4]: `script_test_9.stdout' is up to date.
> make[4]: `dynamic_list.stdout' is up to date.
> make[4]: `plugin_test_1.err' is up to date.
> make[4]: `plugin_test_2.err' is up to date.
> make[4]: `plugin_test_3.err' is up to date.
> make[4]: `plugin_test_4.err' is up to date.
> make[4]: `plugin_test_6.err' is up to date.
> make[4]: Nothing to be done for `plugin_test_7.err'.
> make[4]: `plugin_test_7.syms' is up to date.
> make[4]: `plugin_test_9.err' is up to date.
> make[4]: `plugin_final_layout.stdout' is up to date.
> make[4]: `plugin_final_layout_readelf.stdout' is up to date.
> make[4]: `exclude_libs_test.syms' is up to date.
> make[4]: `discard_locals_test.syms' is up to date.
> make[4]: `discard_locals_relocatable_test1.syms' is up to date.
> make[4]: `discard_locals_relocatable_test2.syms' is up to date.
> make[4]: `hidden_test.err' is up to date.
> make[4]: `retain_symbols_file_test.stdout' is up to date.
> make[4]: `no_version_test.stdout' is up to date.
> make[4]: `strong_ref_weak_def.stdout' is up to date.
> make[4]: `dyn_weak_ref.stdout' is up to date.
> make[4]: `memory_test.stdout' is up to date.
> make[4]: `script_test_10.stdout' is up to date.
> make[4]: `split_x86_64_1.stdout' is up to date.
> make[4]: `split_x86_64_2.stdout' is up to date.
> make[4]: `split_x86_64_3.stdout' is up to date.
> make[4]: `split_x86_64_4.stdout' is up to date.
> make[4]: `split_x86_64_r.stdout' is up to date.
> make[4]: `dwp_test_1.stdout' is up to date.
> make[4]: `dwp_test_2.stdout' is up to date.
> make[4]: Leaving directory
> `/usr/local/google/iant/gold/gold-objdir/gold/testsuite'
> make[3]: *** [check-am] Error 2
> make[3]: Leaving directory
> `/usr/local/google/iant/gold/gold-objdir/gold/testsuite'
> make[2]: *** [check] Error 2
> make[2]: Leaving directory
> `/usr/local/google/iant/gold/gold-objdir/gold/testsuite'
> make[2]: Entering directory `/usr/local/google/iant/gold/gold-objdir/gold'
> make ld1 ld2 ld1-r ld2-r
> make[3]: Entering directory `/usr/local/google/iant/gold/gold-objdir/gold'
> g++ -W -Wall -Werror -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
> -frandom-seed=ld2 -g -O2 -Bgcctestdir2/ -o ld2 main.o i386.o x86_64.o
> sparc.o powerpc.o arm.o arm-reloc-property.o tilegx.o libgold.a
> ../libiberty/libiberty.a -ldl -lz
> (null): internal error in options, at ../../src/gold/parameters.h:92
> collect2: ld returned 1 exit status
> make[3]: *** [ld2] Error 1
> make[3]: `ld1-r' is up to date.
> gcctestdir2-r/ld -o libgold-2-r.o -r --whole-archive libgold.a
> (null): internal error in ~Task_list, at ../../src/gold/token.h:44
> make[3]: *** [libgold-2-r.o] Error 1
> make[3]: Target `ld2-r' not remade because of errors.
> make[3]: Leaving directory `/usr/local/google/iant/gold/gold-objdir/gold'
> make[2]: *** [check-am] Error 2
> make[2]: Leaving directory `/usr/local/google/iant/gold/gold-objdir/gold'
> make[1]: *** [check-recursive] Error 1
> make[1]: Target `check' not remade because of errors.
> make[1]: Leaving directory `/usr/local/google/iant/gold/gold-objdir/gold'
> make: *** [check-gold] Error 2
Ian Lance Taylor
2012-12-20 20:03:14 UTC
Permalink
On Wed, Dec 19, 2012 at 3:15 PM, Cary Coutant <***@google.com> wrote:
> I'm not seeing these failures either. Freshly synced to top of trunk.

I've reproduced it on three different machines. Synced to top of
trunk, no local changes. Haven't had time to investigate yet.

The key difference is probably that I am using GCC 4.6.3 on Ubuntu
Precise and Fedora 16.

Ian


> On Wed, Dec 19, 2012 at 12:12 PM, Sriraman Tallam <***@google.com>
> wrote:
>>
>> On Wed, Dec 19, 2012 at 11:51 AM, Ian Lance Taylor <***@google.com>
>> wrote:
>> > On Tue, Dec 18, 2012 at 6:57 PM, Sriraman Tallam <***@google.com>
>> > wrote:
>> >> On Tue, Dec 18, 2012 at 5:39 PM, Ian Lance Taylor <***@google.com>
>> >> wrote:
>> >>> On Tue, Nov 20, 2012 at 7:08 PM, Sriraman Tallam <***@google.com>
>> >>> wrote:
>> >>>
>> >>>> * layout.cc (Layout::is_section_name_prefix_grouped): New
>> >>>> function.
>> >>>> * layout.h (Layout::is_section_name_prefix_grouped): New
>> >>>> function.
>> >>>> * output.cc (Output_section::add_input_section): Check if
>> >>>> section
>> >>>> name contains special prefix. Keep input sections to sort such
>> >>>> sections.
>> >>>> (Output_section::Input_section_sort_section_order_index_compare
>> >>>> ::operator()): Group sections according to prefixes.
>> >>>> * (Output_section::sort_attached_input_sections): Add condition
>> >>>> to Input_section_entry constructor call.
>> >>>> * testsuite/Makefile.am (text_section_grouping): New test.
>> >>>> * testsuite/Makefile.in: Regenerate.
>> >>>> * testsuite/text_section_grouping.cc: New file.
>> >>>> * testsuite/text_section_grouping.sh: New file.
>> >>>
>> >>>
>> >>>> + // If it is a text section use the following order:
>> >>>> + // .text.unlikely, .text.startup, .text.hot.
>> >>>> + const char* section_prefix [] =
>> >>>> + {
>> >>>> + ".text.unlikely",
>> >>>> + ".text.startup",
>> >>>> + ".text.hot"
>> >>>> + };
>> >>>
>> >>> Please mention in the comment that this should match
>> >>> Layout::is_section_name_prefix_grouped.
>> >>>
>> >>> This is OK with that change.
>> >>
>> >> Made the change and committed the patch.
>> >
>> > I'm seeing a number of testsuite failures that I don't see when I
>> > revert your patch. In fact the linker doesn't seem to work properly
>> > at all, in that the bootstrap test fails. Could you look into that?
>> > Thanks.
>>
>> I will take a look now. Surprisingly, no tests fail for me.
>>
>> -Sri.
>>
>>
>> >
>> > Ian
>> >
>> > make libgoldtest.a object_unittest binary_unittest leb128_unittest
>> > icf_virtual_function_folding_test basic_test basic_pic_test
>> > basic_static_test basic_static_pic_test basic_pie_test
>> > constructor_test constructor_static_test two_file_test
>> > two_file_pic_test two_file_static_test two_file_shared_1_test
>> > two_file_shared_2_test two_file_shared_1_pic_2_test
>> > two_file_shared_2_pic_1_test two_file_same_shared_test
>> > two_file_separate_shared_12_test two_file_separate_shared_21_test
>> > two_file_relocatable_test two_file_pie_test two_file_strip_test
>> > two_file_same_shared_strip_test common_test_1 common_test_2
>> > exception_test exception_shared_1_test exception_shared_2_test
>> > exception_same_shared_test exception_separate_shared_12_test
>> > exception_separate_shared_21_test exception_static_test weak_test
>> > weak_undef_test weak_alias_test weak_plt copy_test tls_test
>> > tls_pic_test tls_pie_test tls_pie_pic_test tls_shared_test
>> > tls_shared_ie_test tls_shared_gd_to_ie_test
>> > tls_shared_gnu2_gd_to_ie_test tls_shared_gnu2_test tls_static_test
>> > tls_static_pic_test many_sections_test many_sections_r_test initpri1
>> > initpri2 initpri3a flagstest_o_specialfile
>> > flagstest_compress_debug_sections
>> > flagstest_o_specialfile_and_compress_debug_sections
>> > flagstest_o_ttext_1 ver_test ver_test_2 ver_test_6 ver_test_8
>> > ver_test_9 ver_test_11 ver_test_12 protected_1 protected_2 relro_test
>> > relro_now_test relro_strip_test relro_script_test script_test_1
>> > script_test_2 justsyms justsyms_exec binary_test script_test_3
>> > tls_phdrs_script_test tls_script_test thin_archive_test_1
>> > thin_archive_test_2 plugin_test_1 plugin_test_2 plugin_test_3
>> > plugin_test_4 plugin_test_5 plugin_test_6 plugin_test_7 plugin_test_8
>> > exclude_libs_test local_labels_test discard_locals_test large
>> > permission_test searched_file_test ifuncmain1static
>> > ifuncmain1picstatic ifuncmain1 ifuncmain1pic ifuncmain1vis
>> > ifuncmain1vispic ifuncmain1staticpic ifuncmain1pie ifuncmain1vispie
>> > ifuncmain1staticpie ifuncmain2static ifuncmain2picstatic ifuncmain2
>> > ifuncmain2pic ifuncmain3 ifuncmain4static ifuncmain4picstatic
>> > ifuncmain4 ifuncmain5static ifuncmain5picstatic ifuncmain5
>> > ifuncmain5pic ifuncmain5staticpic ifuncmain5pie ifuncmain6pie
>> > ifuncmain7static ifuncmain7picstatic ifuncmain7 ifuncmain7pic
>> > ifuncmain7pie ifuncvar start_lib_test incremental_test_2
>> > incremental_test_3 incremental_test_4 incremental_test_5
>> > incremental_test_6 incremental_copy_test incremental_common_test_1
>> > incremental_comdat_test_1 \
>> > incremental_test.sh gc_comdat_test.sh gc_tls_test.sh
>> > gc_orphan_section_test.sh pr14265.sh icf_test.sh
>> > icf_keep_unique_test.sh icf_safe_test.sh icf_safe_so_test.sh
>> > final_layout.sh text_section_grouping.sh
>> > icf_preemptible_functions_test.sh icf_string_merge_test.sh
>> > icf_sht_rel_addend_test.sh two_file_shared.sh weak_plt.sh debug_msg.sh
>> > undef_symbol.sh ver_test_1.sh ver_test_2.sh ver_test_4.sh
>> > ver_test_5.sh ver_test_7.sh ver_test_10.sh relro_test.sh
>> > ver_matching_test.sh script_test_3.sh script_test_4.sh
>> > script_test_5.sh script_test_6.sh script_test_7.sh script_test_8.sh
>> > script_test_9.sh dynamic_list.sh plugin_test_1.sh plugin_test_2.sh
>> > plugin_test_3.sh plugin_test_4.sh plugin_test_6.sh plugin_test_7.sh
>> > plugin_final_layout.sh exclude_libs_test.sh discard_locals_test.sh
>> > hidden_test.sh retain_symbols_file_test.sh no_version_test.sh
>> > strong_ref_weak_def.sh dyn_weak_ref.sh memory_test.sh
>> > script_test_10.sh split_x86_64.sh dwp_test_1.sh dwp_test_2.sh
>> > incremental_test.stdout gc_comdat_test.stdout gc_tls_test.stdout
>> > gc_orphan_section_test.stdout pr14265.stdout icf_test.stdout
>> > icf_keep_unique_test.stdout icf_safe_test_1.stdout
>> > icf_safe_test_2.stdout icf_safe_so_test_1.stdout
>> > icf_safe_so_test_2.stdout final_layout.stdout
>> > text_section_grouping.stdout icf_preemptible_functions_test.stdout
>> > icf_string_merge_test.stdout icf_sht_rel_addend_test.stdout
>> > two_file_shared.dbg weak_plt_shared.so debug_msg.err
>> > debug_msg_cdebug.err debug_msg_so.err debug_msg_ndebug.err
>> > undef_symbol.err flagstest_o_ttext_2 ver_test_1.syms ver_test_2.syms
>> > ver_test_4.syms ver_test_5.syms ver_test_7.syms ver_test_10.syms
>> > protected_3.err relro_test.stdout ver_matching_test.stdout
>> > script_test_3.stdout script_test_4.stdout script_test_5.stdout
>> > script_test_6.stdout script_test_7.stdout script_test_8.stdout
>> > script_test_9.stdout dynamic_list.stdout plugin_test_1.err
>> > plugin_test_2.err plugin_test_3.err plugin_test_4.err
>> > plugin_test_6.err plugin_test_7.err plugin_test_7.syms
>> > plugin_test_9.err plugin_final_layout.stdout
>> > plugin_final_layout_readelf.stdout exclude_libs_test.syms
>> > discard_locals_test.syms discard_locals_relocatable_test1.syms
>> > discard_locals_relocatable_test2.syms hidden_test.err
>> > retain_symbols_file_test.stdout no_version_test.stdout
>> > strong_ref_weak_def.stdout dyn_weak_ref.stdout memory_test.stdout
>> > script_test_10.stdout split_x86_64_1.stdout split_x86_64_2.stdout
>> > split_x86_64_3.stdout split_x86_64_4.stdout split_x86_64_r.stdout
>> > dwp_test_1.stdout dwp_test_2.stdout
>> > make[4]: Entering directory
>> > `/usr/local/google/iant/gold/gold-objdir/gold/testsuite'
>> > make[4]: `libgoldtest.a' is up to date.
>> > make[4]: `object_unittest' is up to date.
>> > make[4]: `binary_unittest' is up to date.
>> > make[4]: `leb128_unittest' is up to date.
>> > make[4]: `icf_virtual_function_folding_test' is up to date.
>> > make[4]: `basic_test' is up to date.
>> > make[4]: `basic_pic_test' is up to date.
>> > make[4]: `basic_static_test' is up to date.
>> > make[4]: `basic_static_pic_test' is up to date.
>> > make[4]: `basic_pie_test' is up to date.
>> > make[4]: `constructor_test' is up to date.
>> > make[4]: `constructor_static_test' is up to date.
>> > make[4]: `two_file_test' is up to date.
>> > make[4]: `two_file_pic_test' is up to date.
>> > make[4]: `two_file_static_test' is up to date.
>> > make[4]: `two_file_shared_1_test' is up to date.
>> > make[4]: `two_file_shared_2_test' is up to date.
>> > make[4]: `two_file_shared_1_pic_2_test' is up to date.
>> > make[4]: `two_file_shared_2_pic_1_test' is up to date.
>> > make[4]: `two_file_same_shared_test' is up to date.
>> > make[4]: `two_file_separate_shared_12_test' is up to date.
>> > make[4]: `two_file_separate_shared_21_test' is up to date.
>> > make[4]: `two_file_relocatable_test' is up to date.
>> > make[4]: `two_file_pie_test' is up to date.
>> > make[4]: `two_file_strip_test' is up to date.
>> > make[4]: `two_file_same_shared_strip_test' is up to date.
>> > make[4]: `common_test_1' is up to date.
>> > make[4]: `common_test_2' is up to date.
>> > make[4]: `exception_test' is up to date.
>> > make[4]: `exception_shared_1_test' is up to date.
>> > make[4]: `exception_shared_2_test' is up to date.
>> > make[4]: `exception_same_shared_test' is up to date.
>> > make[4]: `exception_separate_shared_12_test' is up to date.
>> > make[4]: `exception_separate_shared_21_test' is up to date.
>> > make[4]: `exception_static_test' is up to date.
>> > make[4]: `weak_test' is up to date.
>> > make[4]: `weak_undef_test' is up to date.
>> > make[4]: `weak_alias_test' is up to date.
>> > make[4]: `weak_plt' is up to date.
>> > make[4]: `copy_test' is up to date.
>> > g++ -W -Wall -Werror -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
>> > -fmerge-constants -g -O2 -Bgcctestdir/ -o tls_test tls_test.o
>> > tls_test_file2.o tls_test_main.o tls_test_c.o -lpthread -lz
>> > gcctestdir/ld: internal error in write_sections, at
>> > ../../src/gold/reloc.cc:830
>> > collect2: ld returned 1 exit status
>> > make[4]: *** [tls_test] Error 1
>> > make[4]: `tls_pic_test' is up to date.
>> > make[4]: `tls_pie_test' is up to date.
>> > make[4]: `tls_pie_pic_test' is up to date.
>> > make[4]: `tls_shared_test' is up to date.
>> > make[4]: `tls_shared_ie_test' is up to date.
>> > make[4]: `tls_shared_gd_to_ie_test' is up to date.
>> > make[4]: `tls_shared_gnu2_gd_to_ie_test' is up to date.
>> > make[4]: `tls_shared_gnu2_test' is up to date.
>> > make[4]: `tls_static_test' is up to date.
>> > make[4]: `tls_static_pic_test' is up to date.
>> > make[4]: `many_sections_test' is up to date.
>> > make[4]: `many_sections_r_test' is up to date.
>> > make[4]: `initpri1' is up to date.
>> > gcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror
>> > -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -fmerge-constants -g -O2
>> > -Bgcctestdir/ -Wl,--ctors-in-init-array -o initpri2 initpri2.o -lz
>> > gcctestdir/ld: internal error in write_sections, at
>> > ../../src/gold/reloc.cc:830
>> > collect2: ld returned 1 exit status
>> > make[4]: *** [initpri2] Error 1
>> > make[4]: `initpri3a' is up to date.
>> > make[4]: `flagstest_o_specialfile' is up to date.
>> > make[4]: `flagstest_compress_debug_sections' is up to date.
>> > make[4]: `flagstest_o_specialfile_and_compress_debug_sections' is up to
>> > date.
>> > make[4]: `flagstest_o_ttext_1' is up to date.
>> > make[4]: `ver_test' is up to date.
>> > make[4]: `ver_test_2' is up to date.
>> > make[4]: `ver_test_6' is up to date.
>> > make[4]: `ver_test_8' is up to date.
>> > make[4]: `ver_test_9' is up to date.
>> > make[4]: `ver_test_11' is up to date.
>> > make[4]: `ver_test_12' is up to date.
>> > make[4]: `protected_1' is up to date.
>> > make[4]: `protected_2' is up to date.
>> > make[4]: `relro_test' is up to date.
>> > make[4]: `relro_now_test' is up to date.
>> > make[4]: `relro_strip_test' is up to date.
>> > make[4]: `relro_script_test' is up to date.
>> > make[4]: `script_test_1' is up to date.
>> > make[4]: `script_test_2' is up to date.
>> > make[4]: `justsyms' is up to date.
>> > make[4]: `justsyms_exec' is up to date.
>> > make[4]: `binary_test' is up to date.
>> > make[4]: `script_test_3' is up to date.
>> > make[4]: `tls_phdrs_script_test' is up to date.
>> > make[4]: `tls_script_test' is up to date.
>> > make[4]: `thin_archive_test_1' is up to date.
>> > make[4]: `thin_archive_test_2' is up to date.
>> > make[4]: `plugin_test_1' is up to date.
>> > make[4]: `plugin_test_2' is up to date.
>> > make[4]: `plugin_test_3' is up to date.
>> > make[4]: `plugin_test_4' is up to date.
>> > make[4]: `plugin_test_5' is up to date.
>> > make[4]: `plugin_test_6' is up to date.
>> > make[4]: `plugin_test_7' is up to date.
>> > make[4]: `plugin_test_8' is up to date.
>> > make[4]: `exclude_libs_test' is up to date.
>> > make[4]: `local_labels_test' is up to date.
>> > make[4]: `discard_locals_test' is up to date.
>> > make[4]: `large' is up to date.
>> > make[4]: `permission_test' is up to date.
>> > make[4]: `searched_file_test' is up to date.
>> > make[4]: `ifuncmain1static' is up to date.
>> > make[4]: `ifuncmain1picstatic' is up to date.
>> > make[4]: `ifuncmain1' is up to date.
>> > make[4]: `ifuncmain1pic' is up to date.
>> > make[4]: `ifuncmain1vis' is up to date.
>> > make[4]: `ifuncmain1vispic' is up to date.
>> > make[4]: `ifuncmain1staticpic' is up to date.
>> > make[4]: `ifuncmain1pie' is up to date.
>> > make[4]: `ifuncmain1vispie' is up to date.
>> > make[4]: `ifuncmain1staticpie' is up to date.
>> > make[4]: `ifuncmain2static' is up to date.
>> > make[4]: `ifuncmain2picstatic' is up to date.
>> > make[4]: `ifuncmain2' is up to date.
>> > make[4]: `ifuncmain2pic' is up to date.
>> > make[4]: `ifuncmain3' is up to date.
>> > make[4]: `ifuncmain4static' is up to date.
>> > make[4]: `ifuncmain4picstatic' is up to date.
>> > gcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror
>> > -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -fmerge-constants -g -O2
>> > -Bgcctestdir/ -o ifuncmain4 ifuncmain4.o -lz
>> > gcctestdir/ld: internal error in write_sections, at
>> > ../../src/gold/reloc.cc:830
>> > collect2: ld returned 1 exit status
>> > make[4]: *** [ifuncmain4] Error 1
>> > make[4]: `ifuncmain5static' is up to date.
>> > make[4]: `ifuncmain5picstatic' is up to date.
>> > make[4]: `ifuncmain5' is up to date.
>> > make[4]: `ifuncmain5pic' is up to date.
>> > make[4]: `ifuncmain5staticpic' is up to date.
>> > make[4]: `ifuncmain5pie' is up to date.
>> > make[4]: `ifuncmain6pie' is up to date.
>> > make[4]: `ifuncmain7static' is up to date.
>> > make[4]: `ifuncmain7picstatic' is up to date.
>> > make[4]: `ifuncmain7' is up to date.
>> > make[4]: `ifuncmain7pic' is up to date.
>> > make[4]: `ifuncmain7pie' is up to date.
>> > make[4]: `ifuncvar' is up to date.
>> > make[4]: `start_lib_test' is up to date.
>> > make[4]: `incremental_test_2' is up to date.
>> > make[4]: `incremental_test_3' is up to date.
>> > make[4]: `incremental_test_4' is up to date.
>> > make[4]: `incremental_test_5' is up to date.
>> > make[4]: `incremental_test_6' is up to date.
>> > make[4]: `incremental_copy_test' is up to date.
>> > make[4]: `incremental_common_test_1' is up to date.
>> > make[4]: `incremental_comdat_test_1' is up to date.
>> > make[4]: Nothing to be done for
>> > `../../../src/gold/testsuite/incremental_test.sh'.
>> > make[4]: Nothing to be done for
>> > `../../../src/gold/testsuite/gc_comdat_test.sh'.
>> > make[4]: Nothing to be done for
>> > `../../../src/gold/testsuite/gc_tls_test.sh'.
>> > make[4]: Nothing to be done for
>> > `../../../src/gold/testsuite/gc_orphan_section_test.sh'.
>> > make[4]: Nothing to be done for
>> > `../../../src/gold/testsuite/pr14265.sh'.
>> > make[4]: Nothing to be done for
>> > `../../../src/gold/testsuite/icf_test.sh'.
>> > make[4]: Nothing to be done for
>> > `../../../src/gold/testsuite/icf_keep_unique_test.sh'.
>> > make[4]: Nothing to be done for
>> > `../../../src/gold/testsuite/icf_safe_test.sh'.
>> > make[4]: Nothing to be done for
>> > `../../../src/gold/testsuite/icf_safe_so_test.sh'.
>> > make[4]: Nothing to be done for
>> > `../../../src/gold/testsuite/final_layout.sh'.
>> > make[4]: Nothing to be done for
>> > `../../../src/gold/testsuite/text_section_grouping.sh'.
>> > make[4]: Nothing to be done for
>> > `../../../src/gold/testsuite/icf_preemptible_functions_test.sh'.
>> > make[4]: Nothing to be done for
>> > `../../../src/gold/testsuite/icf_string_merge_test.sh'.
>> > make[4]: Nothing to be done for
>> > `../../../src/gold/testsuite/icf_sht_rel_addend_test.sh'.
>> > make[4]: Nothing to be done for
>> > `../../../src/gold/testsuite/two_file_shared.sh'.
>> > make[4]: Nothing to be done for
>> > `../../../src/gold/testsuite/weak_plt.sh'.
>> > make[4]: Nothing to be done for
>> > `../../../src/gold/testsuite/debug_msg.sh'.
>> > make[4]: Nothing to be done for
>> > `../../../src/gold/testsuite/undef_symbol.sh'.
>> > make[4]: Nothing to be done for
>> > `../../../src/gold/testsuite/ver_test_1.sh'.
>> > make[4]: Nothing to be done for
>> > `../../../src/gold/testsuite/ver_test_2.sh'.
>> > make[4]: Nothing to be done for
>> > `../../../src/gold/testsuite/ver_test_4.sh'.
>> > make[4]: Nothing to be done for
>> > `../../../src/gold/testsuite/ver_test_5.sh'.
>> > make[4]: Nothing to be done for
>> > `../../../src/gold/testsuite/ver_test_7.sh'.
>> > make[4]: Nothing to be done for
>> > `../../../src/gold/testsuite/ver_test_10.sh'.
>> > make[4]: Nothing to be done for
>> > `../../../src/gold/testsuite/relro_test.sh'.
>> > make[4]: Nothing to be done for
>> > `../../../src/gold/testsuite/ver_matching_test.sh'.
>> > make[4]: Nothing to be done for
>> > `../../../src/gold/testsuite/script_test_3.sh'.
>> > make[4]: Nothing to be done for
>> > `../../../src/gold/testsuite/script_test_4.sh'.
>> > make[4]: Nothing to be done for
>> > `../../../src/gold/testsuite/script_test_5.sh'.
>> > make[4]: Nothing to be done for
>> > `../../../src/gold/testsuite/script_test_6.sh'.
>> > make[4]: Nothing to be done for
>> > `../../../src/gold/testsuite/script_test_7.sh'.
>> > make[4]: Nothing to be done for
>> > `../../../src/gold/testsuite/script_test_8.sh'.
>> > make[4]: Nothing to be done for
>> > `../../../src/gold/testsuite/script_test_9.sh'.
>> > make[4]: Nothing to be done for
>> > `../../../src/gold/testsuite/dynamic_list.sh'.
>> > make[4]: Nothing to be done for
>> > `../../../src/gold/testsuite/plugin_test_1.sh'.
>> > make[4]: Nothing to be done for
>> > `../../../src/gold/testsuite/plugin_test_2.sh'.
>> > make[4]: Nothing to be done for
>> > `../../../src/gold/testsuite/plugin_test_3.sh'.
>> > make[4]: Nothing to be done for
>> > `../../../src/gold/testsuite/plugin_test_4.sh'.
>> > make[4]: Nothing to be done for
>> > `../../../src/gold/testsuite/plugin_test_6.sh'.
>> > make[4]: Nothing to be done for
>> > `../../../src/gold/testsuite/plugin_test_7.sh'.
>> > make[4]: Nothing to be done for
>> > `../../../src/gold/testsuite/plugin_final_layout.sh'.
>> > make[4]: Nothing to be done for
>> > `../../../src/gold/testsuite/exclude_libs_test.sh'.
>> > make[4]: Nothing to be done for
>> > `../../../src/gold/testsuite/discard_locals_test.sh'.
>> > make[4]: Nothing to be done for
>> > `../../../src/gold/testsuite/hidden_test.sh'.
>> > make[4]: Nothing to be done for
>> > `../../../src/gold/testsuite/retain_symbols_file_test.sh'.
>> > make[4]: Nothing to be done for
>> > `../../../src/gold/testsuite/no_version_test.sh'.
>> > make[4]: Nothing to be done for
>> > `../../../src/gold/testsuite/strong_ref_weak_def.sh'.
>> > make[4]: Nothing to be done for
>> > `../../../src/gold/testsuite/dyn_weak_ref.sh'.
>> > make[4]: Nothing to be done for
>> > `../../../src/gold/testsuite/memory_test.sh'.
>> > make[4]: Nothing to be done for
>> > `../../../src/gold/testsuite/script_test_10.sh'.
>> > make[4]: Nothing to be done for
>> > `../../../src/gold/testsuite/split_x86_64.sh'.
>> > make[4]: Nothing to be done for
>> > `../../../src/gold/testsuite/dwp_test_1.sh'.
>> > make[4]: Nothing to be done for
>> > `../../../src/gold/testsuite/dwp_test_2.sh'.
>> > make[4]: `incremental_test.stdout' is up to date.
>> > make[4]: `gc_comdat_test.stdout' is up to date.
>> > make[4]: `gc_tls_test.stdout' is up to date.
>> > make[4]: `gc_orphan_section_test.stdout' is up to date.
>> > make[4]: `pr14265.stdout' is up to date.
>> > make[4]: `icf_test.stdout' is up to date.
>> > make[4]: `icf_keep_unique_test.stdout' is up to date.
>> > make[4]: `icf_safe_test_1.stdout' is up to date.
>> > make[4]: `icf_safe_test_2.stdout' is up to date.
>> > make[4]: `icf_safe_so_test_1.stdout' is up to date.
>> > make[4]: `icf_safe_so_test_2.stdout' is up to date.
>> > make[4]: `final_layout.stdout' is up to date.
>> > make[4]: `text_section_grouping.stdout' is up to date.
>> > make[4]: `icf_preemptible_functions_test.stdout' is up to date.
>> > make[4]: `icf_string_merge_test.stdout' is up to date.
>> > make[4]: `icf_sht_rel_addend_test.stdout' is up to date.
>> > make[4]: `two_file_shared.dbg' is up to date.
>> > make[4]: `weak_plt_shared.so' is up to date.
>> > make[4]: `debug_msg.err' is up to date.
>> > make[4]: `debug_msg_cdebug.err' is up to date.
>> > make[4]: `debug_msg_so.err' is up to date.
>> > make[4]: `debug_msg_ndebug.err' is up to date.
>> > make[4]: `undef_symbol.err' is up to date.
>> > make[4]: `flagstest_o_ttext_2' is up to date.
>> > make[4]: `ver_test_1.syms' is up to date.
>> > make[4]: `ver_test_2.syms' is up to date.
>> > make[4]: `ver_test_4.syms' is up to date.
>> > make[4]: `ver_test_5.syms' is up to date.
>> > make[4]: `ver_test_7.syms' is up to date.
>> > make[4]: `ver_test_10.syms' is up to date.
>> > make[4]: `protected_3.err' is up to date.
>> > make[4]: `relro_test.stdout' is up to date.
>> > make[4]: `ver_matching_test.stdout' is up to date.
>> > make[4]: `script_test_3.stdout' is up to date.
>> > make[4]: `script_test_4.stdout' is up to date.
>> > make[4]: `script_test_5.stdout' is up to date.
>> > make[4]: `script_test_6.stdout' is up to date.
>> > make[4]: `script_test_7.stdout' is up to date.
>> > make[4]: `script_test_8.stdout' is up to date.
>> > make[4]: `script_test_9.stdout' is up to date.
>> > make[4]: `dynamic_list.stdout' is up to date.
>> > make[4]: `plugin_test_1.err' is up to date.
>> > make[4]: `plugin_test_2.err' is up to date.
>> > make[4]: `plugin_test_3.err' is up to date.
>> > make[4]: `plugin_test_4.err' is up to date.
>> > make[4]: `plugin_test_6.err' is up to date.
>> > make[4]: Nothing to be done for `plugin_test_7.err'.
>> > make[4]: `plugin_test_7.syms' is up to date.
>> > make[4]: `plugin_test_9.err' is up to date.
>> > make[4]: `plugin_final_layout.stdout' is up to date.
>> > make[4]: `plugin_final_layout_readelf.stdout' is up to date.
>> > make[4]: `exclude_libs_test.syms' is up to date.
>> > make[4]: `discard_locals_test.syms' is up to date.
>> > make[4]: `discard_locals_relocatable_test1.syms' is up to date.
>> > make[4]: `discard_locals_relocatable_test2.syms' is up to date.
>> > make[4]: `hidden_test.err' is up to date.
>> > make[4]: `retain_symbols_file_test.stdout' is up to date.
>> > make[4]: `no_version_test.stdout' is up to date.
>> > make[4]: `strong_ref_weak_def.stdout' is up to date.
>> > make[4]: `dyn_weak_ref.stdout' is up to date.
>> > make[4]: `memory_test.stdout' is up to date.
>> > make[4]: `script_test_10.stdout' is up to date.
>> > make[4]: `split_x86_64_1.stdout' is up to date.
>> > make[4]: `split_x86_64_2.stdout' is up to date.
>> > make[4]: `split_x86_64_3.stdout' is up to date.
>> > make[4]: `split_x86_64_4.stdout' is up to date.
>> > make[4]: `split_x86_64_r.stdout' is up to date.
>> > make[4]: `dwp_test_1.stdout' is up to date.
>> > make[4]: `dwp_test_2.stdout' is up to date.
>> > make[4]: Leaving directory
>> > `/usr/local/google/iant/gold/gold-objdir/gold/testsuite'
>> > make[3]: *** [check-am] Error 2
>> > make[3]: Leaving directory
>> > `/usr/local/google/iant/gold/gold-objdir/gold/testsuite'
>> > make[2]: *** [check] Error 2
>> > make[2]: Leaving directory
>> > `/usr/local/google/iant/gold/gold-objdir/gold/testsuite'
>> > make[2]: Entering directory
>> > `/usr/local/google/iant/gold/gold-objdir/gold'
>> > make ld1 ld2 ld1-r ld2-r
>> > make[3]: Entering directory
>> > `/usr/local/google/iant/gold/gold-objdir/gold'
>> > g++ -W -Wall -Werror -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
>> > -frandom-seed=ld2 -g -O2 -Bgcctestdir2/ -o ld2 main.o i386.o x86_64.o
>> > sparc.o powerpc.o arm.o arm-reloc-property.o tilegx.o libgold.a
>> > ../libiberty/libiberty.a -ldl -lz
>> > (null): internal error in options, at ../../src/gold/parameters.h:92
>> > collect2: ld returned 1 exit status
>> > make[3]: *** [ld2] Error 1
>> > make[3]: `ld1-r' is up to date.
>> > gcctestdir2-r/ld -o libgold-2-r.o -r --whole-archive libgold.a
>> > (null): internal error in ~Task_list, at ../../src/gold/token.h:44
>> > make[3]: *** [libgold-2-r.o] Error 1
>> > make[3]: Target `ld2-r' not remade because of errors.
>> > make[3]: Leaving directory
>> > `/usr/local/google/iant/gold/gold-objdir/gold'
>> > make[2]: *** [check-am] Error 2
>> > make[2]: Leaving directory
>> > `/usr/local/google/iant/gold/gold-objdir/gold'
>> > make[1]: *** [check-recursive] Error 1
>> > make[1]: Target `check' not remade because of errors.
>> > make[1]: Leaving directory
>> > `/usr/local/google/iant/gold/gold-objdir/gold'
>> > make: *** [check-gold] Error 2
>
>
H.J. Lu
2012-12-20 20:05:49 UTC
Permalink
On Thu, Dec 20, 2012 at 12:03 PM, Ian Lance Taylor <***@google.com> wrote:
> On Wed, Dec 19, 2012 at 3:15 PM, Cary Coutant <***@google.com> wrote:
>> I'm not seeing these failures either. Freshly synced to top of trunk.
>
> I've reproduced it on three different machines. Synced to top of
> trunk, no local changes. Haven't had time to investigate yet.
>
> The key difference is probably that I am using GCC 4.6.3 on Ubuntu
> Precise and Fedora 16.
>

Same failures on Fedora 17.

--
H.J.
Cary Coutant
2012-12-20 20:42:30 UTC
Permalink
The failures I'm seeing with the statically-linked tests all went away
when I backed out this patch, but I'm not getting the internal errors
Ian and HJ are seeing. I'm also on Ubuntu Precise with GCC 4.6.3.

-cary

On Thu, Dec 20, 2012 at 12:05 PM, H.J. Lu <***@gmail.com> wrote:
> On Thu, Dec 20, 2012 at 12:03 PM, Ian Lance Taylor <***@google.com> wrote:
>> On Wed, Dec 19, 2012 at 3:15 PM, Cary Coutant <***@google.com> wrote:
>>> I'm not seeing these failures either. Freshly synced to top of trunk.
>>
>> I've reproduced it on three different machines. Synced to top of
>> trunk, no local changes. Haven't had time to investigate yet.
>>
>> The key difference is probably that I am using GCC 4.6.3 on Ubuntu
>> Precise and Fedora 16.
>>
>
> Same failures on Fedora 17.
>
> --
> H.J.
Cary Coutant
2012-12-20 22:08:21 UTC
Permalink
Here's a clue...

In basic_static_test, the .init section is supposed to look like this:

(gdb) disas _init
Dump of assembler code for function _init:
0x00000000004002f8 <+0>: sub $0x8,%rsp
0x00000000004002fc <+4>: callq 0x40040c <call_gmon_start>
0x0000000000400301 <+9>: callq 0x4004b0 <frame_dummy>
0x0000000000400306 <+14>: callq 0x4956a0 <__do_global_ctors_aux>
0x000000000040030b <+19>: add $0x8,%rsp
0x000000000040030f <+23>: retq

But instead it looks like this:

(gdb) disas _init
Dump of assembler code for function _init:
0x00000000004002f8 <+0>: sub $0x8,%rsp
0x00000000004002fc <+4>: callq 0x40040c <check_one_fd.part.0+44>
0x0000000000400301 <+9>: callq 0x4004b0 <group_number+75>
0x0000000000400306 <+14>: callq 0x494720 <__do_global_ctors_aux>
0x000000000040030b <+19>: add $0x8,%rsp
0x000000000040030f <+23>: retq

Those first two callq instructions are jumping to the same address,
but the targets of the calls have been moved. In fact, in the bad
copy, the .text section has been reordered such that call_gmon_start
is now at the very beginning of .text, but the relocation from the
.init section didn't get adjusted, and we're jumping to where it would
have been without the reordering.

-cary


On Thu, Dec 20, 2012 at 12:42 PM, Cary Coutant <***@google.com> wrote:
> The failures I'm seeing with the statically-linked tests all went away
> when I backed out this patch, but I'm not getting the internal errors
> Ian and HJ are seeing. I'm also on Ubuntu Precise with GCC 4.6.3.
>
> -cary
>
> On Thu, Dec 20, 2012 at 12:05 PM, H.J. Lu <***@gmail.com> wrote:
>> On Thu, Dec 20, 2012 at 12:03 PM, Ian Lance Taylor <***@google.com> wrote:
>>> On Wed, Dec 19, 2012 at 3:15 PM, Cary Coutant <***@google.com> wrote:
>>>> I'm not seeing these failures either. Freshly synced to top of trunk.
>>>
>>> I've reproduced it on three different machines. Synced to top of
>>> trunk, no local changes. Haven't had time to investigate yet.
>>>
>>> The key difference is probably that I am using GCC 4.6.3 on Ubuntu
>>> Precise and Fedora 16.
>>>
>>
>> Same failures on Fedora 17.
>>
>> --
>> H.J.
Cary Coutant
2012-12-20 22:38:30 UTC
Permalink
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?

Ian, HJ, does this patch fix the errors you're seeing as well?

-cary


diff --git a/gold/layout.cc b/gold/layout.cc
index 62b4cad..a9583c4 100644
--- a/gold/layout.cc
+++ b/gold/layout.cc
@@ -1602,6 +1602,7 @@ Layout::make_output_section(const char* name,
elfcpp::Elf_Word type,
&& !parameters->options().relocatable()
&& (strcmp(name, ".init_array") == 0
|| strcmp(name, ".fini_array") == 0
+ || strcmp(name, ".text") == 0
|| (!parameters->options().ctors_in_init_array()
&& (strcmp(name, ".ctors") == 0
|| strcmp(name, ".dtors") == 0))))

On Thu, Dec 20, 2012 at 2:08 PM, Cary Coutant <***@google.com> wrote:
> Here's a clue...
>
> In basic_static_test, the .init section is supposed to look like this:
>
> (gdb) disas _init
> Dump of assembler code for function _init:
> 0x00000000004002f8 <+0>: sub $0x8,%rsp
> 0x00000000004002fc <+4>: callq 0x40040c <call_gmon_start>
> 0x0000000000400301 <+9>: callq 0x4004b0 <frame_dummy>
> 0x0000000000400306 <+14>: callq 0x4956a0 <__do_global_ctors_aux>
> 0x000000000040030b <+19>: add $0x8,%rsp
> 0x000000000040030f <+23>: retq
>
> But instead it looks like this:
>
> (gdb) disas _init
> Dump of assembler code for function _init:
> 0x00000000004002f8 <+0>: sub $0x8,%rsp
> 0x00000000004002fc <+4>: callq 0x40040c <check_one_fd.part.0+44>
> 0x0000000000400301 <+9>: callq 0x4004b0 <group_number+75>
> 0x0000000000400306 <+14>: callq 0x494720 <__do_global_ctors_aux>
> 0x000000000040030b <+19>: add $0x8,%rsp
> 0x000000000040030f <+23>: retq
>
> Those first two callq instructions are jumping to the same address,
> but the targets of the calls have been moved. In fact, in the bad
> copy, the .text section has been reordered such that call_gmon_start
> is now at the very beginning of .text, but the relocation from the
> .init section didn't get adjusted, and we're jumping to where it would
> have been without the reordering.
>
> -cary
>
>
> On Thu, Dec 20, 2012 at 12:42 PM, Cary Coutant <***@google.com> wrote:
>> The failures I'm seeing with the statically-linked tests all went away
>> when I backed out this patch, but I'm not getting the internal errors
>> Ian and HJ are seeing. I'm also on Ubuntu Precise with GCC 4.6.3.
>>
>> -cary
>>
>> On Thu, Dec 20, 2012 at 12:05 PM, H.J. Lu <***@gmail.com> wrote:
>>> On Thu, Dec 20, 2012 at 12:03 PM, Ian Lance Taylor <***@google.com> wrote:
>>>> On Wed, Dec 19, 2012 at 3:15 PM, Cary Coutant <***@google.com> wrote:
>>>>> I'm not seeing these failures either. Freshly synced to top of trunk.
>>>>
>>>> I've reproduced it on three different machines. Synced to top of
>>>> trunk, no local changes. Haven't had time to investigate yet.
>>>>
>>>> The key difference is probably that I am using GCC 4.6.3 on Ubuntu
>>>> Precise and Fedora 16.
>>>>
>>>
>>> Same failures on Fedora 17.
>>>
>>> --
>>> H.J.
H.J. Lu
2012-12-20 23:34:04 UTC
Permalink
On Thu, Dec 20, 2012 at 2:38 PM, Cary Coutant <***@google.com> 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?
>
> Ian, HJ, does this patch fix the errors you're seeing as well?

Yes, it fixes the problem for me.

> -cary
>
>
> diff --git a/gold/layout.cc b/gold/layout.cc
> index 62b4cad..a9583c4 100644
> --- a/gold/layout.cc
> +++ b/gold/layout.cc
> @@ -1602,6 +1602,7 @@ Layout::make_output_section(const char* name,
> elfcpp::Elf_Word type,
> && !parameters->options().relocatable()
> && (strcmp(name, ".init_array") == 0
> || strcmp(name, ".fini_array") == 0
> + || strcmp(name, ".text") == 0
> || (!parameters->options().ctors_in_init_array()
> && (strcmp(name, ".ctors") == 0
> || strcmp(name, ".dtors") == 0))))
>

--
H.J.
Ian Lance Taylor
2012-12-21 06:26:55 UTC
Permalink
On Thu, Dec 20, 2012 at 2:38 PM, Cary Coutant <***@google.com> 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 <***@google.com>

* layout.cc (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.cc (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.
H.J. Lu
2012-12-21 15:38:44 UTC
Permalink
On Thu, Dec 20, 2012 at 10:26 PM, Ian Lance Taylor <***@google.com> wrote:
> On Thu, Dec 20, 2012 at 2:38 PM, Cary Coutant <***@google.com> 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 <***@google.com>
>
> * layout.cc (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.cc (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


--
H.J.
Ian Lance Taylor
2012-12-21 15:46:25 UTC
Permalink
On Fri, Dec 21, 2012 at 7:38 AM, H.J. Lu <***@gmail.com> wrote:
> On Thu, Dec 20, 2012 at 10:26 PM, Ian Lance Taylor <***@google.com> wrote:
>> On Thu, Dec 20, 2012 at 2:38 PM, Cary Coutant <***@google.com> 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 <***@google.com>
>>
>> * layout.cc (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.cc (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
H.J. Lu
2012-12-21 18:29:05 UTC
Permalink
On Fri, Dec 21, 2012 at 7:46 AM, Ian Lance Taylor <***@google.com> wrote:
> On Fri, Dec 21, 2012 at 7:38 AM, H.J. Lu <***@gmail.com> wrote:
>> On Thu, Dec 20, 2012 at 10:26 PM, Ian Lance Taylor <***@google.com> wrote:
>>> On Thu, Dec 20, 2012 at 2:38 PM, Cary Coutant <***@google.com> 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 <***@google.com>
>>>
>>> * layout.cc (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.cc (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

(gdb) bt
#0 gold::do_gold_unreachable (
filename=0x69d3d0 "/export/gnu/import/git/binutils/gold/gold.h",
lineno=192,
function=0x6b0826
<_ZZN4gold13convert_typesIjyEET_T0_E12__FUNCTION__> "convert_types")
at /export/gnu/import/git/binutils/gold/gold.cc:100
#1 0x0040375c in gold::convert_types<unsigned int, unsigned long long> (
from=<optimized out>) at /export/gnu/import/git/binutils/gold/gold.h:192
#2 0x00485916 in do_set_section_offset (this=<optimized out>,
shndx=<optimized out>, off=<optimized out>)
at /export/gnu/import/git/binutils/gold/object.h:1936
#3 gold::Sized_relobj<32, false>::do_set_section_offset (
this=<optimized out>, shndx=<optimized out>, off=<optimized out>)
at /export/gnu/import/git/binutils/gold/object.h:1934
#4 0x00594fc1 in gold::Output_section::add_input_section<32, false> (
this=<optimized out>, layout=<optimized out>, object=<optimized out>,
shndx=7, secname=<optimized out>, shdr=..., reloc_shndx=0,
have_sections_script=false)
at /export/gnu/import/git/binutils/gold/output.cc:2514
#5 0x00545b85 in gold::Layout::layout<32, false> (this=<optimized out>,
object=<optimized out>, shndx=7, name=<optimized out>, shdr=...,
reloc_shndx=0, off=0xffff8dd8)
at /export/gnu/import/git/binutils/gold/layout.cc:1177
#6 0x0054a57b in gold::Sized_relobj_file<32, false>::layout_section (
---Type <return> to continue, or q <return> to quit---
this=<optimized out>, layout=<optimized out>, shndx=7,
name=<optimized out>, shdr=..., reloc_shndx=0, reloc_type=0)
at /export/gnu/import/git/binutils/gold/object.cc:1161
#7 0x00561701 in gold::Sized_relobj_file<32, false>::do_layout (
this=<optimized out>, symtab=<optimized out>, layout=<optimized out>,
sd=<optimized out>) at /export/gnu/import/git/binutils/gold/object.cc:1665
#8 0x005b6d22 in layout (sd=<optimized out>, layout=
{void (gold::Read_symbols_data *, gold::Layout *,
gold::Symbol_table *, gold::Object * const)} 0x5b6d11
<gold::Add_symbols::run(gold::Workqueue*)+257>,
symtab=<optimized out>, this=<optimized out>)
at /export/gnu/import/git/binutils/gold/object.h:570
#9 run (this=0x9fe440) at /export/gnu/import/git/binutils/gold/readsyms.cc:634
#10 gold::Add_symbols::run (this=<optimized out>)
at /export/gnu/import/git/binutils/gold/readsyms.cc:594
#11 0x005ff746 in gold::Workqueue::find_and_run_task (
this=***@entry=0xffff9320, thread_number=***@entry=0)
at /export/gnu/import/git/binutils/gold/workqueue.cc:319
#12 0x005ffaca in gold::Workqueue::process (this=<optimized out>,
thread_number=0) at /export/gnu/import/git/binutils/gold/workqueue.cc:495
#13 0x0040602e in main (argc=37, argv=0xffffcbb4)
at /export/gnu/import/git/binutils/gold/main.cc:252
(gdb)


--
H.J.
H.J. Lu
2012-12-21 19:05:32 UTC
Permalink
On Fri, Dec 21, 2012 at 10:29 AM, H.J. Lu <***@gmail.com> wrote:
> On Fri, Dec 21, 2012 at 7:46 AM, Ian Lance Taylor <***@google.com> wrote:
>> On Fri, Dec 21, 2012 at 7:38 AM, H.J. Lu <***@gmail.com> wrote:
>>> On Thu, Dec 20, 2012 at 10:26 PM, Ian Lance Taylor <***@google.com> wrote:
>>>> On Thu, Dec 20, 2012 at 2:38 PM, Cary Coutant <***@google.com> 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 <***@google.com>
>>>>
>>>> * layout.cc (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.cc (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",
lineno=192,
function=0x83781b <unsigned int gold::convert_types<unsigned int,
unsigned long long>(unsigned long long)::__FUNCTION__>
"convert_types")
at /export/gnu/import/git/binutils/gold/gold.cc:102
#1 0x0043f4d4 in gold::convert_types<unsigned int, unsigned long long> (
from=18446744073709551050)
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,
off=18446744073709551050)
at /export/gnu/import/git/binutils/gold/object.h:1172
#4 0x00680bdb in
gold::Output_section::Input_section::set_address_and_file_offset
(this=0xffff8a90, address=4195370, file_offset=250,
section_file_offset=816)
at /export/gnu/import/git/binutils/gold/output.cc:2156
#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,
have_sections_script=false)
at /export/gnu/import/git/binutils/gold/output.cc:2514
---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/layout.cc:1177
#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/object.cc:1161
#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/object.cc:1665

#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/readsyms.cc:634
#11 0x0076d0c7 in gold::Workqueue::find_and_run_task (this=0xffff92d0,
thread_number=0) at /export/gnu/import/git/binutils/gold/workqueue.cc:319
#12 0x0076d713 in gold::Workqueue::process (this=0xffff92d0, thread_number=0)
at /export/gnu/import/git/binutils/gold/workqueue.cc:495
#13 0x0040347a in main (argc=37, argv=0xffffcbb4)
at /export/gnu/import/git/binutils/gold/main.cc:252
(gdb)


--
H.J.
Cary Coutant
2012-12-21 19:14:44 UTC
Permalink
> (gdb) bt
> #0 gold::do_gold_unreachable (
> filename=0x8367b0 "/export/gnu/import/git/binutils/gold/gold.h",
> lineno=192,
> function=0x83781b <unsigned int gold::convert_types<unsigned int,
> unsigned long long>(unsigned long long)::__FUNCTION__>
> "convert_types")
> at /export/gnu/import/git/binutils/gold/gold.cc:102
> #1 0x0043f4d4 in gold::convert_types<unsigned int, unsigned long long> (
> from=18446744073709551050)
> 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

Looks like you have a section offset (18446744073709551050 ==
0xFFFFFFFFFFFFFDCA == -3530) that doesn't fit in a 32-bit Address.
This section sorting thing may be interfering with the incremental
update.

-cary
Ian Lance Taylor
2012-11-20 15:12:55 UTC
Permalink
On Wed, Nov 14, 2012 at 5:06 PM, Sriraman Tallam <***@google.com> wrote:
>
> I finally got around to doing this in a way you suggested a while
> back, that is sorting text sections within the output section rather
> than creating separate output sections. Patch attached.

OK, let's go back to this version.

> + // The GNU linker groups input sections whose names match .text.unlikely.*.
> + // This is used to get better code layout. We are compatible.
> + // Additionally, it could also be beneficial to group .text.hot.*,
> + // .text.startup.* prefixed input sections.
> + if (!this->script_options_->saw_sections_clause()
> + && !parameters->options().relocatable()
> + && !os->input_section_order_specified()
> + && strcmp(name, ".text") == 0)
> + os->set_must_sort_attached_input_sections();

We don't need to always set must_sort_attached_input_sections for
.text. We only need to set it if we see a .text.unlikely, etc.,
section. Let's do that.

> + // If it is a text section use the following order:
> + // .text.unlikely, .text.startup, .text.hot, and .text
> + // In some cases one prefix is itself a prefix of another prefix; in
> + // such a case the longer prefix must come first below.

The last sentence is only there because .text is in the list, but it's
not clear to me why .text is in the list. What happens if you simply
omit it?

> s1_group_index = s2_group_index = num_prefixes;

Write two separate assignments, please.

Ian
s***@gmail.com
2012-11-16 16:16:54 UTC
Permalink
Hi,

Does the compiler generate .text.hot, .text.unlikely, and .text.startup
sections ? Or is this hand coded assembly ?

If its hand coded, why not use a linker script to do the same ?

Also why is gold mapping all .text.* sections to .text ? Doesnt it make
sense to merge all of them to sections of their own and when segments are
laid out, it can select how many of these sections are part of the segment.

While I am at this, Is there an ordering restriction of how segments should
appear in the output file ?

By ordering of segments, I mean that

segments with RX permissions appear before WX and so on, where does the code
handle ordering of segments in the gold linker ?

Thanks

Shankar Easwaran



--
View this message in context: http://sourceware-org.1504.n7.nabble.com/Map-text-hot-and-text-unlikely-input-section-prefixes-to-separate-output-sections-tp136994p213373.html
Sent from the Sourceware - binutils list mailing list archive at Nabble.com.
Ian Lance Taylor
2012-11-16 16:40:08 UTC
Permalink
On Fri, Nov 16, 2012 at 8:16 AM, ***@gmail.com
<***@gmail.com> wrote:
>
> Does the compiler generate .text.hot, .text.unlikely, and .text.startup
> sections ? Or is this hand coded assembly ?

GCC generates them if you use the -freorder-functions option.

> Also why is gold mapping all .text.* sections to .text ? Doesnt it make
> sense to merge all of them to sections of their own and when segments are
> laid out, it can select how many of these sections are part of the segment.

gold is mostly trying to emulate the GNU linker here. But it's not
crazy. When using the GCC option -ffunction-sections you get a
different section for each function. It doesn't really help anybody
to reflect all those sections in the output file.

> While I am at this, Is there an ordering restriction of how segments should
> appear in the output file ?
>
> By ordering of segments, I mean that
>
> segments with RX permissions appear before WX and so on, where does the code
> handle ordering of segments in the gold linker ?

The only ordering requirement is that PT_LOAD segments must appear in
load-address order, and the PT_PHDR and PT_INTERP segments must come
before any PT_LOAD segments.

In gold segment ordering is handled by Layout::segment_precedes.

Ian
Loading...