12 Commits

Author SHA1 Message Date
Sean Perry
97189492a1
The real option name and not the alias used is displayed in msgs when using a config file (#107613)
An example of this is the -mpure-code option. Without a config file
being used, an error message will print `-mpure-code`. But if a config
file is used, the error message will print `-mexecute-only`.
2024-09-25 10:51:55 -04:00
Keith Walker
acc5db2bed [Thumb1] Do not allow Armv6-m XO and PI code
When generating armv6-m (Thumb1) Position Independent (PI) code
there are currently some code sequences that are not compatible
with eXecute-Only (XO) code.

For example, this simple code sequence when compiler for XO & PI:

extern int x;
int fn() { return x; }
is a problem as the address of x is currently loaded by:

  ldr r0, .L0
:
:
.L0:
  .long   x

which is not XO compiant as this involves reading the value at
.L0 which is in the code section. Generating correct code is
currently hindered by lack of suitable relocations.

Disallow the generation of armv6-m PI code together with XO code
until they can be made to work together.

Differential Revision: https://reviews.llvm.org/D157620
2023-08-22 11:08:11 +01:00
Michael Platings
872d22c735 [NFC][Clang][Test] Fix warning-as-error
Since D149444 this test has been failing with -Wmissing-multilib if
multilib is configured for the BareMetal toolchain.
By setting sysroot the test is more hermetic and the failure is avoided.
2023-08-09 21:29:53 +01:00
Ties Stuij
479955a42a [ARM] Allow codegen for Armv6m eXecute-Only (XO) sections
This patch moves the overall lower-bound arch restriction for Arm XO sections
from v8m to v6m. Actual implementation of code-gen for v6m will follow in
follow-up patches, which will include an implementation of relocations needed to
support this.

Reviewed By: simonwallis2, MaskRay

Differential Revision: https://reviews.llvm.org/D149444
2023-08-09 14:16:11 +01:00
Zhiyao Ma
7e8af2fc0c [ARM] Support -mexecute-only with -mlong-calls.
Instead of using constant pools, use movw movt pair.

Differential Revision: https://reviews.llvm.org/D136203
2022-10-24 11:41:24 -07:00
Fangrui Song
e2a1639c73 [test] Fix unused check prefixes in test/Driver
Note, the deprecated AArch64 -msign-return-address= does not accept b-key. So
delete the incorrect tests.
2020-10-31 00:14:59 -07:00
Nico Weber
e3f06b478c Let unaliased Args track which Alias they were created from, and use that in Arg::getAsString() for diagnostics
With this, `clang-cl /source-charset:utf-16 test.cc` now prints `invalid
value 'utf-16' in '/source-charset:utf-16'` instead of `invalid value
'utf-16' in '-finput-charset=utf-16'` before, and several other clang-cl
flags produce much less confusing output as well.

Fixes PR29106.

Since an arg and its alias can have different arg types (joined vs not)
and different values (because of AliasArgs<>), I chose to give the Alias
its own Arg object. For convenience, I just store the alias directly in
the unaliased arg – there aren't many arg objects at runtime, so that
seems ok.

Finally, I changed Arg::getAsString() to use the alias's representation
if it's present – that function was already documented as being the
suitable function for diagnostics, and most callers already used it for
diagnostics.

Implementation-wise, Arg::accept() previously used to parse things as
the unaliased option. The core of that switch is now extracted into a
new function acceptInternal() which parses as the _aliased_ option, and
the previously-intermingled unaliasing is now done as an explicit step
afterwards.

(This also changes one place in lld that didn't use getAsString() for
diagnostics, so that that one place now also prints the flag as the user
wrote it, not as it looks after it went through unaliasing.)

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

llvm-svn: 365413
2019-07-09 00:34:08 +00:00
Eli Friedman
1ad23a494b Remove unused CHECK lines leftover from r306928.
The RUN lines were removed, but the corresponding CHECK lines never
went away.

llvm-svn: 328891
2018-03-30 18:39:28 +00:00
Eric Christopher
6f357afee2 Update clang support for -mexecute-only/-mpure-code for backend change to use subtarget feature rather than command line option.
llvm-svn: 306928
2017-07-01 02:55:23 +00:00
Christof Douma
8723946e91 [ARM] Don't pass -arm-execute-only to cc1as
The option -mexecute-only is translated into the backend option
-arm-execute-only. But this option only makes sense for the compiler and
the assembler does not recognize it. This patch stops clang from passing
this option to the assembler.

Change-Id: I4f4cb1162c13cfd50a0a36702a4ecab1bc0324ba
Review: https://reviews.llvm.org/D30414
llvm-svn: 296454
2017-02-28 09:09:53 +00:00
Prakhar Bahuguna
9390d84d10 [ARM] Add missing -backend-option for -arm-execute-only
llvm-svn: 290110
2016-12-19 15:43:33 +00:00
Prakhar Bahuguna
61ef150d53 [ARM] Implement execute-only support in CodeGen
Summary:
This implements execute-only support for ARM code generation, which
prevents the compiler from generating data accesses to code sections.
The following changes are involved:

* Add the CodeGen option "-arm-execute-only" to the ARM code generator.
* Add the clang flag "-mexecute-only" as well as the GCC-compatible
  alias "-mpure-code" to enable this option.
* When enabled, literal pools are replaced with MOVW/MOVT instructions,
  with VMOV used in addition for floating-point literals. As the MOVT
  instruction is required, execute-only support is only available in
  Thumb mode for targets supporting ARMv8-M baseline or Thumb2.
* Jump tables are placed in data sections when in execute-only mode.
* The execute-only text section is assigned section ID 0, and is
  marked as unreadable with the SHF_ARM_PURECODE flag with symbol 'y'.
  This also overrides selection of ELF sections for globals.

Reviewers: t.p.northover, rengolin

Subscribers: llvm-commits, aemerson

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

llvm-svn: 289786
2016-12-15 07:59:24 +00:00