[PATCH 1/2] driver: Add if-driverlang spec function
Jeff Law
jeffrey.law@oss.qualcomm.com
Sun Oct 11 17:36:39 GMT 2026
On 1/26/26 5:23 PM, Keith Packard wrote:
> Provide a way for spec fragments to detect which language specific
> driver is in use. This allows for language-specific functionality to
> be included during linking, like unwind constructors for C++ exception
> handling.
>
> Signed-off-by: Keith Packard <keithp@keithp.com>
> ---
> gcc/algol68/a68spec.cc | 3 +++
> gcc/c-family/cppspec.cc | 3 +++
> gcc/c/gccspec.cc | 3 +++
> gcc/cobol/gcobolspec.cc | 3 +++
> gcc/cp/g++spec.cc | 3 +++
> gcc/d/d-spec.cc | 2 ++
> gcc/doc/invoke.texi | 17 +++++++++++++++++
> gcc/fortran/gfortranspec.cc | 3 +++
> gcc/gcc.cc | 28 ++++++++++++++++++++++++++++
> gcc/gcc.h | 3 +++
> gcc/go/gospec.cc | 3 +++
> gcc/jit/jit-spec.cc | 3 +++
> gcc/m2/gm2spec.cc | 3 +++
> gcc/rust/rustspec.cc | 3 +++
> 14 files changed, 80 insertions(+)
So I can see what you're doing here, but what I'm struggling with is why
it's necessary. Shouldn't this stuff all be handled by
lang_specific_driver in the various front-ends? I realize that it
means you may need to embed knowledge into those drivers which might be
undesirable. So I guess this ultimately turns into evaluating pros/cons
of each approach and making a decision.
If we go forward with conditionals like you're doing here, then this
seems sensible.
Jeff
More information about the Gcc-patches
mailing list