ld: new options --ctf-variables and --ctf-share-types
libctf recently changed to make it possible to not emit the CTF variables section. Make this the default for ld: the variables section is a simple name -> type mapping, and the names can be quite voluminous. Nothing in the variables section appears in the symbol table, by definition, so GDB cannot make use of them: special-purpose projects that implement their own analogues of symbol table lookup can do so, but they'll need to tell the linker to emit the variables section after all. The new --ctf-variables option does this. The --ctf-share-types option (valid values "share-duplicated" and "share-unconflicted") allow the caller to specify the CTF link mode. Most users will want share-duplicated, since it allows for more convenient debugging: but very large projects composed of many decoupled components may want to use share-unconflicted mode, which places types that appear in only one TU into per-TU dicts. (They may also want to relink the CTF using the ctf_link API and cu-mapping, to make their "components" larger than a single TU. Right now the linker does not expose the CU-mapping machinery. Perhaps it should in future to make this use case easier.) For now, giving the linker the ability to emit share-duplicated CTF lets us add testcases for that mode to the testsuite. ld/ * ldlex.h (option_values) <OPTION_CTF_VARIABLES, OPTION_NO_CTF_VARIABLES, OPTION_CTF_SHARE_TYPES>: New. * ld.h (ld_config_type) <ctf_variables, ctf_share_duplicated>: New fields. * ldlang.c (lang_merge_ctf): Use them. * lexsup.c (ld_options): Add ctf-variables, no-ctf-variables, ctf-share-types. (parse_args) <OPTION_CTF_VARIABLES, OPTION_NO_CTF_VARIABLES, OPTION_CTF_SHARE_TYPES>: New cases. * ld.texi: Document new options. * NEWS: Likewise.
This commit is contained in:
parent
f320bba50f
commit
5dba6f05b7
7 changed files with 107 additions and 1 deletions
29
ld/lexsup.c
29
ld/lexsup.c
|
@ -572,6 +572,18 @@ static const struct ld_option ld_options[] =
|
|||
{ {"no-print-map-discarded", no_argument, NULL, OPTION_NO_PRINT_MAP_DISCARDED},
|
||||
'\0', NULL, N_("Do not show discarded sections in map file output"),
|
||||
TWO_DASHES },
|
||||
{ {"ctf-variables", no_argument, NULL, OPTION_CTF_VARIABLES},
|
||||
'\0', NULL, N_("Emit names and types of static variables in CTF"),
|
||||
TWO_DASHES },
|
||||
{ {"no-ctf-variables", no_argument, NULL, OPTION_NO_CTF_VARIABLES},
|
||||
'\0', NULL, N_("Do not emit names and types of static variables in CTF"),
|
||||
TWO_DASHES },
|
||||
{ {"ctf-share-types=<method>", required_argument, NULL,
|
||||
OPTION_CTF_SHARE_TYPES},
|
||||
'\0', NULL, N_("How to share CTF types between translation units.\n"
|
||||
" <method> is: share-unconflicted (default),\n"
|
||||
" share-duplicated"),
|
||||
TWO_DASHES },
|
||||
};
|
||||
|
||||
#define OPTION_COUNT ARRAY_SIZE (ld_options)
|
||||
|
@ -1637,6 +1649,23 @@ parse_args (unsigned argc, char **argv)
|
|||
case OPTION_DEPENDENCY_FILE:
|
||||
config.dependency_file = optarg;
|
||||
break;
|
||||
|
||||
case OPTION_CTF_VARIABLES:
|
||||
config.ctf_variables = TRUE;
|
||||
break;
|
||||
|
||||
case OPTION_NO_CTF_VARIABLES:
|
||||
config.ctf_variables = FALSE;
|
||||
break;
|
||||
|
||||
case OPTION_CTF_SHARE_TYPES:
|
||||
if (strcmp (optarg, "share-unconflicted") == 0)
|
||||
config.ctf_share_duplicated = FALSE;
|
||||
else if (strcmp (optarg, "share-duplicated") == 0)
|
||||
config.ctf_share_duplicated = TRUE;
|
||||
else
|
||||
einfo (_("%F%P: bad --ctf-share-types option: %s\n"), optarg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue