[PATCH] D63190: Add -gnu-map option to emit a map file in the GNU-tsyle format.

Peter Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 12 06:26:15 PDT 2019


peter.smith added a comment.

I've been through to see if I could spot any significant differences. I've recorded what I found although I'm not sure how significant they are to the person attempting to parse the map file though.



================
Comment at: lld/ELF/MapFile.cpp:257
+
+    OS << format(" 0x%016llx", OSec->Addr) << " "
+       << left_justify(("0x" + Twine::utohexstr(OSec->Size)).str(), 11) << "\n";
----------------
gold right justifies the size, but I doubt that is significant.


================
Comment at: lld/ELF/MapFile.cpp:259
+       << left_justify(("0x" + Twine::utohexstr(OSec->Size)).str(), 11) << "\n";
+
+    // Dump symbols for each input section.
----------------
gold will print out the LMA if it is different at this point. Followed by (before compression) if the output section has been subject to debug compression.


================
Comment at: lld/ELF/MapFile.cpp:268
+        if (IS->Name.size() <= 14)
+          OS << " " << left_justify(IS->Name, 14);
+        else
----------------
Gold has some custom name printing for its linker generated content (do_print_to_mapfile) . For example the .plt comes out as 

```
**PLT 
```
.rela.dyn comes out as

```
** dynamic relocs
``` 



================
Comment at: lld/ELF/MapFile.cpp:273
+        OS << format(" 0x%016llx", IS->getVA(0)) << " "
+           << left_justify(("0x" + Twine::utohexstr(IS->getSize())).str(), 11)
+           << " " << toString(IS) << "\n";
----------------
gold size is right justified (not significant).


================
Comment at: lld/ELF/MapFile.cpp:274
+           << left_justify(("0x" + Twine::utohexstr(IS->getSize())).str(), 11)
+           << " " << toString(IS) << "\n";
+
----------------
Gold does not print the path and object for linker generated content like the .plt, LLD prints out <internal>:(.plt)


================
Comment at: lld/ELF/MapFile.cpp:277
+        for (Symbol *Sym : SectionSyms[IS]) {
+          OS << "                " << format("0x%016llx", Sym->getVA())
+             << "                " << toString(*Sym) << "\n";
----------------
gold only prints "ordinary symbols", for example it does not print sharedFoo, sharedBar, sharedFunc1, sharedFunc2


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D63190/new/

https://reviews.llvm.org/D63190





More information about the llvm-commits mailing list