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

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

Gold bug in ordering text sections.


    This patch to gold :
broke option --section-ordering-file and plugin based reordering. This
patch treats text sections as reorderable when special prefixes like
"" are seen. However, when --section-ordering-file (or
plugins) is also used then it cannot override the default sorting as
the code in to do sorting checks for
"must_sort_attached_input_sections()" first and this is always true
for .text sections with those prefixes.

   I have created the following patch to fix this. I have basically
disabled default sorting of .text sections in the presence of
--section-ordering-file or plugins. I think this makes sense because
this is also disabled in the presence of linker scripts.

  One other alternative is to unset
"must_sort_attached_input_sections" for ".text" if
section-ordering-file or plugins do reorder ".text".  This can sort
.text sections by default if --section-ordering-file does not touch
any .text sections. I think this is overkill though.

   This went unnoticed because none of the test cases generated the
special prefix for input text sections. I have modified the plugin
based test case to catch this problem. This test case will fail if the
patch to is not present.

  Please let me know what you think.


Attachment: section_ordering_bug.txt
Description: Text document

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