CVS commit: src/libexec/ld.elf_so/arch/hppa

2020-05-16 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat May 16 16:43:00 UTC 2020

Modified Files:
src/libexec/ld.elf_so/arch/hppa: hppa_reloc.c

Log Message:
Avoid compiler warnings about uninitialised symnum


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c
diff -u src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c:1.46 src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c:1.47
--- src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c:1.46	Sun May 10 06:42:38 2020
+++ src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c	Sat May 16 16:43:00 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: hppa_reloc.c,v 1.46 2020/05/10 06:42:38 skrll Exp $	*/
+/*	$NetBSD: hppa_reloc.c,v 1.47 2020/05/16 16:43:00 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2004 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: hppa_reloc.c,v 1.46 2020/05/10 06:42:38 skrll Exp $");
+__RCSID("$NetBSD: hppa_reloc.c,v 1.47 2020/05/16 16:43:00 skrll Exp $");
 #endif /* not lint */
 
 #include 
@@ -420,12 +420,12 @@ _rtld_relocate_nonplt_objects(Obj_Entry 
 	for (rela = obj->rela; rela < obj->relalim; rela++) {
 		Elf_Addr*where;
 		Elf_Addr tmp;
-		unsigned long	 symnum;
 
 		where = (Elf_Addr *)(obj->relocbase + rela->r_offset);
 
+		unsigned long symnum = ELF_R_SYM(rela->r_info);
 		/* First, handle DIR32 and PLABEL32 without symbol. */
-		if (ELF_R_SYM(rela->r_info) == 0) {
+		if (symnum == 0) {
 			switch (ELF_R_TYPE(rela->r_info)) {
 			default:
 break;
@@ -474,7 +474,6 @@ _rtld_relocate_nonplt_objects(Obj_Entry 
 		case R_TYPE(TLS_TPREL32):
 		case R_TYPE(TLS_DTPMOD32):
 		case R_TYPE(TLS_DTPOFF32):
-			symnum = ELF_R_SYM(rela->r_info);
 			if (last_symnum != symnum) {
 last_symnum = symnum;
 if (ELF_R_TYPE(rela->r_info) == R_TYPE(DIR32)) {



CVS commit: src/libexec/ld.elf_so/arch/hppa

2020-05-10 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun May 10 06:42:38 UTC 2020

Modified Files:
src/libexec/ld.elf_so/arch/hppa: hppa_reloc.c rtld_start.S

Log Message:
Trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c
cvs rdiff -u -r1.12 -r1.13 src/libexec/ld.elf_so/arch/hppa/rtld_start.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c
diff -u src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c:1.45 src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c:1.46
--- src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c:1.45	Thu Aug 10 19:03:26 2017
+++ src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c	Sun May 10 06:42:38 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: hppa_reloc.c,v 1.45 2017/08/10 19:03:26 joerg Exp $	*/
+/*	$NetBSD: hppa_reloc.c,v 1.46 2020/05/10 06:42:38 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2004 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: hppa_reloc.c,v 1.45 2017/08/10 19:03:26 joerg Exp $");
+__RCSID("$NetBSD: hppa_reloc.c,v 1.46 2020/05/10 06:42:38 skrll Exp $");
 #endif /* not lint */
 
 #include 
@@ -89,10 +89,10 @@ fdc(void *addr)
 }
 
 static __inline void
-fic(void *addr) 
-{   
+fic(void *addr)
+{
 	__asm volatile("fic %%r0(%%sr0,%0)" : : "r" (addr));
-} 
+}
 
 static __inline void
 sync(void)
@@ -128,7 +128,7 @@ typedef struct _hppa_plabel {
 } hppa_plabel;
 
 /*
- * For now allocated PLABEL structures are tracked on a 
+ * For now allocated PLABEL structures are tracked on a
  * singly linked list.  This maybe should be revisited.
  */
 static SLIST_HEAD(hppa_plabel_head, _hppa_plabel) hppa_plabel_list
@@ -151,13 +151,13 @@ static inline int _rtld_relocate_plt_obj
  * This bootstraps the dynamic linker by relocating its GOT.
  * On the hppa, unlike on other architectures, static strings
  * are found through the GOT.  Static strings are essential
- * for RTLD_DEBUG, and I suspect they're used early even when 
+ * for RTLD_DEBUG, and I suspect they're used early even when
  * !defined(RTLD_DEBUG), making relocating the GOT essential.
  *
  * It gets worse.  Relocating the GOT doesn't mean just walking
  * it and adding the relocbase to all of the entries.  You must
- * find and use the GOT relocations, since those RELA relocations 
- * have the necessary addends - the GOT comes initialized as 
+ * find and use the GOT relocations, since those RELA relocations
+ * have the necessary addends - the GOT comes initialized as
  * zeroes.
  */
 void
@@ -176,7 +176,7 @@ _rtld_relocate_nonplt_self(Elf_Dyn *dynp
 
 	/*
 	 * Process the DYNAMIC section, looking for the non-PLT relocations.
-	 */ 
+	 */
 	relafirst = NULL;
 	relasz = 0;
 	symtab = NULL;
@@ -213,11 +213,11 @@ _rtld_relocate_nonplt_self(Elf_Dyn *dynp
 		switch (ELF_R_TYPE(rela->r_info)) {
 		case R_TYPE(DIR32):
 			if (symnum == 0)
-store_ptr(where, 
+store_ptr(where,
 relocbase + rela->r_addend);
 			else {
 sym = symtab + symnum;
-store_ptr(where, 
+store_ptr(where,
 relocbase + rela->r_addend + sym->st_value);
 			}
 			break;
@@ -235,7 +235,7 @@ _rtld_relocate_nonplt_self(Elf_Dyn *dynp
 			 * relocations have been done.
 			 */
 			if (symnum == 0)
-*((Elf_Addr *)where) = 
+*((Elf_Addr *)where) =
 relocbase + rela->r_addend;
 			else
 plabel_relocs[nplabel_relocs++] = rela;
@@ -251,7 +251,7 @@ _rtld_relocate_nonplt_self(Elf_Dyn *dynp
 		rela = plabel_relocs[i];
 		where = (void *)(relocbase + rela->r_offset);
 		sym = symtab + ELF_R_SYM(rela->r_info);
-		
+
 		plabel = _plabel_pre[hppa_plabel_pre_next++];
 
 		plabel->hppa_plabel_pc = (Elf_Addr)
@@ -261,7 +261,7 @@ _rtld_relocate_nonplt_self(Elf_Dyn *dynp
 		SLIST_INSERT_HEAD(_plabel_list, plabel, hppa_plabel_next);
 		*((Elf_Addr *)where) = (Elf_Addr)(RTLD_MAKE_PLABEL(plabel));
 	}
-	
+
 #if defined(RTLD_DEBUG_HPPA)
 	for (rela = relafirst; rela < relalim; rela++) {
 		where = (void *)(relocbase + rela->r_offset);
@@ -304,9 +304,9 @@ _rtld_relocate_nonplt_self(Elf_Dyn *dynp
 }
 
 /*
- * This allocates a PLABEL.  If called with a non-NULL def, the 
+ * This allocates a PLABEL.  If called with a non-NULL def, the
  * plabel is for the function associated with that definition
- * in the defining object defobj, plus the given addend.  If 
+ * in the defining object defobj, plus the given addend.  If
  * called with a NULL def, the plabel is for the function at
  * the (unrelocated) address in addend in the object defobj.
  */
@@ -318,7 +318,7 @@ _rtld_function_descriptor_alloc(const Ob
 	hppa_plabel	*plabel;
 
 	if (def != NULL) {
-	
+
 		/*
 		 * We assume that symbols of type STT_NOTYPE
 		 * are undefined.  Return NULL for these.
@@ -329,7 +329,7 @@ _rtld_function_descriptor_alloc(const Ob
 		/* Otherwise assert that this symbol must be a function. */
 		

CVS commit: src/libexec/ld.elf_so/arch/hppa

2011-12-04 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Dec  4 16:53:08 UTC 2011

Modified Files:
src/libexec/ld.elf_so/arch/hppa: hppa_reloc.c

Log Message:
Use the tlsoffset from the correct object.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c
diff -u src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c:1.40 src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c:1.41
--- src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c:1.40	Sun Sep 25 13:34:54 2011
+++ src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c	Sun Dec  4 16:53:08 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: hppa_reloc.c,v 1.40 2011/09/25 13:34:54 chs Exp $	*/
+/*	$NetBSD: hppa_reloc.c,v 1.41 2011/12/04 16:53:08 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2004 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: hppa_reloc.c,v 1.40 2011/09/25 13:34:54 chs Exp $);
+__RCSID($NetBSD: hppa_reloc.c,v 1.41 2011/12/04 16:53:08 skrll Exp $);
 #endif /* not lint */
 
 #include stdlib.h
@@ -481,7 +481,7 @@ _rtld_relocate_nonplt_objects(Obj_Entry 
 			if (!defobj-tls_done  _rtld_tls_offset_allocate(obj))
 return -1;
 
-			*where = (Elf_Addr)(obj-tlsoffset + def-st_value +
+			*where = (Elf_Addr)(defobj-tlsoffset + def-st_value +
 			rela-r_addend + sizeof(struct tls_tcb));
 
 			rdbg((TPREL32 %s in %s -- %p in %s,



CVS commit: src/libexec/ld.elf_so/arch/hppa

2011-09-29 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Sep 30 03:05:43 UTC 2011

Modified Files:
src/libexec/ld.elf_so/arch/hppa: rtld_start.S

Log Message:
match EXIT() with LEAF_ENTRY() so that sizes are actually constants.
fixes binutils 2.21 build issues reported by he and chuq.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/libexec/ld.elf_so/arch/hppa/rtld_start.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/libexec/ld.elf_so/arch/hppa/rtld_start.S
diff -u src/libexec/ld.elf_so/arch/hppa/rtld_start.S:1.10 src/libexec/ld.elf_so/arch/hppa/rtld_start.S:1.11
--- src/libexec/ld.elf_so/arch/hppa/rtld_start.S:1.10	Thu Mar 10 12:53:42 2011
+++ src/libexec/ld.elf_so/arch/hppa/rtld_start.S	Fri Sep 30 03:05:43 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtld_start.S,v 1.10 2011/03/10 12:53:42 skrll Exp $	*/
+/*	$NetBSD: rtld_start.S,v 1.11 2011/09/30 03:05:43 mrg Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -139,7 +139,7 @@ L$lpc2:	addil	L'_rtld_bind_start - ($PIC
 	stw	%arg0, -8(%arg1)
 	bv	%r0(%rp)
 	stw	%r19, -4(%arg1)
-EXIT(__rtld_hppa_setup_pltgot)
+EXIT(__rtld_setup_hppa_pltgot)
 
 /*
  * In order to support lazy binding, this implementation of _rtld_bind_start is



CVS commit: src/libexec/ld.elf_so/arch/hppa

2011-09-25 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Sun Sep 25 13:34:54 UTC 2011

Modified Files:
src/libexec/ld.elf_so/arch/hppa: hppa_reloc.c

Log Message:
gcc 4.5 generates an extra plabel in ld.elf_so,
so expand the array of preallocated ones.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c
diff -u src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c:1.39 src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c:1.40
--- src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c:1.39	Fri Mar 25 18:07:05 2011
+++ src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c	Sun Sep 25 13:34:54 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: hppa_reloc.c,v 1.39 2011/03/25 18:07:05 joerg Exp $	*/
+/*	$NetBSD: hppa_reloc.c,v 1.40 2011/09/25 13:34:54 chs Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2004 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: hppa_reloc.c,v 1.39 2011/03/25 18:07:05 joerg Exp $);
+__RCSID($NetBSD: hppa_reloc.c,v 1.40 2011/09/25 13:34:54 chs Exp $);
 #endif /* not lint */
 
 #include stdlib.h
@@ -114,7 +114,7 @@ static SLIST_HEAD(hppa_plabel_head, _hpp
  * Because I'm hesitant to use NEW while relocating self,
  * this is a small pool of preallocated PLABELs.
  */
-#define	HPPA_PLABEL_PRE	(18)
+#define	HPPA_PLABEL_PRE	(32)
 static hppa_plabel hppa_plabel_pre[HPPA_PLABEL_PRE];
 static int hppa_plabel_pre_next = 0;
 



CVS commit: src/libexec/ld.elf_so/arch/hppa

2011-03-17 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Mar 17 22:07:52 UTC 2011

Modified Files:
src/libexec/ld.elf_so/arch/hppa: hppa_reloc.c

Log Message:
Another TLS reloc. Thanks to joerg for a hint.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c
diff -u src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c:1.37 src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c:1.38
--- src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c:1.37	Mon Mar 14 08:49:29 2011
+++ src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c	Thu Mar 17 22:07:52 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: hppa_reloc.c,v 1.37 2011/03/14 08:49:29 skrll Exp $	*/
+/*	$NetBSD: hppa_reloc.c,v 1.38 2011/03/17 22:07:52 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2004 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: hppa_reloc.c,v 1.37 2011/03/14 08:49:29 skrll Exp $);
+__RCSID($NetBSD: hppa_reloc.c,v 1.38 2011/03/17 22:07:52 skrll Exp $);
 #endif /* not lint */
 
 #include stdlib.h
@@ -473,6 +473,22 @@
 			rdbg((COPY (avoid in main)));
 			break;
 
+		case R_TYPE(TLS_TPREL32):
+			def = _rtld_find_symdef(symnum, obj, defobj, false);
+			if (def == NULL)
+return -1;
+
+			if (!defobj-tls_done  _rtld_tls_offset_allocate(obj))
+return -1;
+
+			*where = (Elf_Addr)(obj-tlsoffset + def-st_value +
+			rela-r_addend + sizeof(struct tls_tcb));
+
+			rdbg((TPREL32 %s in %s -- %p in %s,
+			obj-strtab + obj-symtab[symnum].st_name,
+			obj-path, (void *)*where, defobj-path));
+			break;
+
 		case R_TYPE(TLS_DTPMOD32):
 			def = _rtld_find_symdef(symnum, obj, defobj, false);
 			if (def == NULL)



CVS commit: src/libexec/ld.elf_so/arch/hppa

2011-03-14 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Mar 14 08:20:15 UTC 2011

Added Files:
src/libexec/ld.elf_so/arch/hppa: mdtls.c

Log Message:
First cut at mdtls.c for hppa.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/libexec/ld.elf_so/arch/hppa/mdtls.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Added files:

Index: src/libexec/ld.elf_so/arch/hppa/mdtls.c
diff -u /dev/null src/libexec/ld.elf_so/arch/hppa/mdtls.c:1.1
--- /dev/null	Mon Mar 14 08:20:15 2011
+++ src/libexec/ld.elf_so/arch/hppa/mdtls.c	Mon Mar 14 08:20:15 2011
@@ -0,0 +1,18 @@
+#include sys/cdefs.h
+
+__RCSID($NetBSD: mdtls.c,v 1.1 2011/03/14 08:20:15 skrll Exp $);
+
+#include sys/tls.h
+#include rtld.h
+
+__dso_public void *__tls_get_addr(int[2]);
+
+void *
+__tls_get_addr(int idx[2])
+{
+	void *p;
+
+__asm volatile(mfctl\t27 /* CR_TLS */, %0 : =r (p));
+
+	return _rtld_tls_get_addr(p, idx[0], idx[1]);
+}



CVS commit: src/libexec/ld.elf_so/arch/hppa

2011-03-14 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Mar 14 08:21:54 UTC 2011

Modified Files:
src/libexec/ld.elf_so/arch/hppa: hppa_reloc.c

Log Message:
Handle some TLS relocs.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c
diff -u src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c:1.35 src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c:1.36
--- src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c:1.35	Thu Mar 10 12:53:42 2011
+++ src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c	Mon Mar 14 08:21:54 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: hppa_reloc.c,v 1.35 2011/03/10 12:53:42 skrll Exp $	*/
+/*	$NetBSD: hppa_reloc.c,v 1.36 2011/03/14 08:21:54 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2004 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: hppa_reloc.c,v 1.35 2011/03/10 12:53:42 skrll Exp $);
+__RCSID($NetBSD: hppa_reloc.c,v 1.36 2011/03/14 08:21:54 skrll Exp $);
 #endif /* not lint */
 
 #include stdlib.h
@@ -473,6 +473,32 @@
 			rdbg((COPY (avoid in main)));
 			break;
 
+		case R_TYPE(TLS_DTPMOD32):
+			def = _rtld_find_symdef(symnum, obj, defobj, false);
+			if (def == NULL)
+return -1;
+
+			*where = (Elf_Addr)(defobj-tlsindex);
+
+			rdbg((TLS_DTPMOD32 %s in %s -- %p,
+			obj-strtab + obj-symtab[symnum].st_name,
+			obj-path, (void *)*where));
+
+			break;
+
+		case R_TYPE(TLS_DTPOFF32):
+			def = _rtld_find_symdef(symnum, obj, defobj, false);
+			if (def == NULL)
+return -1;
+
+			*where = (Elf_Addr)(def-st_value);
+
+			rdbg((TLS_DTPOFF32 %s in %s -- %p,
+			obj-strtab + obj-symtab[symnum].st_name,
+			obj-path, (void *)*where));
+
+			break;
+
 		default:
 			rdbg((sym = %lu, type = %lu, offset = %p, 
 			addend = %p, contents = %p, symbol = %s,



CVS commit: src/libexec/ld.elf_so/arch/hppa

2011-03-14 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Mar 14 08:49:29 UTC 2011

Modified Files:
src/libexec/ld.elf_so/arch/hppa: hppa_reloc.c

Log Message:
More PLABELS are required due to TLS stuff.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c
diff -u src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c:1.36 src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c:1.37
--- src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c:1.36	Mon Mar 14 08:21:54 2011
+++ src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c	Mon Mar 14 08:49:29 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: hppa_reloc.c,v 1.36 2011/03/14 08:21:54 skrll Exp $	*/
+/*	$NetBSD: hppa_reloc.c,v 1.37 2011/03/14 08:49:29 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2004 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: hppa_reloc.c,v 1.36 2011/03/14 08:21:54 skrll Exp $);
+__RCSID($NetBSD: hppa_reloc.c,v 1.37 2011/03/14 08:49:29 skrll Exp $);
 #endif /* not lint */
 
 #include stdlib.h
@@ -114,7 +114,7 @@
  * Because I'm hesitant to use NEW while relocating self,
  * this is a small pool of preallocated PLABELs.
  */
-#define	HPPA_PLABEL_PRE	(14)
+#define	HPPA_PLABEL_PRE	(18)
 static hppa_plabel hppa_plabel_pre[HPPA_PLABEL_PRE];
 static int hppa_plabel_pre_next = 0;
 



CVS commit: src/libexec/ld.elf_so/arch/hppa

2011-03-10 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Mar 10 12:53:42 UTC 2011

Modified Files:
src/libexec/ld.elf_so/arch/hppa: hppa_reloc.c rtld_start.S

Log Message:
Whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c
cvs rdiff -u -r1.9 -r1.10 src/libexec/ld.elf_so/arch/hppa/rtld_start.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c
diff -u src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c:1.34 src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c:1.35
--- src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c:1.34	Fri Sep 24 11:41:46 2010
+++ src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c	Thu Mar 10 12:53:42 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: hppa_reloc.c,v 1.34 2010/09/24 11:41:46 skrll Exp $	*/
+/*	$NetBSD: hppa_reloc.c,v 1.35 2011/03/10 12:53:42 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2004 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: hppa_reloc.c,v 1.34 2010/09/24 11:41:46 skrll Exp $);
+__RCSID($NetBSD: hppa_reloc.c,v 1.35 2011/03/10 12:53:42 skrll Exp $);
 #endif /* not lint */
 
 #include stdlib.h
@@ -177,7 +177,7 @@
 		case DT_PLTGOT:
 			pltgot = (Elf_Addr *)
 			(relocbase + dynp-d_un.d_ptr);
-break;
+			break;
 		}
 	}
 	relalim = (const Elf_Rela *)((const char *)relafirst + relasz);
@@ -230,11 +230,11 @@
 		
 		plabel = hppa_plabel_pre[hppa_plabel_pre_next++];
 
-	plabel-hppa_plabel_pc = (Elf_Addr)
+		plabel-hppa_plabel_pc = (Elf_Addr)
 		(relocbase + sym-st_value + rela-r_addend);
-	plabel-hppa_plabel_sl = (Elf_Addr)pltgot;
+		plabel-hppa_plabel_sl = (Elf_Addr)pltgot;
 
-	SLIST_INSERT_HEAD(hppa_plabel_list, plabel, hppa_plabel_next);
+		SLIST_INSERT_HEAD(hppa_plabel_list, plabel, hppa_plabel_next);
 		*((Elf_Addr *)where) = (Elf_Addr)(RTLD_MAKE_PLABEL(plabel));
 	}
 	

Index: src/libexec/ld.elf_so/arch/hppa/rtld_start.S
diff -u src/libexec/ld.elf_so/arch/hppa/rtld_start.S:1.9 src/libexec/ld.elf_so/arch/hppa/rtld_start.S:1.10
--- src/libexec/ld.elf_so/arch/hppa/rtld_start.S:1.9	Thu Sep 30 19:32:40 2010
+++ src/libexec/ld.elf_so/arch/hppa/rtld_start.S	Thu Mar 10 12:53:42 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtld_start.S,v 1.9 2010/09/30 19:32:40 skrll Exp $	*/
+/*	$NetBSD: rtld_start.S,v 1.10 2011/03/10 12:53:42 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -46,7 +46,7 @@
 	 * twice later: once to call _rtld, and again to transfer to the
 	 * program's entry point.
 	 */
-stw %arg0, HPPA_FRAME_ARG(0)(%r3)
+	stw %arg0, HPPA_FRAME_ARG(0)(%r3)
 
 	/*
 	 * We can't move to C until we relocate at least the 



CVS commit: src/libexec/ld.elf_so/arch/hppa

2010-09-30 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Sep 30 19:32:41 UTC 2010

Modified Files:
src/libexec/ld.elf_so/arch/hppa: rtld_start.S

Log Message:
Add the magic branch instruction that is used by GCC's
__canonicalize_funcptr_for_compare() function to fixup relocations in
order to do function pointer comparisons.

From OpenBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/libexec/ld.elf_so/arch/hppa/rtld_start.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/libexec/ld.elf_so/arch/hppa/rtld_start.S
diff -u src/libexec/ld.elf_so/arch/hppa/rtld_start.S:1.8 src/libexec/ld.elf_so/arch/hppa/rtld_start.S:1.9
--- src/libexec/ld.elf_so/arch/hppa/rtld_start.S:1.8	Fri Sep 24 11:41:46 2010
+++ src/libexec/ld.elf_so/arch/hppa/rtld_start.S	Thu Sep 30 19:32:40 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtld_start.S,v 1.8 2010/09/24 11:41:46 skrll Exp $	*/
+/*	$NetBSD: rtld_start.S,v 1.9 2010/09/30 19:32:40 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -146,6 +146,15 @@
  * very closely tied to the shared-library call stub and the PLT stub, both
  * inserted by the linker.
  */
+
+/*
+ * This is a magic branch instruction that is used by GCC's
+ * __canonicalize_funcptr_for_compare() function to fixup relocations
+ * in order to do function pointer comparisons.
+ */
+
+	bl	_rtld_bind, %rp
+
 ENTRY(_rtld_bind_start,HPPA_FRAME_SIZE)
 
 	/* Start stack calling convention.  */



CVS commit: src/libexec/ld.elf_so/arch/hppa

2010-09-24 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Sep 24 11:41:46 UTC 2010

Modified Files:
src/libexec/ld.elf_so/arch/hppa: hppa_reloc.c rtld_start.S

Log Message:
Wrap long lines

Reformat comments.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c
cvs rdiff -u -r1.7 -r1.8 src/libexec/ld.elf_so/arch/hppa/rtld_start.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c
diff -u src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c:1.33 src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c:1.34
--- src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c:1.33	Fri Aug  6 16:33:17 2010
+++ src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c	Fri Sep 24 11:41:46 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: hppa_reloc.c,v 1.33 2010/08/06 16:33:17 joerg Exp $	*/
+/*	$NetBSD: hppa_reloc.c,v 1.34 2010/09/24 11:41:46 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2004 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: hppa_reloc.c,v 1.33 2010/08/06 16:33:17 joerg Exp $);
+__RCSID($NetBSD: hppa_reloc.c,v 1.34 2010/09/24 11:41:46 skrll Exp $);
 #endif /* not lint */
 
 #include stdlib.h
@@ -83,12 +83,10 @@
 }
 
 /*
- * In the runtime architecture (ABI), PLABEL function 
- * pointers are distinguished from normal function 
- * pointers by having the next-least-significant bit
- * set.  (This bit is referred to as the L field in
- * HP documentation).  The $$dyncall millicode is
- * aware of this.
+ * In the runtime architecture (ABI), PLABEL function pointers are
+ * distinguished from normal function pointers by having the next-least-
+ * significant bit set.  (This bit is referred to as the L field in HP
+ * documentation).  The $$dyncall millicode is aware of this.
  */
 #define	RTLD_MAKE_PLABEL(plabel)	(((Elf_Addr)(plabel)) | (1  1))
 #define RTLD_IS_PLABEL(addr)		(((Elf_Addr)(addr))  (1  1))
@@ -401,7 +399,8 @@
 	store_ptr(where, tmp);
 rdbg((DIR32 %s in %s -- %p in %s,
 obj-strtab + obj-symtab[symnum].st_name,
-obj-path, (void *)load_ptr(where), defobj-path));
+obj-path, (void *)load_ptr(where),
+defobj-path));
 			} else {
 tmp = (Elf_Addr)(obj-relocbase +
 rela-r_addend);
@@ -542,7 +541,8 @@
 }
 
 static inline int
-_rtld_relocate_plt_object(const Obj_Entry *obj, const Elf_Rela *rela, Elf_Addr *tp)
+_rtld_relocate_plt_object(const Obj_Entry *obj, const Elf_Rela *rela,
+Elf_Addr *tp)
 {
 	Elf_Word *where = (Elf_Word *)(obj-relocbase + rela-r_offset);
 	const Elf_Sym *def;
@@ -563,7 +563,8 @@
 		if (__predict_false(def == _rtld_sym_zero))
 			return 0;
 
-		func_pc = (Elf_Addr)(defobj-relocbase + def-st_value + rela-r_addend);
+		func_pc = (Elf_Addr)(defobj-relocbase + def-st_value +
+		rela-r_addend);
 		func_sl = (Elf_Addr)(defobj-pltgot);
 
 		rdbg((bind now/fixup in %s -- old=(%p,%p) new=(%p,%p),

Index: src/libexec/ld.elf_so/arch/hppa/rtld_start.S
diff -u src/libexec/ld.elf_so/arch/hppa/rtld_start.S:1.7 src/libexec/ld.elf_so/arch/hppa/rtld_start.S:1.8
--- src/libexec/ld.elf_so/arch/hppa/rtld_start.S:1.7	Sat Jan  9 15:36:43 2010
+++ src/libexec/ld.elf_so/arch/hppa/rtld_start.S	Fri Sep 24 11:41:46 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtld_start.S,v 1.7 2010/01/09 15:36:43 skrll Exp $	*/
+/*	$NetBSD: rtld_start.S,v 1.8 2010/09/24 11:41:46 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -42,9 +42,9 @@
 	stw,ma	%r1, HPPA_FRAME_SIZE(%sp)
  
 	/*
-	 * Save our single argument, the ps_strings pointer.
-	 * We'll need this twice later: once to call _rtld,
-	 * and again to transfer to the program's entry point.
+	 * Save our single argument, the ps_strings pointer. We'll need this
+	 * twice later: once to call _rtld, and again to transfer to the
+	 * program's entry point.
 	 */
 stw %arg0, HPPA_FRAME_ARG(0)(%r3)
 
@@ -61,19 +61,17 @@
 	ldo	R'_DYNAMIC - ($PIC_pcrel$0 - 12)(%r1),%arg0
 
 	/*
-	 * Load the absolute address of the beginning of the
-	 * GOT into %r19, the shared library linkage table
-	 * register, leaving it ready-to-use by the dynamic
-	 * linker C code.
+	 * Load the absolute address of the beginning of the GOT into %r19, the
+	 * shared library linkage table register, leaving it ready-to-use by
+	 * the dynamic linker C code.
 	 */
 	addil	L'_GLOBAL_OFFSET_TABLE_ - ($PIC_pcrel$0 - 16), %r19
 	ldo	R'_GLOBAL_OFFSET_TABLE_ - ($PIC_pcrel$0 - 20)(%r1),%r19
 
 	/*
-	 * The linker sets the first entry in the GOT to the 
-	 * unrelocated address of _DYNAMIC.  Subtract this
-	 * from the absolute address of _DYNAMIC to get our
-	 * relocbase.
+	 * The linker sets the first entry in the GOT to the unrelocated
+	 *  address of _DYNAMIC.  Subtract this from the absolute address of
+	 * _DYNAMIC to get our relocbase.
 	 */
 	ldw	0(%r19), %arg1
 	sub	%arg0, %arg1, %arg1	; %arg1 = relocbase
@@ -87,12 +85,11 @@
 

CVS commit: src/libexec/ld.elf_so/arch/hppa

2010-01-09 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Jan  9 15:36:44 UTC 2010

Modified Files:
src/libexec/ld.elf_so/arch/hppa: rtld_start.S

Log Message:
Small tidyup.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/libexec/ld.elf_so/arch/hppa/rtld_start.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/libexec/ld.elf_so/arch/hppa/rtld_start.S
diff -u src/libexec/ld.elf_so/arch/hppa/rtld_start.S:1.6 src/libexec/ld.elf_so/arch/hppa/rtld_start.S:1.7
--- src/libexec/ld.elf_so/arch/hppa/rtld_start.S:1.6	Mon Apr 28 20:23:03 2008
+++ src/libexec/ld.elf_so/arch/hppa/rtld_start.S	Sat Jan  9 15:36:43 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtld_start.S,v 1.6 2008/04/28 20:23:03 martin Exp $	*/
+/*	$NetBSD: rtld_start.S,v 1.7 2010/01/09 15:36:43 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -30,9 +30,7 @@
  */
 
 #include machine/asm.h
-#define _LOCORE /* XXX fredette we MUST get rid of this */
 #include machine/frame.h
-#undef _LOCORE
 
 	.import _GLOBAL_OFFSET_TABLE_
 



CVS commit: src/libexec/ld.elf_so/arch/hppa

2009-09-25 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Sep 25 17:49:56 UTC 2009

Modified Files:
src/libexec/ld.elf_so/arch/hppa: hppa_reloc.c

Log Message:
ld.elf_so grew more PLABELS with dlinfo so bump HPPA_PLABEL_PRE.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c
diff -u src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c:1.29 src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c:1.30
--- src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c:1.29	Sat Aug 29 13:46:54 2009
+++ src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c	Fri Sep 25 17:49:56 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: hppa_reloc.c,v 1.29 2009/08/29 13:46:54 jmmv Exp $	*/
+/*	$NetBSD: hppa_reloc.c,v 1.30 2009/09/25 17:49:56 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2004 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: hppa_reloc.c,v 1.29 2009/08/29 13:46:54 jmmv Exp $);
+__RCSID($NetBSD: hppa_reloc.c,v 1.30 2009/09/25 17:49:56 skrll Exp $);
 #endif /* not lint */
 
 #include stdlib.h
@@ -117,7 +117,7 @@
  * Because I'm hesitant to use NEW while relocating self,
  * this is a small pool of preallocated PLABELs.
  */
-#define	HPPA_PLABEL_PRE	(12)
+#define	HPPA_PLABEL_PRE	(14)
 static hppa_plabel hppa_plabel_pre[HPPA_PLABEL_PRE];
 static int hppa_plabel_pre_next = 0;
 



CVS commit: src/libexec/ld.elf_so/arch/hppa

2009-09-12 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Sep 12 07:22:16 UTC 2009

Modified Files:
src/libexec/ld.elf_so/arch/hppa: Makefile.inc

Log Message:
Fix the start symbol.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/libexec/ld.elf_so/arch/hppa/Makefile.inc

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/libexec/ld.elf_so/arch/hppa/Makefile.inc
diff -u src/libexec/ld.elf_so/arch/hppa/Makefile.inc:1.7 src/libexec/ld.elf_so/arch/hppa/Makefile.inc:1.8
--- src/libexec/ld.elf_so/arch/hppa/Makefile.inc:1.7	Sat Jun  4 16:17:17 2005
+++ src/libexec/ld.elf_so/arch/hppa/Makefile.inc	Sat Sep 12 07:22:16 2009
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.7 2005/06/04 16:17:17 lukem Exp $
+#	$NetBSD: Makefile.inc,v 1.8 2009/09/12 07:22:16 skrll Exp $
 
 SRCS+=		rtld_start.S hppa_reloc.c
 
@@ -11,4 +11,4 @@
 #CPPFLAGS+=	-DRTLD_DEBUG_RELOC
 #CPPFLAGS+=	-DRTLD_DEBUG_HPPA
 
-LDFLAGS+=	-Wl,-e,'rtld_start'
+LDFLAGS+=	-Wl,-e,'$$rtld_start'