AArch64: Make processing less fragile in config.gcc

Programming / Compilers / GCC - tnfchris [138bc75d-0d04-0410-961f-82ee72b054a4] - 26 July 2019 13:13 EDT

Due to config.gcc all the options need to be on one line because of the grep lines which would select only the first line of the option.

This causes it not to select the right bits on options that are spread over multiple lines when the --with-arch configure option is used. The issue happens silently and you just get a compiler with an incorrect set of default flags.

The current rules are quite rigid:

1) No space between the AARCH64_OPT_EXTENSION and the opening (. 2) No space between the opening ( and the extension name. 3) No space after the extension name before the ,. 4) Spaces are only allowed after a , and around |.

This patch makes this a lot less fragile by using the C pre-processor to flatten the list and then provides much more flexible regex using group matching to process the options instead of string replacement. This removes all the restrictions above and makes the code a bit more readable.

gcc/ChangeLog:

PR target/89517
- config.gcc: Relax parsing of AARCH64_OPT_EXTENSION.
- config/aarch64/aarch64-option-extensions.def: Add new comments and restore easier to read options.

3a3f0ab1c55 AArch64: Make processing less fragile in config.gcc
gcc/ChangeLog | 7 ++
gcc/config.gcc | 46 +++++++-----
gcc/config/aarch64/aarch64-option-extensions.def | 89 +++++++++++++++++-------
3 files changed, 97 insertions(+), 45 deletions(-)

Upstream: gcc.gnu.org


  • Share