Skip to content

Commit

Permalink
Print local
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasSte committed Jul 17, 2024
1 parent 873810b commit 15f1e0d
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
20 changes: 18 additions & 2 deletions lld/ELF/Driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@
#include <tuple>
#include <utility>
#include <iostream>
#include <iostream>
#include <fstream>

using namespace llvm;
Expand Down Expand Up @@ -2667,7 +2666,23 @@ void LinkerDriver::link(opt::InputArgList &args) {
parseArmCMSEImportLib(*armCmseImpLib);
}

std::ofstream myfile ("/Users/lucasste/Documents/overflow-repro/tube.txt");
std::ofstream anotherfile ("/Users/lucasste/Documents/overflow-repro/tube3.txt", std::ios_base::app);
anotherfile << "New case\n";
for (InputFile *file : files)
if (file)
for (Symbol *sym : file->getSymbols())
if (sym)
anotherfile << sym->getName().str() << "\n";

std::ofstream otherfile ("/Users/lucasste/Documents/overflow-repro/tube2.txt", std::ios_base::app);
otherfile << "New case\n";
for (ELFFileBase *file : ctx.objectFiles)
if (file)
for (Symbol *sym : file->getSymbols())
if (sym)
otherfile << sym->getName().str() << "\n";

std::ofstream myfile ("/Users/lucasste/Documents/overflow-repro/tube.txt", std::ios_base::app);
if (config->emachine == EM_BPF) {
myfile << "Target BPF \n";
} else if (config->emachine == EM_SBF) {
Expand Down Expand Up @@ -2743,6 +2758,7 @@ void LinkerDriver::link(opt::InputArgList &args) {
// Archive members defining __wrap symbols may be extracted.
std::vector<WrappedSymbol> wrapped = addWrappedSymbols(args);


// No more lazy bitcode can be extracted at this point. Do post parse work
// like checking duplicate symbols.
parallelForEach(ctx.objectFiles, [](ELFFileBase *file) {
Expand Down
2 changes: 2 additions & 0 deletions lld/ELF/InputFiles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include "llvm/Support/TarWriter.h"
#include "llvm/Support/raw_ostream.h"
#include <iostream>
#include <fstream>

using namespace llvm;
using namespace llvm::ELF;
Expand Down Expand Up @@ -1127,6 +1128,7 @@ void ObjFile<ELFT>::initSectionsAndLocalSyms(bool ignoreComdats) {
for (size_t i = 0, end = firstGlobal; i != end; ++i) {
const Elf_Sym &eSym = eSyms[i];
uint32_t secIdx = eSym.st_shndx;
Expected<StringRef> exp_name = eSym.getName(this->getStringTable());
if (LLVM_UNLIKELY(secIdx == SHN_XINDEX))
secIdx = check(getExtendedSymbolTableIndex<ELFT>(eSym, i, shndxTable));
else if (secIdx >= SHN_LORESERVE)
Expand Down
3 changes: 2 additions & 1 deletion llvm/lib/Target/SBF/SBFRegisterInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ static void WarnSize(int Offset, MachineFunction &MF, DebugLoc& DL)

//if (MF.getFunction().getLinkage() == GlobalValue::LinkageTypes::InternalLinkage) {
Twine NewName = MF.getFunction().getName() + "invalid";
MF.getFunction().setName(NewName);
//MF.getFunction().setName(NewName);
MF.getFunction().setLinkage(GlobalValue::LinkageTypes::ExternalLinkage);
//}
dbgs() << "The linkage is: " << (int)MF.getFunction().getLinkage() << "\n";
} else {
Expand Down

0 comments on commit 15f1e0d

Please sign in to comment.