From a688a732b671263838c2cd056ab5dbb71be91468 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sat, 10 Jun 2006 06:33:00 +0000 Subject: * i386_ld.c (elf_i386_finalize_plt): Don't change symbol table entries for PLT entries if there is no local definition. * ld.c (parse_option): Handle -z ignore like --as-needed and -z record like --no-as-needed. * ld.h (struct ld_state): Remove ignore_unused_dsos field. * ldgeneric.c (new_generated_scn): Always compute ndt_needed by looping over DSOs. When deciding about adding DT_NEEDED entries use ->as_needed instead of ignore_unused_dsos. --- src/i386_ld.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'src/i386_ld.c') diff --git a/src/i386_ld.c b/src/i386_ld.c index 1724d324..d1a213d6 100644 --- a/src/i386_ld.c +++ b/src/i386_ld.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2001, 2002, 2003, 2004, 2005 Red Hat, Inc. +/* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 Red Hat, Inc. This file is part of Red Hat elfutils. Written by Ulrich Drepper , 2001. @@ -396,14 +396,19 @@ elf_i386_finalize_plt (struct ld_state *statep, size_t nsym, /* Point the GOT entry at the PLT entry, after the initial jmp. */ ((Elf32_Word *) data->d_buf)[3 + cnt] = pltentryaddr + 6; - /* The value of the symbol is the address of the corresponding PLT - entry. Store the address, also for the normal symbol table if - this is necessary. */ - ((Elf32_Sym *) dynsymdata->d_buf)[1 + cnt].st_value = pltentryaddr; - if (symdata != NULL) - ((Elf32_Sym *) symdata->d_buf)[nsym - statep->nplt + cnt].st_value - = pltentryaddr; + /* If the symbol is defined, adjust the address. */ + if (((Elf32_Sym *) dynsymdata->d_buf)[1 + cnt].st_shndx != SHN_UNDEF) + { + /* The value of the symbol is the address of the corresponding PLT + entry. Store the address, also for the normal symbol table if + this is necessary. */ + ((Elf32_Sym *) dynsymdata->d_buf)[1 + cnt].st_value = pltentryaddr; + + if (symdata != NULL) + ((Elf32_Sym *) symdata->d_buf)[nsym - statep->nplt + cnt].st_value + = pltentryaddr; + } } /* Create the .plt section. */ -- cgit v1.2.3