This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] gnu_indirect_function support for FreeBSD


Hi all,

as of today FreeBSD supports the gnu_indirect_function elf_type:

http://lists.freebsd.org/pipermail/svn-src-head/2011-December/032133.html

Therefor we'd like to 'enable' this functionality in gas and readelf.
Below the patch which I have tested on x86_64/amd64-*-freebsd10.0.
There are some modifications necessary in the ld-ifunc test cases. Namely the matching of the osabi string. This will be a separate patch.


Is the below ok for trunk?

TIA,
Andreas

2011-12-12 Andreas Tobler <andreast@fgznet.ch>

	* readelf.c (get_symbol_type): Add ELFOSABI_FREEBSD to the
	supported abi's.

2011-12-12 Konstantin Belousov <kib@FreeBSD.org>

	* config/obj-elf.c (obj_elf_type): Add ELFOSABI_FREEBSD to the
	supported abi's.

Index: binutils/readelf.c
===================================================================
RCS file: /cvs/src/src/binutils/readelf.c,v
retrieving revision 1.560
diff -u -r1.560 readelf.c
--- binutils/readelf.c	2 Nov 2011 03:09:01 -0000	1.560
+++ binutils/readelf.c	12 Dec 2011 20:10:41 -0000
@@ -8680,7 +8680,8 @@
 	  if (type == STT_GNU_IFUNC
 	      && (elf_header.e_ident[EI_OSABI] == ELFOSABI_GNU
 		  /* GNU is still using the default value 0.  */
-		  || elf_header.e_ident[EI_OSABI] == ELFOSABI_NONE))
+		  || elf_header.e_ident[EI_OSABI] == ELFOSABI_NONE
+		  || elf_header.e_ident[EI_OSABI] == ELFOSABI_FREEBSD))
 	    return "IFUNC";

snprintf (buff, sizeof (buff), _("<OS specific>: %d"), type);
Index: gas/config/obj-elf.c
===================================================================
RCS file: /cvs/src/src/gas/config/obj-elf.c,v
retrieving revision 1.143
diff -u -r1.143 obj-elf.c
--- gas/config/obj-elf.c 4 Aug 2011 07:44:44 -0000 1.143
+++ gas/config/obj-elf.c 12 Dec 2011 20:10:41 -0000
@@ -1703,8 +1703,9 @@
bed = get_elf_backend_data (stdoutput);
if (!(bed->elf_osabi == ELFOSABI_GNU
/* GNU is still using the default value 0. */
- || bed->elf_osabi == ELFOSABI_NONE))
- as_bad (_("symbol type \"%s\" is supported only by GNU targets"),
+ || bed->elf_osabi == ELFOSABI_NONE
+ || bed->elf_osabi == ELFOSABI_FREEBSD))
+ as_bad (_("symbol type \"%s\" is supported only by GNU and FreeBSD targets"),
type_name);
type = BSF_FUNCTION | BSF_GNU_INDIRECT_FUNCTION;
}



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]