[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 03:09:48 PDT 2019


peter.smith added a comment.

In D63190#1539544 <https://reviews.llvm.org/D63190#1539544>, @ruiu wrote:

> Yes, we have an internal user who has a proprietary tool to process a -Map output. As to the difference between bfd and gold, they don't look too big, so perhaps most tools can consume both. In this output, I modeled gold.


I think it isn't likely that tools will accept both gold and bfd map file formats; from a conversation with an employee of a Linux Distro, gold was used about 3% of the time although I expect its use to be significantly higher in Google. I've seen map file post processing most used in embedded systems as this is where placement of sections and size information is most crucial. I think most of those users are with ld.bfd at the moment though.

At the Euro LLVM binutils (LLD as honorary member) it was suggested that a machine readable format option for outputs such as the map file would be ideal.  There was some belief that binutils could be persuaded to adopt a similar format. The TI proprietary linker does this http://downloads.ti.com/docs/esd/SLAU131K/Content/SLAU131K_HTML/xml_link_information_file_description.html#STDZ0820750 although they use XML which is probably overkill. Something like JSON would be quite simple for tools to parse.

Would it be worth asking if the customer would be willing to rewrite their parser to consume something like JSON and go down that route? Having said all that I've no objections to adding support for other linker map file formats, and adding gold doesn't prevent adding others later.



================
Comment at: lld/ELF/Options.td:192
 
+defm gnu_map: Eq<"gnu-map",
+    "Print a link map to the specified file in the same format as GNU gold">;
----------------
MaskRay wrote:
> Without looking at the documentation, I think people would mostly likely think `-gnu-map` means a GNU ld compatible format.
> 
> ld.bfd is GNU ld :) (I have to say `-gold-map` sounds like a weird option name)
I agree with MaskRay here. Perhaps another command line option --map-file-format=<format> where <format> defaults to lld. We could then add gold, bfd etc.


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