Add OUTPUT_FORMAT linker script directive support.

Authored by ruiu on Oct 22 2018, 1:50 PM.


Add OUTPUT_FORMAT linker script directive support.

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.

Differential Revision: https://reviews.llvm.org/D53495

llvm-svn: 344952


ruiuOct 22 2018, 1:50 PM
Differential Revision
D53495: Add OUTPUT_FORMAT linker script directive support.
rG01cc58bfb013: Update commnents to reflect the changes for LWG#3127. NFC