aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2012-03-05 22:43:40 +0000
committerAlan Modra <amodra@gmail.com>2012-03-05 22:43:40 +0000
commit66be105571d3494a28c0062f8bc663822121d838 (patch)
tree34de3a757605fafdb8ebeb907f4af86ceeb29490 /ld
parentd8df103b509c3750e9702b17b8af193cb93437c7 (diff)
downloadfsf-binutils-gdb-66be105571d3494a28c0062f8bc663822121d838.zip
fsf-binutils-gdb-66be105571d3494a28c0062f8bc663822121d838.tar.gz
fsf-binutils-gdb-66be105571d3494a28c0062f8bc663822121d838.tar.bz2
* ldlang.h (struct lang_input_statement_flags): New, extract from..
(lang_input_statement_type): ..here. New field "flags". (input_flags): Declare. (missing_file): Delete. * ldmain.h (whole_archive): Delete. (add_DT_NEEDED_for_regular, add_DT_NEEDED_for_dynamic): Delete. * ld.h (ld_config_type <dynamic_link>): Delete. * ldmain.c (whole_archive): Delete. (add_DT_NEEDED_for_regular, add_DT_NEEDED_for_dynamic): Delete. * ldlang.c (missing_file, ldlang_sysrooted_script): Delete. (input_flags): New variable. Replace all uses of config.dynamic_link, missing_file, ldlang_sysrooted_script, whole_archive, add_DT_NEEDED_for_regular and add_DT_NEEDED_for_dynamic with fields from here. * ldfile.c: Likewise. * ldgram.y: Likewise. * ldmain.c: Likewise. * ldwrite.c: Likewise. * lexsup.c: Likewise. * plugin.c: Likewise. * emultempl/aix.em: Likewise. * emultempl/armelf.em: Likewise. * emultempl/elf32.em: Likewise. * emultempl/hppaelf.em: Likewise. * emultempl/linux.em: Likewise. * emultempl/pe.em: Likewise. * emultempl/pep.em: Likewise. * emultempl/ppc64elf.em: Likewise. * emultempl/scoreelf.em: Likewise. * emultempl/spuelf.em: Likewise. * emultempl/sunos.em: Likewise. * emultempl/vms.em: Likewise. * ldlang.c (new_afile): Use memset to init zero fields. (load_symbols): Simplify save and restore of flags around command file processing. * ldfile.c (is_sysrooted_pathname): Tidy.
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog39
-rw-r--r--ld/emultempl/aix.em8
-rw-r--r--ld/emultempl/armelf.em6
-rw-r--r--ld/emultempl/elf32.em18
-rw-r--r--ld/emultempl/hppaelf.em4
-rw-r--r--ld/emultempl/linux.em6
-rw-r--r--ld/emultempl/pe.em7
-rw-r--r--ld/emultempl/pep.em6
-rw-r--r--ld/emultempl/ppc64elf.em4
-rw-r--r--ld/emultempl/scoreelf.em4
-rw-r--r--ld/emultempl/spuelf.em4
-rw-r--r--ld/emultempl/sunos.em17
-rw-r--r--ld/emultempl/vms.em6
-rw-r--r--ld/ld.h3
-rw-r--r--ld/ldfile.c67
-rw-r--r--ld/ldgram.y15
-rw-r--r--ld/ldlang.c149
-rw-r--r--ld/ldlang.h65
-rw-r--r--ld/ldmain.c16
-rw-r--r--ld/ldmain.h5
-rw-r--r--ld/ldwrite.c2
-rw-r--r--ld/lexsup.c30
-rw-r--r--ld/plugin.c8
23 files changed, 245 insertions, 244 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 32ed5d7..8446bc7 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,42 @@
+2012-03-06 Alan Modra <amodra@gmail.com>
+
+ * ldlang.h (struct lang_input_statement_flags): New, extract from..
+ (lang_input_statement_type): ..here. New field "flags".
+ (input_flags): Declare.
+ (missing_file): Delete.
+ * ldmain.h (whole_archive): Delete.
+ (add_DT_NEEDED_for_regular, add_DT_NEEDED_for_dynamic): Delete.
+ * ld.h (ld_config_type <dynamic_link>): Delete.
+ * ldmain.c (whole_archive): Delete.
+ (add_DT_NEEDED_for_regular, add_DT_NEEDED_for_dynamic): Delete.
+ * ldlang.c (missing_file, ldlang_sysrooted_script): Delete.
+ (input_flags): New variable. Replace all uses of config.dynamic_link,
+ missing_file, ldlang_sysrooted_script, whole_archive,
+ add_DT_NEEDED_for_regular and add_DT_NEEDED_for_dynamic with fields
+ from here.
+ * ldfile.c: Likewise.
+ * ldgram.y: Likewise.
+ * ldmain.c: Likewise.
+ * ldwrite.c: Likewise.
+ * lexsup.c: Likewise.
+ * plugin.c: Likewise.
+ * emultempl/aix.em: Likewise.
+ * emultempl/armelf.em: Likewise.
+ * emultempl/elf32.em: Likewise.
+ * emultempl/hppaelf.em: Likewise.
+ * emultempl/linux.em: Likewise.
+ * emultempl/pe.em: Likewise.
+ * emultempl/pep.em: Likewise.
+ * emultempl/ppc64elf.em: Likewise.
+ * emultempl/scoreelf.em: Likewise.
+ * emultempl/spuelf.em: Likewise.
+ * emultempl/sunos.em: Likewise.
+ * emultempl/vms.em: Likewise.
+ * ldlang.c (new_afile): Use memset to init zero fields.
+ (load_symbols): Simplify save and restore of flags around command
+ file processing.
+ * ldfile.c (is_sysrooted_pathname): Tidy.
+
2012-03-05 Hans-Peter Nilsson <hp@axis.com>
* configure.tgt (mips64*el-*-freebsd*, mips64*-*-freebsd*)
diff --git a/ld/emultempl/aix.em b/ld/emultempl/aix.em
index f4660ec..3f6a097 100644
--- a/ld/emultempl/aix.em
+++ b/ld/emultempl/aix.em
@@ -10,7 +10,7 @@ fragment <<EOF
/* AIX emulation code for ${EMULATION_NAME}
Copyright 1991, 1993, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
- 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+ 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012
Free Software Foundation, Inc.
Written by Steve Chamberlain <sac@cygnus.com>
AIX support by Ian Lance Taylor <ian@cygnus.com>
@@ -145,7 +145,7 @@ gld${EMULATION_NAME}_before_parse (void)
{
ldfile_set_output_arch ("${OUTPUT_ARCH}", bfd_arch_`echo ${ARCH} | sed -e 's/:.*//'`);
- config.dynamic_link = TRUE;
+ input_flags.dynamic = TRUE;
config.has_shared = TRUE;
/* The link_info.[init|fini]_functions are initialized in ld/lexsup.c.
@@ -669,7 +669,7 @@ gld${EMULATION_NAME}_unrecognized_file (lang_input_statement_type *entry)
*flpp = n;
ret = TRUE;
- entry->loaded = TRUE;
+ entry->flags.loaded = TRUE;
}
fclose (e);
@@ -1505,7 +1505,7 @@ gld${EMULATION_NAME}_open_dynamic_archive (const char *arch,
{
char *path;
- if (!entry->maybe_archive)
+ if (!entry->flags.maybe_archive)
return FALSE;
path = concat (search->name, "/lib", entry->filename, arch, ".a", NULL);
diff --git a/ld/emultempl/armelf.em b/ld/emultempl/armelf.em
index 21d4f59..03ee98b 100644
--- a/ld/emultempl/armelf.em
+++ b/ld/emultempl/armelf.em
@@ -1,6 +1,6 @@
# This shell script emits a C file. -*- C -*-
# Copyright 1991, 1993, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
-# 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
+# 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
# Free Software Foundation, Inc.
#
# This file is part of the GNU Binutils.
@@ -50,7 +50,7 @@ gld${EMULATION_NAME}_before_parse (void)
#ifndef TARGET_ /* I.e., if not generic. */
ldfile_set_output_arch ("`echo ${ARCH}`", bfd_arch_unknown);
#endif /* not TARGET_ */
- config.dynamic_link = ${DYNAMIC_LINK-TRUE};
+ input_flags.dynamic = ${DYNAMIC_LINK-TRUE};
config.has_shared = `if test -n "$GENERATE_SHLIB_SCRIPT" ; then echo TRUE ; else echo FALSE ; fi`;
}
@@ -240,7 +240,7 @@ build_section_lists (lang_statement_union_type *statement)
{
asection *i = statement->input_section.section;
- if (!((lang_input_statement_type *) i->owner->usrdata)->just_syms_flag
+ if (!((lang_input_statement_type *) i->owner->usrdata)->flags.just_syms
&& (i->flags & SEC_EXCLUDE) == 0
&& i->output_section != NULL
&& i->output_section->owner == link_info.output_bfd)
diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em
index 78a708b..7d31864 100644
--- a/ld/emultempl/elf32.em
+++ b/ld/emultempl/elf32.em
@@ -13,7 +13,7 @@ fragment <<EOF
/* ${ELFSIZE} bit ELF emulation code for ${EMULATION_NAME}
Copyright 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
- 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
+ 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
Free Software Foundation, Inc.
Written by Steve Chamberlain <sac@cygnus.com>
ELF support by Ian Lance Taylor <ian@cygnus.com>
@@ -102,7 +102,7 @@ static void
gld${EMULATION_NAME}_before_parse (void)
{
ldfile_set_output_arch ("${OUTPUT_ARCH}", bfd_arch_`echo ${ARCH} | sed -e 's/:.*//'`);
- config.dynamic_link = ${DYNAMIC_LINK-TRUE};
+ input_flags.dynamic = ${DYNAMIC_LINK-TRUE};
config.has_shared = `if test -n "$GENERATE_SHLIB_SCRIPT" ; then echo TRUE ; else echo FALSE ; fi`;
}
@@ -121,16 +121,16 @@ gld${EMULATION_NAME}_load_symbols (lang_input_statement_type *entry)
/* Tell the ELF linker that we don't want the output file to have a
DT_NEEDED entry for this file, unless it is used to resolve
references in a regular object. */
- if (entry->add_DT_NEEDED_for_regular)
+ if (entry->flags.add_DT_NEEDED_for_regular)
link_class = DYN_AS_NEEDED;
/* Tell the ELF linker that we don't want the output file to have a
DT_NEEDED entry for any dynamic library in DT_NEEDED tags from
this file at all. */
- if (!entry->add_DT_NEEDED_for_dynamic)
+ if (!entry->flags.add_DT_NEEDED_for_dynamic)
link_class |= DYN_NO_ADD_NEEDED;
- if (entry->just_syms_flag
+ if (entry->flags.just_syms
&& (bfd_get_file_flags (entry->the_bfd) & DYNAMIC) != 0)
einfo (_("%P%F: --just-symbols may not be used on DSO: %B\n"),
entry->the_bfd);
@@ -862,7 +862,7 @@ gld${EMULATION_NAME}_check_needed (lang_input_statement_type *s)
return;
}
- if (s->search_dirs_flag)
+ if (s->flags.search_dirs)
{
const char *f = strrchr (s->filename, '/');
if (f != NULL
@@ -1560,7 +1560,7 @@ ${ELF_INTERPRETER_SET_DEFAULT}
char *msg;
bfd_boolean ret;
- if (is->just_syms_flag)
+ if (is->flags.just_syms)
continue;
s = bfd_get_section_by_name (is->the_bfd, ".gnu.warning");
@@ -1621,7 +1621,7 @@ gld${EMULATION_NAME}_open_dynamic_archive
const char *filename;
char *string;
- if (! entry->maybe_archive)
+ if (! entry->flags.maybe_archive)
return FALSE;
filename = entry->filename;
@@ -1675,7 +1675,7 @@ gld${EMULATION_NAME}_open_dynamic_archive
if (bfd_check_format (entry->the_bfd, bfd_object)
&& (entry->the_bfd->flags & DYNAMIC) != 0)
{
- ASSERT (entry->maybe_archive && entry->search_dirs_flag);
+ ASSERT (entry->flags.maybe_archive && entry->flags.search_dirs);
/* Rather than duplicating the logic above. Just use the
filename we recorded earlier. */
diff --git a/ld/emultempl/hppaelf.em b/ld/emultempl/hppaelf.em
index 1137ba2..ec81624 100644
--- a/ld/emultempl/hppaelf.em
+++ b/ld/emultempl/hppaelf.em
@@ -1,6 +1,6 @@
# This shell script emits a C file. -*- C -*-
# Copyright 1991, 1993, 1994, 1997, 1999, 2000, 2001, 2002, 2003, 2004,
-# 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+# 2005, 2006, 2007, 2008, 2009, 2012 Free Software Foundation, Inc.
#
# This file is part of the GNU Binutils.
#
@@ -229,7 +229,7 @@ build_section_lists (lang_statement_union_type *statement)
{
asection *i = statement->input_section.section;
- if (!((lang_input_statement_type *) i->owner->usrdata)->just_syms_flag
+ if (!((lang_input_statement_type *) i->owner->usrdata)->flags.just_syms
&& (i->flags & SEC_EXCLUDE) == 0
&& i->output_section != NULL
&& i->output_section->owner == link_info.output_bfd)
diff --git a/ld/emultempl/linux.em b/ld/emultempl/linux.em
index db62830..61c7df4 100644
--- a/ld/emultempl/linux.em
+++ b/ld/emultempl/linux.em
@@ -10,7 +10,7 @@ fragment <<EOF
/* Linux a.out emulation code for ${EMULATION_NAME}
Copyright 1991, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002,
- 2003, 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
+ 2003, 2004, 2005, 2007, 2008, 2012 Free Software Foundation, Inc.
Written by Steve Chamberlain <sac@cygnus.com>
Linux support by Eric Youngdale <ericy@cais.cais.com>
@@ -49,7 +49,7 @@ static void
gld${EMULATION_NAME}_before_parse (void)
{
ldfile_set_output_arch ("${OUTPUT_ARCH}", bfd_arch_`echo ${ARCH} | sed -e 's/:.*//'`);
- config.dynamic_link = TRUE;
+ input_flags.dynamic = TRUE;
config.has_shared = TRUE;
}
@@ -62,7 +62,7 @@ gld${EMULATION_NAME}_open_dynamic_archive
{
char *string;
- if (! entry->maybe_archive)
+ if (! entry->flags.maybe_archive)
return FALSE;
string = (char *) xmalloc (strlen (search->name)
diff --git a/ld/emultempl/pe.em b/ld/emultempl/pe.em
index 5737fc0..fe188f7 100644
--- a/ld/emultempl/pe.em
+++ b/ld/emultempl/pe.em
@@ -9,7 +9,8 @@ rm -f e${EMULATION_NAME}.c
(echo;echo;echo;echo;echo)>e${EMULATION_NAME}.c # there, now line numbers match ;-)
fragment <<EOF
/* Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
- 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+ 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
+ Free Software Foundation, Inc.
This file is part of the GNU Binutils.
@@ -164,7 +165,7 @@ gld_${EMULATION_NAME}_before_parse (void)
ldfile_set_output_arch ("${OUTPUT_ARCH}", bfd_arch_`echo ${ARCH} | sed -e 's/:.*//'`);
output_filename = "${EXECUTABLE_NAME:-a.exe}";
#ifdef DLL_SUPPORT
- config.dynamic_link = TRUE;
+ input_flags.dynamic = TRUE;
config.has_shared = 1;
EOF
@@ -2093,7 +2094,7 @@ gld_${EMULATION_NAME}_open_dynamic_archive
unsigned int i;
- if (! entry->maybe_archive)
+ if (! entry->flags.maybe_archive)
return FALSE;
filename = entry->filename;
diff --git a/ld/emultempl/pep.em b/ld/emultempl/pep.em
index e02ddcf..a24c30a 100644
--- a/ld/emultempl/pep.em
+++ b/ld/emultempl/pep.em
@@ -8,7 +8,7 @@ fi
rm -f e${EMULATION_NAME}.c
(echo;echo;echo;echo;echo)>e${EMULATION_NAME}.c # there, now line numbers match ;-)
fragment <<EOF
-/* Copyright 2006, 2007, 2008, 2009, 2010, 2011
+/* Copyright 2006, 2007, 2008, 2009, 2010, 2011, 2012
Free Software Foundation, Inc.
Written by Kai Tietz, OneVision Software GmbH&CoKg.
@@ -139,7 +139,7 @@ gld_${EMULATION_NAME}_before_parse (void)
ldfile_set_output_arch ("${OUTPUT_ARCH}", bfd_arch_`echo ${ARCH} | sed -e 's/:.*//'`);
output_filename = "${EXECUTABLE_NAME:-a.exe}";
#ifdef DLL_SUPPORT
- config.dynamic_link = TRUE;
+ input_flags.dynamic = TRUE;
config.has_shared = 1;
link_info.pei386_auto_import = 1;
link_info.pei386_runtime_pseudo_reloc = 2; /* Use by default version 2. */
@@ -1830,7 +1830,7 @@ gld_${EMULATION_NAME}_open_dynamic_archive
unsigned int i;
- if (! entry->maybe_archive)
+ if (! entry->flags.maybe_archive)
return FALSE;
filename = entry->filename;
diff --git a/ld/emultempl/ppc64elf.em b/ld/emultempl/ppc64elf.em
index 5b637e1..668b468 100644
--- a/ld/emultempl/ppc64elf.em
+++ b/ld/emultempl/ppc64elf.em
@@ -435,7 +435,7 @@ build_toc_list (lang_statement_union_type *statement)
{
asection *i = statement->input_section.section;
- if (!((lang_input_statement_type *) i->owner->usrdata)->just_syms_flag
+ if (!((lang_input_statement_type *) i->owner->usrdata)->flags.just_syms
&& (i->flags & SEC_EXCLUDE) == 0
&& i->output_section == toc_section)
{
@@ -453,7 +453,7 @@ build_section_lists (lang_statement_union_type *statement)
{
asection *i = statement->input_section.section;
- if (!((lang_input_statement_type *) i->owner->usrdata)->just_syms_flag
+ if (!((lang_input_statement_type *) i->owner->usrdata)->flags.just_syms
&& (i->flags & SEC_EXCLUDE) == 0
&& i->output_section != NULL
&& i->output_section->owner == link_info.output_bfd)
diff --git a/ld/emultempl/scoreelf.em b/ld/emultempl/scoreelf.em
index 897147e..94aa5af 100644
--- a/ld/emultempl/scoreelf.em
+++ b/ld/emultempl/scoreelf.em
@@ -1,5 +1,5 @@
# This shell script emits a C file. -*- C -*-
-# Copyright 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+# Copyright 2006, 2007, 2008, 2009, 2012 Free Software Foundation, Inc.
# Contributed by:
# Brain.lin (brain.lin@sunplusct.com)
# Mei Ligang (ligang@sunnorth.com.cn)
@@ -36,7 +36,7 @@ gld${EMULATION_NAME}_before_parse ()
#ifndef TARGET_ /* I.e., if not generic. */
ldfile_set_output_arch ("`echo ${ARCH}`", bfd_arch_unknown);
#endif /* not TARGET_ */
- config.dynamic_link = ${DYNAMIC_LINK-TRUE};
+ input_flags.dynamic = ${DYNAMIC_LINK-TRUE};
config.has_shared = `if test -n "$GENERATE_SHLIB_SCRIPT" ; then echo TRUE ; else echo FALSE ; fi`;
}
diff --git a/ld/emultempl/spuelf.em b/ld/emultempl/spuelf.em
index 714d33d..d3e3c70 100644
--- a/ld/emultempl/spuelf.em
+++ b/ld/emultempl/spuelf.em
@@ -1,5 +1,5 @@
# This shell script emits a C file. -*- C -*-
-# Copyright 2006, 2007, 2008, 2009, 2010, 2011
+# Copyright 2006, 2007, 2008, 2009, 2010, 2011, 2012
# Free Software Foundation, Inc.
#
# This file is part of the GNU Binutils.
@@ -579,7 +579,7 @@ embedded_spu_file (lang_input_statement_type *entry, const char *flags)
/* Ensure bfd sections are excluded from the output. */
bfd_section_list_clear (entry->the_bfd);
- entry->loaded = TRUE;
+ entry->flags.loaded = TRUE;
return TRUE;
}
diff --git a/ld/emultempl/sunos.em b/ld/emultempl/sunos.em
index 567b8e2..d7cd3e8 100644
--- a/ld/emultempl/sunos.em
+++ b/ld/emultempl/sunos.em
@@ -10,7 +10,8 @@ fragment <<EOF
/* SunOS emulation code for ${EMULATION_NAME}
Copyright 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
- 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+ 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2012
+ Free Software Foundation, Inc.
Written by Steve Chamberlain <sac@cygnus.com>
SunOS shared library support by Ian Lance Taylor <ian@cygnus.com>
@@ -85,7 +86,7 @@ static void
gld${EMULATION_NAME}_before_parse (void)
{
ldfile_set_output_arch ("${OUTPUT_ARCH}", bfd_arch_`echo ${ARCH} | sed -e 's/:.*//'`);
- config.dynamic_link = TRUE;
+ input_flags.dynamic = TRUE;
config.has_shared = TRUE;
}
@@ -156,9 +157,9 @@ gld${EMULATION_NAME}_find_so (lang_input_statement_type *inp)
char *alc;
struct stat st;
- if (! inp->search_dirs_flag
- || ! inp->maybe_archive
- || ! inp->dynamic)
+ if (! inp->flags.search_dirs
+ || ! inp->flags.maybe_archive
+ || ! inp->flags.dynamic)
return;
ASSERT (CONST_STRNEQ (inp->local_sym_name, "-l"));
@@ -188,7 +189,7 @@ gld${EMULATION_NAME}_find_so (lang_input_statement_type *inp)
/* Turn off the search_dirs_flag to prevent ldfile_open_file from
searching for this file again. */
- inp->search_dirs_flag = FALSE;
+ inp->flags.search_dirs = FALSE;
free (found);
@@ -891,7 +892,7 @@ gld${EMULATION_NAME}_count_need (lang_input_statement_type *inp)
{
++need_entries;
need_size += NEED_ENTRY_SIZE;
- if (! inp->maybe_archive)
+ if (! inp->flags.maybe_archive)
need_size += strlen (inp->filename) + 1;
else
{
@@ -919,7 +920,7 @@ gld${EMULATION_NAME}_set_need (lang_input_statement_type *inp)
referential locality. */
bfd_put_32 (link_info.output_bfd, need_pnames - need_contents,
need_pinfo);
- if (! inp->maybe_archive)
+ if (! inp->flags.maybe_archive)
{
bfd_put_32 (link_info.output_bfd, (bfd_vma) 0, need_pinfo + 4);
bfd_put_16 (link_info.output_bfd, (bfd_vma) 0, need_pinfo + 8);
diff --git a/ld/emultempl/vms.em b/ld/emultempl/vms.em
index 6107c56..164f2e1 100644
--- a/ld/emultempl/vms.em
+++ b/ld/emultempl/vms.em
@@ -1,5 +1,5 @@
# This shell script emits a C file. -*- C -*-
-# Copyright 2010
+# Copyright 2010, 2012
# Free Software Foundation, Inc.
#
# This file is part of the GNU Binutils.
@@ -29,7 +29,7 @@ static void
gld${EMULATION_NAME}_before_parse (void)
{
ldfile_set_output_arch ("${ARCH}", bfd_arch_`echo ${ARCH} | sed -e 's/:.*//'`);
- config.dynamic_link = TRUE;
+ input_flags.dynamic = TRUE;
config.has_shared = FALSE; /* Not yet. */
}
@@ -54,7 +54,7 @@ gld${EMULATION_NAME}_open_dynamic_archive (const char *arch ATTRIBUTE_UNUSED,
{
char *string;
- if (! entry->maybe_archive)
+ if (! entry->flags.maybe_archive)
return FALSE;
string = (char *) xmalloc (strlen (search->name)
diff --git a/ld/ld.h b/ld/ld.h
index 9a7080c..f5e031b 100644
--- a/ld/ld.h
+++ b/ld/ld.h
@@ -250,9 +250,6 @@ typedef struct {
bfd_boolean magic_demand_paged;
bfd_boolean make_executable;
- /* If TRUE, doing a dynamic link. */
- bfd_boolean dynamic_link;
-
/* If TRUE, -shared is supported. */
/* ??? A better way to do this is perhaps to define this in the
ld_emulation_xfer_struct since this is really a target dependent
diff --git a/ld/ldfile.c b/ld/ldfile.c
index e9cb173..b76f669 100644
--- a/ld/ldfile.c
+++ b/ld/ldfile.c
@@ -72,27 +72,29 @@ static search_arch_type **search_arch_tail_ptr = &search_arch_head;
static bfd_boolean
is_sysrooted_pathname (const char *name, bfd_boolean notsame)
{
- char * realname = ld_canon_sysroot ? lrealpath (name) : NULL;
+ char *realname;
int len;
bfd_boolean result;
- if (! realname)
+ if (ld_canon_sysroot == NULL)
return FALSE;
+ realname = lrealpath (name);
len = strlen (realname);
+ result = FALSE;
+ if (len == ld_canon_sysroot_len)
+ result = !notsame;
+ else if (len > ld_canon_sysroot_len
+ && IS_DIR_SEPARATOR (realname[ld_canon_sysroot_len]))
+ {
+ result = TRUE;
+ realname[ld_canon_sysroot_len] = '\0';
+ }
- if (((! notsame && len == ld_canon_sysroot_len)
- || (len >= ld_canon_sysroot_len
- && IS_DIR_SEPARATOR (realname[ld_canon_sysroot_len])
- && (realname[ld_canon_sysroot_len] = '\0') == '\0'))
- && FILENAME_CMP (ld_canon_sysroot, realname) == 0)
- result = TRUE;
- else
- result = FALSE;
-
- if (realname)
- free (realname);
+ if (result)
+ result = FILENAME_CMP (ld_canon_sysroot, realname) == 0;
+ free (realname);
return result;
}
@@ -164,7 +166,7 @@ ldfile_try_open_bfd (const char *attempt,
checks out compatible, do not exit early returning TRUE, or
the plugins will not get a chance to claim the file. */
- if (entry->search_dirs_flag || !entry->dynamic)
+ if (entry->flags.search_dirs || !entry->flags.dynamic)
{
bfd *check;
@@ -178,7 +180,7 @@ ldfile_try_open_bfd (const char *attempt,
if (! bfd_check_format (check, bfd_object))
{
if (check == entry->the_bfd
- && entry->search_dirs_flag
+ && entry->flags.search_dirs
&& bfd_get_error () == bfd_error_file_not_recognized
&& ! ldemul_unrecognized_file (entry))
{
@@ -274,7 +276,7 @@ ldfile_try_open_bfd (const char *attempt,
goto success;
}
- if (!entry->dynamic && (entry->the_bfd->flags & DYNAMIC) != 0)
+ if (!entry->flags.dynamic && (entry->the_bfd->flags & DYNAMIC) != 0)
{
einfo (_("%F%P: attempted static link of dynamic object `%s'\n"),
attempt);
@@ -283,7 +285,7 @@ ldfile_try_open_bfd (const char *attempt,
return FALSE;
}
- if (entry->search_dirs_flag
+ if (entry->flags.search_dirs
&& !bfd_arch_get_compatible (check, link_info.output_bfd,
command_line.accept_unknown_input_arch)
/* XCOFF archives can have 32 and 64 bit objects. */
@@ -348,9 +350,9 @@ ldfile_open_file_search (const char *arch,
/* If this is not an archive, try to open it in the current
directory first. */
- if (! entry->maybe_archive)
+ if (! entry->flags.maybe_archive)
{
- if (entry->sysrooted && IS_ABSOLUTE_PATH (entry->filename))
+ if (entry->flags.sysrooted && IS_ABSOLUTE_PATH (entry->filename))
{
char *name = concat (ld_sysroot, entry->filename,
(const char *) NULL);
@@ -363,8 +365,9 @@ ldfile_open_file_search (const char *arch,
}
else if (ldfile_try_open_bfd (entry->filename, entry))
{
- entry->sysrooted = IS_ABSOLUTE_PATH (entry->filename)
- && is_sysrooted_pathname (entry->filename, TRUE);
+ entry->flags.sysrooted
+ = (IS_ABSOLUTE_PATH (entry->filename)
+ && is_sysrooted_pathname (entry->filename, TRUE));
return TRUE;
}
@@ -376,16 +379,16 @@ ldfile_open_file_search (const char *arch,
{
char *string;
- if (entry->dynamic && ! link_info.relocatable)
+ if (entry->flags.dynamic && ! link_info.relocatable)
{
if (ldemul_open_dynamic_archive (arch, search, entry))
{
- entry->sysrooted = search->sysrooted;
+ entry->flags.sysrooted = search->sysrooted;
return TRUE;
}
}
- if (entry->maybe_archive)
+ if (entry->flags.maybe_archive)
string = concat (search->name, slash, lib, entry->filename,
arch, suffix, (const char *) NULL);
else
@@ -395,7 +398,7 @@ ldfile_open_file_search (const char *arch,
if (ldfile_try_open_bfd (string, entry))
{
entry->filename = string;
- entry->sysrooted = search->sysrooted;
+ entry->flags.sysrooted = search->sysrooted;
return TRUE;
}
@@ -416,7 +419,7 @@ ldfile_open_file (lang_input_statement_type *entry)
if (entry->the_bfd != NULL)
return;
- if (! entry->search_dirs_flag)
+ if (! entry->flags.search_dirs)
{
if (ldfile_try_open_bfd (entry->filename, entry))
return;
@@ -427,8 +430,8 @@ ldfile_open_file (lang_input_statement_type *entry)
else
einfo (_("%P: cannot find %s: %E\n"), entry->local_sym_name);
- entry->missing_file = TRUE;
- missing_file = TRUE;
+ entry->flags.missing_file = TRUE;
+ input_flags.missing_file = TRUE;
}
else
{
@@ -454,18 +457,18 @@ ldfile_open_file (lang_input_statement_type *entry)
/* If we have found the file, we don't need to search directories
again. */
if (found)
- entry->search_dirs_flag = FALSE;
+ entry->flags.search_dirs = FALSE;
else
{
- if (entry->sysrooted
+ if (entry->flags.sysrooted
&& ld_sysroot
&& IS_ABSOLUTE_PATH (entry->local_sym_name))
einfo (_("%P: cannot find %s inside %s\n"),
entry->local_sym_name, ld_sysroot);
else
einfo (_("%P: cannot find %s\n"), entry->local_sym_name);
- entry->missing_file = TRUE;
- missing_file = TRUE;
+ entry->flags.missing_file = TRUE;
+ input_flags.missing_file = TRUE;
}
}
}
diff --git a/ld/ldgram.y b/ld/ldgram.y
index b8b5008..923ac0f 100644
--- a/ld/ldgram.y
+++ b/ld/ldgram.y
@@ -386,17 +386,20 @@ input_list:
{ lang_add_input_file($2,lang_input_file_is_l_enum,
(char *)NULL); }
| AS_NEEDED '('
- { $<integer>$ = add_DT_NEEDED_for_regular; add_DT_NEEDED_for_regular = TRUE; }
+ { $<integer>$ = input_flags.add_DT_NEEDED_for_regular;
+ input_flags.add_DT_NEEDED_for_regular = TRUE; }
input_list ')'
- { add_DT_NEEDED_for_regular = $<integer>3; }
+ { input_flags.add_DT_NEEDED_for_regular = $<integer>3; }
| input_list ',' AS_NEEDED '('
- { $<integer>$ = add_DT_NEEDED_for_regular; add_DT_NEEDED_for_regular = TRUE; }
+ { $<integer>$ = input_flags.add_DT_NEEDED_for_regular;
+ input_flags.add_DT_NEEDED_for_regular = TRUE; }
input_list ')'
- { add_DT_NEEDED_for_regular = $<integer>5; }
+ { input_flags.add_DT_NEEDED_for_regular = $<integer>5; }
| input_list AS_NEEDED '('
- { $<integer>$ = add_DT_NEEDED_for_regular; add_DT_NEEDED_for_regular = TRUE; }
+ { $<integer>$ = input_flags.add_DT_NEEDED_for_regular;
+ input_flags.add_DT_NEEDED_for_regular = TRUE; }
input_list ')'
- { add_DT_NEEDED_for_regular = $<integer>4; }
+ { input_flags.add_DT_NEEDED_for_regular = $<integer>4; }
;
sections:
diff --git a/ld/ldlang.c b/ld/ldlang.c
index 1bffa93..650f4b7 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -69,7 +69,6 @@ static struct bfd_hash_table lang_definedness_table;
static lang_statement_list_type *stat_save[10];
static lang_statement_list_type **stat_save_ptr = &stat_save[0];
static struct unique_sections *unique_section_list;
-static bfd_boolean ldlang_sysrooted_script = FALSE;
/* Forward declarations. */
static void exp_init_os (etree_type *);
@@ -100,6 +99,7 @@ lang_statement_list_type file_chain = { NULL, NULL };
lang_statement_list_type input_file_chain;
struct bfd_sym_chain entry_symbol = { NULL, NULL };
const char *entry_section = ".text";
+struct lang_input_statement_flags input_flags;
bfd_boolean entry_from_cmdline;
bfd_boolean undef_from_cmdline;
bfd_boolean lang_has_input_file = FALSE;
@@ -108,7 +108,6 @@ bfd_boolean lang_float_flag = FALSE;
bfd_boolean delete_output_file_on_failure = FALSE;
struct lang_phdr *lang_phdr_list;
struct lang_nocrossrefs *nocrossref_list;
-bfd_boolean missing_file = FALSE;
/* Functions that traverse the linker script and might evaluate
DEFINED() need to increment this. */
@@ -731,7 +730,7 @@ walk_wild_section (lang_wild_statement_type *ptr,
callback_t callback,
void *data)
{
- if (file->just_syms_flag)
+ if (file->flags.just_syms)
return;
(*ptr->walk_wild_section_handler) (ptr, file, callback, data);
@@ -1046,6 +1045,8 @@ new_afile (const char *name,
{
lang_input_statement_type *p;
+ lang_has_input_file = TRUE;
+
if (add_to_list)
p = (lang_input_statement_type *) new_stat (lang_input_statement, stat_ptr);
else
@@ -1056,9 +1057,13 @@ new_afile (const char *name,
p->header.next = NULL;
}
- lang_has_input_file = TRUE;
+ memset (&p->the_bfd, 0,
+ sizeof (*p) - offsetof (lang_input_statement_type, the_bfd));
p->target = target;
- p->sysrooted = FALSE;
+ p->flags.dynamic = input_flags.dynamic;
+ p->flags.add_DT_NEEDED_for_dynamic = input_flags.add_DT_NEEDED_for_dynamic;
+ p->flags.add_DT_NEEDED_for_regular = input_flags.add_DT_NEEDED_for_regular;
+ p->flags.whole_archive = input_flags.whole_archive;
if (file_type == lang_input_file_is_l_enum
&& name[0] == ':' && name[1] != '\0')
@@ -1071,70 +1076,41 @@ new_afile (const char *name,
{
case lang_input_file_is_symbols_only_enum:
p->filename = name;
- p->maybe_archive = FALSE;
- p->real = TRUE;
p->local_sym_name = name;
- p->just_syms_flag = TRUE;
- p->search_dirs_flag = FALSE;
+ p->flags.real = TRUE;
+ p->flags.just_syms = TRUE;
break;
case lang_input_file_is_fake_enum:
p->filename = name;
- p->maybe_archive = FALSE;
- p->real = FALSE;
p->local_sym_name = name;
- p->just_syms_flag = FALSE;
- p->search_dirs_flag = FALSE;
break;
case lang_input_file_is_l_enum:
- p->maybe_archive = TRUE;
p->filename = name;
- p->real = TRUE;
p->local_sym_name = concat ("-l", name, (const char *) NULL);
- p->just_syms_flag = FALSE;
- p->search_dirs_flag = TRUE;
+ p->flags.maybe_archive = TRUE;
+ p->flags.real = TRUE;
+ p->flags.search_dirs = TRUE;
break;
case lang_input_file_is_marker_enum:
p->filename = name;
- p->maybe_archive = FALSE;
- p->real = FALSE;
p->local_sym_name = name;
- p->just_syms_flag = FALSE;
- p->search_dirs_flag = TRUE;
+ p->flags.search_dirs = TRUE;
break;
case lang_input_file_is_search_file_enum:
- p->sysrooted = ldlang_sysrooted_script;
p->filename = name;
- p->maybe_archive = FALSE;
- p->real = TRUE;
p->local_sym_name = name;
- p->just_syms_flag = FALSE;
- p->search_dirs_flag = TRUE;
+ p->flags.real = TRUE;
+ p->flags.search_dirs = TRUE;
+ p->flags.sysrooted = input_flags.sysrooted;
break;
case lang_input_file_is_file_enum:
p->filename = name;
- p->maybe_archive = FALSE;
- p->real = TRUE;
p->local_sym_name = name;
- p->just_syms_flag = FALSE;
- p->search_dirs_flag = FALSE;
+ p->flags.real = TRUE;
break;
default:
FAIL ();
}
- p->the_bfd = NULL;
- p->next_real_file = NULL;
- p->next = NULL;
- p->dynamic = config.dynamic_link;
- p->add_DT_NEEDED_for_dynamic = add_DT_NEEDED_for_dynamic;
- p->add_DT_NEEDED_for_regular = add_DT_NEEDED_for_regular;
- p->whole_archive = whole_archive;
- p->loaded = FALSE;
- p->missing_file = FALSE;
-#ifdef ENABLE_PLUGINS
- p->claimed = FALSE;
- p->claim_archive = FALSE;
- p->reload = FALSE;
-#endif /* ENABLE_PLUGINS */
lang_statement_append (&input_file_chain,
(lang_statement_union_type *) p,
@@ -2012,7 +1988,7 @@ lang_map (void)
asection *s;
if ((file->the_bfd->flags & (BFD_LINKER_CREATED | DYNAMIC)) != 0
- || file->just_syms_flag)
+ || file->flags.just_syms)
continue;
for (s = file->the_bfd->sections; s != NULL; s = s->next)
@@ -2234,7 +2210,7 @@ section_already_linked (bfd *abfd, asection *sec, void *data)
/* If we are only reading symbols from this object, then we want to
discard all sections. */
- if (entry->just_syms_flag)
+ if (entry->flags.just_syms)
{
bfd_link_just_syms (abfd, sec, &link_info);
return;
@@ -2619,7 +2595,7 @@ lookup_name (const char *name)
/* If we have already added this file, or this file is not real
don't add this file. */
- if (search->loaded || !search->real)
+ if (search->flags.loaded || !search->flags.real)
return search;
if (! load_symbols (search, NULL))
@@ -2697,23 +2673,20 @@ load_symbols (lang_input_statement_type *entry,
{
char **matching;
- if (entry->loaded)
+ if (entry->flags.loaded)
return TRUE;
ldfile_open_file (entry);
/* Do not process further if the file was missing. */
- if (entry->missing_file)
+ if (entry->flags.missing_file)
return TRUE;
if (! bfd_check_format (entry->the_bfd, bfd_archive)
&& ! bfd_check_format_matches (entry->the_bfd, bfd_object, &matching))
{
bfd_error_type err;
- bfd_boolean save_ldlang_sysrooted_script;
- bfd_boolean save_add_DT_NEEDED_for_regular;
- bfd_boolean save_add_DT_NEEDED_for_dynamic;
- bfd_boolean save_whole_archive;
+ struct lang_input_statement_flags save_flags;
err = bfd_get_error ();
@@ -2739,30 +2712,26 @@ load_symbols (lang_input_statement_type *entry,
entry->the_bfd = NULL;
/* Try to interpret the file as a linker script. */
+ save_flags = input_flags;
ldfile_open_command_file (entry->filename);
push_stat_ptr (place);
- save_ldlang_sysrooted_script = ldlang_sysrooted_script;
- ldlang_sysrooted_script = entry->sysrooted;
- save_add_DT_NEEDED_for_regular = add_DT_NEEDED_for_regular;
- add_DT_NEEDED_for_regular = entry->add_DT_NEEDED_for_regular;
- save_add_DT_NEEDED_for_dynamic = add_DT_NEEDED_for_dynamic;
- add_DT_NEEDED_for_dynamic = entry->add_DT_NEEDED_for_dynamic;
- save_whole_archive = whole_archive;
- whole_archive = entry->whole_archive;
+ input_flags.sysrooted = entry->flags.sysrooted;
+ input_flags.add_DT_NEEDED_for_regular
+ = entry->flags.add_DT_NEEDED_for_regular;
+ input_flags.add_DT_NEEDED_for_dynamic
+ = entry->flags.add_DT_NEEDED_for_dynamic;
+ input_flags.whole_archive = entry->flags.whole_archive;
+ input_flags.dynamic = entry->flags.dynamic;
ldfile_assumed_script = TRUE;
parser_input = input_script;
- /* We want to use the same -Bdynamic/-Bstatic as the one for
- ENTRY. */
- config.dynamic_link = entry->dynamic;
yyparse ();
ldfile_assumed_script = FALSE;
- ldlang_sysrooted_script = save_ldlang_sysrooted_script;
- add_DT_NEEDED_for_regular = save_add_DT_NEEDED_for_regular;
- add_DT_NEEDED_for_dynamic = save_add_DT_NEEDED_for_dynamic;
- whole_archive = save_whole_archive;
+ /* missing_file is sticky. */
+ save_flags.missing_file |= input_flags.missing_file;
+ input_flags = save_flags;
pop_stat_ptr ();
return TRUE;
@@ -2782,7 +2751,7 @@ load_symbols (lang_input_statement_type *entry,
case bfd_object:
#ifdef ENABLE_PLUGINS
- if (!entry->reload)
+ if (!entry->flags.reload)
#endif
ldlang_add_file (entry);
if (trace_files || trace_file_tries)
@@ -2792,7 +2761,7 @@ load_symbols (lang_input_statement_type *entry,
case bfd_archive:
check_excluded_libs (entry->the_bfd);
- if (entry->whole_archive)
+ if (entry->flags.whole_archive)
{
bfd *member = NULL;
bfd_boolean loaded = TRUE;
@@ -2827,18 +2796,18 @@ load_symbols (lang_input_statement_type *entry,
}
}
- entry->loaded = loaded;
+ entry->flags.loaded = loaded;
return loaded;
}
break;
}
if (bfd_link_add_symbols (entry->the_bfd, &link_info))
- entry->loaded = TRUE;
+ entry->flags.loaded = TRUE;
else
einfo (_("%F%B: could not read symbols: %E\n"), entry->the_bfd);
- return entry->loaded;
+ return entry->flags.loaded;
}
/* Handle a wild statement. S->FILENAME or S->SECTION_LIST or both
@@ -3022,7 +2991,7 @@ get_first_input_target (void)
LANG_FOR_EACH_INPUT_STATEMENT (s)
{
if (s->header.type == lang_input_statement_enum
- && s->real)
+ && s->flags.real)
{
ldfile_open_file (s);
@@ -3255,7 +3224,7 @@ open_input_bfds (lang_statement_union_type *s, enum open_bfd_mode mode)
current_target = s->target_statement.target;
break;
case lang_input_statement_enum:
- if (s->input_statement.real)
+ if (s->input_statement.flags.real)
{
lang_statement_union_type **os_tail;
lang_statement_list_type add;
@@ -3271,22 +3240,22 @@ open_input_bfds (lang_statement_union_type *s, enum open_bfd_mode mode)
&& ((mode & OPEN_BFD_RESCAN) == 0
|| plugin_insert == NULL)
#endif
- && !s->input_statement.whole_archive
- && s->input_statement.loaded
+ && !s->input_statement.flags.whole_archive
+ && s->input_statement.flags.loaded
&& bfd_check_format (s->input_statement.the_bfd,
bfd_archive))
- s->input_statement.loaded = FALSE;
+ s->input_statement.flags.loaded = FALSE;
#ifdef ENABLE_PLUGINS
/* When rescanning, reload --as-needed shared libs. */
else if ((mode & OPEN_BFD_RESCAN) != 0
&& plugin_insert == NULL
- && s->input_statement.loaded
- && s->input_statement.add_DT_NEEDED_for_regular
+ && s->input_statement.flags.loaded
+ && s->input_statement.flags.add_DT_NEEDED_for_regular
&& ((s->input_statement.the_bfd->flags) & DYNAMIC) != 0
&& plugin_should_reload (s->input_statement.the_bfd))
{
- s->input_statement.loaded = FALSE;
- s->input_statement.reload = TRUE;
+ s->input_statement.flags.loaded = FALSE;
+ s->input_statement.flags.reload = TRUE;
}
#endif
@@ -3337,7 +3306,7 @@ open_input_bfds (lang_statement_union_type *s, enum open_bfd_mode mode)
}
/* Exit if any of the files were missing. */
- if (missing_file)
+ if (input_flags.missing_file)
einfo ("%F");
}
@@ -4648,7 +4617,7 @@ size_input_section
lang_input_section_type *is = &((*this_ptr)->input_section);
asection *i = is->section;
- if (!((lang_input_statement_type *) i->owner->usrdata)->just_syms_flag
+ if (!((lang_input_statement_type *) i->owner->usrdata)->flags.just_syms
&& (i->flags & SEC_EXCLUDE) == 0)
{
bfd_size_type alignment_needed;
@@ -5819,7 +5788,7 @@ lang_check (void)
{
#ifdef ENABLE_PLUGINS
/* Don't check format of files claimed by plugin. */
- if (file->input_statement.claimed)
+ if (file->input_statement.flags.claimed)
continue;
#endif /* ENABLE_PLUGINS */
input_bfd = file->input_statement.the_bfd;
@@ -6022,7 +5991,7 @@ lang_place_orphans (void)
/* This section of the file is not attached, root
around for a sensible place for it to go. */
- if (file->just_syms_flag)
+ if (file->flags.just_syms)
bfd_link_just_syms (file->the_bfd, s, &link_info);
else if ((s->flags & SEC_EXCLUDE) != 0)
s->output_section = bfd_abs_section_ptr;
@@ -6334,7 +6303,7 @@ lang_gc_sections (void)
{
asection *sec;
#ifdef ENABLE_PLUGINS
- if (f->claimed)
+ if (f->flags.claimed)
continue;
#endif
for (sec = f->the_bfd->sections; sec != NULL; sec = sec->next)
@@ -6499,8 +6468,8 @@ find_replacements_insert_point (void)
claim1 != NULL;
claim1 = &claim1->next->input_statement)
{
- if (claim1->claimed)
- return claim1->claim_archive ? lastobject : claim1;
+ if (claim1->flags.claimed)
+ return claim1->flags.claim_archive ? lastobject : claim1;
/* Update lastobject if this is a real object file. */
if (claim1->the_bfd && (claim1->the_bfd->my_archive == NULL))
lastobject = claim1;
@@ -6911,7 +6880,7 @@ lang_startup (const char *name)
}
first_file->filename = name;
first_file->local_sym_name = name;
- first_file->real = TRUE;
+ first_file->flags.real = TRUE;
}
void
diff --git a/ld/ldlang.h b/ld/ldlang.h
index f37409c..9ed3952 100644
--- a/ld/ldlang.h
+++ b/ld/ldlang.h
@@ -1,6 +1,6 @@
/* ldlang.h - linker command language support
Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
- 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
+ 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
Free Software Foundation, Inc.
This file is part of the GNU Binutils.
@@ -228,36 +228,16 @@ typedef struct
bfd_vma output_offset;
} lang_reloc_statement_type;
-typedef struct lang_input_statement_struct
+struct lang_input_statement_flags
{
- lang_statement_header_type header;
- /* Name of this file. */
- const char *filename;
- /* Name to use for the symbol giving address of text start.
- Usually the same as filename, but for a file spec'd with
- -l this is the -l switch itself rather than the filename. */
- const char *local_sym_name;
-
- bfd *the_bfd;
-
- struct flag_info *section_flag_list;
-
- /* Point to the next file - whatever it is, wanders up and down
- archives */
- union lang_statement_union *next;
-
- /* Point to the next file, but skips archive contents. */
- union lang_statement_union *next_real_file;
-
- const char *target;
-
+ /* 1 means this file was specified in a -l option. */
unsigned int maybe_archive : 1;
/* 1 means search a set of directories for this file. */
- unsigned int search_dirs_flag : 1;
+ unsigned int search_dirs : 1;
/* 1 means this was found in a search directory marked as sysrooted,
- if search_dirs_flag is false, otherwise, that it should be
+ if search_dirs is false, otherwise, that it should be
searched in ld_sysroot before any other location, as long as it
starts with a slash. */
unsigned int sysrooted : 1;
@@ -265,7 +245,7 @@ typedef struct lang_input_statement_struct
/* 1 means this is base file of incremental load.
Do not load this file's text or data.
Also default text_start to after this file's bss. */
- unsigned int just_syms_flag : 1;
+ unsigned int just_syms : 1;
/* Whether to search for this entry as a dynamic archive. */
unsigned int dynamic : 1;
@@ -300,7 +280,32 @@ typedef struct lang_input_statement_struct
/* Set if reloading an --as-needed lib. */
unsigned int reload : 1;
#endif /* ENABLE_PLUGINS */
+};
+
+typedef struct lang_input_statement_struct
+{
+ lang_statement_header_type header;
+ /* Name of this file. */
+ const char *filename;
+ /* Name to use for the symbol giving address of text start.
+ Usually the same as filename, but for a file spec'd with
+ -l this is the -l switch itself rather than the filename. */
+ const char *local_sym_name;
+
+ bfd *the_bfd;
+
+ struct flag_info *section_flag_list;
+
+ /* Point to the next file - whatever it is, wanders up and down
+ archives */
+ union lang_statement_union *next;
+
+ /* Point to the next file, but skips archive contents. */
+ union lang_statement_union *next_real_file;
+
+ const char *target;
+ struct lang_input_statement_flags flags;
} lang_input_statement_type;
typedef struct
@@ -416,8 +421,6 @@ struct lang_phdr
etree_type *flags;
};
-extern struct lang_phdr *lang_phdr_list;
-
/* This structure is used to hold a list of sections which may not
cross reference each other. */
@@ -435,8 +438,6 @@ struct lang_nocrossrefs
lang_nocrossref_type *list;
};
-extern struct lang_nocrossrefs *nocrossref_list;
-
/* This structure is used to hold a list of input section names which
will not match an output section in the linker script. */
@@ -467,9 +468,12 @@ struct orphan_save
lang_output_section_statement_type **os_tail;
};
+extern struct lang_phdr *lang_phdr_list;
+extern struct lang_nocrossrefs *nocrossref_list;
extern const char *output_target;
extern lang_output_section_statement_type *abs_output_section;
extern lang_statement_list_type lang_output_section_statement;
+extern struct lang_input_statement_flags input_flags;
extern bfd_boolean lang_has_input_file;
extern etree_type *base;
extern lang_statement_list_type *stat_ptr;
@@ -482,7 +486,6 @@ extern lang_statement_list_type file_chain;
extern lang_statement_list_type input_file_chain;
extern int lang_statement_iteration;
-extern bfd_boolean missing_file;
extern void lang_init
(void);
diff --git a/ld/ldmain.c b/ld/ldmain.c
index d006ed5..b2810a7 100644
--- a/ld/ldmain.c
+++ b/ld/ldmain.c
@@ -95,18 +95,6 @@ bfd_boolean trace_file_tries;
instead of complaining if no input files are given. */
bfd_boolean version_printed;
-/* Nonzero means link in every member of an archive. */
-bfd_boolean whole_archive;
-
-/* True means only create DT_NEEDED entries for dynamic libraries
- if they actually satisfy some reference in a regular object. */
-bfd_boolean add_DT_NEEDED_for_regular;
-
-/* True means create DT_NEEDED entries for dynamic libraries that
- are DT_NEEDED by dynamic libraries specifically mentioned on
- the command line. */
-bfd_boolean add_DT_NEEDED_for_dynamic;
-
/* TRUE if we should demangle symbol names. */
bfd_boolean demangling;
@@ -767,9 +755,9 @@ add_archive_element (struct bfd_link_info *info,
file.filesize = arelt_size (abfd);
file.fd = fd;
plugin_maybe_claim (&file, input);
- if (input->claimed)
+ if (input->flags.claimed)
{
- input->claim_archive = TRUE;
+ input->flags.claim_archive = TRUE;
*subsbfd = input->the_bfd;
}
}
diff --git a/ld/ldmain.h b/ld/ldmain.h
index 57ce8d7..527d3f2 100644
--- a/ld/ldmain.h
+++ b/ld/ldmain.h
@@ -1,6 +1,6 @@
/* ldmain.h -
Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1999, 2002, 2003, 2004,
- 2005, 2007, 2008, 2009 Free Software Foundation, Inc.
+ 2005, 2007, 2008, 2009, 2012 Free Software Foundation, Inc.
This file is part of the GNU Binutils.
@@ -33,9 +33,6 @@ extern char *default_target;
extern bfd_boolean trace_files;
extern bfd_boolean trace_file_tries;
extern bfd_boolean version_printed;
-extern bfd_boolean whole_archive;
-extern bfd_boolean add_DT_NEEDED_for_regular;
-extern bfd_boolean add_DT_NEEDED_for_dynamic;
extern bfd_boolean demangling;
extern int g_switch_value;
extern const char *output_filename;
diff --git a/ld/ldwrite.c b/ld/ldwrite.c
index 481fef4..911149e 100644
--- a/ld/ldwrite.c
+++ b/ld/ldwrite.c
@@ -241,7 +241,7 @@ build_link_order (lang_statement_union_type *statement)
attached */
asection *i = statement->input_section.section;
- if (!((lang_input_statement_type *) i->owner->usrdata)->just_syms_flag
+ if (!((lang_input_statement_type *) i->owner->usrdata)->flags.just_syms
&& (i->flags & SEC_EXCLUDE) == 0)
{
asection *output_section = i->output_section;
diff --git a/ld/lexsup.c b/ld/lexsup.c
index 7c1bc46..490f79c 100644
--- a/ld/lexsup.c
+++ b/ld/lexsup.c
@@ -775,10 +775,10 @@ parse_args (unsigned argc, char **argv)
``use only shared libraries'' but, then, we don't
currently support shared libraries on HP/UX anyhow. */
if (strcmp (optarg, "archive") == 0)
- config.dynamic_link = FALSE;
+ input_flags.dynamic = FALSE;
else if (strcmp (optarg, "shared") == 0
|| strcmp (optarg, "default") == 0)
- config.dynamic_link = TRUE;
+ input_flags.dynamic = TRUE;
else
einfo (_("%P%F: unrecognized -a option `%s'\n"), optarg);
break;
@@ -807,10 +807,10 @@ parse_args (unsigned argc, char **argv)
yyparse ();
break;
case OPTION_CALL_SHARED:
- config.dynamic_link = TRUE;
+ input_flags.dynamic = TRUE;
break;
case OPTION_NON_SHARED:
- config.dynamic_link = FALSE;
+ input_flags.dynamic = FALSE;
break;
case OPTION_CREF:
command_line.cref = TRUE;
@@ -934,17 +934,17 @@ parse_args (unsigned argc, char **argv)
case 'N':
config.text_read_only = FALSE;
config.magic_demand_paged = FALSE;
- config.dynamic_link = FALSE;
+ input_flags.dynamic = FALSE;
break;
case OPTION_NO_OMAGIC:
config.text_read_only = TRUE;
config.magic_demand_paged = TRUE;
- /* NB/ Does not set dynamic_link to TRUE.
+ /* NB/ Does not set input_flags.dynamic to TRUE.
Use --call-shared or -Bdynamic for this. */
break;
case 'n':
config.magic_demand_paged = FALSE;
- config.dynamic_link = FALSE;
+ input_flags.dynamic = FALSE;
break;
case OPTION_NO_DEFINE_COMMON:
command_line.inhibit_common_definition = TRUE;
@@ -1040,7 +1040,7 @@ parse_args (unsigned argc, char **argv)
config.only_cmd_line_lib_dirs = TRUE;
break;
case OPTION_NO_WHOLE_ARCHIVE:
- whole_archive = FALSE;
+ input_flags.whole_archive = FALSE;
break;
case 'O':
/* FIXME "-O<non-digits> <value>" used to set the address of
@@ -1092,7 +1092,7 @@ parse_args (unsigned argc, char **argv)
config.build_constructors = FALSE;
config.magic_demand_paged = FALSE;
config.text_read_only = FALSE;
- config.dynamic_link = FALSE;
+ input_flags.dynamic = FALSE;
break;
case 'R':
/* The GNU linker traditionally uses -R to mean to include
@@ -1313,7 +1313,7 @@ parse_args (unsigned argc, char **argv)
config.build_constructors = TRUE;
config.magic_demand_paged = FALSE;
config.text_read_only = FALSE;
- config.dynamic_link = FALSE;
+ input_flags.dynamic = FALSE;
break;
case 'u':
ldlang_add_undef (optarg, TRUE);
@@ -1437,19 +1437,19 @@ parse_args (unsigned argc, char **argv)
link_info.warn_alternate_em = TRUE;
break;
case OPTION_WHOLE_ARCHIVE:
- whole_archive = TRUE;
+ input_flags.whole_archive = TRUE;
break;
case OPTION_ADD_DT_NEEDED_FOR_DYNAMIC:
- add_DT_NEEDED_for_dynamic = TRUE;
+ input_flags.add_DT_NEEDED_for_dynamic = TRUE;
break;
case OPTION_NO_ADD_DT_NEEDED_FOR_DYNAMIC:
- add_DT_NEEDED_for_dynamic = FALSE;
+ input_flags.add_DT_NEEDED_for_dynamic = FALSE;
break;
case OPTION_ADD_DT_NEEDED_FOR_REGULAR:
- add_DT_NEEDED_for_regular = TRUE;
+ input_flags.add_DT_NEEDED_for_regular = TRUE;
break;
case OPTION_NO_ADD_DT_NEEDED_FOR_REGULAR:
- add_DT_NEEDED_for_regular = FALSE;
+ input_flags.add_DT_NEEDED_for_regular = FALSE;
break;
case OPTION_WRAP:
add_wrap (optarg);
diff --git a/ld/plugin.c b/ld/plugin.c
index 91fe48b..2515888 100644
--- a/ld/plugin.c
+++ b/ld/plugin.c
@@ -1,5 +1,5 @@
/* Plugin control for the GNU linker.
- Copyright 2010, 2011 Free Software Foundation, Inc.
+ Copyright 2010, 2011, 2012 Free Software Foundation, Inc.
This file is part of the GNU Binutils.
@@ -262,7 +262,7 @@ is_ir_dummy_bfd (const bfd *abfd)
when processing DT_NEEDED dependencies. */
return (abfd
&& abfd->usrdata
- && ((lang_input_statement_type *)(abfd->usrdata))->claimed);
+ && ((lang_input_statement_type *)(abfd->usrdata))->flags.claimed);
}
/* Helpers to convert between BFD and GOLD symbol formats. */
@@ -873,7 +873,7 @@ plugin_maybe_claim (struct ld_plugin_input_file *file,
if (entry->the_bfd->my_archive == NULL)
bfd_close (entry->the_bfd);
entry->the_bfd = file->handle;
- entry->claimed = TRUE;
+ entry->flags.claimed = TRUE;
bfd_make_readable (entry->the_bfd);
}
else
@@ -881,7 +881,7 @@ plugin_maybe_claim (struct ld_plugin_input_file *file,
/* If plugin didn't claim the file, we don't need the dummy bfd.
Can't avoid speculatively creating it, alas. */
bfd_close_all_done (file->handle);
- entry->claimed = FALSE;
+ entry->flags.claimed = FALSE;
}
}