summaryrefslogtreecommitdiffstats
path: root/src/i386_ld.c
diff options
context:
space:
mode:
authorUlrich Drepper <[email protected]>2006-06-10 06:33:00 +0000
committerUlrich Drepper <[email protected]>2006-06-10 06:33:00 +0000
commita688a732b671263838c2cd056ab5dbb71be91468 (patch)
treec0f222b2c1b7ae6d088d75f738350ba2e47b773b /src/i386_ld.c
parentbdb29c0b5613ecda012edfd291765f17da3939da (diff)
* 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.
Diffstat (limited to 'src/i386_ld.c')
-rw-r--r--src/i386_ld.c21
1 files changed, 13 insertions, 8 deletions
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 <[email protected]>, 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. */