File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -1032,6 +1032,8 @@ void Writer::createSections() {
1032
1032
1033
1033
// Finally, move some output sections to the end.
1034
1034
auto sectionOrder = [&](const OutputSection *s) {
1035
+ if (ctx.config .driver && s->name == " INIT2" )
1036
+ return 1 ;
1035
1037
// Move DISCARDABLE (or non-memory-mapped) sections to the end of file
1036
1038
// because the loader cannot handle holes. Stripping can remove other
1037
1039
// discardable ones than .reloc, which is first of them (created early).
@@ -1040,22 +1042,18 @@ void Writer::createSections() {
1040
1042
// discardable sections. Stripping only removes the sections named
1041
1043
// .debug_* - thus try to avoid leaving holes after stripping.
1042
1044
if (s->name .starts_with (" .debug_" ))
1043
- return 3 ;
1044
- return 2 ;
1045
+ return 4 ;
1046
+ return 3 ;
1045
1047
}
1046
1048
// .rsrc should come at the end of the non-discardable sections because its
1047
1049
// size may change by the Win32 UpdateResources() function, causing
1048
1050
// subsequent sections to move (see https://crbug.com/827082).
1049
1051
if (s == rsrcSec)
1050
- return 1 ;
1052
+ return 2 ;
1051
1053
return 0 ;
1052
1054
};
1053
1055
llvm::stable_sort (ctx.outputSections ,
1054
1056
[&](const OutputSection *s, const OutputSection *t) {
1055
- if (s->name == " INIT2" && t->name == " .reloc" )
1056
- return true ;
1057
- if (s->name == " INIT2" && t->name == " .rsrc" )
1058
- return true ;
1059
1057
return sectionOrder (s) < sectionOrder (t);
1060
1058
});
1061
1059
}
You can’t perform that action at this time.
0 commit comments