diff options
author | Nick Clifton <nickc@redhat.com> | 2004-10-07 14:45:24 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2004-10-07 14:45:24 +0000 |
commit | 6f6401f9e0ecc0ebe678c81536628a9e51e1d168 (patch) | |
tree | 77f9fd03db3f3614aad774dbf334e3ea08f24e7e | |
parent | d0cfa40e05add927e319b318c160150d8e805411 (diff) | |
download | gdb-6f6401f9e0ecc0ebe678c81536628a9e51e1d168.tar.gz |
Add linker option: --warn-shared-textrel to produce warnings when adding a
DT_TEXTREL to a shared object.
-rw-r--r-- | bfd/ChangeLog | 6 | ||||
-rw-r--r-- | bfd/elflink.c | 28 | ||||
-rw-r--r-- | include/ChangeLog | 4 | ||||
-rw-r--r-- | include/bfdlink.h | 3 |
4 files changed, 29 insertions, 12 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 6a4e7449e5e..0500b9bda0d 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2004-10-07 Jeff Baker <jbaker@qnx.com> + + * elflink.c (_bfd_elf_add_dynamic_entry): Add code to warn if + adding a DT_TEXTREL to a shared object and --warn-shared-textrel + was specified. + 2004-10-04 Roland McGrath <roland@redhat.com> * hash.c (bfd_hash_set_default_size): Use const for table. diff --git a/bfd/elflink.c b/bfd/elflink.c index e93145d6c24..69fdcc044bf 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -2,21 +2,21 @@ Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. -This file is part of BFD, the Binary File Descriptor library. + This file is part of BFD, the Binary File Descriptor library. -This program 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; either version 2 of the License, or -(at your option) any later version. + This program 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; either version 2 of the License, or + (at your option) any later version. -This program 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. + This program 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 this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "bfd.h" #include "sysdep.h" @@ -2701,6 +2701,10 @@ _bfd_elf_add_dynamic_entry (struct bfd_link_info *info, if (! is_elf_hash_table (hash_table)) return FALSE; + if (info->warn_shared_textrel && info->shared && tag == DT_TEXTREL) + _bfd_error_handler + (_("warning: creating a DT_TEXTREL in a shared object.")); + bed = get_elf_backend_data (hash_table->dynobj); s = bfd_get_section_by_name (hash_table->dynobj, ".dynamic"); BFD_ASSERT (s != NULL); diff --git a/include/ChangeLog b/include/ChangeLog index b6c11568fb4..9ddcc72b228 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,3 +1,7 @@ +2004-10-07 Jeff Baker <jbaker@qnx.com> + + * bfdlink.h (bfd_link_info): Add bitfield: warn_shared_textrel. + 2004-09-17 Paul Brook <paul@codesourcery.com> * elf/arm.h: Remove R_ARM_STKCHK and R_ARM_THM_STKCHK. diff --git a/include/bfdlink.h b/include/bfdlink.h index 5aa72d4b4c2..db276b02c99 100644 --- a/include/bfdlink.h +++ b/include/bfdlink.h @@ -308,6 +308,9 @@ struct bfd_link_info /* TRUE if PT_GNU_RELRO segment should be created. */ unsigned int relro: 1; + /* TRUE if we should warn when adding a DT_TEXTREL to a shared object. */ + unsigned int warn_shared_textrel: 1; + /* What to do with unresolved symbols in an object file. When producing executables the default is GENERATE_ERROR. When producing shared libraries the default is IGNORE. The |