modula-2, driver, Front end: Revise handling of I and L paths [PR108182].
authorIain Sandoe <iain@sandoe.co.uk>
Wed, 11 Jan 2023 10:22:34 +0000 (10:22 +0000)
committerIain Sandoe <iain@sandoe.co.uk>
Mon, 23 Jan 2023 17:26:53 +0000 (17:26 +0000)
commit47b269caf87904fd0112e8c9e96884dd0313ed15
tree3b44b1817a0df1ef659f426bb5524cd40dd9a891
parentbcc023e2b4dd0dc1fd1fca3ea12664d5bdade4dc
modula-2, driver, Front end: Revise handling of I and L paths [PR108182].

The adds the includes in the FE as done in other GCC languages.
It also revises the library handling to avoid additional -L options
from hiding LIBDIR.

For the include/import paths as presented to the front end initialisation,
we capture them and then arrange to emit the 'standard library' paths in
the same order as specified for C.

The specs are tidied up.

The use of the internal prefix also fixes searching in a relocated compiler.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
PR modula2/108182
PR modula2/108480

gcc/m2/ChangeLog:

* Make-lang.in: Pass libsubdir to the language init
build.
* gm2-lang.cc (INCLUDE_VECTOR): Define.
(add_one_import_path): New.
(add_m2_import_paths): New.
(gm2_langhook_post_options): Arrange to add the include
paths (and add the system ones) in the same order as C
uses.
* gm2spec.cc (build_archive_path): Remove.
(add_default_combination): Remove.
(add_default_archives): Remove.
(add_default_libs): We no longer need a '-L' option, just
emit the -l and each library in use.
(build_include_path): Remove.
(add_include): Remove.
(add_default_includes): Remove.
(library_installed): Remove.
(check_valid_library): Remove.
(check_valid_list): Remove.
(convert_abbreviation): Diagnose unhandled cases.
(lang_specific_driver): Skip options where we will add back
a validated version.
* lang-specs.h (M2CPP): Reformat, append %I when -fcpp is not
in use.  Revise the cc1gm2 spec to omit mentioning options that
are handled in the c pre-processor line.
* lang.opt: Allow preprocessing and path options as input to the
cc1gm2 invocation, so that they can be passed to the preprocessor
invocation.
gcc/m2/Make-lang.in
gcc/m2/gm2-lang.cc
gcc/m2/gm2spec.cc
gcc/m2/lang-specs.h
gcc/m2/lang.opt