View | Details | Raw Unified | Return to bug 12913 | Differences between
and this patch

Collapse All | Expand All

(-)bfd/elf.c (-2 / +2 lines)
Lines 9608-9618 _bfd_elf_set_osabi (bfd * abfd, Link Here
9608
  i_ehdrp->e_ident[EI_OSABI] = get_elf_backend_data (abfd)->elf_osabi;
9608
  i_ehdrp->e_ident[EI_OSABI] = get_elf_backend_data (abfd)->elf_osabi;
9609
9609
9610
  /* To make things simpler for the loader on Linux systems we set the
9610
  /* To make things simpler for the loader on Linux systems we set the
9611
     osabi field to ELFOSABI_LINUX if the binary contains symbols of
9611
     osabi field to ELFOSABI_GNU if the binary contains symbols of
9612
     the STT_GNU_IFUNC type or STB_GNU_UNIQUE binding.  */
9612
     the STT_GNU_IFUNC type or STB_GNU_UNIQUE binding.  */
9613
  if (i_ehdrp->e_ident[EI_OSABI] == ELFOSABI_NONE
9613
  if (i_ehdrp->e_ident[EI_OSABI] == ELFOSABI_NONE
9614
      && elf_tdata (abfd)->has_gnu_symbols)
9614
      && elf_tdata (abfd)->has_gnu_symbols)
9615
    i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_LINUX;
9615
    i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_GNU;
9616
}
9616
}
9617
9617
9618
9618
(-)bfd/elf32-hppa.c (-2 / +2 lines)
Lines 950-958 elf32_hppa_object_p (bfd *abfd) Link Here
950
  i_ehdrp = elf_elfheader (abfd);
950
  i_ehdrp = elf_elfheader (abfd);
951
  if (strcmp (bfd_get_target (abfd), "elf32-hppa-linux") == 0)
951
  if (strcmp (bfd_get_target (abfd), "elf32-hppa-linux") == 0)
952
    {
952
    {
953
      /* GCC on hppa-linux produces binaries with OSABI=Linux,
953
      /* GCC on hppa-linux produces binaries with OSABI=GNU,
954
	 but the kernel produces corefiles with OSABI=SysV.  */
954
	 but the kernel produces corefiles with OSABI=SysV.  */
955
      if (i_ehdrp->e_ident[EI_OSABI] != ELFOSABI_LINUX &&
955
      if (i_ehdrp->e_ident[EI_OSABI] != ELFOSABI_GNU &&
956
	  i_ehdrp->e_ident[EI_OSABI] != ELFOSABI_NONE) /* aka SYSV */
956
	  i_ehdrp->e_ident[EI_OSABI] != ELFOSABI_NONE) /* aka SYSV */
957
	return FALSE;
957
	return FALSE;
958
    }
958
    }
(-)bfd/elf64-hppa.c (-2 / +2 lines)
Lines 329-337 elf64_hppa_object_p (bfd *abfd) Link Here
329
  i_ehdrp = elf_elfheader (abfd);
329
  i_ehdrp = elf_elfheader (abfd);
330
  if (strcmp (bfd_get_target (abfd), "elf64-hppa-linux") == 0)
330
  if (strcmp (bfd_get_target (abfd), "elf64-hppa-linux") == 0)
331
    {
331
    {
332
      /* GCC on hppa-linux produces binaries with OSABI=Linux,
332
      /* GCC on hppa-linux produces binaries with OSABI=GNU,
333
	 but the kernel produces corefiles with OSABI=SysV.  */
333
	 but the kernel produces corefiles with OSABI=SysV.  */
334
      if (i_ehdrp->e_ident[EI_OSABI] != ELFOSABI_LINUX
334
      if (i_ehdrp->e_ident[EI_OSABI] != ELFOSABI_GNU
335
	  && i_ehdrp->e_ident[EI_OSABI] != ELFOSABI_NONE) /* aka SYSV */
335
	  && i_ehdrp->e_ident[EI_OSABI] != ELFOSABI_NONE) /* aka SYSV */
336
	return FALSE;
336
	return FALSE;
337
    }
337
    }
(-)binutils/elfedit.c (-2 / +3 lines)
Lines 518-525 osabis[] = Link Here
518
  { ELFOSABI_NONE, "none" },
518
  { ELFOSABI_NONE, "none" },
519
  { ELFOSABI_HPUX, "HPUX" },
519
  { ELFOSABI_HPUX, "HPUX" },
520
  { ELFOSABI_NETBSD, "NetBSD" },
520
  { ELFOSABI_NETBSD, "NetBSD" },
521
  { ELFOSABI_LINUX, "Linux" },
521
  { ELFOSABI_GNU, "Linux" },
522
  { ELFOSABI_HURD, "Hurd" },
522
  { ELFOSABI_GNU, "GNU" },
523
  { ELFOSABI_GNU, "Hurd" },
523
  { ELFOSABI_SOLARIS, "Solaris" },
524
  { ELFOSABI_SOLARIS, "Solaris" },
524
  { ELFOSABI_AIX, "AIX" },
525
  { ELFOSABI_AIX, "AIX" },
525
  { ELFOSABI_IRIX, "Irix" },
526
  { ELFOSABI_IRIX, "Irix" },
(-)binutils/readelf.c (-6 / +5 lines)
Lines 2612-2619 get_osabi_name (unsigned int osabi) Link Here
2612
    case ELFOSABI_NONE:		return "UNIX - System V";
2612
    case ELFOSABI_NONE:		return "UNIX - System V";
2613
    case ELFOSABI_HPUX:		return "UNIX - HP-UX";
2613
    case ELFOSABI_HPUX:		return "UNIX - HP-UX";
2614
    case ELFOSABI_NETBSD:	return "UNIX - NetBSD";
2614
    case ELFOSABI_NETBSD:	return "UNIX - NetBSD";
2615
    case ELFOSABI_LINUX:	return "UNIX - Linux";
2615
    case ELFOSABI_GNU:		return "UNIX - GNU";
2616
    case ELFOSABI_HURD:		return "GNU/Hurd";
2617
    case ELFOSABI_SOLARIS:	return "UNIX - Solaris";
2616
    case ELFOSABI_SOLARIS:	return "UNIX - Solaris";
2618
    case ELFOSABI_AIX:		return "UNIX - AIX";
2617
    case ELFOSABI_AIX:		return "UNIX - AIX";
2619
    case ELFOSABI_IRIX:		return "UNIX - IRIX";
2618
    case ELFOSABI_IRIX:		return "UNIX - IRIX";
Lines 8585-8592 get_symbol_binding (unsigned int binding Link Here
8585
      else if (binding >= STB_LOOS && binding <= STB_HIOS)
8584
      else if (binding >= STB_LOOS && binding <= STB_HIOS)
8586
	{
8585
	{
8587
	  if (binding == STB_GNU_UNIQUE
8586
	  if (binding == STB_GNU_UNIQUE
8588
	      && (elf_header.e_ident[EI_OSABI] == ELFOSABI_LINUX
8587
	      && (elf_header.e_ident[EI_OSABI] == ELFOSABI_GNU
8589
		  /* GNU/Linux is still using the default value 0.  */
8588
		  /* GNU is still using the default value 0.  */
8590
		  || elf_header.e_ident[EI_OSABI] == ELFOSABI_NONE))
8589
		  || elf_header.e_ident[EI_OSABI] == ELFOSABI_NONE))
8591
	    return "UNIQUE";
8590
	    return "UNIQUE";
8592
	  snprintf (buff, sizeof (buff), _("<OS specific>: %d"), binding);
8591
	  snprintf (buff, sizeof (buff), _("<OS specific>: %d"), binding);
Lines 8638-8645 get_symbol_type (unsigned int type) Link Here
8638
	    }
8637
	    }
8639
8638
8640
	  if (type == STT_GNU_IFUNC
8639
	  if (type == STT_GNU_IFUNC
8641
	      && (elf_header.e_ident[EI_OSABI] == ELFOSABI_LINUX
8640
	      && (elf_header.e_ident[EI_OSABI] == ELFOSABI_GNU
8642
		  /* GNU/Linux is still using the default value 0.  */
8641
		  /* GNU is still using the default value 0.  */
8643
		  || elf_header.e_ident[EI_OSABI] == ELFOSABI_NONE))
8642
		  || elf_header.e_ident[EI_OSABI] == ELFOSABI_NONE))
8644
	    return "IFUNC";
8643
	    return "IFUNC";
8645
8644
(-)elfcpp/elfcpp.h (-3 / +3 lines)
Lines 129-138 enum ELFOSABI Link Here
129
  ELFOSABI_NONE = 0,
129
  ELFOSABI_NONE = 0,
130
  ELFOSABI_HPUX = 1,
130
  ELFOSABI_HPUX = 1,
131
  ELFOSABI_NETBSD = 2,
131
  ELFOSABI_NETBSD = 2,
132
  // ELFOSABI_LINUX is not listed in the ELF standard.
132
  // ELFOSABI_GNU is not listed in the ELF standard.
133
  ELFOSABI_GNU = 3,
134
  // ELFOSABI_LINUX is not listed in the ELF standard, and is an alias for ELFOSABI_GNU
133
  ELFOSABI_LINUX = 3,
135
  ELFOSABI_LINUX = 3,
134
  // ELFOSABI_HURD is not listed in the ELF standard.
135
  ELFOSABI_HURD = 4,
136
  ELFOSABI_SOLARIS = 6,
136
  ELFOSABI_SOLARIS = 6,
137
  ELFOSABI_AIX = 7,
137
  ELFOSABI_AIX = 7,
138
  ELFOSABI_IRIX = 8,
138
  ELFOSABI_IRIX = 8,
(-)gas/config/obj-elf.c (-6 / +6 lines)
Lines 1704-1711 obj_elf_type (int ignore ATTRIBUTE_UNUSE Link Here
1704
      const struct elf_backend_data *bed;
1704
      const struct elf_backend_data *bed;
1705
1705
1706
      bed = get_elf_backend_data (stdoutput);
1706
      bed = get_elf_backend_data (stdoutput);
1707
      if (!(bed->elf_osabi == ELFOSABI_LINUX
1707
      if (!(bed->elf_osabi == ELFOSABI_GNU
1708
	    /* GNU/Linux is still using the default value 0.  */
1708
	    /* GNU is still using the default value 0.  */
1709
	    || bed->elf_osabi == ELFOSABI_NONE))
1709
	    || bed->elf_osabi == ELFOSABI_NONE))
1710
	as_bad (_("symbol type \"%s\" is supported only by GNU targets"),
1710
	as_bad (_("symbol type \"%s\" is supported only by GNU targets"),
1711
		type_name);
1711
		type_name);
Lines 1716-1729 obj_elf_type (int ignore ATTRIBUTE_UNUSE Link Here
1716
      struct elf_backend_data *bed;
1716
      struct elf_backend_data *bed;
1717
1717
1718
      bed = (struct elf_backend_data *) get_elf_backend_data (stdoutput);
1718
      bed = (struct elf_backend_data *) get_elf_backend_data (stdoutput);
1719
      if (!(bed->elf_osabi == ELFOSABI_LINUX
1719
      if (!(bed->elf_osabi == ELFOSABI_GNU
1720
	    /* GNU/Linux is still using the default value 0.  */
1720
	    /* GNU is still using the default value 0.  */
1721
	    || bed->elf_osabi == ELFOSABI_NONE))
1721
	    || bed->elf_osabi == ELFOSABI_NONE))
1722
	as_bad (_("symbol type \"%s\" is supported only by GNU targets"),
1722
	as_bad (_("symbol type \"%s\" is supported only by GNU targets"),
1723
		type_name);
1723
		type_name);
1724
      type = BSF_OBJECT | BSF_GNU_UNIQUE;
1724
      type = BSF_OBJECT | BSF_GNU_UNIQUE;
1725
      /* PR 10549: Always set OSABI field to LINUX for objects containing unique symbols.  */
1725
      /* PR 10549: Always set OSABI field to GNU for objects containing unique symbols.  */
1726
      bed->elf_osabi = ELFOSABI_LINUX;
1726
      bed->elf_osabi = ELFOSABI_GNU;
1727
    }
1727
    }
1728
#ifdef md_elf_symbol_type
1728
#ifdef md_elf_symbol_type
1729
  else if ((type = md_elf_symbol_type (type_name, sym, elfsym)) != -1)
1729
  else if ((type = md_elf_symbol_type (type_name, sym, elfsym)) != -1)
(-)include/elf/common.h (-2 / +2 lines)
Lines 62-69 Link Here
62
#define ELFOSABI_NONE	      0	/* UNIX System V ABI */
62
#define ELFOSABI_NONE	      0	/* UNIX System V ABI */
63
#define ELFOSABI_HPUX	      1	/* HP-UX operating system */
63
#define ELFOSABI_HPUX	      1	/* HP-UX operating system */
64
#define ELFOSABI_NETBSD	      2	/* NetBSD */
64
#define ELFOSABI_NETBSD	      2	/* NetBSD */
65
#define ELFOSABI_LINUX	      3	/* GNU/Linux */
65
#define ELFOSABI_GNU	      3	/* GNU */
66
#define ELFOSABI_HURD	      4	/* GNU/Hurd */
66
#define ELFOSABI_LINUX	      3	/* Alias for ELFOSABI_GNU */
67
#define ELFOSABI_SOLARIS      6	/* Solaris */
67
#define ELFOSABI_SOLARIS      6	/* Solaris */
68
#define ELFOSABI_AIX	      7	/* AIX */
68
#define ELFOSABI_AIX	      7	/* AIX */
69
#define ELFOSABI_IRIX	      8	/* IRIX */
69
#define ELFOSABI_IRIX	      8	/* IRIX */

Return to bug 12913