public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* GNU Binutils on OpeBSD
@ 2011-04-24 18:41 Maxim Koltsov
  2011-04-24 19:28 ` Mike Frysinger
  0 siblings, 1 reply; 8+ messages in thread
From: Maxim Koltsov @ 2011-04-24 18:41 UTC (permalink / raw)
  To: binutils

[-- Attachment #1: Type: text/plain, Size: 625 bytes --]

Hi!
I'm building binutils on OpenBSD 4.8. I've ported OpenBSD's binutils
patch to binutils-2.21, so bfd is aware of openbsd now. But i get very
strange error with --enable-shared: libopcodes.so has DT_NEEDED
pointing to libbfd.so in temporaly location:
  NEEDED      /home/maksbotan/gentoo/var/tmp/portage/sys-devel/binutils-2.21/work/build/opcodes/../bfd/.libs/libbfd.so
Of course, this cannot be found, and tools like as and objdump cannot
work. And when compiling binutils on linux, libopcodes.so has only
'libbfd-2.21.so' in DT_NEEDED. Can you figure out what problem is
cause by? My patch is attached.
Maxim.

[-- Attachment #2: big-patch --]
[-- Type: application/octet-stream, Size: 40351 bytes --]

From a2105dfa9d60aa65e72b39d676031f5ebfe07ea3 Mon Sep 17 00:00:00 2001

From: Maxim <kolmax94@gmail.com>

Subject: [PATCH 01/27] Port bfd/config.bfd patch
---

 bfd/config.bfd |   26 +++++++++++++++++++++-----
 1 files changed, 21 insertions(+), 5 deletions(-)


diff --git a/bfd/config.bfd b/bfd/config.bfd
index 9b719d8..2916bf0 100644
--- a/bfd/config.bfd
+++ b/bfd/config.bfd
@@ -271,7 +271,7 @@ case "${targ}" in
     targ_defvec=bfd_elf32_littlearm_vec
     targ_selvecs=bfd_elf32_bigarm_vec
     ;;
-  armeb-*-elf | arm*b-*-linux-*)
+  armeb-*-elf | arm*b-*-linux-* | armeb-*-openbsd* )
     targ_defvec=bfd_elf32_bigarm_vec
     targ_selvecs=bfd_elf32_littlearm_vec
     ;;
@@ -281,7 +281,7 @@ case "${targ}" in
     ;;
   arm-*-elf | arm-*-freebsd* | arm*-*-linux-* | arm*-*-conix* | \
   arm*-*-uclinux* | arm-*-kfreebsd*-gnu | \
-  arm*-*-eabi* )
+  arm*-*-eabi* | arm-*-openbsd* )
     targ_defvec=bfd_elf32_littlearm_vec
     targ_selvecs=bfd_elf32_bigarm_vec
     ;;
@@ -443,6 +443,10 @@ case "${targ}" in
     ;;
 
 #ifdef BFD64
+  hppa64*-*-openbsd*)
+    targ_defvec=bfd_elf64_hppa_vec
+    targ_selfvecs=bfd_elf64_hppa_linux_vec
+    ;;
   hppa*64*-*-linux-*)
     targ_defvec=bfd_elf64_hppa_linux_vec
     targ_selvecs=bfd_elf64_hppa_vec
@@ -530,6 +534,10 @@ case "${targ}" in
     targ_defvec=go32coff_vec
     targ_selvecs="go32stubbedcoff_vec i386aout_vec"
     ;;
+  hppa64*-*-openbsd*)
+    targ_defvec=bfd_elf64_hppa_vec
+    targ_selfvecs=bfd_elf64_hppa_linux_vec
+    ;;
   i[3-7]86-*-sysv* | i[3-7]86-*-isc* | i[3-7]86-*-sco* | i[3-7]86-*-coff | \
   i[3-7]86-*-aix*)
     targ_defvec=i386coff_vec
@@ -622,11 +630,16 @@ case "${targ}" in
     targ_selvecs="bfd_elf32_i386_freebsd_vec i386coff_vec i386pei_vec x86_64pei_vec bfd_elf32_i386_vec bfd_elf64_x86_64_vec bfd_elf64_l1om_vec bfd_elf64_l1om_freebsd_vec"
     want64=true
     ;;
-  x86_64-*-netbsd* | x86_64-*-openbsd*)
+  x86_64-*-netbsd*)
     targ_defvec=bfd_elf64_x86_64_vec
     targ_selvecs="bfd_elf32_i386_vec i386netbsd_vec i386coff_vec i386pei_vec x86_64pei_vec bfd_elf64_l1om_vec"
     want64=true
     ;;
+  x86_64-*-openbsd*)
+    targ_defvec=bfd_elf64_x86_64_vec
+    targ_selfvecs="bfd_elf32_i386_vec i386coff_vec bfd_efi_app_ia32_vec"
+    want64=true
+    ;;
   x86_64-*-linux-*)
     targ_defvec=bfd_elf64_x86_64_vec
     targ_selvecs="bfd_elf32_i386_vec i386linux_vec i386pei_vec x86_64pei_vec bfd_elf64_l1om_vec"
@@ -1043,7 +1056,7 @@ case "${targ}" in
     targ_defvec=pc532machaout_vec
     targ_underscore=yes
     ;;
-  ns32k-*-netbsd* | ns32k-*-lites* | ns32k-*-openbsd*)
+  ns32k-*-netbsd* | ns32k-*-lites*)
     targ_defvec=pc532netbsd_vec
     targ_underscore=yes
     ;;
@@ -1300,7 +1313,10 @@ case "${targ}" in
     targ_selvecs="shlcoff_vec shlcoff_small_vec"
     targ_underscore=yes
     ;;
-
+  sh*-*-openbsd*)
+    targ_defvec=bfd_elf32_shlobsd_vec
+    targ_selvecs="bfd_elf32_shobsd_vec"
+    ;;
 #ifdef BFD64
   shl*-*-elf* | sh[1234]l*-*-elf* | sh3el*-*-elf* | shl*-*-kaos*)
     targ_defvec=bfd_elf32_shl_vec
From c5b873b76f42263fc8cdadfa4e75ed2f15ef2c28 Mon Sep 17 00:00:00 2001

From: Maxim <kolmax94@gmail.com>

Subject: [PATCH 01/26] Port bfd/configure.in patch
---

 bfd/configure.in |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)


diff --git a/bfd/configure.in b/bfd/configure.in
index fce1dd7..e57d832 100644
--- a/bfd/configure.in
+++ b/bfd/configure.in
@@ -779,8 +779,10 @@ do
     bfd_elf32_shl_symbian_vec)	tb="$tb elf32-sh-symbian.lo elf32-sh64-com.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo" ;;
     bfd_elf32_shlin_vec)	tb="$tb elf32-sh.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;;
     bfd_elf32_shlnbsd_vec)	tb="$tb elf32-sh.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;;
+    bfd_elf32_shlobsd_vec)  tb="$tb elf32-sh.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;;
     bfd_elf32_shlvxworks_vec)	tb="$tb elf32-sh.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo" ;;
     bfd_elf32_shnbsd_vec)	tb="$tb elf32-sh.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;;
+    bfd_elf32_shobsd_vec)   tb="$tb elf32-sh.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;;
     bfd_elf32_shvxworks_vec)	tb="$tb elf32-sh.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo" ;;
     bfd_elf32_sparc_vec)	tb="$tb elf32-sparc.lo elfxx-sparc.lo elf-vxworks.lo elf32.lo $elf" ;;
     bfd_elf32_sparc_sol2_vec)	tb="$tb elf32-sparc.lo elfxx-sparc.lo elf-vxworks.lo elf32.lo $elf" ;;
From bf789c2ba2a436c7e8dc0a8ff4e34bc28af15e2b Mon Sep 17 00:00:00 2001

From: Maxim <kolmax94@gmail.com>

Subject: [PATCH 09/26] Port bfd/dlltool.c and bfd/dllwrap.c patch
---

 binutils/dlltool.c |    4 ++++
 binutils/dllwrap.c |   22 ++++++++++------------
 2 files changed, 14 insertions(+), 12 deletions(-)


diff --git a/binutils/dlltool.c b/binutils/dlltool.c
index 8c72647..1d266ed 100644
--- a/binutils/dlltool.c
+++ b/binutils/dlltool.c
@@ -1297,7 +1297,11 @@ run (const char *what, char *args)
   int i;
   const char **argv;
   char *errmsg_fmt, *errmsg_arg;
+#if defined(__MSDOS__) && !defined(__GO32__)
   char *temp_base = choose_temp_base ();
+#else
+  char *temp_base = NULL;
+#endif
 
   inform ("run: %s %s", what, args);
 
diff --git a/binutils/dllwrap.c b/binutils/dllwrap.c
index 4e48f3e..f121d51 100644
--- a/binutils/dllwrap.c
+++ b/binutils/dllwrap.c
@@ -358,7 +358,11 @@ run (const char *what, char *args)
   int i;
   const char **argv;
   char *errmsg_fmt, *errmsg_arg;
+#if defined(__MSDOS__) && !defined(__GO32__)
   char *temp_base = choose_temp_base ();
+#else
+  char *temp_base = NULL;
+#endif
   int in_quote;
   char sep;
 
@@ -823,13 +827,9 @@ main (int argc, char **argv)
 
   if (! def_file_seen)
     {
-      char *fileprefix = choose_temp_base ();
-
-      def_file_name = (char *) xmalloc (strlen (fileprefix) + 5);
-      sprintf (def_file_name, "%s.def",
-	       (dontdeltemps) ? mybasename (fileprefix) : fileprefix);
-      delete_def_file = 1;
-      free (fileprefix);
+      def_file_name = make_temp_file (".def");
+      if (dontdeltemps)
+       def_file_name = mybasename (def_file_name);
       delete_def_file = 1;
       warn (_("no export definition file provided.\n\
 Creating one, but that may not be what you want"));
@@ -1036,12 +1036,10 @@ Creating one, but that may not be what you want"));
 
   if (! base_file_name)
     {
-      char *fileprefix = choose_temp_base ();
-      base_file_name = (char *) xmalloc (strlen (fileprefix) + 6);
-      sprintf (base_file_name, "%s.base",
-	       (dontdeltemps) ? mybasename (fileprefix) : fileprefix);
+      base_file_name = make_temp_file (".base");
+      if (dontdeltemps)
+       base_file_name = mybasename (base_file_name);
       delete_base_file = 1;
-      free (fileprefix);
     }
 
   {
From 9ec7febe77cbd6b0420d976de07b96eadd9345d1 Mon Sep 17 00:00:00 2001

From: Maxim <kolmax94@gmail.com>

Subject: [PATCH 02/26] Port bfd/elf32-sh.c patch
---

 bfd/elf32-sh.c |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)


diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c
index e15f51c..23c9457 100644
--- a/bfd/elf32-sh.c
+++ b/bfd/elf32-sh.c
@@ -7629,6 +7629,24 @@ sh_elf_encode_eh_address (bfd *abfd,
 
 #include "elf32-target.h"
 
+/* OpenBSD support.  */
+#undef TARGET_BIG_SYM
+#define    TARGET_BIG_SYM          bfd_elf32_shobsd_vec
+#undef TARGET_BIG_NAME
+#define    TARGET_BIG_NAME         "elf32-sh-obsd"
+#undef TARGET_LITTLE_SYM
+#define    TARGET_LITTLE_SYM       bfd_elf32_shlobsd_vec
+#undef TARGET_LITTLE_NAME
+#define    TARGET_LITTLE_NAME      "elf32-shl-obsd"
+#undef ELF_MAXPAGESIZE
+#define    ELF_MAXPAGESIZE         0x10000
+#undef elf_symbol_leading_char
+#define    elf_symbol_leading_char     0
+#undef elf32_bed
+#define    elf32_bed           elf32_sh_obsd_bed
+
+#include "elf32-target.h"
+
 /* NetBSD support.  */
 #undef	TARGET_BIG_SYM
 #define	TARGET_BIG_SYM			bfd_elf32_shnbsd_vec
From 3cc9fdc96ec097a5dfab1224ca054cf7fd551257 Mon Sep 17 00:00:00 2001

From: Maxim <kolmax94@gmail.com>

Subject: [PATCH 03/26] Port bfd/elf.c patch
---

 bfd/elf.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)


diff --git a/bfd/elf.c b/bfd/elf.c
index 4f326a7..d7afa6c 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -3489,9 +3489,12 @@ get_program_header_size (bfd *abfd, struct bfd_link_info *info)
   asection *s;
   const struct elf_backend_data *bed;
 
-  /* Assume we will need exactly two PT_LOAD segments: one for text
-     and one for data.  */
-  segs = 2;
+  /* We used to assume that two PT_LOAD segments would be enough,
+     code and data, with the change to pad the PLT and GOT, this is no
+     longer true. Now there can be several PT_LOAD sections. 7 seems
+     to be enough with BSS_PLT and .rodata-X, where we have text, data,
+     GOT, dynamic, PLT, bss */
+  segs = 7;
 
   s = bfd_get_section_by_name (abfd, ".interp");
   if (s != NULL && (s->flags & SEC_LOAD) != 0)
From 0b42b2ac300a254c01e270d44817de9c08ee6552 Mon Sep 17 00:00:00 2001

From: Maxim <kolmax94@gmail.com>

Subject: [PATCH 05/26] Port bfd/elfxx-mips.c patch
---

 bfd/elfxx-mips.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)


diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c
index 4718dd4..0b3c591 100644
--- a/bfd/elfxx-mips.c
+++ b/bfd/elfxx-mips.c
@@ -10374,11 +10374,16 @@ _bfd_mips_elf_finish_dynamic_sections (bfd *output_bfd,
 		 decided not to make.  This is for the n64 irix rld,
 		 which doesn't seem to apply any relocations if there
 		 are trailing null entries.  */
-	      s = mips_elf_rel_dyn_section (info, FALSE);
-	      dyn.d_un.d_val = (s->reloc_count
+	      if (SGI_COMPAT (output_bfd))
+		{
+		  s = mips_elf_rel_dyn_section (dynobj, FALSE);
+		  dyn.d_un.d_val = (s->reloc_count
 				* (ABI_64_P (output_bfd)
 				   ? sizeof (Elf64_Mips_External_Rel)
 				   : sizeof (Elf32_External_Rel)));
+		}
+	      else
+		swap_out_p = FALSE;
 	      /* Adjust the section size too.  Tools like the prelinker
 		 can reasonably expect the values to the same.  */
 	      elf_section_data (s->output_section)->this_hdr.sh_size
From 95b0858781c6c371f3d53a4b0303c3a6dd45efe0 Mon Sep 17 00:00:00 2001

From: Maxim <kolmax94@gmail.com>

Subject: [PATCH 06/26] Port bfd/m68kopenbsd.c patch
---

 bfd/m68kopenbsd.c |   33 +++++++++++++++++++++++++++++++++
 1 files changed, 33 insertions(+), 0 deletions(-)
 create mode 100644 bfd/m68kopenbsd.c


diff --git a/bfd/m68kopenbsd.c b/bfd/m68kopenbsd.c
new file mode 100644
index 0000000..459d3b2
--- /dev/null
+++ b/bfd/m68kopenbsd.c
@@ -0,0 +1,33 @@
+/* BFD back-end for OpenBSD/m88k a.out binaries.
+   Copyright 2004 Free Software Foundation, Inc.
+
+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 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.  */
+
+#define	TARGET_IS_BIG_ENDIAN_P
+
+#define	TARGET_PAGE_SIZE	4096
+
+#define	DEFAULT_ARCH		bfd_arch_m88k
+#define	DEFAULT_MID		M_88K_OPENBSD
+
+/* Do not "beautify" the CONCAT* macro args.  Traditional C will not
+   remove whitespace added here, and thus will fail to concatenate
+   the tokens.  */
+#define MY(OP) CONCAT2 (m88kopenbsd_,OP)
+#define TARGETNAME "a.out-m88k-openbsd"
+
+#include "netbsd.h"
From 08d9089d8293e875a0f292a5c98d50a862c7d335 Mon Sep 17 00:00:00 2001

From: Maxim <kolmax94@gmail.com>

Subject: [PATCH 07/26] Port bfd/Makefile.am patch
---

 bfd/Makefile.am |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)


diff --git a/bfd/Makefile.am b/bfd/Makefile.am
index bf5dea4..39fcd8a 100644
--- a/bfd/Makefile.am
+++ b/bfd/Makefile.am
@@ -884,7 +884,7 @@ host-aout.lo: Makefile
 aout-params.h: gen-aout
 	./gen-aout host > aout-params.h
 gen-aout: $(srcdir)/gen-aout.c Makefile
-	$(CC) -o gen-aout $(CFLAGS) $(LFLAGS) $(srcdir)/gen-aout.c
+	$(CC) -o gen-aout $(CSEARCH) $(CFLAGS) $(LFLAGS) $(srcdir)/gen-aout.c
 
 $(BFD_H): stmp-bfd-h ; @true
 
From 4601313fe3212de5027223467cff767eefd45073 Mon Sep 17 00:00:00 2001

From: Maxim <kolmax94@gmail.com>

Subject: [PATCH 08/26] Port bfd/targets.c patch
---

 bfd/targets.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)


diff --git a/bfd/targets.c b/bfd/targets.c
index 3e99754..8ee779b 100644
--- a/bfd/targets.c
+++ b/bfd/targets.c
@@ -672,8 +672,10 @@ extern const bfd_target bfd_elf32_shl_vec;
 extern const bfd_target bfd_elf32_shl_symbian_vec;
 extern const bfd_target bfd_elf32_shlin_vec;
 extern const bfd_target bfd_elf32_shlnbsd_vec;
+extern const bfd_target bfd_elf32_shlobsd_vec;
 extern const bfd_target bfd_elf32_shlvxworks_vec;
 extern const bfd_target bfd_elf32_shnbsd_vec;
+extern const bfd_target bfd_elf32_shobsd_vec;
 extern const bfd_target bfd_elf32_shvxworks_vec;
 extern const bfd_target bfd_elf32_sparc_vec;
 extern const bfd_target bfd_elf32_sparc_sol2_vec;
@@ -1015,8 +1017,10 @@ static const bfd_target * const _bfd_target_vector[] =
         &bfd_elf32_shl_symbian_vec,
         &bfd_elf32_shlin_vec,
 	&bfd_elf32_shlnbsd_vec,
+    &bfd_elf32_shlobsd_vec,
 	&bfd_elf32_shlvxworks_vec,
 	&bfd_elf32_shnbsd_vec,
+    &bfd_elf32_shobsd_vec,
 	&bfd_elf32_shvxworks_vec,
 #ifdef BFD64
 	&bfd_elf32_sh64_vec,
From 049390e058a46a6b4052ec37dc3a9b927ef39382 Mon Sep 17 00:00:00 2001

From: Maxim <kolmax94@gmail.com>

Subject: [PATCH 10/26] Port bfd/dlltool.c and binutils/Makefile.am patch
---

 binutils/Makefile.am |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)


diff --git a/binutils/Makefile.am b/binutils/Makefile.am
index 0978538..d3c7ec6 100644
--- a/binutils/Makefile.am
+++ b/binutils/Makefile.am
@@ -48,7 +48,7 @@ OBJDUMP_PROG=objdump
 
 # This is the demangler, as a standalone program.
 # Note: This one is used as the installed name too, unlike the above.
-DEMANGLER_PROG=cxxfilt
+#DEMANGLER_PROG=cxxfilt
 
 ADDR2LINE_PROG=addr2line
 
@@ -60,17 +60,18 @@ DLLWRAP_PROG=dllwrap
 
 SRCONV_PROG=srconv$(EXEEXT) sysdump$(EXEEXT) coffdump$(EXEEXT)
 
-bin_PROGRAMS = $(SIZE_PROG) $(OBJDUMP_PROG) $(AR_PROG) $(STRINGS_PROG) $(RANLIB_PROG) $(OBJCOPY_PROG) @BUILD_NLMCONV@ @BUILD_SRCONV@ @BUILD_DLLTOOL@ @BUILD_WINDRES@ @BUILD_WINDMC@ $(ADDR2LINE_PROG) $(READELF_PROG) $(ELFEDIT_PROG) @BUILD_DLLWRAP@ @BUILD_INSTALL_MISC@
+bin_PROGRAMS = $(OBJDUMP_PROG) $(AR_PROG) $(STRINGS_PROG) $(RANLIB_PROG) $(OBJCOPY_PROG) @BUILD_NLMCONV@ @BUILD_SRCONV@ @BUILD_DLLTOOL@ @BUILD_WINDRES@ @BUILD_WINDMC@ $(ADDR2LINE_PROG) $(READELF_PROG) $(ELFEDIT_PROG) @BUILD_DLLWRAP@ @BUILD_INSTALL_MISC@
 
 ## We need a special rule to install the programs which are built with
 ## -new, and to rename cxxfilt to c++filt.
-RENAMED_PROGS = $(NM_PROG) $(STRIP_PROG) $(DEMANGLER_PROG)
+#RENAMED_PROGS = $(NM_PROG) $(STRIP_PROG) $(DEMANGLER_PROG)
+RENAMED_PROGS = $(STRIP_PROGS)
 noinst_PROGRAMS = $(RENAMED_PROGS) @BUILD_MISC@
 
 EXTRA_PROGRAMS = $(NLMCONV_PROG) srconv sysdump coffdump $(DLLTOOL_PROG) $(WINDRES_PROG) $(WINDMC_PROG) $(DLLWRAP_PROG)
 
 # Stuff that goes in tooldir/ if appropriate.
-TOOL_PROGS = nm-new strip-new ar ranlib dlltool objdump objcopy
+TOOL_PROGS = strip-new ar ranlib dlltool objdump objcopy
 
 BASEDIR = $(srcdir)/..
 BFDDIR = $(BASEDIR)/bfd
@@ -217,7 +218,7 @@ endif
 	$(COMPILE) -c $(OBJDUMP_DEFS) $(srcdir)/objdump.c
 endif
 
-cxxfilt_SOURCES = cxxfilt.c $(BULIBS)
+#cxxfilt_SOURCES = cxxfilt.c $(BULIBS)
 
 ar_SOURCES = arparse.y arlex.l ar.c not-ranlib.c arsup.c rename.c binemul.c \
 	emul_$(EMULATION).c $(BULIBS)
From 70447029f77c30e293997db95f6cc622d4182e45 Mon Sep 17 00:00:00 2001

From: Maxim <kolmax94@gmail.com>

Subject: [PATCH 11/26] Port bfd/dlltool.c and binutils/rdbg.c patch
---

 binutils/rddbg.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)


diff --git a/binutils/rddbg.c b/binutils/rddbg.c
index 27abd66..c91ead7 100644
--- a/binutils/rddbg.c
+++ b/binutils/rddbg.c
@@ -199,7 +199,7 @@ read_section_stabs_debugging_info (bfd *abfd, asymbol **syms, long symcount,
 
 		  s = (char *) strings + stroff + strx;
 
-		  while (s[strlen (s) - 1] == '\\'
+		  while (*s != '\0' && s[strlen (s) - 1] == '\\'
 			 && stab + 12 < stabs + stabsize)
 		    {
 		      char *p;
From 5f87ad14c028aad0539f20f42bf2264b7c84a6b4 Mon Sep 17 00:00:00 2001

From: Maxim <kolmax94@gmail.com>

Subject: [PATCH 12/26] Port bfd/dlltool.c and binutils/stabs.c patch
---

 binutils/resrc.c |   11 +-
 binutils/stabs.c |  350 ------------------------------------------------------
 2 files changed, 8 insertions(+), 353 deletions(-)


diff --git a/binutils/resrc.c b/binutils/resrc.c
index a72a23f..ff99c65 100644
--- a/binutils/resrc.c
+++ b/binutils/resrc.c
@@ -207,7 +207,11 @@ run_cmd (char *cmd, const char *redir)
   int i;
   const char **argv;
   char *errmsg_fmt, *errmsg_arg;
+#if defined(__MSDOS__) && !defined(__GO32__)
   char *temp_base = choose_temp_base ();
+#else
+  char *temp_base = NULL;
+#endif
   int in_quote;
   char sep;
   int redir_handle = -1;
@@ -318,12 +322,7 @@ open_input_stream (char *cmd)
 {
   if (istream_type == ISTREAM_FILE)
     {
-      char *fileprefix;
-
-      fileprefix = choose_temp_base ();
-      cpp_temp_file = (char *) xmalloc (strlen (fileprefix) + 5);
-      sprintf (cpp_temp_file, "%s.irc", fileprefix);
-      free (fileprefix);
+      cpp_temp_file = make_temp_file (".irc");
 
       if (run_cmd (cmd, cpp_temp_file))
 	fatal (_("can't execute `%s': %s"), cmd, strerror (errno));
diff --git a/binutils/stabs.c b/binutils/stabs.c
index f8fb48c..293dbfc 100644
--- a/binutils/stabs.c
+++ b/binutils/stabs.c
@@ -199,13 +199,13 @@ static debug_type stab_find_tagged_type
   (void *, struct stab_handle *, const char *, int, enum debug_type_kind);
 static debug_type *stab_demangle_argtypes
   (void *, struct stab_handle *, const char *, bfd_boolean *, unsigned int);
-static debug_type *stab_demangle_v3_argtypes
+/*static debug_type *stab_demangle_v3_argtypes
   (void *, struct stab_handle *, const char *, bfd_boolean *);
 static debug_type *stab_demangle_v3_arglist
   (void *, struct stab_handle *, struct demangle_component *, bfd_boolean *);
 static debug_type stab_demangle_v3_arg
   (void *, struct stab_handle *, struct demangle_component *, debug_type,
-   bfd_boolean *);
+   bfd_boolean *);*/
 
 /* Save a string in memory.  */
 
@@ -2829,7 +2829,6 @@ parse_stab_argtypes (void *dhandle, struct stab_handle *info,
   bfd_boolean is_full_physname_constructor;
   bfd_boolean is_constructor;
   bfd_boolean is_destructor;
-  bfd_boolean is_v3;
   debug_type *args;
   bfd_boolean varargs;
   unsigned int physname_len = 0;
@@ -2849,9 +2848,8 @@ parse_stab_argtypes (void *dhandle, struct stab_handle *info,
 		    && (argtypes[1] == '$' || argtypes[1] == '.')
 		    && argtypes[2] == '_')
 		   || CONST_STRNEQ (argtypes, "__dt"));
-  is_v3 = argtypes[0] == '_' && argtypes[1] == 'Z';
 
-  if (is_destructor || is_full_physname_constructor || is_v3)
+  if (is_destructor || is_full_physname_constructor)
     *pphysname = argtypes;
   else
     {
@@ -3714,10 +3712,6 @@ stab_demangle_argtypes (void *dhandle, struct stab_handle *info,
 {
   struct stab_demangle_info minfo;
 
-  /* Check for the g++ V3 ABI.  */
-  if (physname[0] == '_' && physname[1] == 'Z')
-    return stab_demangle_v3_argtypes (dhandle, info, physname, pvarargs);
-
   minfo.dhandle = dhandle;
   minfo.info = info;
   minfo.args = NULL;
@@ -5060,341 +5054,3 @@ stab_demangle_remember_type (struct stab_demangle_info *minfo,
 
   return TRUE;
 }
-\f
-/* Demangle names encoded using the g++ V3 ABI.  The newer versions of
-   g++ which use this ABI do not encode ordinary method argument types
-   in a mangled name; they simply output the argument types.  However,
-   for a static method, g++ simply outputs the return type and the
-   physical name.  So in that case we need to demangle the name here.
-   Here PHYSNAME is the physical name of the function, and we set the
-   variable pointed at by PVARARGS to indicate whether this function
-   is varargs.  This returns NULL, or a NULL terminated array of
-   argument types.  */
-
-static debug_type *
-stab_demangle_v3_argtypes (void *dhandle, struct stab_handle *info,
-			   const char *physname, bfd_boolean *pvarargs)
-{
-  struct demangle_component *dc;
-  void *mem;
-  debug_type *pargs;
-
-  dc = cplus_demangle_v3_components (physname, DMGL_PARAMS | DMGL_ANSI, &mem);
-  if (dc == NULL)
-    {
-      stab_bad_demangle (physname);
-      return NULL;
-    }
-
-  /* We expect to see TYPED_NAME, and the right subtree describes the
-     function type.  */
-  if (dc->type != DEMANGLE_COMPONENT_TYPED_NAME
-      || dc->u.s_binary.right->type != DEMANGLE_COMPONENT_FUNCTION_TYPE)
-    {
-      fprintf (stderr, _("Demangled name is not a function\n"));
-      free (mem);
-      return NULL;
-    }
-
-  pargs = stab_demangle_v3_arglist (dhandle, info,
-				    dc->u.s_binary.right->u.s_binary.right,
-				    pvarargs);
-
-  free (mem);
-
-  return pargs;
-}
-
-/* Demangle an argument list in a struct demangle_component tree.
-   Returns a DEBUG_TYPE_NULL terminated array of argument types, and
-   sets *PVARARGS to indicate whether this is a varargs function.  */
-
-static debug_type *
-stab_demangle_v3_arglist (void *dhandle, struct stab_handle *info,
-			  struct demangle_component *arglist,
-			  bfd_boolean *pvarargs)
-{
-  struct demangle_component *dc;
-  unsigned int alloc, count;
-  debug_type *pargs;
-
-  alloc = 10;
-  pargs = (debug_type *) xmalloc (alloc * sizeof *pargs);
-  *pvarargs = FALSE;
-
-  count = 0;
-
-  for (dc = arglist;
-       dc != NULL;
-       dc = dc->u.s_binary.right)
-    {
-      debug_type arg;
-      bfd_boolean varargs;
-
-      if (dc->type != DEMANGLE_COMPONENT_ARGLIST)
-	{
-	  fprintf (stderr, _("Unexpected type in v3 arglist demangling\n"));
-	  free (pargs);
-	  return NULL;
-	}
-
-      arg = stab_demangle_v3_arg (dhandle, info, dc->u.s_binary.left,
-				  NULL, &varargs);
-      if (arg == NULL)
-	{
-	  if (varargs)
-	    {
-	      *pvarargs = TRUE;
-	      continue;
-	    }
-	  free (pargs);
-	  return NULL;
-	}
-
-      if (count + 1 >= alloc)
-	{
-	  alloc += 10;
-	  pargs = (debug_type *) xrealloc (pargs, alloc * sizeof *pargs);
-	}
-
-      pargs[count] = arg;
-      ++count;
-    }
-
-  pargs[count] = DEBUG_TYPE_NULL;
-
-  return pargs;
-}
-
-/* Convert a struct demangle_component tree describing an argument
-   type into a debug_type.  */
-
-static debug_type
-stab_demangle_v3_arg (void *dhandle, struct stab_handle *info,
-		      struct demangle_component *dc, debug_type context,
-		      bfd_boolean *pvarargs)
-{
-  debug_type dt;
-
-  if (pvarargs != NULL)
-    *pvarargs = FALSE;
-
-  switch (dc->type)
-    {
-      /* FIXME: These are demangle component types which we probably
-	 need to handle one way or another.  */
-    case DEMANGLE_COMPONENT_LOCAL_NAME:
-    case DEMANGLE_COMPONENT_TYPED_NAME:
-    case DEMANGLE_COMPONENT_TEMPLATE_PARAM:
-    case DEMANGLE_COMPONENT_CTOR:
-    case DEMANGLE_COMPONENT_DTOR:
-    case DEMANGLE_COMPONENT_JAVA_CLASS:
-    case DEMANGLE_COMPONENT_RESTRICT_THIS:
-    case DEMANGLE_COMPONENT_VOLATILE_THIS:
-    case DEMANGLE_COMPONENT_CONST_THIS:
-    case DEMANGLE_COMPONENT_VENDOR_TYPE_QUAL:
-    case DEMANGLE_COMPONENT_COMPLEX:
-    case DEMANGLE_COMPONENT_IMAGINARY:
-    case DEMANGLE_COMPONENT_VENDOR_TYPE:
-    case DEMANGLE_COMPONENT_ARRAY_TYPE:
-    case DEMANGLE_COMPONENT_PTRMEM_TYPE:
-    case DEMANGLE_COMPONENT_ARGLIST:
-    default:
-      fprintf (stderr, _("Unrecognized demangle component %d\n"),
-	       (int) dc->type);
-      return NULL;
-
-    case DEMANGLE_COMPONENT_NAME:
-      if (context != NULL)
-	{
-	  const debug_field *fields;
-
-	  fields = debug_get_fields (dhandle, context);
-	  if (fields != NULL)
-	    {
-	      /* Try to find this type by looking through the context
-		 class.  */
-	      for (; *fields != DEBUG_FIELD_NULL; fields++)
-		{
-		  debug_type ft;
-		  const char *dn;
-
-		  ft = debug_get_field_type (dhandle, *fields);
-		  if (ft == NULL)
-		    return NULL;
-		  dn = debug_get_type_name (dhandle, ft);
-		  if (dn != NULL
-		      && (int) strlen (dn) == dc->u.s_name.len
-		      && strncmp (dn, dc->u.s_name.s, dc->u.s_name.len) == 0)
-		    return ft;
-		}
-	    }
-	}
-      return stab_find_tagged_type (dhandle, info, dc->u.s_name.s,
-				    dc->u.s_name.len, DEBUG_KIND_ILLEGAL);
-
-    case DEMANGLE_COMPONENT_QUAL_NAME:
-      context = stab_demangle_v3_arg (dhandle, info, dc->u.s_binary.left,
-				      context, NULL);
-      if (context == NULL)
-	return NULL;
-      return stab_demangle_v3_arg (dhandle, info, dc->u.s_binary.right,
-				   context, NULL);
-
-    case DEMANGLE_COMPONENT_TEMPLATE:
-      {
-	char *p;
-	size_t alc;
-
-	/* We print this component to get a class name which we can
-	   use.  FIXME: This probably won't work if the template uses
-	   template parameters which refer to an outer template.  */
-	p = cplus_demangle_print (DMGL_PARAMS | DMGL_ANSI, dc, 20, &alc);
-	if (p == NULL)
-	  {
-	    fprintf (stderr, _("Failed to print demangled template\n"));
-	    return NULL;
-	  }
-	dt = stab_find_tagged_type (dhandle, info, p, strlen (p),
-				    DEBUG_KIND_CLASS);
-	free (p);
-	return dt;
-      }
-
-    case DEMANGLE_COMPONENT_SUB_STD:
-      return stab_find_tagged_type (dhandle, info, dc->u.s_string.string,
-				    dc->u.s_string.len, DEBUG_KIND_ILLEGAL);
-
-    case DEMANGLE_COMPONENT_RESTRICT:
-    case DEMANGLE_COMPONENT_VOLATILE:
-    case DEMANGLE_COMPONENT_CONST:
-    case DEMANGLE_COMPONENT_POINTER:
-    case DEMANGLE_COMPONENT_REFERENCE:
-      dt = stab_demangle_v3_arg (dhandle, info, dc->u.s_binary.left, NULL,
-				 NULL);
-      if (dt == NULL)
-	return NULL;
-
-      switch (dc->type)
-	{
-	default:
-	  abort ();
-	case DEMANGLE_COMPONENT_RESTRICT:
-	  /* FIXME: We have no way to represent restrict.  */
-	  return dt;
-	case DEMANGLE_COMPONENT_VOLATILE:
-	  return debug_make_volatile_type (dhandle, dt);
-	case DEMANGLE_COMPONENT_CONST:
-	  return debug_make_const_type (dhandle, dt);
-	case DEMANGLE_COMPONENT_POINTER:
-	  return debug_make_pointer_type (dhandle, dt);
-	case DEMANGLE_COMPONENT_REFERENCE:
-	  return debug_make_reference_type (dhandle, dt);
-	}
-
-    case DEMANGLE_COMPONENT_FUNCTION_TYPE:
-      {
-	debug_type *pargs;
-	bfd_boolean varargs;
-
-	if (dc->u.s_binary.left == NULL)
-	  {
-	    /* In this case the return type is actually unknown.
-	       However, I'm not sure this will ever arise in practice;
-	       normally an unknown return type would only appear at
-	       the top level, which is handled above.  */
-	    dt = debug_make_void_type (dhandle);
-	  }
-	else
-	  dt = stab_demangle_v3_arg (dhandle, info, dc->u.s_binary.left, NULL,
-				     NULL);
-	if (dt == NULL)
-	  return NULL;
-
-	pargs = stab_demangle_v3_arglist (dhandle, info,
-					  dc->u.s_binary.right,
-					  &varargs);
-	if (pargs == NULL)
-	  return NULL;
-
-	return debug_make_function_type (dhandle, dt, pargs, varargs);
-      }
-
-    case DEMANGLE_COMPONENT_BUILTIN_TYPE:
-      {
-	char *p;
-	size_t alc;
-	debug_type ret;
-
-	/* We print this component in order to find out the type name.
-	   FIXME: Should we instead expose the
-	   demangle_builtin_type_info structure?  */
-	p = cplus_demangle_print (DMGL_PARAMS | DMGL_ANSI, dc, 20, &alc);
-	if (p == NULL)
-	  {
-	    fprintf (stderr, _("Couldn't get demangled builtin type\n"));
-	    return NULL;
-	  }
-
-	/* The mangling is based on the type, but does not itself
-	   indicate what the sizes are.  So we have to guess.  */
-	if (strcmp (p, "signed char") == 0)
-	  ret = debug_make_int_type (dhandle, 1, FALSE);
-	else if (strcmp (p, "bool") == 0)
-	  ret = debug_make_bool_type (dhandle, 1);
-	else if (strcmp (p, "char") == 0)
-	  ret = debug_make_int_type (dhandle, 1, FALSE);
-	else if (strcmp (p, "double") == 0)
-	  ret = debug_make_float_type (dhandle, 8);
-	else if (strcmp (p, "long double") == 0)
-	  ret = debug_make_float_type (dhandle, 8);
-	else if (strcmp (p, "float") == 0)
-	  ret = debug_make_float_type (dhandle, 4);
-	else if (strcmp (p, "__float128") == 0)
-	  ret = debug_make_float_type (dhandle, 16);
-	else if (strcmp (p, "unsigned char") == 0)
-	  ret = debug_make_int_type (dhandle, 1, TRUE);
-	else if (strcmp (p, "int") == 0)
-	  ret = debug_make_int_type (dhandle, 4, FALSE);
-	else if (strcmp (p, "unsigned int") == 0)
-	  ret = debug_make_int_type (dhandle, 4, TRUE);
-	else if (strcmp (p, "long") == 0)
-	  ret = debug_make_int_type (dhandle, 4, FALSE);
-	else if (strcmp (p, "unsigned long") == 0)
-	  ret = debug_make_int_type (dhandle, 4, TRUE);
-	else if (strcmp (p, "__int128") == 0)
-	  ret = debug_make_int_type (dhandle, 16, FALSE);
-	else if (strcmp (p, "unsigned __int128") == 0)
-	  ret = debug_make_int_type (dhandle, 16, TRUE);
-	else if (strcmp (p, "short") == 0)
-	  ret = debug_make_int_type (dhandle, 2, FALSE);
-	else if (strcmp (p, "unsigned short") == 0)
-	  ret = debug_make_int_type (dhandle, 2, TRUE);
-	else if (strcmp (p, "void") == 0)
-	  ret = debug_make_void_type (dhandle);
-	else if (strcmp (p, "wchar_t") == 0)
-	  ret = debug_make_int_type (dhandle, 4, TRUE);
-	else if (strcmp (p, "long long") == 0)
-	  ret = debug_make_int_type (dhandle, 8, FALSE);
-	else if (strcmp (p, "unsigned long long") == 0)
-	  ret = debug_make_int_type (dhandle, 8, TRUE);
-	else if (strcmp (p, "...") == 0)
-	  {
-	    if (pvarargs == NULL)
-	      fprintf (stderr, _("Unexpected demangled varargs\n"));
-	    else
-	      *pvarargs = TRUE;
-	    ret = NULL;
-	  }
-	else
-	  {
-	    fprintf (stderr, _("Unrecognized demangled builtin type\n"));
-	    ret = NULL;
-	  }
-
-	free (p);
-
-	return ret;
-      }
-    }
-}
From 99bb30f56b48efed145d359ecfb119814d00e309 Mon Sep 17 00:00:00 2001

From: Maxim <kolmax94@gmail.com>

Subject: [PATCH 22/27] Port emulparams scripts
---

 ld/emulparams/elf_i386_obsd.sh   |   24 ++++++++++++++++++++++++
 ld/emulparams/elf_obsd.sh        |    8 ++++++++
 ld/emulparams/elf_x86_64_obsd.sh |    2 ++
 3 files changed, 34 insertions(+), 0 deletions(-)
 create mode 100644 ld/emulparams/elf_i386_obsd.sh
 create mode 100644 ld/emulparams/elf_obsd.sh
 create mode 100644 ld/emulparams/elf_x86_64_obsd.sh


diff --git a/ld/emulparams/elf_i386_obsd.sh b/ld/emulparams/elf_i386_obsd.sh
new file mode 100644
index 0000000..ae7ba0e
--- /dev/null
+++ b/ld/emulparams/elf_i386_obsd.sh
@@ -0,0 +1,24 @@
+. ${srcdir}/emulparams/elf_i386.sh
+. ${srcdir}/emulparams/elf_obsd.sh
+
+if test "${LD_FLAG#"${LD_FLAG%pie}"}" = "pie"; then
+  TEXT_START_ADDR=0x0
+  if test "${LD_FLAG%%(cpie|pie)}" = "Z"; then
+    RODATA_PADSIZE=${MAXPAGESIZE}
+  else
+    RODATA_PADSIZE=0x20000000
+  fi
+else
+  if test "${LD_FLAG%%(cpie|pie)}" = "Z"; then
+    TEXT_START_ADDR=0x08048000
+    RODATA_PADSIZE=${MAXPAGESIZE}
+  else
+    TEXT_START_ADDR=0x1C000000
+    RODATA_PADSIZE=0x20000000
+  fi
+fi
+
+RODATA_ALIGN=". = ALIGN(${RODATA_PADSIZE})"
+RODATA_ALIGN_ADD="${TEXT_START_ADDR}"
+
+unset PAD_PLT
diff --git a/ld/emulparams/elf_obsd.sh b/ld/emulparams/elf_obsd.sh
new file mode 100644
index 0000000..37e0d51
--- /dev/null
+++ b/ld/emulparams/elf_obsd.sh
@@ -0,0 +1,8 @@
+LIB_PATH=/usr/lib
+
+PAD_RO=
+RODATA_PADSIZE=${MAXPAGESIZE}
+RODATA_ALIGN=". = ALIGN(${RODATA_PADSIZE}) + (. & (${RODATA_PADSIZE} - 1))"
+PAD_GOT=
+PAD_PLT=
+DATA_START_SYMBOLS='__data_start = . ;'
diff --git a/ld/emulparams/elf_x86_64_obsd.sh b/ld/emulparams/elf_x86_64_obsd.sh
new file mode 100644
index 0000000..3689dad
--- /dev/null
+++ b/ld/emulparams/elf_x86_64_obsd.sh
@@ -0,0 +1,2 @@
+. ${srcdir}/emulparams/elf_x86_64.sh
+. ${srcdir}/emulparams/elf_obsd.sh
From f8fc67d17104aaf6e331259439a5c8a520ac1684 Mon Sep 17 00:00:00 2001

From: Maxim <kolmax94@gmail.com>

Subject: [PATCH 13/26] Port gas cofig patches
---

 gas/config/tc-arm.c  |    4 ++--
 gas/config/tc-i386.c |    3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)


diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c
index f4ebdc4..8acf362 100644
--- a/gas/config/tc-arm.c
+++ b/gas/config/tc-arm.c
@@ -108,7 +108,7 @@ enum arm_float_abi
 #ifndef FPU_DEFAULT
 # ifdef TE_LINUX
 #  define FPU_DEFAULT FPU_ARCH_FPA
-# elif defined (TE_NetBSD)
+# elif defined (TE_NetBSD) || defined (TE_OpenBSD)
 #  ifdef OBJ_ELF
 #   define FPU_DEFAULT FPU_ARCH_VFP	/* Soft-float, but VFP order.  */
 #  else
@@ -22052,7 +22052,7 @@ md_begin (void)
   else if (!mfpu_opt)
     {
 #if !(defined (EABI_DEFAULT) || defined (TE_LINUX) \
-	|| defined (TE_NetBSD) || defined (TE_VXWORKS))
+	|| defined (TE_NetBSD) || defined (TE_VXWORKS) || defined(TE_OpenBSD))
       /* Some environments specify a default FPU.  If they don't, infer it
 	 from the processor.  */
       if (mcpu_fpu_opt)
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index 9c33cf9..f59694f 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -303,7 +303,8 @@ const char extra_symbol_chars[] = "*%-(["
 	 && !defined (TE_LINUX)				\
  	 && !defined (TE_NETWARE)			\
 	 && !defined (TE_FreeBSD)			\
-	 && !defined (TE_NetBSD)))
+	 && !defined (TE_NetBSD)            \
+     && !defined (TE_OpenBSD)))
 /* This array holds the chars that always start a comment.  If the
    pre-processor is disabled, these aren't very useful.  The option
    --divide will remove '/' from this list.  */
From 9a9948f66a8bd7806d93903b7c35eaa60be967d7 Mon Sep 17 00:00:00 2001

From: Maxim <kolmax94@gmail.com>

Subject: [PATCH 14/26] Port gas/Makefile.am patch
---

 gas/Makefile.am |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)


diff --git a/gas/Makefile.am b/gas/Makefile.am
index 7b897f3..9fc7afd 100644
--- a/gas/Makefile.am
+++ b/gas/Makefile.am
@@ -282,6 +282,7 @@ TARG_ENV_HFILES = \
 	config/te-macos.h \
 	config/te-nbsd.h \
 	config/te-nbsd532.h \
+	config/te-obsd.h \
 	config/te-netware.h \
 	config/te-pc532mach.h \
 	config/te-pe.h \
@@ -355,6 +356,7 @@ AM_CPPFLAGS = -I. -I$(srcdir) -I../bfd -I$(srcdir)/config \
 # and the system's installed libraries.
 
 GASLIBS = @OPCODES_LIB@ ../bfd/libbfd.la ../libiberty/libiberty.a
+GASLIBSDEPS = @OPCODES_LIB@ ../bfd/libbfd.la
 
 # Files to be copied away after each stage in building.
 STAGESTUFF = *.@OBJEXT@ $(noinst_PROGRAMS)
@@ -363,7 +365,7 @@ as_new_SOURCES = $(GAS_CFILES)
 as_new_LDADD = $(TARG_CPU_O) $(OBJ_FORMAT_O) $(ATOF_TARG_O) \
 	$(extra_objects) $(GASLIBS) $(LIBINTL) $(LIBM)
 as_new_DEPENDENCIES = $(TARG_CPU_O) $(OBJ_FORMAT_O) $(ATOF_TARG_O) \
-	$(extra_objects) $(GASLIBS) $(LIBINTL_DEP)
+	$(extra_objects) $(GASLIBSDEPS) $(LIBINTL_DEP)
 EXTRA_as_new_SOURCES = $(CFILES) $(HFILES) $(TARGET_CPU_CFILES) \
 	$(TARGET_CPU_HFILES) $(OBJ_FORMAT_CFILES) $(OBJ_FORMAT_HFILES) \
 	$(TARG_ENV_CFILES) $(CONFIG_ATOF_CFILES) $(MULTI_CFILES)
From 0f2df696592793712a16cae18bd5dac4c2d3a58e Mon Sep 17 00:00:00 2001

From: Maxim <kolmax94@gmail.com>

Subject: [PATCH 15/26] Port gas/read.c patch
---

 gas/read.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)


diff --git a/gas/read.c b/gas/read.c
index bd3fa58..a2f37bb 100644
--- a/gas/read.c
+++ b/gas/read.c
@@ -5336,7 +5336,7 @@ next_char_of_string (void)
 	    int i;
 
 	    for (i = 0, number = 0;
-		 ISDIGIT (c) && i < 3;
+		 i < 3 && ISDIGIT (c);
 		 c = *input_line_pointer++, i++)
 	      {
 		number = number * 8 + c - '0';
From 1f312c52f16e177676ac82816412b336f8cd0bd7 Mon Sep 17 00:00:00 2001

From: Maxim <kolmax94@gmail.com>

Subject: [PATCH 17/26] Port ld/configure.tgt patch
---

 ld/configure.tgt |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)


diff --git a/ld/configure.tgt b/ld/configure.tgt
index 4e90739..bff4c20 100644
--- a/ld/configure.tgt
+++ b/ld/configure.tgt
@@ -259,6 +259,14 @@ x86_64-*-freebsd* | x86_64-*-kfreebsd*-gnu)
 			    | sed -e 's/x86_64/i386/'`
 			tdir_elf_i386=`echo ${targ_alias} \
 			    | sed -e 's/x86_64/i386/'` ;;
+i[3-7]86-*-openbsd[0-2]* | i[3-7]86-*-openbsd3.[0-2])
+			targ_emul=i386obsd ;;
+i[3-7]86-*-openbsd*)	targ_emul=elf_i386_obsd ;;
+x86_64-*-openbsd*)	targ_emul=elf_x86_64_obsd
+			targ_extra_emuls="elf_i386_obsd elf_i386"
+			tdir_elf_i386_obsd=`echo ${targ_alias} | \
+			    sed -e 's/x86_64/i386/'`
+			;;
 i[3-7]86-*-sysv*)	targ_emul=i386coff ;;
 i[3-7]86-*-ptx*)	targ_emul=i386coff ;;
 i[3-7]86-*-mach*)	targ_emul=i386mach ;;
From b05d9772b29631845d033f12b09aacfc5edd8f73 Mon Sep 17 00:00:00 2001

From: Maxim <kolmax94@gmail.com>

Subject: [PATCH 21/27] Port ld/Makefile.am patch
---

 ld/Makefile.am |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)


diff --git a/ld/Makefile.am b/ld/Makefile.am
index b4364be..46dbba6 100644
--- a/ld/Makefile.am
+++ b/ld/Makefile.am
@@ -237,6 +237,7 @@ ALL_EMULATION_SOURCES = \
 	eelf_i386_be.c \
 	eelf_i386_chaos.c \
 	eelf_i386_fbsd.c \
+	eelf_i386_obsd.c \
 	eelf_i386_ldso.c \
 	eelf_i386_sol2.c \
 	eelf_i386_vxworks.c \
@@ -281,6 +282,7 @@ ALL_EMULATION_SOURCES = \
 	ei386nbsd.c \
 	ei386nto.c \
 	ei386nw.c \
+	ei386obsd.c \
 	ei386pe.c \
 	ei386pe_posix.c \
 	ei386pep.c \
@@ -443,6 +445,7 @@ ALL_64_EMULATION_SOURCES = \
 	eshlelf64_nbsd.c \
 	eelf_x86_64.c \
 	eelf_x86_64_fbsd.c \
+	eelf_x86_64_obsd.c \
 	eelf_x86_64_sol2.c \
 	eelf_l1om.c \
 	eelf_l1om_fbsd.c \
@@ -1183,6 +1186,10 @@ eelf_l1om_fbsd.c: $(srcdir)/emulparams/elf_l1om_fbsd.sh \
   $(srcdir)/emulparams/elf_l1om.sh \
   $(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
 	${GENSCRIPTS} elf_l1om_fbsd "$(tdir_elf_l1om_fbsd)"
+eelf_x86_64_obsd.c: $(srcdir)/emulparams/elf_x86_64_obsd.sh \
+  $(srcdir)/emulparams/elf_x86_64.sh \
+  $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+	${GENSCRIPTS} elf_x86_64_obsd "$(tdir_elf_x86_64_obsd)"
 eelf_i386_be.c: $(srcdir)/emulparams/elf_i386_be.sh \
   $(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
 	${GENSCRIPTS} elf_i386_be "$(tdir_elf_i386_be)"
@@ -1193,6 +1200,10 @@ eelf_i386_fbsd.c: $(srcdir)/emulparams/elf_i386_fbsd.sh \
   $(srcdir)/emulparams/elf_i386.sh \
   $(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
 	${GENSCRIPTS} elf_i386_fbsd "$(tdir_elf_i386_fbsd)"
+eelf_i386_obsd.c: $(srcdir)/emulparams/elf_i386_obsd.sh \
+  $(srcdir)/emulparams/elf_i386.sh \
+  $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+	${GENSCRIPTS} elf_i386_obsd "$(tdir_elf_i386_obsd)"
 eelf_i386_ldso.c: $(srcdir)/emulparams/elf_i386_ldso.sh \
   $(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
 	${GENSCRIPTS} elf_i386_ldso "$(tdir_elf_i386_ldso)"
@@ -1342,6 +1353,9 @@ ei386nto.c:	$(srcdir)/emulparams/i386nto.sh \
 ei386nw.c:	$(srcdir)/emulparams/i386nw.sh \
   $(ELF_DEPS) $(srcdir)/scripttempl/nw.sc ${GEN_DEPENDS}
 	${GENSCRIPTS} i386nw "$(tdir_i386nw)"
+ei386obsd.c:	$(srcdir)/emulparams/i386obsd.sh \
+  $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
+	${GENSCRIPTS} i386obsd "$(tdir_i386obsd)"
 ei386pe.c: $(srcdir)/emulparams/i386pe.sh \
   $(srcdir)/emultempl/pe.em $(srcdir)/scripttempl/pe.sc ${GEN_DEPENDS}
 	${GENSCRIPTS} i386pe "$(tdir_i386pe)"
From fe7580454be658f3838f631c33b46c7f612c8371 Mon Sep 17 00:00:00 2001

From: Maxim <kolmax94@gmail.com>

Subject: [PATCH 27/27] Fix sentinels
---

 ld/plugin.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)


diff --git a/ld/plugin.c b/ld/plugin.c
index 79b39e8..6107dbe 100644
--- a/ld/plugin.c
+++ b/ld/plugin.c
@@ -268,7 +268,7 @@ asymbol_from_plugin_symbol (bfd *abfd, asymbol *asym,
 
   asym->the_bfd = abfd;
   asym->name = ldsym->version
-		? concat (ldsym->name, "@", ldsym->version, NULL)
+		? concat (ldsym->name, "@", ldsym->version, (char *) NULL)
 		: ldsym->name;
   asym->value = 0;
   switch (ldsym->def)
@@ -563,7 +563,7 @@ message (int level, const char *format, ...)
     default:
       {
 	char *newfmt = ACONCAT ((level == LDPL_FATAL ? "%F" : "%X",
-				format, NULL));
+				format, (char *) NULL));
 	vfinfo (stderr, newfmt, args, TRUE);
       }
       break;

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: GNU Binutils on OpeBSD
  2011-04-24 18:41 GNU Binutils on OpeBSD Maxim Koltsov
@ 2011-04-24 19:28 ` Mike Frysinger
       [not found]   ` <BANLkTinY2uodMryK3aFB7Zh7etwuOh5M-A@mail.gmail.com>
  0 siblings, 1 reply; 8+ messages in thread
From: Mike Frysinger @ 2011-04-24 19:28 UTC (permalink / raw)
  To: Maxim Koltsov; +Cc: binutils

On Sun, Apr 24, 2011 at 2:41 PM, Maxim Koltsov wrote:
> I'm building binutils on OpenBSD 4.8. I've ported OpenBSD's binutils
> patch to binutils-2.21, so bfd is aware of openbsd now. But i get very
> strange error with --enable-shared: libopcodes.so has DT_NEEDED
> pointing to libbfd.so in temporaly location:
>   NEEDED      /home/maksbotan/gentoo/var/tmp/portage/sys-devel/binutils-2.21/work/build/opcodes/../bfd/.libs/libbfd.so
> Of course, this cannot be found, and tools like as and objdump cannot
> work. And when compiling binutils on linux, libopcodes.so has only
> 'libbfd-2.21.so' in DT_NEEDED. Can you figure out what problem is
> cause by? My patch is attached.

pretty sure this isnt a bug.  you probably need to `make install` first.
-mike

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: GNU Binutils on OpeBSD
       [not found]   ` <BANLkTinY2uodMryK3aFB7Zh7etwuOh5M-A@mail.gmail.com>
@ 2011-04-24 20:56     ` Mike Frysinger
       [not found]       ` <BANLkTim8CDtJO7vrKq--dfJipTBU69Po8w@mail.gmail.com>
  0 siblings, 1 reply; 8+ messages in thread
From: Mike Frysinger @ 2011-04-24 20:56 UTC (permalink / raw)
  To: Максим
	Кольцов
  Cc: binutils

On Sun, Apr 24, 2011 at 3:56 PM, Максим Кольцов wrote:
>> pretty sure this isnt a bug.  you probably need to `make install` first.
>
> Of course binutils are installed.

the path you posted was of the *non-installed* library, and those
often have the build dir encoded in them.  not a bug.

once you do run `make install`, the shared libs are relinked and the
temp paths removed.  this is simply how libtool works.

> So when i run, e.g. as i give error:
> /home/maksbotan/gentoo/usr/i686-pc-openbsd4.8/binutils-bin/2.21/as:
> can't load library
> '/home/maksbotan/gentoo/var/tmp/portage/sys-devel/binutils-2.21/work/build/opcodes/../bfd/.libs/libbfd.so'.

post the info on the *installed* libs, as well as a build log.  and
dont link to random pastebin sites ... attach all relevant logs to
your e-mail.
-mike

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: GNU Binutils on OpeBSD
       [not found]         ` <BANLkTikqs7ghsJ63PKLKHiAx38PE0QMRfw@mail.gmail.com>
@ 2011-04-25  4:47           ` Maxim Koltsov
  2011-04-25  5:06             ` Mike Frysinger
  0 siblings, 1 reply; 8+ messages in thread
From: Maxim Koltsov @ 2011-04-25  4:47 UTC (permalink / raw)
  To: binutils

[-- Attachment #1: Type: text/plain, Size: 625 bytes --]

2011/4/25 Mike Frysinger <vapier@gentoo.org>:
> On Sun, Apr 24, 2011 at 3:56 PM, Максим Кольцов wrote:
>>> pretty sure this isnt a bug.  you probably need to `make install` first.
>>
>> Of course binutils are installed.
>
> the path you posted was of the *non-installed* library, and those
> often have the build dir encoded in them.  not a bug.
>
> once you do run `make install`, the shared libs are relinked and the
> temp paths removed.  this is simply how libtool works.

No, this path comes from _installed_ binutils (sorry for bzipped log,
maillist doesn't accept big files).
See attached logs.
Maxim.

[-- Attachment #2: ld_debug.log --]
[-- Type: text/x-log, Size: 2383 bytes --]

rtld loading: '/home/maksbotan/gentoo/usr/i686-pc-openbsd4.8/binutils-bin/2.21/as'
exe load offset:  0x0
head /home/maksbotan/gentoo/usr/i686-pc-openbsd4.8/binutils-bin/2.21/as
obj /home/maksbotan/gentoo/usr/i686-pc-openbsd4.8/binutils-bin/2.21/as has /home/maksbotan/gentoo/usr/i686-pc-openbsd4.8/binutils-bin/2.21/as as head
examining: '/home/maksbotan/gentoo/usr/i686-pc-openbsd4.8/binutils-bin/2.21/as'
loading: libbfd.so required by /home/maksbotan/gentoo/usr/i686-pc-openbsd4.8/binutils-bin/2.21/as
obj /home/maksbotan/gentoo/usr/lib/binutils/i686-pc-openbsd4.8/2.21/libbfd.so has /home/maksbotan/gentoo/usr/i686-pc-openbsd4.8/binutils-bin/2.21/as as head
loading: libopcodes.so required by /home/maksbotan/gentoo/usr/i686-pc-openbsd4.8/binutils-bin/2.21/as
obj /home/maksbotan/gentoo/usr/lib/binutils/i686-pc-openbsd4.8/2.21/libopcodes.so has /home/maksbotan/gentoo/usr/i686-pc-openbsd4.8/binutils-bin/2.21/as as head
loading: libc.so.56.0 required by /home/maksbotan/gentoo/usr/i686-pc-openbsd4.8/binutils-bin/2.21/as
obj /usr/lib/libc.so.56.0 has /home/maksbotan/gentoo/usr/i686-pc-openbsd4.8/binutils-bin/2.21/as as head
loading: libz.so.4.1 required by /home/maksbotan/gentoo/usr/i686-pc-openbsd4.8/binutils-bin/2.21/as
obj /usr/lib/libz.so.4.1 has /home/maksbotan/gentoo/usr/i686-pc-openbsd4.8/binutils-bin/2.21/as as head
linking dep /home/maksbotan/gentoo/usr/lib/binutils/i686-pc-openbsd4.8/2.21/libopcodes.so as child of /home/maksbotan/gentoo/usr/i686-pc-openbsd4.8/binutils-bin/2.21/as
linking dep /home/maksbotan/gentoo/usr/lib/binutils/i686-pc-openbsd4.8/2.21/libbfd.so as child of /home/maksbotan/gentoo/usr/i686-pc-openbsd4.8/binutils-bin/2.21/as
linking dep /usr/lib/libz.so.4.1 as child of /home/maksbotan/gentoo/usr/i686-pc-openbsd4.8/binutils-bin/2.21/as
linking dep /usr/lib/libc.so.56.0 as child of /home/maksbotan/gentoo/usr/i686-pc-openbsd4.8/binutils-bin/2.21/as
examining: '/home/maksbotan/gentoo/usr/lib/binutils/i686-pc-openbsd4.8/2.21/libopcodes.so'
loading: /home/maksbotan/gentoo/var/tmp/portage/sys-devel/binutils-2.21/work/build/opcodes/../bfd/.libs/libbfd.so required by /home/maksbotan/gentoo/usr/lib/binutils/i686-pc-openbsd4.8/2.21/libopcodes.so
/home/maksbotan/gentoo/usr/i686-pc-openbsd4.8/binutils-bin/2.21/as: can't load library '/home/maksbotan/gentoo/var/tmp/portage/sys-devel/binutils-2.21/work/build/opcodes/../bfd/.libs/libbfd.so'

[-- Attachment #3: libopcodes.log --]
[-- Type: text/x-log, Size: 1619 bytes --]


/home/maksbotan/gentoo/usr/lib/binutils/i686-pc-openbsd4.8/2.21/libopcodes.so:     file format elf32-i386

Program Header:
    LOAD off    0x00000000 vaddr 0x00000000 paddr 0x00000000 align 2**12
         filesz 0x00018376 memsz 0x00018376 flags r-x
    LOAD off    0x00019000 vaddr 0x20000000 paddr 0x20000000 align 2**12
         filesz 0x00006070 memsz 0x00006070 flags r--
    LOAD off    0x0001f080 vaddr 0x20007080 paddr 0x20007080 align 2**12
         filesz 0x0006e07c memsz 0x0006e07c flags rw-
    LOAD off    0x0008d0fc vaddr 0x200760fc paddr 0x200760fc align 2**12
         filesz 0x00000094 memsz 0x00000094 flags rw-
    LOAD off    0x0008d1a0 vaddr 0x200771a0 paddr 0x200771a0 align 2**12
         filesz 0x00000000 memsz 0x0000047c flags rw-
 DYNAMIC off    0x0008d040 vaddr 0x20075040 paddr 0x20075040 align 2**2
         filesz 0x000000b8 memsz 0x000000b8 flags rw-
    NOTE off    0x0001f058 vaddr 0x20006058 paddr 0x20006058 align 2**2
         filesz 0x00000018 memsz 0x00000018 flags r--

Dynamic Section:
  NEEDED      /home/maksbotan/gentoo/var/tmp/portage/sys-devel/binutils-2.21/work/build/opcodes/../bfd/.libs/libbfd.so
  NEEDED      libc.so.56.0
  RPATH       /home/maksbotan/gentoo/usr/lib:/home/maksbotan/gentoo/lib:/home/maksbotan/gentoo/usr/lib/binutils/i686-pc-openbsd4.8/2.21/
  INIT        0xe840
  FINI        0x18370
  HASH        0x154
  STRTAB      0x830
  SYMTAB      0x390
  STRSZ       0x35f
  SYMENT      0x10
  PLTGOT      0x200760fc
  PLTRELSZ    0x98
  PLTREL      0x11
  JMPREL      0xe7a8
  REL         0xb90
  RELSZ       0xdc18
  RELENT      0x8
  RELCOUNT    0x1b79


[-- Attachment #4: build.log.bz2 --]
[-- Type: application/x-bzip2, Size: 19697 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: GNU Binutils on OpeBSD
  2011-04-25  4:47           ` Maxim Koltsov
@ 2011-04-25  5:06             ` Mike Frysinger
  2011-04-25 11:35               ` Maxim Koltsov
  0 siblings, 1 reply; 8+ messages in thread
From: Mike Frysinger @ 2011-04-25  5:06 UTC (permalink / raw)
  To: Maxim Koltsov; +Cc: binutils

2011/4/25 Maxim Koltsov:
> 2011/4/25 Mike Frysinger:
>> On Sun, Apr 24, 2011 at 3:56 PM, Максим Кольцов wrote:
>>>> pretty sure this isnt a bug.  you probably need to `make install` first.
>>>
>>> Of course binutils are installed.
>>
>> the path you posted was of the *non-installed* library, and those
>> often have the build dir encoded in them.  not a bug.
>>
>> once you do run `make install`, the shared libs are relinked and the
>> temp paths removed.  this is simply how libtool works.
>
> No, this path comes from _installed_ binutils (sorry for bzipped log,
> maillist doesn't accept big files).
> See attached logs.

looks like your host linker sucks.  when linking libopcodes.so, libtool does:
-Wl,/home/maksbotan/gentoo/var/tmp/portage/sys-devel/binutils-2.21/work/build/opcodes/../bfd/.libs/libbfd.so

instead of encoding the DT_SONAME, it wrongly encodes the full path.
not really a bug in binutils that i can see.

$ echo 'main(){}' > test.c
$ readelf -d /usr/x86_64-pc-linux-gnu/lib/libbfd.so | grep SONAME
 0x000000000000000e (SONAME)     Library soname: [libbfd-2.21.so]
$ gcc test.c -Wl,/usr/x86_64-pc-linux-gnu/lib/libbfd.so
$ readelf -d a.out | grep NEEDED
 0x0000000000000001 (NEEDED)     Shared library: [libbfd-2.21.so]
 0x0000000000000001 (NEEDED)     Shared library: [libc.so.6]
-mike

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: GNU Binutils on OpeBSD
  2011-04-25  5:06             ` Mike Frysinger
@ 2011-04-25 11:35               ` Maxim Koltsov
  2011-04-25 12:42                 ` Alan Modra
  0 siblings, 1 reply; 8+ messages in thread
From: Maxim Koltsov @ 2011-04-25 11:35 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: binutils

>
> looks like your host linker sucks.  when linking libopcodes.so, libtool does:
> -Wl,/home/maksbotan/gentoo/var/tmp/portage/sys-devel/binutils-2Y.21/work/build/opcodes/../bfd/.libs/libbfd.so
>
> instead of encoding the DT_SONAME, it wrongly encodes the full path.
> not really a bug in binutils that i can see.
>
So, what can you advice to fix the issue. Can we modify DT_NEEDED with
objcopy or anything else?
Also, FYI the linker is openbsd modified GNU binutils-2.15.
Maxim.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: GNU Binutils on OpeBSD
  2011-04-25 11:35               ` Maxim Koltsov
@ 2011-04-25 12:42                 ` Alan Modra
  2011-04-25 12:50                   ` Максим Кольцов
  0 siblings, 1 reply; 8+ messages in thread
From: Alan Modra @ 2011-04-25 12:42 UTC (permalink / raw)
  To: Maxim Koltsov; +Cc: Mike Frysinger, binutils

On Mon, Apr 25, 2011 at 03:35:12PM +0400, Maxim Koltsov wrote:
> >
> > looks like your host linker sucks.  when linking libopcodes.so, libtool does:
> > -Wl,/home/maksbotan/gentoo/var/tmp/portage/sys-devel/binutils-2Y.21/work/build/opcodes/../bfd/.libs/libbfd.so
> >
> > instead of encoding the DT_SONAME, it wrongly encodes the full path.
> > not really a bug in binutils that i can see.
> >
> So, what can you advice to fix the issue. Can we modify DT_NEEDED with
> objcopy or anything else?
> Also, FYI the linker is openbsd modified GNU binutils-2.15.

Build binutils static, install, rebuild shared if you like it that
way.

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: GNU Binutils on OpeBSD
  2011-04-25 12:42                 ` Alan Modra
@ 2011-04-25 12:50                   ` Максим Кольцов
  0 siblings, 0 replies; 8+ messages in thread
From: Максим Кольцов @ 2011-04-25 12:50 UTC (permalink / raw)
  To: Maxim Koltsov, Mike Frysinger, binutils

> Build binutils static, install, rebuild shared if you like it that
> way.
>
I've already thinked of this way, probably i will do it. Thanks.
Maxim.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2011-04-25 12:50 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-24 18:41 GNU Binutils on OpeBSD Maxim Koltsov
2011-04-24 19:28 ` Mike Frysinger
     [not found]   ` <BANLkTinY2uodMryK3aFB7Zh7etwuOh5M-A@mail.gmail.com>
2011-04-24 20:56     ` Mike Frysinger
     [not found]       ` <BANLkTim8CDtJO7vrKq--dfJipTBU69Po8w@mail.gmail.com>
     [not found]         ` <BANLkTikqs7ghsJ63PKLKHiAx38PE0QMRfw@mail.gmail.com>
2011-04-25  4:47           ` Maxim Koltsov
2011-04-25  5:06             ` Mike Frysinger
2011-04-25 11:35               ` Maxim Koltsov
2011-04-25 12:42                 ` Alan Modra
2011-04-25 12:50                   ` Максим Кольцов

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).