Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/libexec/ld.elf_so Introduce a new flag, `isdynamic', which i...
details: https://anonhg.NetBSD.org/src/rev/973cc5307f3c
branches: trunk
changeset: 536077:973cc5307f3c
user: mycroft <mycroft%NetBSD.org@localhost>
date: Fri Sep 06 13:20:29 2002 +0000
description:
Introduce a new flag, `isdynamic', which is used to remember whether the
executable was of type ET_DYN. Use this instead of `mainprog' to determine
whether we need to do base-relative fixups of the PLT. (This allows loading
non-relocatable objects, should we desire to do that at some point...)
diffstat:
libexec/ld.elf_so/arch/alpha/alpha_reloc.c | 6 +++---
libexec/ld.elf_so/arch/arm/mdreloc.c | 4 ++--
libexec/ld.elf_so/arch/hppa/hppa_reloc.c | 4 ++--
libexec/ld.elf_so/arch/i386/mdreloc.c | 4 ++--
libexec/ld.elf_so/arch/m68k/mdreloc.c | 4 ++--
libexec/ld.elf_so/arch/mips/mips_reloc.c | 6 +++---
libexec/ld.elf_so/arch/powerpc/ppc_reloc.c | 4 ++--
libexec/ld.elf_so/arch/sh3/mdreloc.c | 4 ++--
libexec/ld.elf_so/arch/vax/mdreloc.c | 4 ++--
libexec/ld.elf_so/arch/x86_64/mdreloc.c | 4 ++--
libexec/ld.elf_so/map_object.c | 3 ++-
libexec/ld.elf_so/reloc.c | 4 ++--
libexec/ld.elf_so/rtld.h | 5 +++--
13 files changed, 29 insertions(+), 27 deletions(-)
diffs (267 lines):
diff -r 555201d54497 -r 973cc5307f3c libexec/ld.elf_so/arch/alpha/alpha_reloc.c
--- a/libexec/ld.elf_so/arch/alpha/alpha_reloc.c Fri Sep 06 13:18:43 2002 +0000
+++ b/libexec/ld.elf_so/arch/alpha/alpha_reloc.c Fri Sep 06 13:20:29 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: alpha_reloc.c,v 1.11 2002/09/06 03:12:05 mycroft Exp $ */
+/* $NetBSD: alpha_reloc.c,v 1.12 2002/09/06 13:20:31 mycroft Exp $ */
/*
* Copyright (c) 2001 Wasabi Systems, Inc.
@@ -182,7 +182,7 @@
* COPY relocation is not in a shared library. They
* are allowed only in executable files.
*/
- if (!obj->mainprog) {
+ if (obj->isdynamic) {
_rtld_error(
"%s: Unexpected R_COPY relocation in shared library",
obj->path);
@@ -214,7 +214,7 @@
{
const Elf_Rela *rela;
- if (obj->mainprog)
+ if (!obj->isdynamic)
return 0;
for (rela = obj->pltrela; rela < obj->pltrelalim; rela++) {
diff -r 555201d54497 -r 973cc5307f3c libexec/ld.elf_so/arch/arm/mdreloc.c
--- a/libexec/ld.elf_so/arch/arm/mdreloc.c Fri Sep 06 13:18:43 2002 +0000
+++ b/libexec/ld.elf_so/arch/arm/mdreloc.c Fri Sep 06 13:20:29 2002 +0000
@@ -100,7 +100,7 @@
* COPY relocation is not in a shared library. They
* are allowed only in executable files.
*/
- if (!obj->mainprog) {
+ if (obj->isdynamic) {
_rtld_error(
"%s: Unexpected R_COPY relocation in shared library",
obj->path);
@@ -131,7 +131,7 @@
{
const Elf_Rel *rel;
- if (obj->mainprog)
+ if (!obj->isdynamic)
return 0;
for (rel = obj->pltrel; rel < obj->pltrellim; rel++) {
diff -r 555201d54497 -r 973cc5307f3c libexec/ld.elf_so/arch/hppa/hppa_reloc.c
--- a/libexec/ld.elf_so/arch/hppa/hppa_reloc.c Fri Sep 06 13:18:43 2002 +0000
+++ b/libexec/ld.elf_so/arch/hppa/hppa_reloc.c Fri Sep 06 13:20:29 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: hppa_reloc.c,v 1.9 2002/09/06 03:12:06 mycroft Exp $ */
+/* $NetBSD: hppa_reloc.c,v 1.10 2002/09/06 13:20:32 mycroft Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -443,7 +443,7 @@
* COPY relocation is not in a shared library. They
* are allowed only in executable files.
*/
- if (!obj->mainprog) {
+ if (obj->isdynamic) {
_rtld_error(
"%s: Unexpected R_COPY relocation in shared library",
obj->path);
diff -r 555201d54497 -r 973cc5307f3c libexec/ld.elf_so/arch/i386/mdreloc.c
--- a/libexec/ld.elf_so/arch/i386/mdreloc.c Fri Sep 06 13:18:43 2002 +0000
+++ b/libexec/ld.elf_so/arch/i386/mdreloc.c Fri Sep 06 13:20:29 2002 +0000
@@ -98,7 +98,7 @@
* COPY relocation is not in a shared library. They
* are allowed only in executable files.
*/
- if (!obj->mainprog) {
+ if (obj->isdynamic) {
_rtld_error(
"%s: Unexpected R_COPY relocation in shared library",
obj->path);
@@ -129,7 +129,7 @@
{
const Elf_Rel *rel;
- if (obj->mainprog)
+ if (!obj->isdynamic)
return 0;
for (rel = obj->pltrel; rel < obj->pltrellim; rel++) {
diff -r 555201d54497 -r 973cc5307f3c libexec/ld.elf_so/arch/m68k/mdreloc.c
--- a/libexec/ld.elf_so/arch/m68k/mdreloc.c Fri Sep 06 13:18:43 2002 +0000
+++ b/libexec/ld.elf_so/arch/m68k/mdreloc.c Fri Sep 06 13:20:29 2002 +0000
@@ -77,7 +77,7 @@
* COPY relocation is not in a shared library. They
* are allowed only in executable files.
*/
- if (!obj->mainprog) {
+ if (obj->isdynamic) {
_rtld_error(
"%s: Unexpected R_COPY relocation in shared library",
obj->path);
@@ -109,7 +109,7 @@
{
const Elf_Rela *rela;
- if (obj->mainprog)
+ if (!obj->isdynamic)
return 0;
for (rela = obj->pltrela; rela < obj->pltrelalim; rela++) {
diff -r 555201d54497 -r 973cc5307f3c libexec/ld.elf_so/arch/mips/mips_reloc.c
--- a/libexec/ld.elf_so/arch/mips/mips_reloc.c Fri Sep 06 13:18:43 2002 +0000
+++ b/libexec/ld.elf_so/arch/mips/mips_reloc.c Fri Sep 06 13:20:29 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mips_reloc.c,v 1.14 2002/09/06 12:00:41 mycroft Exp $ */
+/* $NetBSD: mips_reloc.c,v 1.15 2002/09/06 13:20:33 mycroft Exp $ */
/*
* Copyright 1997 Michael L. Hitch <mhitch%montana.edu@localhost>
@@ -225,7 +225,7 @@
{
const Elf_Rel *rel;
- if (obj->mainprog)
+ if (!obj->isdynamic)
return 0;
for (rel = obj->pltrel; rel < obj->pltrellim; rel++) {
@@ -252,7 +252,7 @@
/* Fully resolve procedure addresses now */
- if (!obj->mainprog) {
+ if (obj->isdynamic) {
/* Just relocate the GOT slots pointing into the PLT */
new_value = *where + (Elf_Addr)(obj->relocbase);
rdbg(dodebug, ("fixup !main in %s --> %p", obj->path,
diff -r 555201d54497 -r 973cc5307f3c libexec/ld.elf_so/arch/powerpc/ppc_reloc.c
--- a/libexec/ld.elf_so/arch/powerpc/ppc_reloc.c Fri Sep 06 13:18:43 2002 +0000
+++ b/libexec/ld.elf_so/arch/powerpc/ppc_reloc.c Fri Sep 06 13:20:29 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ppc_reloc.c,v 1.19 2002/09/06 12:00:41 mycroft Exp $ */
+/* $NetBSD: ppc_reloc.c,v 1.20 2002/09/06 13:20:33 mycroft Exp $ */
/*-
* Copyright (C) 1998 Tsubai Masanari
@@ -207,7 +207,7 @@
* COPY relocation is not in a shared library. They
* are allowed only in executable files.
*/
- if (!obj->mainprog) {
+ if (obj->isdynamic) {
_rtld_error(
"%s: Unexpected R_COPY relocation in shared library",
obj->path);
diff -r 555201d54497 -r 973cc5307f3c libexec/ld.elf_so/arch/sh3/mdreloc.c
--- a/libexec/ld.elf_so/arch/sh3/mdreloc.c Fri Sep 06 13:18:43 2002 +0000
+++ b/libexec/ld.elf_so/arch/sh3/mdreloc.c Fri Sep 06 13:20:29 2002 +0000
@@ -102,7 +102,7 @@
* COPY relocation is not in a shared library. They
* are allowed only in executable files.
*/
- if (!obj->mainprog) {
+ if (obj->isdynamic) {
_rtld_error(
"%s: Unexpected R_COPY relocation in shared library",
obj->path);
@@ -134,7 +134,7 @@
{
const Elf_Rela *rela;
- if (obj->mainprog)
+ if (!obj->isdynamic)
return 0;
for (rela = obj->pltrela; rela < obj->pltrelalim; rela++) {
diff -r 555201d54497 -r 973cc5307f3c libexec/ld.elf_so/arch/vax/mdreloc.c
--- a/libexec/ld.elf_so/arch/vax/mdreloc.c Fri Sep 06 13:18:43 2002 +0000
+++ b/libexec/ld.elf_so/arch/vax/mdreloc.c Fri Sep 06 13:20:29 2002 +0000
@@ -63,7 +63,7 @@
* COPY relocation is not in a shared library. They
* are allowed only in executable files.
*/
- if (!obj->mainprog) {
+ if (obj->isdynamic) {
_rtld_error(
"%s: Unexpected R_COPY relocation in shared library",
obj->path);
@@ -95,7 +95,7 @@
{
const Elf_Rela *rela;
- if (obj->mainprog)
+ if (!obj->isdynamic)
return 0;
for (rela = obj->pltrela; rela < obj->pltrelalim; rela++) {
diff -r 555201d54497 -r 973cc5307f3c libexec/ld.elf_so/arch/x86_64/mdreloc.c
--- a/libexec/ld.elf_so/arch/x86_64/mdreloc.c Fri Sep 06 13:18:43 2002 +0000
+++ b/libexec/ld.elf_so/arch/x86_64/mdreloc.c Fri Sep 06 13:20:29 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mdreloc.c,v 1.13 2002/09/06 03:12:08 mycroft Exp $ */
+/* $NetBSD: mdreloc.c,v 1.14 2002/09/06 13:20:35 mycroft Exp $ */
/*
* Copyright (c) 2001 Wasabi Systems, Inc.
@@ -202,7 +202,7 @@
{
const Elf_Rela *rela;
- if (obj->mainprog)
+ if (!obj->isdynamic)
return 0;
for (rela = obj->pltrela; rela < obj->pltrelalim; rela++) {
diff -r 555201d54497 -r 973cc5307f3c libexec/ld.elf_so/map_object.c
--- a/libexec/ld.elf_so/map_object.c Fri Sep 06 13:18:43 2002 +0000
+++ b/libexec/ld.elf_so/map_object.c Fri Sep 06 13:20:29 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: map_object.c,v 1.13 2002/06/01 23:50:53 lukem Exp $ */
+/* $NetBSD: map_object.c,v 1.14 2002/09/06 13:20:29 mycroft Exp $ */
/*
* Copyright 1996 John D. Polstra.
@@ -273,6 +273,7 @@
}
if (phinterp != NULL)
obj->interp = (const char *) (obj->relocbase + phinterp->p_vaddr);
+ obj->isdynamic = u.hdr.e_type == ET_DYN;
return obj;
}
diff -r 555201d54497 -r 973cc5307f3c libexec/ld.elf_so/reloc.c
--- a/libexec/ld.elf_so/reloc.c Fri Sep 06 13:18:43 2002 +0000
+++ b/libexec/ld.elf_so/reloc.c Fri Sep 06 13:20:29 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: reloc.c,v 1.63 2002/09/06 12:00:40 mycroft Exp $ */
+/* $NetBSD: reloc.c,v 1.64 2002/09/06 13:20:30 mycroft Exp $ */
/*
* Copyright 1996 John D. Polstra.
@@ -115,7 +115,7 @@
#ifndef RTLD_INHIBIT_COPY_RELOCS
/* COPY relocations are invalid elsewhere */
- assert(dstobj->mainprog);
+ assert(!dstobj->isdynamic);
if (dstobj->rel != NULL) {
const Elf_Rel *rel;
diff -r 555201d54497 -r 973cc5307f3c libexec/ld.elf_so/rtld.h
--- a/libexec/ld.elf_so/rtld.h Fri Sep 06 13:18:43 2002 +0000
+++ b/libexec/ld.elf_so/rtld.h Fri Sep 06 13:20:29 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rtld.h,v 1.43 2002/09/06 12:00:40 mycroft Exp $ */
+/* $NetBSD: rtld.h,v 1.44 2002/09/06 13:20:30 mycroft Exp $ */
/*
* Copyright 1996 John D. Polstra.
@@ -203,7 +203,8 @@
* text seg */
symbolic:1, /* True if generated with
* "-Bsymbolic" */
- printed:1; /* True if ldd has printed it */
+ printed:1, /* True if ldd has printed it */
+ isdynamic:1; /* True if this is a pure PIC object */
struct link_map linkmap; /* for GDB */
Home |
Main Index |
Thread Index |
Old Index