[prev in list] [next in list] [prev in thread] [next in thread] 

List:       binutils
Subject:    PATCH: Support ia64-hpux (Re: [PATCH] Fix bfd_generic_get_relocated_section_contents on IA-64)
From:       "H. J. Lu" <hjl () lucon ! org>
Date:       2003-09-30 20:48:32
Message-ID: 20030930204832.GA27686 () lucon ! org
[Download RAW message or body]

On Tue, Sep 30, 2003 at 08:34:35PM +0200, Jakub Jelinek wrote:
> Hi!
> 
> Following testcase:
> 
> /* gcc -shared -g -O2 -fpic -Wl,-z,defs test.c -o test.so /lib/ld-linux-ia64.so.2 */
> static __thread int i;
> extern int bar;
> 
> int *foo (void)
> {
>   return &i + bar;
> }
> 
> (distilled from glibc with a buggy patch) causes linker abort.
> The problem is that .rela.debug_info contains R_IA64_DTPREL64LSB
> relocation and ia64_howto_table incorrectly used howto->size 8
> (which is 16 bytes) for it, which means bfd_perform_relocation returned
> bfd_reloc_other and bfd_generic_get_relocated_section_contents aborted.
> Apparently I wrote the sizes in bytes instead of the weirdo encoding.
> Ok to commit?
> 
> BTW: I have doubts about other relocs:
>     IA64_HOWTO (R_IA64_IPLTMSB,     "IPLTMSB",     4, FALSE, TRUE),
>     IA64_HOWTO (R_IA64_IPLTLSB,     "IPLTLSB",     4, FALSE, TRUE),
>     IA64_HOWTO (R_IA64_COPY,        "COPY",        4, FALSE, TRUE),
> I'd say the former two should be size NN/8 (16 bytes for elf64_ia64,
> 8 bytes for elf32_ia64) and R_IA64_COPY should be size 3 (0 bytes).

My ILP32 patches can deal with it. 


H.J.

["ld-hpux-2.patch" (text/plain)]

2003-09-30  H.J. Lu  <hongjiu.lu@intel.com>

	* configure.in (ia64*-**-hpux*): Enable ld.
	* configure: Regenerated.

ld/

2003-09-30  H.J. Lu  <hongjiu.lu@intel.com>

	* Makefile.am (ALL_EMULATIONS): Add eelf32_ia64_hpux.o.
	(ALL_64_EMULATIONS): Add eelf64_ia64_hpux.o.
	(eelf32_ia64_hpux.c): New.
	(eelf64_ia64_hpux.c): Likewise.
	* Makefile.in: Regenerated.

	* configure.tgt (ia64-*-hpux*): New.

	* mulparams/elf32_ia64_hpux.sh: New file.
	* emulparams/elf64_ia64_hpux.sh: Likewise.

--- binutils/configure.in.hpux	2003-09-23 08:16:43.000000000 -0700
+++ binutils/configure.in	2003-09-30 12:05:09.000000000 -0700
@@ -500,8 +500,8 @@ case "${target}" in
     noconfigdirs="$noconfigdirs tix readline mmalloc libgui itcl gdb"
     ;;
   ia64*-**-hpux*)
-    # No gdb or ld support yet.
-    noconfigdirs="$noconfigdirs tix readline mmalloc libgui itcl gdb ld"
+    # No gdb support yet.
+    noconfigdirs="$noconfigdirs tix readline mmalloc libgui itcl gdb"
     ;;
   i[[3456789]]86-*-coff | i[[3456789]]86-*-elf)
     noconfigdirs="$noconfigdirs ${libgcj}"
--- binutils/ld/Makefile.am.hpux	2003-08-15 23:22:43.000000000 -0700
+++ binutils/ld/Makefile.am	2003-09-30 12:05:09.000000000 -0700
@@ -155,6 +155,7 @@ ALL_EMULATIONS = \
 	eebmon29k.o \
 	eelf32_i960.o \
 	eelf32_i860.o \
+	eelf32_ia64_hpux.o \
 	eelf32_sparc.o \
 	eelf32b4300.o \
 	eelf32bmip.o \
@@ -363,6 +364,7 @@ ALL_64_EMULATIONS = \
 	eelf64_aix.o \
 	eelf64_ia64.o \
 	eelf64_ia64_fbsd.o \
+	eelf64_ia64_hpux.o \
 	eshelf64.o \
 	eshlelf64.o \
 	eshelf64_nbsd.o \
@@ -657,6 +659,10 @@ eelf32_i860.c: $(srcdir)/emulparams/elf3
 eelf32_i960.c: $(srcdir)/emulparams/elf32_i960.sh \
   $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
 	${GENSCRIPTS} elf32_i960 "$(tdir_elf32_i960)"
+eelf32_ia64_hpux.c: $(srcdir)/emulparams/elf32_ia64_hpux.sh \
+  $(srcdir)/emultempl/elf32.em $(srcdir)/emultempl/needrelax.em \
+  $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+	${GENSCRIPTS} elf32_ia64_hpux "$(tdir_elf32_ia64_hpux)"
 eelf32b4300.c: $(srcdir)/emulparams/elf32b4300.sh \
   $(srcdir)/emulparams/elf32bmip.sh $(srcdir)/emultempl/mipself.em \
   $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
@@ -797,6 +803,11 @@ eelf64_ia64_fbsd.c: $(srcdir)/emulparams
   $(srcdir)/emultempl/elf32.em $(srcdir)/emultempl/needrelax.em \
   $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
 	${GENSCRIPTS} elf64_ia64_fbsd "$(tdir_elf64_ia64_fbsd)"
+eelf64_ia64_hpux.c: $(srcdir)/emulparams/elf64_ia64_hpux.sh \
+  $(srcdir)/emulparams/elf64_ia64.sh \
+  $(srcdir)/emultempl/elf32.em $(srcdir)/emultempl/needrelax.em \
+  $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+	${GENSCRIPTS} elf64_ia64_hpux "$(tdir_elf64_ia64_hpux)"
 eelf64_s390.c: $(srcdir)/emulparams/elf64_s390.sh \
   $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
 	${GENSCRIPTS} elf64_s390 "$(tdir_elf64_s390)"
--- binutils/ld/Makefile.in.hpux	2003-08-15 23:22:43.000000000 -0700
+++ binutils/ld/Makefile.in	2003-09-30 12:05:34.000000000 -0700
@@ -1,4 +1,4 @@
-# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am
+# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am
 
 # Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
@@ -269,6 +269,7 @@ ALL_EMULATIONS = \
 	eebmon29k.o \
 	eelf32_i960.o \
 	eelf32_i860.o \
+	eelf32_ia64_hpux.o \
 	eelf32_sparc.o \
 	eelf32b4300.o \
 	eelf32bmip.o \
@@ -478,6 +479,7 @@ ALL_64_EMULATIONS = \
 	eelf64_aix.o \
 	eelf64_ia64.o \
 	eelf64_ia64_fbsd.o \
+	eelf64_ia64_hpux.o \
 	eshelf64.o \
 	eshlelf64.o \
 	eshelf64_nbsd.o \
@@ -888,7 +890,7 @@ uninstall-man:
 all-recursive install-data-recursive install-exec-recursive \
 installdirs-recursive install-recursive uninstall-recursive install-info-recursive \
 check-recursive installcheck-recursive info-recursive dvi-recursive:
-	@set fnord $(MAKEFLAGS); amf=$$2; \
+	@set fnord $$MAKEFLAGS; amf=$$2; \
 	dot_seen=no; \
 	target=`echo $@ | sed s/-recursive//`; \
 	list='$(SUBDIRS)'; for subdir in $$list; do \
@@ -908,7 +910,7 @@ check-recursive installcheck-recursive i
 
 mostlyclean-recursive clean-recursive distclean-recursive \
 maintainer-clean-recursive:
-	@set fnord $(MAKEFLAGS); amf=$$2; \
+	@set fnord $$MAKEFLAGS; amf=$$2; \
 	dot_seen=no; \
 	rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \
 	  rev="$$subdir $$rev"; \
@@ -1093,7 +1095,7 @@ distclean-generic:
 	-test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
 
 maintainer-clean-generic:
-	-test -z "ldlexldeffilephdeffilepcldgramhldgramc$(MAINTAINERCLEANFILES)" || rm -f \
ldlexl deffileph deffilepc ldgramh ldgramc $(MAINTAINERCLEANFILES) +	-test -z \
"ldlexcdeffilephdeffilepcldgramhldgramc$(MAINTAINERCLEANFILES)" || rm -f ldlexc \
deffileph deffilepc ldgramh ldgramc $(MAINTAINERCLEANFILES)  mostlyclean-am:  \
mostlyclean-hdr mostlyclean-noinstPROGRAMS \  mostlyclean-compile mostlyclean-libtool \
\  mostlyclean-aminfo mostlyclean-tags mostlyclean-generic \
@@ -1383,6 +1385,10 @@ eelf32_i860.c: $(srcdir)/emulparams/elf3
 eelf32_i960.c: $(srcdir)/emulparams/elf32_i960.sh \
   $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
 	${GENSCRIPTS} elf32_i960 "$(tdir_elf32_i960)"
+eelf32_ia64_hpux.c: $(srcdir)/emulparams/elf32_ia64_hpux.sh \
+  $(srcdir)/emultempl/elf32.em $(srcdir)/emultempl/needrelax.em \
+  $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+	${GENSCRIPTS} elf32_ia64_hpux "$(tdir_elf32_ia64_hpux)"
 eelf32b4300.c: $(srcdir)/emulparams/elf32b4300.sh \
   $(srcdir)/emulparams/elf32bmip.sh $(srcdir)/emultempl/mipself.em \
   $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
@@ -1523,6 +1529,11 @@ eelf64_ia64_fbsd.c: $(srcdir)/emulparams
   $(srcdir)/emultempl/elf32.em $(srcdir)/emultempl/needrelax.em \
   $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
 	${GENSCRIPTS} elf64_ia64_fbsd "$(tdir_elf64_ia64_fbsd)"
+eelf64_ia64_hpux.c: $(srcdir)/emulparams/elf64_ia64_hpux.sh \
+  $(srcdir)/emulparams/elf64_ia64.sh \
+  $(srcdir)/emultempl/elf32.em $(srcdir)/emultempl/needrelax.em \
+  $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+	${GENSCRIPTS} elf64_ia64_hpux "$(tdir_elf64_ia64_hpux)"
 eelf64_s390.c: $(srcdir)/emulparams/elf64_s390.sh \
   $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
 	${GENSCRIPTS} elf64_s390 "$(tdir_elf64_s390)"
--- binutils/ld/configure.tgt.hpux	2003-09-03 11:05:45.000000000 -0700
+++ binutils/ld/configure.tgt	2003-09-30 12:05:09.000000000 -0700
@@ -109,6 +109,9 @@ i960-intel-nindy)	targ_emul=gld960 ;;
 i960-*-rtems*)		targ_emul=gld960coff ;;
 i960-*-elf*)		targ_emul=elf32_i960 ;;
 ia64-*-elf*)		targ_emul=elf64_ia64 ;;
+ia64-*-hpux*)		targ_emul=elf32_ia64_hpux
+			targ_extra_emuls="elf64_ia64_hpux"
+			targ_extra_libpath="elf64_ia64_hpux" ;;
 ia64-*-freebsd* | ia64-*-kfreebsd*-gnu)
 		        targ_emul=elf64_ia64_fbsd
 			targ_extra_emuls="elf64_ia64" ;;
--- binutils/ld/emulparams/elf32_ia64_hpux.sh.hpux	2003-09-30 12:05:09.000000000 \
                -0700
+++ binutils/ld/emulparams/elf32_ia64_hpux.sh	2003-09-30 12:05:09.000000000 -0700
@@ -0,0 +1,5 @@
+. ${srcdir}/emulparams/elf64_ia64.sh
+ELFSIZE=32
+OUTPUT_FORMAT="elf32-ia64-hpux-big"
+TEXT_START_ADDR="0x10000"
+unset DATA_ADDR
--- binutils/ld/emulparams/elf64_ia64_hpux.sh.hpux	2003-09-30 12:05:09.000000000 \
                -0700
+++ binutils/ld/emulparams/elf64_ia64_hpux.sh	2003-09-30 12:05:09.000000000 -0700
@@ -0,0 +1,17 @@
+. ${srcdir}/emulparams/elf64_ia64.sh
+OUTPUT_FORMAT="elf64-ia64-hpux-big"
+
+if [ "x${host}" = "x${target}" ]; then
+  case " $EMULATION_LIBPATH " in
+    *" ${EMULATION_NAME} "*)
+      NATIVE=yes
+  esac
+fi
+
+case "$target" in
+  ia64-*-hpux*)
+    case "$EMULATION_NAME" in
+      *64*) LIBPATH_SUFFIX=hpux64 ;;
+    esac
+    ;;
+esac


["bfd-ia64-ilp32-abi-2.patch" (text/plain)]

2003-09-29  H.J. Lu  <hongjiu.lu@intel.com>

	* elfxx-ia64.c (ARCH_SIZE): New.
	(LOG_SECTION_ALIGN): Likewise.
	(elfNN_ia64_create_dynamic_sections): Use LOG_SECTION_ALIGN to
	align relocation sections.
	(get_fptr): Likewise.
	(get_reloc_section): Likewise.
	Support ILP32.

--- bfd/elfxx-ia64.c.ilp32-abi	2003-08-20 10:53:28.000000000 -0700
+++ bfd/elfxx-ia64.c	2003-08-21 07:59:15.000000000 -0700
@@ -25,6 +25,16 @@
 #include "opcode/ia64.h"
 #include "elf/ia64.h"
 
+#define ARCH_SIZE	NN
+
+#if ARCH_SIZE == 64
+#define	LOG_SECTION_ALIGN	3
+#endif
+
+#if ARCH_SIZE == 32
+#define	LOG_SECTION_ALIGN	2
+#endif
+
 /* THE RULES for all the stuff the linker creates --
 
   GOT		Entries created in response to LTOFF or LTOFF_FPTR
@@ -1793,7 +1803,7 @@ elfNN_ia64_create_dynamic_sections (abfd
 					   | SEC_IN_MEMORY
 					   | SEC_LINKER_CREATED
 					   | SEC_READONLY))
-      || !bfd_set_section_alignment (abfd, s, 3))
+      || !bfd_set_section_alignment (abfd, s, LOG_SECTION_ALIGN))
     return FALSE;
   ia64_info->rel_pltoff_sec = s;
 
@@ -1804,7 +1814,7 @@ elfNN_ia64_create_dynamic_sections (abfd
 					   | SEC_IN_MEMORY
 					   | SEC_LINKER_CREATED
 					   | SEC_READONLY))
-      || !bfd_set_section_alignment (abfd, s, 3))
+      || !bfd_set_section_alignment (abfd, s, LOG_SECTION_ALIGN))
     return FALSE;
   ia64_info->rel_got_sec = s;
 
@@ -1967,7 +1977,8 @@ get_fptr (abfd, info, ia64_info)
 					  | SEC_IN_MEMORY
 					  | SEC_LINKER_CREATED
 					  | SEC_READONLY))
-	      || !bfd_set_section_alignment (abfd, fptr_rel, 3))
+	      || !bfd_set_section_alignment (abfd, fptr_rel,
+					     LOG_SECTION_ALIGN))
 	    {
 	      BFD_ASSERT (0);
 	      return NULL;
@@ -2057,7 +2068,8 @@ get_reloc_section (abfd, ia64_info, sec,
 				      | SEC_IN_MEMORY
 				      | SEC_LINKER_CREATED
 				      | SEC_READONLY))
-	  || !bfd_set_section_alignment (dynobj, srel, 3))
+	  || !bfd_set_section_alignment (dynobj, srel,
+					 LOG_SECTION_ALIGN))
 	return NULL;
     }
 
@@ -2185,11 +2197,13 @@ elfNN_ia64_check_relocs (abfd, info, sec
 	    info->flags |= DF_STATIC_TLS;
 	  break;
 
+	case R_IA64_DTPREL32MSB:
+	case R_IA64_DTPREL32LSB:
 	case R_IA64_DTPREL64MSB:
 	case R_IA64_DTPREL64LSB:
 	  if (info->shared || maybe_dynamic)
 	    need_entry = NEED_DYNREL;
-	  dynrel_type = R_IA64_DTPREL64LSB;
+	  dynrel_type = R_IA64_DTPRELNNLSB;
 	  break;
 
 	case R_IA64_LTOFF_DTPREL22:
@@ -2225,7 +2239,7 @@ elfNN_ia64_check_relocs (abfd, info, sec
 	    need_entry = NEED_FPTR | NEED_DYNREL;
 	  else
 	    need_entry = NEED_FPTR;
-	  dynrel_type = R_IA64_FPTR64LSB;
+	  dynrel_type = R_IA64_FPTRNNLSB;
 	  break;
 
 	case R_IA64_LTOFF22:
@@ -2275,7 +2289,7 @@ elfNN_ia64_check_relocs (abfd, info, sec
 	  /* Shared objects will always need at least a REL relocation.  */
 	  if (info->shared || maybe_dynamic)
 	    need_entry = NEED_DYNREL;
-	  dynrel_type = R_IA64_DIR64LSB;
+	  dynrel_type = R_IA64_DIRNNLSB;
 	  break;
 
 	case R_IA64_IPLTMSB:
@@ -2294,7 +2308,7 @@ elfNN_ia64_check_relocs (abfd, info, sec
 	case R_IA64_PCREL64LSB:
 	  if (maybe_dynamic)
 	    need_entry = NEED_DYNREL;
-	  dynrel_type = R_IA64_PCREL64LSB;
+	  dynrel_type = R_IA64_PCRELNNLSB;
 	  break;
 	}
 
@@ -2446,7 +2460,7 @@ allocate_global_fptr_got (dyn_i, data)
 
   if (dyn_i->want_got
       && dyn_i->want_fptr
-      && elfNN_ia64_dynamic_symbol_p (dyn_i->h, x->info, R_IA64_FPTR64LSB))
+      && elfNN_ia64_dynamic_symbol_p (dyn_i->h, x->info, R_IA64_FPTRNNLSB))
     {
       dyn_i->got_offset = x->ofs;
       x->ofs += 8;
@@ -2653,6 +2667,7 @@ allocate_dynrel_entries (dyn_i, data)
 
       switch (rent->type)
 	{
+	case R_IA64_FPTR32LSB:
 	case R_IA64_FPTR64LSB:
 	  /* Allocate one iff !want_fptr and not PIE, which by this point
 	     will be true only if we're actually allocating one statically
@@ -2661,10 +2676,12 @@ allocate_dynrel_entries (dyn_i, data)
 	  if (dyn_i->want_fptr && !x->info->pie)
 	    continue;
 	  break;
+	case R_IA64_PCREL32LSB:
 	case R_IA64_PCREL64LSB:
 	  if (!dynamic_symbol)
 	    continue;
 	  break;
+	case R_IA64_DIR32LSB:
 	case R_IA64_DIR64LSB:
 	  if (!dynamic_symbol && !shared)
 	    continue;
@@ -2677,6 +2694,7 @@ allocate_dynrel_entries (dyn_i, data)
 	  if (!dynamic_symbol)
 	    count *= 2;
 	  break;
+	case R_IA64_DTPREL32LSB:
 	case R_IA64_TPREL64LSB:
 	case R_IA64_DTPREL64LSB:
 	case R_IA64_DTPMOD64LSB:
@@ -3302,6 +3320,7 @@ set_got_entry (abfd, info, dyn_i, dynind
 	}
       got_offset = dyn_i->dtpmod_offset;
       break;
+    case R_IA64_DTPREL32LSB:
     case R_IA64_DTPREL64LSB:
       done = dyn_i->dtprel_done;
       dyn_i->dtprel_done = TRUE;
@@ -3326,9 +3345,12 @@ set_got_entry (abfd, info, dyn_i, dynind
 	    && (!dyn_i->h
 		|| ELF_ST_VISIBILITY (dyn_i->h->other) == STV_DEFAULT
 		|| dyn_i->h->root.type != bfd_link_hash_undefweak)
+	    && dyn_r_type != R_IA64_DTPREL32LSB
 	    && dyn_r_type != R_IA64_DTPREL64LSB)
            || elfNN_ia64_dynamic_symbol_p (dyn_i->h, info, dyn_r_type)
-	   || (dynindx != -1 && dyn_r_type == R_IA64_FPTR64LSB))
+	   || (dynindx != -1
+	       && (dyn_r_type == R_IA64_FPTR32LSB
+		   || dyn_r_type == R_IA64_FPTR64LSB)))
 	  && (!dyn_i->want_ltoff_fptr
 	      || !info->pie
 	      || !dyn_i->h
@@ -3337,9 +3359,10 @@ set_got_entry (abfd, info, dyn_i, dynind
 	  if (dynindx == -1
 	      && dyn_r_type != R_IA64_TPREL64LSB
 	      && dyn_r_type != R_IA64_DTPMOD64LSB
+	      && dyn_r_type != R_IA64_DTPREL32LSB
 	      && dyn_r_type != R_IA64_DTPREL64LSB)
 	    {
-	      dyn_r_type = R_IA64_REL64LSB;
+	      dyn_r_type = R_IA64_RELNNLSB;
 	      dynindx = 0;
 	      addend = value;
 	    }
@@ -3348,6 +3371,18 @@ set_got_entry (abfd, info, dyn_i, dynind
 	    {
 	      switch (dyn_r_type)
 		{
+		case R_IA64_REL32LSB:
+		  dyn_r_type = R_IA64_REL32MSB;
+		  break;
+		case R_IA64_DIR32LSB:
+		  dyn_r_type = R_IA64_DIR32MSB;
+		  break;
+		case R_IA64_FPTR32LSB:
+		  dyn_r_type = R_IA64_FPTR32MSB;
+		  break;
+		case R_IA64_DTPREL32LSB:
+		  dyn_r_type = R_IA64_DTPREL32MSB;
+		  break;
 		case R_IA64_REL64LSB:
 		  dyn_r_type = R_IA64_REL64MSB;
 		  break;
@@ -3477,9 +3512,9 @@ set_pltoff_entry (abfd, info, dyn_i, val
 	  unsigned int dyn_r_type;
 
 	  if (bfd_big_endian (abfd))
-	    dyn_r_type = R_IA64_REL64MSB;
+	    dyn_r_type = R_IA64_RELNNMSB;
 	  else
-	    dyn_r_type = R_IA64_REL64LSB;
+	    dyn_r_type = R_IA64_RELNNLSB;
 
 	  elfNN_ia64_install_dyn_reloc (abfd, NULL, pltoff_sec,
 					ia64_info->rel_pltoff_sec,
@@ -3487,7 +3522,7 @@ set_pltoff_entry (abfd, info, dyn_i, val
 					dyn_r_type, 0, value);
 	  elfNN_ia64_install_dyn_reloc (abfd, NULL, pltoff_sec,
 					ia64_info->rel_pltoff_sec,
-					dyn_i->pltoff_offset + 8,
+					dyn_i->pltoff_offset + ARCH_SIZE / 8,
 					dyn_r_type, 0, gp);
 	}
 
@@ -3974,7 +4009,7 @@ elfNN_ia64_relocate_section (output_bfd,
 	case R_IA64_LTOFF64I:
           dyn_i = get_dyn_sym_info (ia64_info, h, input_bfd, rel, FALSE);
 	  value = set_got_entry (input_bfd, info, dyn_i, (h ? h->dynindx : -1),
-				 rel->r_addend, value, R_IA64_DIR64LSB);
+				 rel->r_addend, value, R_IA64_DIRNNLSB);
 	  value -= gp_val;
 	  r = elfNN_ia64_install_value (output_bfd, hit_addr, value, r_type);
 	  break;
@@ -4027,7 +4062,7 @@ elfNN_ia64_relocate_section (output_bfd,
 		    }
 		  dynindx = 0;
 		  addend = value;
-		  dyn_r_type = r_type + R_IA64_REL64LSB - R_IA64_FPTR64LSB;
+		  dyn_r_type = r_type + R_IA64_RELNNLSB - R_IA64_FPTRNNLSB;
 		}
 	      else if (h)
 		{
@@ -4091,7 +4126,7 @@ elfNN_ia64_relocate_section (output_bfd,
 	      }
 
 	    value = set_got_entry (output_bfd, info, dyn_i, dynindx,
-				   rel->r_addend, value, R_IA64_FPTR64LSB);
+				   rel->r_addend, value, R_IA64_FPTRNNLSB);
 	    value -= gp_val;
 	    r = elfNN_ia64_install_value (output_bfd, hit_addr, value, r_type);
 	  }
@@ -4327,7 +4363,7 @@ elfNN_ia64_relocate_section (output_bfd,
 	      case R_IA64_LTOFF_DTPREL22:
 		if (!dynamic_symbol_p)
 		  value -= elfNN_ia64_dtprel_base (info);
-		got_r_type = R_IA64_DTPREL64LSB;
+		got_r_type = R_IA64_DTPRELNNLSB;
 		break;
 	      }
 	    dyn_i = get_dyn_sym_info (ia64_info, h, input_bfd, rel, FALSE);

["bfd-ia64-ilp32-tls-2.patch" (text/plain)]

2003-09-10  H.J. Lu  <hongjiu.lu@intel.com>

	* elfxx-ia64.c (elfNN_ia64_tprel_base): Support ILP32.
	(elfNN_ia64_relocate_section): Handle R_IA64_DTPREL32LSB and
	R_IA64_DTPREL32MSB.

--- bfd/elfxx-ia64.c.ilp32-tls	2003-09-10 13:45:23.000000000 -0700
+++ bfd/elfxx-ia64.c	2003-09-10 16:41:15.000000000 -0700
@@ -3542,7 +3542,7 @@ set_pltoff_entry (abfd, info, dyn_i, val
 /* Return the base VMA address which should be subtracted from real addresses
    when resolving @tprel() relocation.
    Main program TLS (whose template starts at PT_TLS p_vaddr)
-   is assigned offset round(16, PT_TLS p_align).  */
+   is assigned offset round(2 * size of pointer, PT_TLS p_align).  */
 
 static bfd_vma
 elfNN_ia64_tprel_base (info)
@@ -3553,7 +3553,7 @@ elfNN_ia64_tprel_base (info)
 
   BFD_ASSERT (tls_segment != NULL);
   return (tls_segment->start
-	  - align_power ((bfd_vma) 16, tls_segment->align));
+	  - align_power ((bfd_vma) ARCH_SIZE / 4, tls_segment->align));
 }
 
 /* Return the base VMA address which should be subtracted from real addresses
@@ -4327,6 +4327,8 @@ elfNN_ia64_relocate_section (output_bfd,
 	case R_IA64_DTPREL14:
 	case R_IA64_DTPREL22:
 	case R_IA64_DTPREL64I:
+	case R_IA64_DTPREL32LSB:
+	case R_IA64_DTPREL32MSB:
 	case R_IA64_DTPREL64LSB:
 	case R_IA64_DTPREL64MSB:
 	  value -= elfNN_ia64_dtprel_base (info);


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic