[PATCH] gold: Add -z noreloc-overflow option

H.J. Lu hjl.tools@gmail.com
Tue Nov 3 12:22:30 GMT 2020


On Mon, Nov 2, 2020 at 11:02 PM Fangrui Song <i@maskray.me> wrote:
>
> On 2020-11-03, Hang Deng (handeng) via Binutils wrote:
> >HJ, Cary,
> >
> >Thanks, we tried your patch for X86_64, it works well.
> >
> >And the patch below also works with arm64,  but I am not familiar with  the test case and review/commit process, can you please help to commit this patch as well?
> >
> >Thanks,
> >Hunter
> >
> >diff --git a/gold/aarch64.cc b/gold/aarch64.cc
> >index b207dcdc..29da1e35 100644
> >--- a/gold/aarch64.cc
> >+++ b/gold/aarch64.cc
> >@@ -5972,7 +5972,6 @@ Target_aarch64<size, big_endian>::Scan::local(
> >     case elfcpp::R_AARCH64_NONE:
> >       break;
> >
> >-    case elfcpp::R_AARCH64_ABS32:
> >     case elfcpp::R_AARCH64_ABS16:
> >       if (parameters->options().output_is_position_independent())
> >        {
> >@@ -5981,6 +5980,13 @@ Target_aarch64<size, big_endian>::Scan::local(
> >        }
> >       break;
> >
> >+    case elfcpp::R_AARCH64_ABS32:
> >+      if ( parameters->options().output_is_position_independent() &&
> >+          !parameters->options().noreloc_overflow()) {
> >+              gold_error(_("%s: unsupported reloc %u in pos independent link."),
> >+                       object->name().c_str(), r_type);
> >+           break;
> >+       }
>
> Cary raised the point that -z noreloc-overflow should be related to the
> link-time value, rather than the possibility of runtime overflow.
>

>From ld manual:

    'noreloc-overflow'
          Disable relocation overflow check.  This can be used to
          disable relocation overflow check if there will be no dynamic
          relocation overflow at run-time.  Supported for x86_64.

H.J.


More information about the Binutils mailing list