-z undefs is the inverse of -z defs. It allows unresolved references
from object files. This can be used to cancel --no-undefined or -z defs.
Details
Details
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
Comment Actions
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;
}| ELF/Driver.cpp | ||
|---|---|---|
| 390 ↗ | (On Diff #219847) | Unrelated to this change. % ld.lld -z max-page-sizez a.o error: unknown -z value: max-page-sizez % ld.lld -z common-page-sizez a.o # No diagnostic "error: unknown -z value: common-page-sizez" |
Comment Actions
LGTM
| ELF/Driver.cpp | ||
|---|---|---|
| 390 ↗ | (On Diff #219847) | Yeah, it is perhaps better to tighten the check a bit to catch that error too. |