[PATCH] D75966: [ELF] Move --print-map(-M)/--cref before checkSections() and openFile()

Peter Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 11 05:09:01 PDT 2020


psmith added inline comments.


================
Comment at: lld/ELF/Writer.cpp:598
 
+  // Handle --print-map(-M)/--Map and --cref. Dump them before checkSections()
+  // because the files may be useful in case checkSections() or openFile()
----------------
In general I think moving the map file before writing is a good thing, especially when trying to debug problems. Arm's proprietary linker has done something similar to this for a while, it will attempt to print the map file whenever an error has been detected, once a certain stage in the link has passed. 
My experience from that:
- There are sometimes problems when the map file crashes due some information not being available at the time, or not being valid. I don't think the risk is high with this implementation. Is it possible checkSections() might find something that would crash the map file printer? Does the map file writing code need to guard against invalid sections for example?
- It sometimes gives the impression that the link has succeeded even when it has failed, especially if the error message comes before the map file. If it isn't obvious the link has failed we may need to make it so.  


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D75966





More information about the llvm-commits mailing list