[PATCH] D35724: [ELF] - Fix missing relocation when linking executable with --unresolved-symbols=ignore-all

Rafael Avila de Espindola via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 26 07:31:18 PDT 2017


George Rimar via Phabricator <reviews at reviews.llvm.org> writes:
> Index: test/ELF/no-inhibit-exec.s
> ===================================================================
> --- test/ELF/no-inhibit-exec.s
> +++ test/ELF/no-inhibit-exec.s
> @@ -6,7 +6,7 @@
>  
>  # CHECK: Disassembly of section .text:
>  # CHECK-NEXT: _start
> -# CHECK-NEXT: 201000: {{.*}} callq -2101253
> +# CHECK-NEXT: 201000: {{.*}} callq 0

Please add a test of produced dynamic relocation.

> +bool Symbol::canBeExternal() const {
> +  return computeBinding() != STB_LOCAL &&
> +         body()->getVisibility() == STV_DEFAULT;
> +}
> +
>  bool Symbol::includeInDynsym() const {
>    if (computeBinding() == STB_LOCAL)
>      return false;
> -  return ExportDynamic || body()->isShared() ||
> -         (body()->isUndefined() && Config->Shared);
> +  if (ExportDynamic || body()->isShared())
> +    return true;
> +  if (!body()->isUndefined())
> +    return false;
> +  return Config->Shared || (canBeExternal() && !body()->symbol()->isWeak());

computeBinding() already took care of what canBeExternal() is doing in
here, no?

Cheers,
Rafael


More information about the llvm-commits mailing list