[Bug gas/26722] New: arm-unknown-elf sets inconsistent ELF OSABI values

2020-10-09 Thread jozef.l at mittosystems dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=26722

Bug ID: 26722
   Summary: arm-unknown-elf sets inconsistent ELF OSABI values
   Product: binutils
   Version: 2.36 (HEAD)
Status: UNCONFIRMED
  Severity: normal
  Priority: P2
 Component: gas
  Assignee: unassigned at sourceware dot org
  Reporter: jozef.l at mittosystems dot com
  Target Milestone: ---

When assembling an SHF_GNU_MBIND section for arm-unknown-elf,
gas/config/obj-elf.c:obj_elf_section will set
elf_backend_data->elf_osabi to ELFOSABI_GNU from ELFOSABI_NONE.

However, bfd/elf32-arm.c:elf32_arm_init_file_header will set
i_ehdrp->e_ident[EI_OSABI] to ELFOSABI_ARM for
EF_ARM_EABI_VERSION == EF_ARM_EABI_UNKNOWN.
This is the default for non-eabi ARM targets, such as arm-unknown-elf.

Is arm-unknown-elf a legacy target? Should it just always set the ELF
OSABI to ELFOSABI_ARM, thereby disabling any modern GNU ELF OSABI
extensions?

Or should elf32_arm_init_file_header only set i_ehdrp->e_ident[EI_OSABI]
to ELFOSABI_ARM if elf_backend_data->elf_osabi is ELF_OSABI_NONE?

The following testcase exposes the problem:
  .section ".mbind.foo","adx",%progbits

  $ arm-unknown-elf-as armbug.s

  arm-unknown-elf-as: GNU_MBIND section is unsupported
  armbug.s: Assembler messages:
  armbug.s: Fatal error: can't close a.out: sorry, cannot handle this file

This error message is coming from bfd/elf.c
(_bfd_elf_final_write_processing), which is why the the file close error
appears. If GAS caught the error in obj_elf_section, then an error would
be emitted, but it wouldn't be fatal.

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


[Bug gas/26722] arm-unknown-elf sets inconsistent ELF OSABI values

2020-10-09 Thread jozef.l at mittosystems dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=26722

Jozef Lawrynowicz  changed:

   What|Removed |Added

 Target||arm-unknown-elf

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


[Bug gas/26703] Support x86 micro-architecture ISA level marker

2020-10-09 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=26703

--- Comment #2 from cvs-commit at gcc dot gnu.org  ---
The master branch has been updated by H.J. Lu :

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=32930e4edbc06bc6f10c435dbcc63131715df678

commit 32930e4edbc06bc6f10c435dbcc63131715df678
Author: H.J. Lu 
Date:   Fri Oct 9 05:05:57 2020 -0700

x86: Support GNU_PROPERTY_X86_ISA_1_V[234] marker

GCC 11 supports -march=x86-64-v[234] to enable x86 micro-architecture ISA
levels:

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

Update GNU_PROPERTY_X86_ISA_1_XXX macros:

https://gitlab.com/x86-psABIs/x86-64-ABI/-/merge_requests/13

in x86 ELF binaries to indicate that micro-architecture ISA levels
required to execute the binary:

 #define GNU_PROPERTY_X86_ISA_1_NEEDED (GNU_PROPERTY_X86_UINT32_OR_LO + 2)
 #define GNU_PROPERTY_X86_ISA_1_USED (GNU_PROPERTY_X86_UINT32_OR_AND_LO +
2)
 #define GNU_PROPERTY_X86_ISA_1_V2 (1U << 0)
 #define GNU_PROPERTY_X86_ISA_1_V3 (1U << 1)
 #define GNU_PROPERTY_X86_ISA_1_V4 (1U << 2)

The previous GNU_PROPERTY_X86_ISA_1_XXX  macros are deprecated and renamed
to GNU_PROPERTY_X86_COMPAT_2_ISA_1_XXX.

In addition to EM_X86_64, GNU_PROPERTY_X86_ISA_1_V[234] marker can be used
by ld.so to detect the x86-64-v4 shared library placed in an x86-64-v2
directory by mistake on an x86-64-v2 machine to avoid crashes on x86-64-v4
instructions.

Add -z x86-64-v[234] linker command line option to mark x86-64-v[234]
ISA level as needed.

Also add

 #define GNU_PROPERTY_X86_FEATURE_2_MASK (1U << 11)

for mask registers.

bfd/

PR gas/26703
* elf-linker-x86.h (elf_linker_x86_params): Add isa_level.
* elfxx-x86.c (_bfd_x86_elf_merge_gnu_properties): Merge
GNU_PROPERTY_X86_ISA_1_V[234].
(_bfd_x86_elf_link_setup_gnu_properties): Generate
GNU_PROPERTY_X86_ISA_1_V[234] for -z x86-64-v[234].

binutils/

PR gas/26703
* readelf.c (decode_x86_compat_2_isa): New function.
(decode_x86_isa): Updated for new X86_ISA_1_XXX bits.
(decode_x86_feature_1): Handle GNU_PROPERTY_X86_FEATURE_2_MASK.
(print_gnu_property_note): Handle X86_COMPAT_2_ISA_1_USED,
and X86_COMPAT_2_ISA_1_NEEDED.
* testsuite/binutils-all/i386/pr21231b.s: Updated to the current
GNU_PROPERTY_X86_ISA_1_USED and GNU_PROPERTY_X86_ISA_1_NEEDED
values.
* testsuite/binutils-all/x86-64/pr21231b.s: Likewise.
* testsuite/binutils-all/x86-64/pr23494a.s: Likewise.
* testsuite/binutils-all/x86-64/pr23494b.s: Likewise.
* testsuite/binutils-all/x86-64/pr23494c.s: Likewise.
* testsuite/binutils-all/i386/empty.d: Updated.
* testsuite/binutils-all/i386/ibt.d: Likewise.
* testsuite/binutils-all/i386/pr21231a.d: Likewise.
* testsuite/binutils-all/i386/pr21231b.d: Likewise.
* testsuite/binutils-all/i386/shstk.d: Likewise.
* testsuite/binutils-all/x86-64/empty-x32.d: Likewise.
* testsuite/binutils-all/x86-64/empty.d: Likewise.
* testsuite/binutils-all/x86-64/ibt-x32.d: Likewise.
* testsuite/binutils-all/x86-64/ibt.d: Likewise.
* testsuite/binutils-all/x86-64/pr21231a.d: Likewise.
* testsuite/binutils-all/x86-64/pr21231b.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494a-x32.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494a.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494c-x32.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494c.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494d-x32.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494d.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494e-x32.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494e.d: Likewise.
* testsuite/binutils-all/x86-64/shstk-x32.d: Likewise.
* testsuite/binutils-all/x86-64/shstk.d: Likewise.

gas/

PR gas/26703
* config/tc-i386.c (xstate): Add xstate_mask.
(md_assemble): Check i.types[j], instead of i.tm.operand_types[j],
for xstate.  Set xstate_mask, instead of xstate_zmm, for RegMask.
(output_insn): Update for GNU_PROPERTY_X86_ISA_1_V[234].  Update
xstate for mask register and VSIB.
* testsuite/gas/i386/i386.exp: Run more GNU_PROPERTY tests.
* testsuite/gas/i386/property-1.s: Updated to the current
GNU_PROPERTY_X86_ISA_1_USED value.
* testsuite/gas/i386/property-2.s: Only keep cmove.
* testsuite/gas/i386/property-3.s: Changed to addsubpd.
* testsuite/gas/i386/property-1.d: Updated.
* testsuite/gas/i386/property-2.d: Likewise.
   

[Bug gas/26703] Support x86 micro-architecture ISA level marker

2020-10-09 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=26703

H.J. Lu  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|NEW |RESOLVED
   Target Milestone|--- |2.36

--- Comment #3 from H.J. Lu  ---
Fixed.

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


[Bug ld/26626] Provide a hook to customize missing library error handling

2020-10-09 Thread nickc at redhat dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=26626

--- Comment #5 from Nick Clifton  ---
Hi Serge,

  I am going to have a go at implementing this feature.

  Would you mind uploading an example script that I can use for testing
purposes ?

Cheers
  Nick

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


[Bug ld/26626] Provide a hook to customize missing library error handling

2020-10-09 Thread nickc at redhat dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=26626

Nick Clifton  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED

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