| 1 |
# SPDX-License-Identifier: Apache-2.0 |
| 2 |
# Copyright 2012-2023 The Meson development team |
| 3 |
|
| 4 |
# Core public classes for linkers. |
| 5 |
from __future__ import annotations |
| 6 |
|
| 7 |
import enum |
| 8 |
import typing as T |
| 9 |
|
| 10 |
if T.TYPE_CHECKING: |
| 11 |
from ..environment import Environment |
| 12 |
|
| 13 |
|
| 14 |
@enum.unique |
| 15 |
class RSPFileSyntax(enum.Enum): |
| 16 |
|
| 17 |
"""Which RSP file syntax the compiler supports.""" |
| 18 |
|
| 19 |
MSVC = enum.auto() |
| 20 |
GCC = enum.auto() |
| 21 |
TASKING = enum.auto() |
| 22 |
|
| 23 |
|
| 24 |
class ArLikeLinker: |
| 25 |
# POSIX requires supporting the dash, GNU permits omitting it |
| 26 |
std_args = ['-csr'] |
| 27 |
|
| 28 |
def can_linker_accept_rsp(self) -> bool: |
| 29 |
# armar / AIX can't accept arguments using the @rsp syntax |
| 30 |
# in fact, only the 'ar' id can |
| 31 |
return False |
| 32 |
|
| 33 |
def get_std_link_args(self, env: 'Environment', is_thin: bool) -> T.List[str]: |
| 34 |
return self.std_args |
| 35 |
|
| 36 |
def get_output_args(self, target: str) -> T.List[str]: |
| 37 |
return [target] |
| 38 |
|
| 39 |
def rsp_file_syntax(self) -> RSPFileSyntax: |
| 40 |
return RSPFileSyntax.GCC |