Skip to content

Commit

Permalink
[LLD][COFF] Fixed a logic bug
Browse files Browse the repository at this point in the history
  • Loading branch information
gmh5225 authored Oct 11, 2023
1 parent 85f5117 commit ccf5e33
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions lld/COFF/Writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -932,11 +932,14 @@ void Writer::createSections() {
auto createSection = [&](StringRef name, uint32_t outChars) {
// If the user specified /driver, then we need to set the nonpaged attribute
// for the specific sections.
if (ctx.config.driver && (name == ".text" || name == ".data" ||
name == ".rdata" || name == ".pdata") ||
((outChars & (code | r | x)) == (code | r | x)) && name != "PAGE" &&
name != "INIT")
outChars |= nonpaged;
if (ctx.config.driver) {
if (name == ".text" || name == ".data" || name == ".rdata" ||
name == ".pdata")
outChars |= nonpaged;
else if ((outChars & (code | r | x)) == (code | r | x) &&
name != "PAGE" && name != "INIT")
outChars |= nonpaged;
}
OutputSection *&sec = sections[{name, outChars}];
if (!sec) {
sec = make<OutputSection>(name, outChars);
Expand Down

0 comments on commit ccf5e33

Please sign in to comment.