[PATCH] Forward -target-feature option through to assembler.

Charlie Turner charlie.turner at arm.com
Fri Nov 7 09:41:31 PST 2014


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.

http://reviews.llvm.org/D6170

Files:
  lib/Driver/Tools.cpp
  test/Driver/integrated-as.s
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D6170.15928.patch
Type: text/x-patch
Size: 1206 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20141107/125274f6/attachment.bin>


More information about the cfe-commits mailing list