[llvm-commits] CVS: llvm/lib/CodeGen/ELFWriter.cpp
Chris Lattner
lattner at cs.uiuc.edu
Sun Jul 10 20:11:58 PDT 2005
Changes in directory llvm/lib/CodeGen:
ELFWriter.cpp updated: 1.3 -> 1.4
---
Log message:
Use a name mangler object to uniquify names and remove nonstandard
characters from them.
---
Diffs of the changes: (+8 -2)
ELFWriter.cpp | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
Index: llvm/lib/CodeGen/ELFWriter.cpp
diff -u llvm/lib/CodeGen/ELFWriter.cpp:1.3 llvm/lib/CodeGen/ELFWriter.cpp:1.4
--- llvm/lib/CodeGen/ELFWriter.cpp:1.3 Fri Jul 8 00:47:00 2005
+++ llvm/lib/CodeGen/ELFWriter.cpp Sun Jul 10 22:11:47 2005
@@ -35,6 +35,7 @@
#include "llvm/CodeGen/ELFWriter.h"
#include "llvm/Module.h"
#include "llvm/Target/TargetMachine.h"
+#include "llvm/Support/Mangler.h"
using namespace llvm;
ELFWriter::ELFWriter(std::ostream &o, TargetMachine &tm) : O(o), TM(tm) {
@@ -48,6 +49,8 @@
// doInitialization - Emit the file header and all of the global variables for
// the module to the ELF file.
bool ELFWriter::doInitialization(Module &M) {
+ Mang = new Mangler(M);
+
outbyte(0x7F); // EI_MAG0
outbyte('E'); // EI_MAG1
outbyte('L'); // EI_MAG2
@@ -225,6 +228,9 @@
// Free the output buffer.
std::vector<unsigned char>().swap(OutputBuffer);
+
+ // Release the name mangler object.
+ delete Mang; Mang = 0;
return false;
}
@@ -246,8 +252,8 @@
SymbolTable[0].NameIdx = 0;
unsigned Index = 1;
for (unsigned i = 1, e = SymbolTable.size(); i != e; ++i) {
- // FIXME: USE A MANGLER!!
- const std::string &Name = SymbolTable[i].GV->getName();
+ // Use the name mangler to uniquify the LLVM symbol.
+ std::string Name = Mang->getValueName(SymbolTable[i].GV);
if (Name.empty()) {
SymbolTable[i].NameIdx = 0;
More information about the llvm-commits
mailing list