This is an archive of the discontinued LLVM Phabricator instance.

Forward -target-feature option through to assembler.
Needs ReviewPublic

Authored by chatur01 on Nov 7 2014, 9:41 AM.
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

The cc1as driver supports the -target-feature option, but the Clang driver refuses to forward such an option specified with -Xassembler or -Wa through to cc1as, claiming it is unrecognized. This patch makes Clang forward the target-feature option and its argument through to the assembler.

The -target-feature option is useful for enabling/disabling optional features when using Clang as an assembler. For example (assuming test.s contains appropriate content),

$ clang -c -target arm-none-eabi -mcpu=cortex-a9 -Xassembler -target-feature -Xassembler -mp test.s
# Or
$ clang -c -target arm-none-eabi -mcpu=cortex-a9 -Wa,-target-feature,-mp test.s

Would signal an error if the assembly file test.s contained any multiprocessing extension instructions, such as PLDW,

$ clang -c -target arm-none-eabi -mcpu=cortex-a9 -Xassembler -target-feature -Xassembler -mp test.s
test.s:31:2: error: instruction requires: mp-extensions
        pldw    [r0]

However, currently the behavior is,

$ clang -c -target arm-none-eabi -mcpu=cortex-a9 -Xassembler -target-feature -Xassembler -mp test.s
clang-3.6: error: unsupported argument '-target-feature' to option 'Xassembler'
clang-3.6: error: unsupported argument '-mp' to option 'Xassembler

Which I consider incorrect.

Diff Detail

Event Timeline

chatur01 retitled this revision from to Forward -target-feature option through to assembler..
chatur01 updated this object.
chatur01 edited the test plan for this revision. (Show Details)
chatur01 added a subscriber: Unknown Object (MLST).

We normally use -Wa,FOO to be compatible with gnu as. Is there a gnu
as option that you could use?