https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121457

            Bug ID: 121457
           Summary: R_X86_64_CODE_6_GOTTPOFF configure test is broken with
                    binutils --enable-targets=all
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sjames at gcc dot gnu.org
                CC: hjl.tools at gmail dot com
  Target Milestone: ---

r14-9154-g7f2cf0c45f4ba7 adds a check for R_X86_64_CODE_6_GOTTPOFF support, but
it makes a bad assumption.

+    # Check if gas and gld support "addq %r23,foo@GOTTPOFF(%rip), %r15"
+    # with R_X86_64_CODE_6_GOTTPOFF relocation.
+    if echo "$ld_ver" | grep GNU > /dev/null; then
+      if $gcc_cv_ld -V 2>/dev/null | grep elf_x86_64_sol2 > /dev/null; then
+        ld_ix86_gld_64_opt="-melf_x86_64_sol2"
+      else
+        ld_ix86_gld_64_opt="-melf_x86_64"
+      fi

This will pass -melf_x86_64_sol2 on x86_64-pc-linux-gnu if binutils is built
with --enable-targets=all, and then gcc_cv_as_x86_64_code_6_gottpoff=no is set.

We should check first if $target is *solaris* (or something like that) and only
then have this fallback check.

Reply via email to