[PATCH] D67479: [ELF] Support -z undefs
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 11 22:04:23 PDT 2019
MaskRay added a comment.
Some findings related to the topic. There are two kinds of unresolved references: 1) from object files 2) from shared objects. `--unresolved-symbols=` toggles both bits while `-z (un)defs` and `--(no-)allow-shlib-undefined` toggles one bit, respectively. I personally favor the fine-grained options over `--unresolved-symbols=`
It seems we can actually model `--unresolved-symbols=ignore-in-object-files` in terms of `--allow-shlib-undefined` but I think that is probably unnecessary. I can't find any use of "ignore-in-object-files" outside lld and binutils.
// ld/emultempl/elf32.em
case 'z':
if (strcmp (optarg, "defs") == 0)
link_info.unresolved_syms_in_objects = RM_GENERATE_ERROR;
else if (strcmp (optarg, "undefs") == 0)
link_info.unresolved_syms_in_objects = RM_IGNORE;
// ld/lexsup.c
case OPTION_NO_UNDEFINED:
link_info.unresolved_syms_in_objects
= how_to_report_unresolved_symbols;
break;
case OPTION_ALLOW_SHLIB_UNDEFINED:
link_info.unresolved_syms_in_shared_libs = RM_IGNORE;
break;
case OPTION_NO_ALLOW_SHLIB_UNDEFINED:
link_info.unresolved_syms_in_shared_libs
= how_to_report_unresolved_symbols;
break;
case OPTION_UNRESOLVED_SYMBOLS:
if (strcmp (optarg, "ignore-all") == 0)
{
link_info.unresolved_syms_in_objects = RM_IGNORE;
link_info.unresolved_syms_in_shared_libs = RM_IGNORE;
}
else if (strcmp (optarg, "report-all") == 0)
{
link_info.unresolved_syms_in_objects
= how_to_report_unresolved_symbols;
link_info.unresolved_syms_in_shared_libs
= how_to_report_unresolved_symbols;
}
else if (strcmp (optarg, "ignore-in-object-files") == 0)
{
link_info.unresolved_syms_in_objects = RM_IGNORE;
link_info.unresolved_syms_in_shared_libs
= how_to_report_unresolved_symbols;
}
else if (strcmp (optarg, "ignore-in-shared-libs") == 0)
{
link_info.unresolved_syms_in_objects
= how_to_report_unresolved_symbols;
link_info.unresolved_syms_in_shared_libs = RM_IGNORE;
}
Repository:
rLLD LLVM Linker
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D67479/new/
https://reviews.llvm.org/D67479
More information about the llvm-commits
mailing list