[PATCH] D53495: Add OUTPUT_FORMAT linker script directive support.

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 22 06:43:36 PDT 2018


ruiu created this revision.
ruiu added a reviewer: grimar.
Herald added subscribers: arichardson, emaste.
Herald added a reviewer: espindola.

This patch adds a support for OUTPUT_FORMAT linker script directive.
Since I'm not 100% confident with BFD names you can use in the directive
for all architectures, I added only a few in this patch. We can add
other names for other archtiectures later.

We still do not support triple-style OUTPUT_FORMAT directive, namely,
OUTPUT_FORMAT(bfdname, big, little). If you pass -EL (little endian)
or -EB (big endian) to the linker, GNU linkers pick up big or little
as a BFD name, correspondingly, so that you can use a single linker
script for bi-endian processor. I'm not sure if we really need to
support that, so I'll leave it alone for now.

Note that -m takes precedence over OUTPUT_FORAMT, but we always parse
a BFD name given to OUTPUT_FORMAT for error checking. You cannot write
an invalid name in the OUTPUT_FORMAT directive.


https://reviews.llvm.org/D53495

Files:
  lld/ELF/ScriptParser.cpp
  lld/test/ELF/emulation.s
  lld/test/ELF/invalid-linkerscript.test
  lld/test/ELF/linkerscript/output-format.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53495.170402.patch
Type: text/x-patch
Size: 5254 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181022/bcc5f1cf/attachment.bin>


More information about the llvm-commits mailing list