Skip to content

Commit ccf5e33

Browse files
authored
[LLD][COFF] Fixed a logic bug
1 parent 85f5117 commit ccf5e33

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

lld/COFF/Writer.cpp

+8-5
Original file line numberDiff line numberDiff line change
@@ -932,11 +932,14 @@ void Writer::createSections() {
932932
auto createSection = [&](StringRef name, uint32_t outChars) {
933933
// If the user specified /driver, then we need to set the nonpaged attribute
934934
// for the specific sections.
935-
if (ctx.config.driver && (name == ".text" || name == ".data" ||
936-
name == ".rdata" || name == ".pdata") ||
937-
((outChars & (code | r | x)) == (code | r | x)) && name != "PAGE" &&
938-
name != "INIT")
939-
outChars |= nonpaged;
935+
if (ctx.config.driver) {
936+
if (name == ".text" || name == ".data" || name == ".rdata" ||
937+
name == ".pdata")
938+
outChars |= nonpaged;
939+
else if ((outChars & (code | r | x)) == (code | r | x) &&
940+
name != "PAGE" && name != "INIT")
941+
outChars |= nonpaged;
942+
}
940943
OutputSection *&sec = sections[{name, outChars}];
941944
if (!sec) {
942945
sec = make<OutputSection>(name, outChars);

0 commit comments

Comments
 (0)