From 6ca4600fb59d1e1ae3dfb872b184ac91f10c473f Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Mon, 12 Jun 2006 22:40:23 +0000 Subject: Don't create INTERP and PHDR program header entry if a DSO is created without a specific interpreter. Ignore duplicate COMDAT group sections. elflint should not complain about anything about *_NONE relocations. Add support to libebl to determine whether given relocation is *_NONE relocation. --- libebl/ChangeLog | 9 +++++++ libebl/Makefile.am | 5 ++-- libebl/ebl-hooks.h | 5 +++- libebl/eblnonerelocp.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++++ libebl/eblopenbackend.c | 5 +++- libebl/libebl.h | 3 +++ 6 files changed, 87 insertions(+), 4 deletions(-) create mode 100644 libebl/eblnonerelocp.c (limited to 'libebl') diff --git a/libebl/ChangeLog b/libebl/ChangeLog index 01dba09e..1d9fcfd5 100644 --- a/libebl/ChangeLog +++ b/libebl/ChangeLog @@ -1,3 +1,12 @@ +2006-06-12 Ulrich Drepper + + * Makefile.am (gen_SOURCES): Add eblnonerelocp.c. + * eblnonerelocp.c: New file. + * ebl-hooks.c: Add none_reloc_p. + * eblopenbackend.c (default_none_reloc_p): New function. + (fill_defaults): Hook it up. + * libebl.h: Declare ebl_none_reloc_p. + 2006-05-27 Ulrich Drepper * libebl.h: Add extern "C". diff --git a/libebl/Makefile.am b/libebl/Makefile.am index 483fd13a..98269272 100644 --- a/libebl/Makefile.am +++ b/libebl/Makefile.am @@ -1,6 +1,6 @@ ## Process this file with automake to create Makefile.in ## -## Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005 Red Hat, Inc. +## Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006 Red Hat, Inc. ## This file is part of Red Hat elfutils. ## ## Red Hat elfutils is free software; you can redistribute it and/or modify @@ -55,7 +55,8 @@ gen_SOURCES = eblopenbackend.c eblclosebackend.c eblstrtab.c \ eblcorenote.c eblobjnote.c ebldebugscnp.c \ eblgotpcreloccheck.c eblcopyrelocp.c eblsectionstripp.c \ eblelfclass.c eblelfdata.c eblelfmachine.c \ - ebl_check_special_symbol.c eblbsspltp.c eblretval.c eblregname.c + ebl_check_special_symbol.c eblbsspltp.c eblretval.c \ + eblregname.c eblnonerelocp.c libebl_a_SOURCES = $(gen_SOURCES) diff --git a/libebl/ebl-hooks.h b/libebl/ebl-hooks.h index 22d38733..4227c24f 100644 --- a/libebl/ebl-hooks.h +++ b/libebl/ebl-hooks.h @@ -1,5 +1,5 @@ /* Backend hook signatures internal interface for libebl. - Copyright (C) 2000, 2001, 2002, 2004, 2005 Red Hat, Inc. + Copyright (C) 2000, 2001, 2002, 2004, 2005, 2006 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -116,6 +116,9 @@ bool EBLHOOK(debugscn_p) (const char *); /* Check whether given relocation is a copy relocation. */ bool EBLHOOK(copy_reloc_p) (int); +/* Check whether given relocation is a no-op relocation. */ +bool EBLHOOK(none_reloc_p) (int); + /* Check whether given symbol's value is ok despite normal checks. */ bool EBLHOOK(check_special_symbol) (Elf *, GElf_Ehdr *, const GElf_Sym *, const char *, const GElf_Shdr *); diff --git a/libebl/eblnonerelocp.c b/libebl/eblnonerelocp.c new file mode 100644 index 00000000..3d62a0b4 --- /dev/null +++ b/libebl/eblnonerelocp.c @@ -0,0 +1,64 @@ +/* Check whether given relocation is a copy relocation. + Copyright (C) 2006 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper , 2006. + + Red Hat elfutils is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by the + Free Software Foundation; version 2 of the License. + + Red Hat elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License along + with Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + . */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include + + +bool +ebl_none_reloc_p (ebl, reloc) + Ebl *ebl; + int reloc; +{ + return ebl->none_reloc_p (reloc); +} diff --git a/libebl/eblopenbackend.c b/libebl/eblopenbackend.c index 03fa99e6..092068cb 100644 --- a/libebl/eblopenbackend.c +++ b/libebl/eblopenbackend.c @@ -1,5 +1,5 @@ /* Generate ELF backend handle. - Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005 Red Hat, Inc. + Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -190,6 +190,7 @@ static bool default_object_note (const char *name, uint32_t type, uint32_t descsz, const char *desc); static bool default_debugscn_p (const char *name); static bool default_copy_reloc_p (int reloc); +static bool default_none_reloc_p (int reloc); static bool default_check_special_symbol (Elf *elf, GElf_Ehdr *ehdr, const GElf_Sym *sym, const char *name, @@ -229,6 +230,7 @@ fill_defaults (Ebl *result) result->object_note = default_object_note; result->debugscn_p = default_debugscn_p; result->copy_reloc_p = default_copy_reloc_p; + result->none_reloc_p = default_none_reloc_p; result->check_special_symbol = default_check_special_symbol; result->bss_plt_p = default_bss_plt_p; result->return_value_location = default_return_value_location; @@ -605,6 +607,7 @@ default_copy_reloc_p (int reloc __attribute__ ((unused))) { return false; } +strong_alias (default_copy_reloc_p, default_none_reloc_p) static bool default_check_special_symbol (Elf *elf __attribute__ ((unused)), diff --git a/libebl/libebl.h b/libebl/libebl.h index 30146345..c27dfd4a 100644 --- a/libebl/libebl.h +++ b/libebl/libebl.h @@ -189,6 +189,9 @@ extern bool ebl_debugscn_p (Ebl *ebl, const char *name); /* Check whether given relocation is a copy relocation. */ extern bool ebl_copy_reloc_p (Ebl *ebl, int reloc); +/* Check whether given relocation is a no-op relocation. */ +extern bool ebl_none_reloc_p (Ebl *ebl, int reloc); + /* Check whether section should be stripped. */ extern bool ebl_section_strip_p (Ebl *ebl, const GElf_Ehdr *ehdr, const GElf_Shdr *shdr, const char *name, -- cgit v1.2.1