Skip to content

Commit

Permalink
Filter for the targets
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasSte committed Jul 15, 2024
1 parent d1cc2d0 commit 97e09ed
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions lld/ELF/Driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2925,19 +2925,22 @@ void LinkerDriver::link(opt::InputArgList &args) {
invokeELFT(markLive,);
demoteSharedAndLazySymbols();


for (const Symbol *sb : symtab.getSymbols()) {
if (sb->getName().ends_with("::stack_overflow")) {
const StringRef FuncName = sb->getName().substr(0, sb->getName().size());
report_fatal_error("Function " + FuncName +
" utilizes too much stack space and will cause "
"undefined behavior in the program. Refer to a"
"previously emitted warning for more information.");
} else if (sb->getName().ends_with("::call_overflow")) {
const StringRef FuncName = sb->getName().substr(0, sb->getName().size());
report_fatal_error("A function call inside method " + FuncName +
"will overwrite data in the stack frame. Refer to a "
"previously emitted warning for more information.");
if (config->emachine == EM_BPF || config->emachine == EM_SBF) {
for (const Symbol *sb : symtab.getSymbols()) {
if (sb->getName().ends_with("::stack_overflow")) {
const StringRef FuncName =
sb->getName().substr(0, sb->getName().size());
report_fatal_error("Function " + FuncName +
" utilizes too much stack space and will cause "
"undefined behavior in the program. Refer to a"
"previously emitted warning for more information.");
} else if (sb->getName().ends_with("::call_overflow")) {
const StringRef FuncName =
sb->getName().substr(0, sb->getName().size());
report_fatal_error("A function call inside method " + FuncName +
"will overwrite data in the stack frame. Refer to a "
"previously emitted warning for more information.");
}
}
}

Expand Down

0 comments on commit 97e09ed

Please sign in to comment.