summaryrefslogtreecommitdiffstats
path: root/lld/ELF/MapFile.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2017-05-18 21:30:14 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2017-05-18 21:30:14 +0000
commita46f688e8f4d90444e3537f046cac2e7c67120b3 (patch)
tree7798f9dd26d63ebcf7cdd6b76bca9e1570596889 /lld/ELF/MapFile.cpp
parent795de8a7bdb5443a0196dcb9158a30ad6d68ab61 (diff)
downloadbcm5719-llvm-a46f688e8f4d90444e3537f046cac2e7c67120b3.tar.gz
bcm5719-llvm-a46f688e8f4d90444e3537f046cac2e7c67120b3.zip
Use linker script commands in writeMapFile.
This converts the last (chronologically) user of OutputSections to use the linker script commands instead. The idea is to convert all uses after fabricateDefaultCommands, so that we have a single representation. llvm-svn: 303384
Diffstat (limited to 'lld/ELF/MapFile.cpp')
-rw-r--r--lld/ELF/MapFile.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/lld/ELF/MapFile.cpp b/lld/ELF/MapFile.cpp
index c3f4f5a4848..7b82eceba02 100644
--- a/lld/ELF/MapFile.cpp
+++ b/lld/ELF/MapFile.cpp
@@ -21,6 +21,7 @@
#include "MapFile.h"
#include "InputFiles.h"
+#include "LinkerScript.h"
#include "OutputSections.h"
#include "Strings.h"
#include "SymbolTable.h"
@@ -99,7 +100,7 @@ getSymbolStrings(ArrayRef<DefinedRegular *> Syms) {
}
template <class ELFT>
-void elf::writeMapFile(ArrayRef<OutputSection *> OutputSections) {
+void elf::writeMapFile(llvm::ArrayRef<BaseCommand *> Script) {
if (Config->MapFile.empty())
return;
@@ -122,7 +123,11 @@ void elf::writeMapFile(ArrayRef<OutputSection *> OutputSections) {
<< " Align Out In Symbol\n";
// Print out file contents.
- for (OutputSection *OSec : OutputSections) {
+ for (BaseCommand *Base : Script) {
+ auto *Cmd = dyn_cast<OutputSectionCommand>(Base);
+ if (!Cmd)
+ continue;
+ OutputSection *OSec = Cmd->Sec;
writeHeader<ELFT>(OS, OSec->Addr, OSec->Size, OSec->Alignment);
OS << OSec->Name << '\n';
@@ -137,7 +142,7 @@ void elf::writeMapFile(ArrayRef<OutputSection *> OutputSections) {
}
}
-template void elf::writeMapFile<ELF32LE>(ArrayRef<OutputSection *>);
-template void elf::writeMapFile<ELF32BE>(ArrayRef<OutputSection *>);
-template void elf::writeMapFile<ELF64LE>(ArrayRef<OutputSection *>);
-template void elf::writeMapFile<ELF64BE>(ArrayRef<OutputSection *>);
+template void elf::writeMapFile<ELF32LE>(ArrayRef<BaseCommand *>);
+template void elf::writeMapFile<ELF32BE>(ArrayRef<BaseCommand *>);
+template void elf::writeMapFile<ELF64LE>(ArrayRef<BaseCommand *>);
+template void elf::writeMapFile<ELF64BE>(ArrayRef<BaseCommand *>);
OpenPOWER on IntegriCloud