summaryrefslogtreecommitdiff
path: root/ELF/MapFile.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-05-22 19:44:12 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-05-22 19:44:12 +0000
commitc53addf38e24e4dafe992aafb3ae928bfa8fdb0a (patch)
tree5a8f08e745d2dbfdd66c9e4838a8b7eeb7f0453f /ELF/MapFile.cpp
parent2dcc0c5ee66570f02392d1fbf29f573fa47258f8 (diff)
Notes
Diffstat (limited to 'ELF/MapFile.cpp')
-rw-r--r--ELF/MapFile.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/ELF/MapFile.cpp b/ELF/MapFile.cpp
index 23c63e845c9a..7b82eceba02a 100644
--- a/ELF/MapFile.cpp
+++ b/ELF/MapFile.cpp
@@ -21,6 +21,8 @@
#include "MapFile.h"
#include "InputFiles.h"
+#include "LinkerScript.h"
+#include "OutputSections.h"
#include "Strings.h"
#include "SymbolTable.h"
#include "Threads.h"
@@ -98,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;
@@ -121,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';
@@ -136,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 *>);