https://sourceware.org/bugzilla/show_bug.cgi?id=33863

            Bug ID: 33863
           Summary: ld: internal error in
                    _bfd_x86_elf_merge_gnu_properties with -z
                    x86-64-baseline
           Product: binutils
           Version: 2.45.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: gandalf at winds dot org
  Target Milestone: ---

Using flag -z x86-64-baseline in ld 2.45.1 on a 32 & 64-bit multilib Gentoo OS
built with -march=x86-64-v3 causes the following error:

/usr/lib/gcc/x86_64-pc-linux-gnu/15/../../../../x86_64-pc-linux-gnu/bin/ld: BFD
(Gentoo 2.45.1 p1) 2.45.1 internal error, aborting at
/var/tmp/portage/sys-devel/binutils-2.45.1/work/binutils-2.45.1/bfd/elfxx-x86.c:4049
in _bfd_x86_elf_merge_gnu_properties
Please report this bug.

Steps to reproduce on 64-bit x86-64-v3 Gentoo OS:

cat > test.c <<EOF

int main()
{
  return 0;
}
EOF

gcc -Wl,-z,x86-64-baseline test.c -o test

Without this flag, compiling produces the following gnu property note in the
executable:

  GNU                  0x00000024       NT_GNU_PROPERTY_TYPE_0       
Properties: x86 ISA needed: x86-64-baseline, x86-64-v2, x86-64-v3, x86 feature
used: x86, x86 ISA used: 

The real intent is to
1) compile the executable using "-m32 -march=i686" while in the
-march=x86-64-v3 OS
2) remove any x86-64-v2+ requirements from the gnu property note
3) copy the resulting executable to a 32-bit-only Gentoo OS system built solely
with -march=i686
4) expect this to run in 32-bit mode on x86-64-v2 or older hardware just like
it used to with previous versions of binutils.

My current workaround is to run "strip --remove-section=.note.gnu.property" on
the resulting executable.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Reply via email to