From 70c442caa8296a698b395b8969b9a04d5491d47b Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Wed, 8 Jul 2009 00:53:24 -0700 Subject: [PATCH] Add support for STB_GNU_UNIQUE to libebl. --- NEWS | 2 ++ libebl/ChangeLog | 8 ++++++++ libebl/eblsymbolbindingname.c | 8 +++++++- libebl/eblsymboltypename.c | 6 +++++- libelf/ChangeLog | 4 ++++ libelf/elf.h | 1 + 6 files changed, 27 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 2933d35..1b73645 100644 --- a/NEWS +++ b/NEWS @@ -4,6 +4,8 @@ libelf: Add elf_getshdrnum alias for elf_getshnum and elf_getshdrstrndx alias for elf_getshstrndx and deprecate original names. Sun screwed up their implementation and asked for a solution. +libebl: Add support for STB_GNU_UNIQUE. + readelf: Add -N option, speeds up DWARF printing without address->name lookups. Version 0.141: diff --git a/libebl/ChangeLog b/libebl/ChangeLog index 83319c7..12e94f4 100644 --- a/libebl/ChangeLog +++ b/libebl/ChangeLog @@ -1,3 +1,11 @@ +2009-07-08 Ulrich Drepper + + * eblsymbolbindingname.c (ebl_symbol_binding_name): Handle + STB_GNU_UNIQUE. + + * eblsymboltypename.c (ebl_symbol_type_name): Only handle STT_GNU_IFUNC + if the binary is marked as being for Linux. + 2009-04-01 Roland McGrath * eblsymboltypename.c (ebl_symbol_type_name): Add STT_GNU_IFUNC. diff --git a/libebl/eblsymbolbindingname.c b/libebl/eblsymbolbindingname.c index c4412c9..334a9c3 100644 --- a/libebl/eblsymbolbindingname.c +++ b/libebl/eblsymbolbindingname.c @@ -1,5 +1,5 @@ /* Return symbol binding name. - Copyright (C) 2001, 2002 Red Hat, Inc. + Copyright (C) 2001, 2002, 2009 Red Hat, Inc. This file is part of Red Hat elfutils. Written by Ulrich Drepper , 2001. @@ -78,8 +78,14 @@ ebl_symbol_binding_name (ebl, binding, buf, len) res = stb_names[binding]; else { + char *ident; + if (binding >= STB_LOPROC && binding <= STB_HIPROC) snprintf (buf, len, "LOPROC+%d", binding - STB_LOPROC); + else if (binding == STB_GNU_UNIQUE + && (ident = elf_getident (ebl->elf, NULL)) != NULL + && ident[EI_OSABI] == ELFOSABI_LINUX) + return "GNU_UNIQUE"; else if (binding >= STB_LOOS && binding <= STB_HIOS) snprintf (buf, len, "LOOS+%d", binding - STB_LOOS); else diff --git a/libebl/eblsymboltypename.c b/libebl/eblsymboltypename.c index 6aae13e..f2ac622 100644 --- a/libebl/eblsymboltypename.c +++ b/libebl/eblsymboltypename.c @@ -84,9 +84,13 @@ ebl_symbol_type_name (ebl, symbol, buf, len) res = stt_names[symbol]; else { + char *ident; + if (symbol >= STT_LOPROC && symbol <= STT_HIPROC) snprintf (buf, len, "LOPROC+%d", symbol - STT_LOPROC); - else if (symbol == STT_GNU_IFUNC) + else if (symbol == STT_GNU_IFUNC + && (ident = elf_getident (ebl->elf, NULL)) != NULL + && ident[EI_OSABI] == ELFOSABI_LINUX) return "GNU_IFUNC"; else if (symbol >= STT_LOOS && symbol <= STT_HIOS) snprintf (buf, len, "LOOS+%d", symbol - STT_LOOS); diff --git a/libelf/ChangeLog b/libelf/ChangeLog index a0163db..5d8ac8a 100644 --- a/libelf/ChangeLog +++ b/libelf/ChangeLog @@ -1,3 +1,7 @@ +2009-07-08 Ulrich Drepper + + * elf.h: Update from glibc. + 2009-06-13 Ulrich Drepper * Makefile.am (libelf_a_SOURCES): Replace elf_getshnum.c and diff --git a/libelf/elf.h b/libelf/elf.h index 8fdf74b..7efdede 100644 --- a/libelf/elf.h +++ b/libelf/elf.h @@ -444,6 +444,7 @@ typedef struct #define STB_WEAK 2 /* Weak symbol */ #define STB_NUM 3 /* Number of defined types. */ #define STB_LOOS 10 /* Start of OS-specific */ +#define STB_GNU_UNIQUE 10 /* Unique symbol. */ #define STB_HIOS 12 /* End of OS-specific */ #define STB_LOPROC 13 /* Start of processor-specific */ #define STB_HIPROC 15 /* End of processor-specific */ -- 2.7.4