This is the mail archive of the binutils@sources.redhat.com 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]

Re: Forcing all SGI-compatible DSOs to use DT_SONAME


Alan Modra <amodra@bigpond.net.au> writes:
> I think it would be better to avoid adding a bfd_target hook in this
> case.  Instead, you should hook into the linker to set
> command_line.soname.  See ppc64elf.em for examples of how to add
> target dependent linker functions in a way that has zero impact on
> other targets.  LDEMUL_AFTER_OPEN is probably the right place.

Aha!  Thanks for the pointer.

This patch adds an irix.em file and uses it in the three SGI-compatible
target files.  Tested in the same way as before.  OK for trunk and 2.15?

Richard


ld/
	* emulparams/elf32bsmip.sh (EXTRA_EM_FILE): Define to irix.
	* emulparams/elf64bmip.sh (EXTRA_EM_FILE): Likewise.
	* emulparams/elf32bmipn32.sh (EXTRA_EM_FILE): Likewise.
	* emultempl/irix.em: New file.

Index: ld/emulparams/elf32bsmip.sh
===================================================================
RCS file: /cvs/src/src/ld/emulparams/elf32bsmip.sh,v
retrieving revision 1.3
diff -c -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.3 elf32bsmip.sh
*** ld/emulparams/elf32bsmip.sh	22 Nov 2001 09:08:04 -0000	1.3
--- ld/emulparams/elf32bsmip.sh	8 Apr 2004 07:20:39 -0000
***************
*** 1,2 ****
--- 1,3 ----
  . ${srcdir}/emulparams/elf32bmip.sh
  ENTRY=__start
+ EXTRA_EM_FILE=irix
Index: ld/emulparams/elf64bmip.sh
===================================================================
RCS file: /cvs/src/src/ld/emulparams/elf64bmip.sh,v
retrieving revision 1.8
diff -c -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.8 elf64bmip.sh
*** ld/emulparams/elf64bmip.sh	13 Oct 2003 19:48:39 -0000	1.8
--- ld/emulparams/elf64bmip.sh	8 Apr 2004 07:20:39 -0000
*************** EXECUTABLE_SYMBOLS="
*** 19,21 ****
--- 19,23 ----
  # Following the IRIX linker, we simply put .rodata in the data
  # segment.
  WRITABLE_RODATA=
+ 
+ EXTRA_EM_FILE=irix
Index: ld/emulparams/elf32bmipn32.sh
===================================================================
RCS file: /cvs/src/src/ld/emulparams/elf32bmipn32.sh,v
retrieving revision 1.8
diff -c -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.8 elf32bmipn32.sh
*** ld/emulparams/elf32bmipn32.sh	9 Feb 2004 17:54:24 -0000	1.8
--- ld/emulparams/elf32bmipn32.sh	8 Apr 2004 07:20:39 -0000
*************** EXECUTABLE_SYMBOLS="
*** 18,20 ****
--- 18,22 ----
  # Following the IRIX linker, we simply put .rodata in the data
  # segment.
  WRITABLE_RODATA=
+ 
+ EXTRA_EM_FILE=irix
*** /dev/null	Tue Jun 17 23:06:41 2003
--- ld/emultempl/irix.em	Thu Apr  8 08:20:37 2004
***************
*** 0 ****
--- 1,41 ----
+ # This shell script emits a C file. -*- C -*-
+ #   Copyright 2004 Free Software Foundation, Inc.
+ #
+ # This file is part of GLD, the Gnu Linker.
+ #
+ # 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.
+ #
+ # 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.
+ #
+ 
+ cat >>e${EMULATION_NAME}.c <<EOF
+ 
+ #include "ld.h"
+ #include "ldmain.h"
+ #include "libiberty.h"
+ 
+ /* The native IRIX linker will always create a DT_SONAME for shared objects.
+    While this shouldn't really be necessary for ABI conformance, some versions
+    of the native linker will segfault if the tag is missing.  */
+ 
+ static void
+ irix_after_open (void)
+ {
+   if (link_info.shared && command_line.soname == 0)
+     command_line.soname = basename (bfd_get_filename (output_bfd));
+ 
+   gld${EMULATION_NAME}_after_open ();
+ }
+ EOF
+ 
+ LDEMUL_AFTER_OPEN=irix_after_open


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