aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2002-05-15 00:18:58 +0000
committerAlan Modra <amodra@gmail.com>2002-05-15 00:18:58 +0000
commit2d653fc7608af5956303017a1ae8303e96784a59 (patch)
tree62c029114a51741afa834d4c3fa96155e28c667f /bfd
parent0e0cbfbfde8653dcb082457afe80ed50d4bef95b (diff)
downloadgdb-2d653fc7608af5956303017a1ae8303e96784a59.zip
gdb-2d653fc7608af5956303017a1ae8303e96784a59.tar.gz
gdb-2d653fc7608af5956303017a1ae8303e96784a59.tar.bz2
Fix ld --just-symbols
* aix5ppc-core.c: Warning fixes. * aout-adobe.c (aout_32_bfd_link_just_syms): Define. * aout-target.h (MY_bfd_link_just_syms): Define. * aout-tic30.c (MY_bfd_link_just_syms): Define. * bfd.c (bfd_link_just_syms): Define. * binary.c (binary_bfd_link_just_syms): Define. * bout.c (b_out_bfd_link_just_syms): Define. * coff-rs6000.c (rs6000coff_vec, pmac_xcoff_vec): Update initializer. * coff64-rs6000.c (rs6000coff64_vec, aix5coff64_vec): Likewise. * coffcode.h (coff_bfd_link_just_syms): Define. * elf-bfd.h (enum elf_link_info_type): Add ELF_INFO_TYPE_JUST_SYMS. (elf_discarded_section): Check for ELF_INFO_TYPE_JUST_SYMS. (_bfd_elf_link_just_syms): Declare. * elf.c (_bfd_elf_link_just_syms): New function. * elf-eh-frame.c (_bfd_elf_maybe_strip_eh_frame_hdr): Check that sections haven't already been discarded by the linker. * elflink.h (elf_link_add_object_symbols): Likewise for stab sections and SEC_MERGE sections. (elf_bfd_discard_info): Similarly here. * elfxx-target.h (bfd_elfNN_bfd_link_just_syms): Define. * i386msdos.c (msdos_bfd_link_just_syms): Define. * i386os9k.c (os9k_bfd_link_just_syms): Define. * ieee.c (ieee_bfd_link_just_syms): Define. * ihex.c (ihex_bfd_link_just_syms): Define. * libbfd-in.h (_bfd_nolink_bfd_link_just_syms): Define. (_bfd_generic_link_just_syms): Declare. * libecoff.h (_bfd_ecoff_bfd_link_just_syms): Define. * linker.c (_bfd_generic_link_just_syms): New function. * mmo.c (mmo_bfd_link_just_syms): Define. * nlm-target.h (nlm_bfd_link_just_syms): Define. * oasys.c (oasys_bfd_link_just_syms): Define. * ppcboot.c (ppcboot_bfd_link_just_syms): Define. * som.c (som_bfd_link_just_syms): Define. * srec.c (srec_bfd_link_just_syms): Define. * targets.c (struct bfd_target): Add _bfd_link_just_syms. (BFD_JUMP_TABLE_LINK): And here. * tekhex.c (tekhex_bfd_link_just_syms): Define. * versados.c (versados_bfd_link_just_syms): Define. * vms.c (vms_bfd_link_just_syms): Define. * libbfd.h: Regenerate. * bfd-in2.h: Regenerate.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog44
-rw-r--r--bfd/aix5ppc-core.c10
-rw-r--r--bfd/aout-adobe.c1
-rw-r--r--bfd/aout-target.h3
-rw-r--r--bfd/aout-tic30.c3
-rw-r--r--bfd/bfd-in2.h7
-rw-r--r--bfd/bfd.c3
-rw-r--r--bfd/binary.c1
-rw-r--r--bfd/bout.c1
-rw-r--r--bfd/coff-rs6000.c6
-rw-r--r--bfd/coff64-rs6000.c6
-rw-r--r--bfd/coffcode.h1
-rw-r--r--bfd/elf-bfd.h8
-rw-r--r--bfd/elf-eh-frame.c4
-rw-r--r--bfd/elf.c13
-rw-r--r--bfd/elflink.h19
-rw-r--r--bfd/elfxx-target.h5
-rw-r--r--bfd/i386msdos.c1
-rw-r--r--bfd/i386os9k.c1
-rw-r--r--bfd/ieee.c1
-rw-r--r--bfd/ihex.c1
-rw-r--r--bfd/libbfd-in.h8
-rw-r--r--bfd/libbfd.h8
-rw-r--r--bfd/libecoff.h1
-rw-r--r--bfd/linker.c13
-rw-r--r--bfd/mmo.c1
-rw-r--r--bfd/nlm-target.h1
-rw-r--r--bfd/oasys.c1
-rw-r--r--bfd/ppcboot.c1
-rw-r--r--bfd/som.c1
-rw-r--r--bfd/srec.c1
-rw-r--r--bfd/targets.c4
-rw-r--r--bfd/tekhex.c1
-rw-r--r--bfd/versados.c1
-rw-r--r--bfd/vms.c1
35 files changed, 160 insertions, 22 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index e1f12cc..54028e8 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,47 @@
+2002-05-15 Alan Modra <amodra@bigpond.net.au>
+
+ * aix5ppc-core.c: Warning fixes.
+ * aout-adobe.c (aout_32_bfd_link_just_syms): Define.
+ * aout-target.h (MY_bfd_link_just_syms): Define.
+ * aout-tic30.c (MY_bfd_link_just_syms): Define.
+ * bfd.c (bfd_link_just_syms): Define.
+ * binary.c (binary_bfd_link_just_syms): Define.
+ * bout.c (b_out_bfd_link_just_syms): Define.
+ * coff-rs6000.c (rs6000coff_vec, pmac_xcoff_vec): Update initializer.
+ * coff64-rs6000.c (rs6000coff64_vec, aix5coff64_vec): Likewise.
+ * coffcode.h (coff_bfd_link_just_syms): Define.
+ * elf-bfd.h (enum elf_link_info_type): Add ELF_INFO_TYPE_JUST_SYMS.
+ (elf_discarded_section): Check for ELF_INFO_TYPE_JUST_SYMS.
+ (_bfd_elf_link_just_syms): Declare.
+ * elf.c (_bfd_elf_link_just_syms): New function.
+ * elf-eh-frame.c (_bfd_elf_maybe_strip_eh_frame_hdr): Check that
+ sections haven't already been discarded by the linker.
+ * elflink.h (elf_link_add_object_symbols): Likewise for stab
+ sections and SEC_MERGE sections.
+ (elf_bfd_discard_info): Similarly here.
+ * elfxx-target.h (bfd_elfNN_bfd_link_just_syms): Define.
+ * i386msdos.c (msdos_bfd_link_just_syms): Define.
+ * i386os9k.c (os9k_bfd_link_just_syms): Define.
+ * ieee.c (ieee_bfd_link_just_syms): Define.
+ * ihex.c (ihex_bfd_link_just_syms): Define.
+ * libbfd-in.h (_bfd_nolink_bfd_link_just_syms): Define.
+ (_bfd_generic_link_just_syms): Declare.
+ * libecoff.h (_bfd_ecoff_bfd_link_just_syms): Define.
+ * linker.c (_bfd_generic_link_just_syms): New function.
+ * mmo.c (mmo_bfd_link_just_syms): Define.
+ * nlm-target.h (nlm_bfd_link_just_syms): Define.
+ * oasys.c (oasys_bfd_link_just_syms): Define.
+ * ppcboot.c (ppcboot_bfd_link_just_syms): Define.
+ * som.c (som_bfd_link_just_syms): Define.
+ * srec.c (srec_bfd_link_just_syms): Define.
+ * targets.c (struct bfd_target): Add _bfd_link_just_syms.
+ (BFD_JUMP_TABLE_LINK): And here.
+ * tekhex.c (tekhex_bfd_link_just_syms): Define.
+ * versados.c (versados_bfd_link_just_syms): Define.
+ * vms.c (vms_bfd_link_just_syms): Define.
+ * libbfd.h: Regenerate.
+ * bfd-in2.h: Regenerate.
+
2002-05-15 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
* elf32-mips.c: Remove superfluous definitions copied from
diff --git a/bfd/aix5ppc-core.c b/bfd/aix5ppc-core.c
index 5ba182f..12f4917 100644
--- a/bfd/aix5ppc-core.c
+++ b/bfd/aix5ppc-core.c
@@ -328,7 +328,7 @@ int xcoff64_core_file_failing_signal PARAMS ((bfd *));
const bfd_target *
xcoff64_core_p (abfd)
- bfd *abfd;
+ bfd *abfd ATTRIBUTE_UNUSED;
{
bfd_set_error (bfd_error_wrong_format);
return 0;
@@ -336,22 +336,22 @@ xcoff64_core_p (abfd)
boolean
xcoff64_core_file_matches_executable_p (core_bfd, exec_bfd)
- bfd *core_bfd;
- bfd *exec_bfd;
+ bfd *core_bfd ATTRIBUTE_UNUSED;
+ bfd *exec_bfd ATTRIBUTE_UNUSED;
{
return false;
}
char *
xcoff64_core_file_failing_command (abfd)
- bfd *abfd;
+ bfd *abfd ATTRIBUTE_UNUSED;
{
return 0;
}
int
xcoff64_core_file_failing_signal (abfd)
- bfd *abfd;
+ bfd *abfd ATTRIBUTE_UNUSED;
{
return 0;
}
diff --git a/bfd/aout-adobe.c b/bfd/aout-adobe.c
index 01f2691..c11c504 100644
--- a/bfd/aout-adobe.c
+++ b/bfd/aout-adobe.c
@@ -515,6 +515,7 @@ aout_adobe_sizeof_headers (ignore_abfd, ignore)
#define aout_32_bfd_link_hash_table_free \
_bfd_generic_link_hash_table_free
#define aout_32_bfd_link_add_symbols _bfd_generic_link_add_symbols
+#define aout_32_bfd_link_just_syms _bfd_generic_link_just_syms
#define aout_32_bfd_final_link _bfd_generic_final_link
#define aout_32_bfd_link_split_section _bfd_generic_link_split_section
diff --git a/bfd/aout-target.h b/bfd/aout-target.h
index 30c735a..15a2568 100644
--- a/bfd/aout-target.h
+++ b/bfd/aout-target.h
@@ -534,6 +534,9 @@ MY_bfd_final_link (abfd, info)
#ifndef MY_bfd_link_add_symbols
#define MY_bfd_link_add_symbols NAME(aout,link_add_symbols)
#endif
+#ifndef MY_bfd_link_just_syms
+#define MY_bfd_link_just_syms _bfd_generic_link_just_syms
+#endif
#ifndef MY_bfd_link_split_section
#define MY_bfd_link_split_section _bfd_generic_link_split_section
#endif
diff --git a/bfd/aout-tic30.c b/bfd/aout-tic30.c
index 58ef3ea..e00c137 100644
--- a/bfd/aout-tic30.c
+++ b/bfd/aout-tic30.c
@@ -986,6 +986,9 @@ tic30_aout_set_arch_mach (abfd, arch, machine)
#ifndef MY_bfd_link_add_symbols
#define MY_bfd_link_add_symbols NAME(aout,link_add_symbols)
#endif
+#ifndef MY_bfd_link_just_syms
+#define MY_bfd_link_just_syms _bfd_generic_link_just_syms
+#endif
#ifndef MY_bfd_link_split_section
#define MY_bfd_link_split_section _bfd_generic_link_split_section
#endif
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index 774d439..0dfc073 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -3510,6 +3510,9 @@ bfd_set_private_flags PARAMS ((bfd *abfd, flagword flags));
#define bfd_link_add_symbols(abfd, info) \
BFD_SEND (abfd, _bfd_link_add_symbols, (abfd, info))
+#define bfd_link_just_syms(sec, info) \
+ BFD_SEND (abfd, _bfd_link_just_syms, (sec, info))
+
#define bfd_final_link(abfd, info) \
BFD_SEND (abfd, _bfd_final_link, (abfd, info))
@@ -3834,6 +3837,7 @@ CONCAT2 (NAME,_bfd_relax_section), \
CONCAT2 (NAME,_bfd_link_hash_table_create), \
CONCAT2 (NAME,_bfd_link_hash_table_free), \
CONCAT2 (NAME,_bfd_link_add_symbols), \
+CONCAT2 (NAME,_bfd_link_just_syms), \
CONCAT2 (NAME,_bfd_final_link), \
CONCAT2 (NAME,_bfd_link_split_section), \
CONCAT2 (NAME,_bfd_gc_sections), \
@@ -3856,6 +3860,9 @@ CONCAT2 (NAME,_bfd_merge_sections)
/* Add symbols from this object file into the hash table. */
boolean (*_bfd_link_add_symbols) PARAMS ((bfd *, struct bfd_link_info *));
+ /* Indicate that we are only retrieving symbol values from this section. */
+ void (*_bfd_link_just_syms) PARAMS ((asection *, struct bfd_link_info *));
+
/* Do a link based on the link_order structures attached to each
section of the BFD. */
boolean (*_bfd_final_link) PARAMS ((bfd *, struct bfd_link_info *));
diff --git a/bfd/bfd.c b/bfd/bfd.c
index c1135c8..9de4d53 100644
--- a/bfd/bfd.c
+++ b/bfd/bfd.c
@@ -1195,6 +1195,9 @@ DESCRIPTION
.#define bfd_link_add_symbols(abfd, info) \
. BFD_SEND (abfd, _bfd_link_add_symbols, (abfd, info))
.
+.#define bfd_link_just_syms(sec, info) \
+. BFD_SEND (abfd, _bfd_link_just_syms, (sec, info))
+.
.#define bfd_final_link(abfd, info) \
. BFD_SEND (abfd, _bfd_final_link, (abfd, info))
.
diff --git a/bfd/binary.c b/bfd/binary.c
index 3207e89..3a03901 100644
--- a/bfd/binary.c
+++ b/bfd/binary.c
@@ -339,6 +339,7 @@ binary_sizeof_headers (abfd, exec)
#define binary_bfd_merge_sections bfd_generic_merge_sections
#define binary_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
#define binary_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
+#define binary_bfd_link_just_syms _bfd_generic_link_just_syms
#define binary_bfd_link_add_symbols _bfd_generic_link_add_symbols
#define binary_bfd_final_link _bfd_generic_final_link
#define binary_bfd_link_split_section _bfd_generic_link_split_section
diff --git a/bfd/bout.c b/bfd/bout.c
index 0e070ad..d02364e 100644
--- a/bfd/bout.c
+++ b/bfd/bout.c
@@ -1451,6 +1451,7 @@ b_out_bfd_get_relocated_section_contents (output_bfd, link_info, link_order,
#define b_out_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
#define b_out_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
#define b_out_bfd_link_add_symbols _bfd_generic_link_add_symbols
+#define b_out_bfd_link_just_syms _bfd_generic_link_just_syms
#define b_out_bfd_final_link _bfd_generic_final_link
#define b_out_bfd_link_split_section _bfd_generic_link_split_section
#define b_out_bfd_gc_sections bfd_generic_gc_sections
diff --git a/bfd/coff-rs6000.c b/bfd/coff-rs6000.c
index 10ef5df..f560c7f 100644
--- a/bfd/coff-rs6000.c
+++ b/bfd/coff-rs6000.c
@@ -4167,7 +4167,8 @@ const bfd_target rs6000coff_vec =
_bfd_xcoff_bfd_link_hash_table_create, /* _bfd_link_hash_table_create */
_bfd_generic_link_hash_table_free, /* _bfd_link_hash_table_free */
_bfd_xcoff_bfd_link_add_symbols, /* _bfd_link_add_symbols */
- _bfd_xcoff_bfd_final_link, /* _bfd_filnal_link */
+ _bfd_generic_link_just_syms, /* _bfd_link_just_syms */
+ _bfd_xcoff_bfd_final_link, /* _bfd_final_link */
_bfd_generic_link_split_section, /* _bfd_link_split_section */
bfd_generic_gc_sections, /* _bfd_gc_sections */
bfd_generic_merge_sections, /* _bfd_merge_sections */
@@ -4428,7 +4429,8 @@ const bfd_target pmac_xcoff_vec =
_bfd_xcoff_bfd_link_hash_table_create, /* _bfd_link_hash_table_create */
_bfd_generic_link_hash_table_free, /* _bfd_link_hash_table_free */
_bfd_xcoff_bfd_link_add_symbols, /* _bfd_link_add_symbols */
- _bfd_xcoff_bfd_final_link, /* _bfd_filnal_link */
+ _bfd_generic_link_just_syms, /* _bfd_link_just_syms */
+ _bfd_xcoff_bfd_final_link, /* _bfd_final_link */
_bfd_generic_link_split_section, /* _bfd_link_split_section */
bfd_generic_gc_sections, /* _bfd_gc_sections */
bfd_generic_merge_sections, /* _bfd_merge_sections */
diff --git a/bfd/coff64-rs6000.c b/bfd/coff64-rs6000.c
index 931a914..5ed5be4 100644
--- a/bfd/coff64-rs6000.c
+++ b/bfd/coff64-rs6000.c
@@ -2712,7 +2712,8 @@ const bfd_target rs6000coff64_vec =
_bfd_xcoff_bfd_link_hash_table_create,/* _bfd_link_hash_table_create */
_bfd_generic_link_hash_table_free, /* _bfd_link_hash_table_free */
_bfd_xcoff_bfd_link_add_symbols, /* _bfd_link_add_symbols */
- _bfd_xcoff_bfd_final_link, /* _bfd_filnal_link */
+ _bfd_generic_link_just_syms, /* _bfd_link_just_syms */
+ _bfd_xcoff_bfd_final_link, /* _bfd_final_link */
_bfd_generic_link_split_section, /* _bfd_link_split_section */
bfd_generic_gc_sections, /* _bfd_gc_sections */
bfd_generic_merge_sections, /* _bfd_merge_sections */
@@ -2964,7 +2965,8 @@ const bfd_target aix5coff64_vec =
_bfd_xcoff_bfd_link_hash_table_create,/* _bfd_link_hash_table_create */
_bfd_generic_link_hash_table_free, /* _bfd_link_hash_table_free */
_bfd_xcoff_bfd_link_add_symbols, /* _bfd_link_add_symbols */
- _bfd_xcoff_bfd_final_link, /* _bfd_filnal_link */
+ _bfd_generic_link_just_syms, /* _bfd_link_just_syms */
+ _bfd_xcoff_bfd_final_link, /* _bfd_final_link */
_bfd_generic_link_split_section, /* _bfd_link_split_section */
bfd_generic_gc_sections, /* _bfd_gc_sections */
bfd_generic_merge_sections, /* _bfd_merge_sections */
diff --git a/bfd/coffcode.h b/bfd/coffcode.h
index eadb898..cea516f 100644
--- a/bfd/coffcode.h
+++ b/bfd/coffcode.h
@@ -5175,6 +5175,7 @@ dummy_reloc16_extra_cases (abfd, link_info, link_order, reloc, data, src_ptr,
#define coff_bfd_final_link _bfd_generic_final_link
#endif /* ! defined (coff_relocate_section) */
+#define coff_bfd_link_just_syms _bfd_generic_link_just_syms
#define coff_bfd_link_split_section _bfd_generic_link_split_section
#ifndef coff_start_final_link
diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
index 5959077..06661d5 100644
--- a/bfd/elf-bfd.h
+++ b/bfd/elf-bfd.h
@@ -230,6 +230,7 @@ enum elf_link_info_type
ELF_INFO_TYPE_MERGE,
ELF_INFO_TYPE_EH_FRAME,
ELF_INFO_TYPE_EH_FRAME_HDR,
+ ELF_INFO_TYPE_JUST_SYMS,
ELF_INFO_TYPE_LAST
};
@@ -908,7 +909,8 @@ struct bfd_elf_section_data
#define elf_discarded_section(sec) \
(!bfd_is_abs_section(sec) \
&& bfd_is_abs_section((sec)->output_section) \
- && elf_section_data (sec)->sec_info_type != ELF_INFO_TYPE_MERGE)
+ && elf_section_data (sec)->sec_info_type != ELF_INFO_TYPE_MERGE \
+ && elf_section_data (sec)->sec_info_type != ELF_INFO_TYPE_JUST_SYMS)
#define get_elf_backend_data(abfd) \
((struct elf_backend_data *) (abfd)->xvec->backend_data)
@@ -1226,10 +1228,10 @@ extern boolean _bfd_elf_link_hash_table_init
const char *)));
extern boolean _bfd_elf_slurp_version_tables
PARAMS ((bfd *));
-
extern boolean _bfd_elf_merge_sections
PARAMS ((bfd *, struct bfd_link_info *));
-
+extern void _bfd_elf_link_just_syms
+ PARAMS ((asection *, struct bfd_link_info *));
extern boolean _bfd_elf_copy_private_symbol_data
PARAMS ((bfd *, asymbol *, bfd *, asymbol *));
extern boolean _bfd_elf_copy_private_section_data
diff --git a/bfd/elf-eh-frame.c b/bfd/elf-eh-frame.c
index 6a23edb..6f10cd7 100644
--- a/bfd/elf-eh-frame.c
+++ b/bfd/elf-eh-frame.c
@@ -787,7 +787,7 @@ _bfd_elf_maybe_strip_eh_frame_hdr (info)
struct eh_frame_hdr_info *hdr_info;
sec = bfd_get_section_by_name (elf_hash_table (info)->dynobj, ".eh_frame_hdr");
- if (sec == NULL)
+ if (sec == NULL || bfd_is_abs_section (sec->output_section))
return true;
hdr_info
@@ -805,7 +805,7 @@ _bfd_elf_maybe_strip_eh_frame_hdr (info)
/* Count only sections which have at least a single CIE or FDE.
There cannot be any CIE or FDE <= 8 bytes. */
o = bfd_get_section_by_name (abfd, ".eh_frame");
- if (o && o->_raw_size > 8)
+ if (o && o->_raw_size > 8 && !bfd_is_abs_section (o->output_section))
break;
}
diff --git a/bfd/elf.c b/bfd/elf.c
index f8fdbd2..c3339f9 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -814,6 +814,19 @@ _bfd_elf_merge_sections (abfd, info)
merge_sections_remove_hook);
return true;
}
+
+void
+_bfd_elf_link_just_syms (sec, info)
+ asection *sec;
+ struct bfd_link_info *info;
+{
+ sec->output_section = bfd_abs_section_ptr;
+ sec->output_offset = sec->vma;
+ if (!is_elf_hash_table (info))
+ return;
+
+ elf_section_data (sec)->sec_info_type = ELF_INFO_TYPE_JUST_SYMS;
+}
/* Copy the program header and other data from one object module to
another. */
diff --git a/bfd/elflink.h b/bfd/elflink.h
index bfe6374..5a818bb 100644
--- a/bfd/elflink.h
+++ b/bfd/elflink.h
@@ -2258,7 +2258,9 @@ elf_link_add_object_symbols (abfd, info)
asection *stab, *stabstr;
stab = bfd_get_section_by_name (abfd, ".stab");
- if (stab != NULL && !(stab->flags & SEC_MERGE))
+ if (stab != NULL
+ && (stab->flags & SEC_MERGE) == 0
+ && !bfd_is_abs_section (stab->output_section))
{
stabstr = bfd_get_section_by_name (abfd, ".stabstr");
@@ -2284,7 +2286,8 @@ elf_link_add_object_symbols (abfd, info)
asection *s;
for (s = abfd->sections; s != NULL; s = s->next)
- if (s->flags & SEC_MERGE)
+ if ((s->flags & SEC_MERGE) != 0
+ && !bfd_is_abs_section (s->output_section))
{
struct bfd_elf_section_data *secdata;
@@ -8267,11 +8270,19 @@ elf_bfd_discard_info (output_bfd, info)
if (ehdr)
{
eh = bfd_get_section_by_name (abfd, ".eh_frame");
- if (eh && eh->_raw_size == 0)
+ if (eh && (eh->_raw_size == 0
+ || bfd_is_abs_section (eh->output_section)))
eh = NULL;
}
- stab = strip ? NULL : bfd_get_section_by_name (abfd, ".stab");
+ stab = NULL;
+ if (!strip)
+ {
+ stab = bfd_get_section_by_name (abfd, ".stab");
+ if (stab && (stab->_raw_size == 0
+ || bfd_is_abs_section (stab->output_section)))
+ stab = NULL;
+ }
if ((! stab
|| elf_section_data(stab)->sec_info_type != ELF_INFO_TYPE_STABS)
&& ! eh
diff --git a/bfd/elfxx-target.h b/bfd/elfxx-target.h
index 7d391d4..08b680a 100644
--- a/bfd/elfxx-target.h
+++ b/bfd/elfxx-target.h
@@ -194,6 +194,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define bfd_elfNN_bfd_final_link _bfd_generic_final_link
#endif
#endif /* ! defined (elf_backend_relocate_section) */
+
+#ifndef bfd_elfNN_bfd_link_just_syms
+#define bfd_elfNN_bfd_link_just_syms _bfd_elf_link_just_syms
+#endif
+
#ifndef bfd_elfNN_bfd_link_split_section
#define bfd_elfNN_bfd_link_split_section _bfd_generic_link_split_section
#endif
diff --git a/bfd/i386msdos.c b/bfd/i386msdos.c
index 655ecfd..0edb90e 100644
--- a/bfd/i386msdos.c
+++ b/bfd/i386msdos.c
@@ -176,6 +176,7 @@ msdos_set_section_contents (abfd, section, location, offset, count)
#define msdos_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
#define msdos_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
#define msdos_bfd_link_add_symbols _bfd_generic_link_add_symbols
+#define msdos_bfd_link_just_syms _bfd_generic_link_just_syms
#define msdos_bfd_final_link _bfd_generic_final_link
#define msdos_bfd_link_split_section _bfd_generic_link_split_section
#define msdos_set_arch_mach _bfd_generic_set_arch_mach
diff --git a/bfd/i386os9k.c b/bfd/i386os9k.c
index 099a714..47f9ef3 100644
--- a/bfd/i386os9k.c
+++ b/bfd/i386os9k.c
@@ -332,6 +332,7 @@ os9k_sizeof_headers (ignore_abfd, ignore)
#define os9k_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
#define os9k_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
#define os9k_bfd_link_add_symbols _bfd_generic_link_add_symbols
+#define os9k_bfd_link_just_syms _bfd_generic_link_just_syms
#define os9k_bfd_final_link _bfd_generic_final_link
#define os9k_bfd_link_split_section _bfd_generic_link_split_section
diff --git a/bfd/ieee.c b/bfd/ieee.c
index cd56101..8439f6d 100644
--- a/bfd/ieee.c
+++ b/bfd/ieee.c
@@ -4013,6 +4013,7 @@ ieee_bfd_debug_info_accumulate (abfd, section)
#define ieee_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
#define ieee_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
#define ieee_bfd_link_add_symbols _bfd_generic_link_add_symbols
+#define ieee_bfd_link_just_syms _bfd_generic_link_just_syms
#define ieee_bfd_final_link _bfd_generic_final_link
#define ieee_bfd_link_split_section _bfd_generic_link_split_section
diff --git a/bfd/ihex.c b/bfd/ihex.c
index 0aad164..cee736a 100644
--- a/bfd/ihex.c
+++ b/bfd/ihex.c
@@ -980,6 +980,7 @@ ihex_sizeof_headers (abfd, exec)
#define ihex_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
#define ihex_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
#define ihex_bfd_link_add_symbols _bfd_generic_link_add_symbols
+#define ihex_bfd_link_just_syms _bfd_generic_link_just_syms
#define ihex_bfd_final_link _bfd_generic_final_link
#define ihex_bfd_link_split_section _bfd_generic_link_split_section
diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h
index 68006fa..106ba8d 100644
--- a/bfd/libbfd-in.h
+++ b/bfd/libbfd-in.h
@@ -328,6 +328,8 @@ extern boolean _bfd_generic_set_section_contents
((void (*) PARAMS ((struct bfd_link_hash_table *))) bfd_void)
#define _bfd_nolink_bfd_link_add_symbols \
((boolean (*) PARAMS ((bfd *, struct bfd_link_info *))) bfd_false)
+#define _bfd_nolink_bfd_link_just_syms \
+ ((void (*) PARAMS ((asection *, struct bfd_link_info *))) bfd_void)
#define _bfd_nolink_bfd_final_link \
((boolean (*) PARAMS ((bfd *, struct bfd_link_info *))) bfd_false)
#define _bfd_nolink_bfd_link_split_section \
@@ -410,8 +412,6 @@ extern boolean _bfd_generic_link_add_archive_symbols
PARAMS ((bfd *, struct bfd_link_info *,
boolean (*checkfn) (bfd *, struct bfd_link_info *, boolean *)));
-
-
/* Forward declaration to avoid prototype errors. */
typedef struct bfd_link_hash_entry _bfd_link_hash_entry;
@@ -421,6 +421,10 @@ extern boolean _bfd_generic_link_add_one_symbol
asection *, bfd_vma, const char *, boolean copy,
boolean constructor, struct bfd_link_hash_entry **));
+/* Generic routine to mark section as supplying symbols only. */
+extern void _bfd_generic_link_just_syms
+ PARAMS ((asection *, struct bfd_link_info *));
+
/* Generic link routine. */
extern boolean _bfd_generic_final_link
PARAMS ((bfd *, struct bfd_link_info *));
diff --git a/bfd/libbfd.h b/bfd/libbfd.h
index cbe4973..2fe674c 100644
--- a/bfd/libbfd.h
+++ b/bfd/libbfd.h
@@ -333,6 +333,8 @@ extern boolean _bfd_generic_set_section_contents
((void (*) PARAMS ((struct bfd_link_hash_table *))) bfd_void)
#define _bfd_nolink_bfd_link_add_symbols \
((boolean (*) PARAMS ((bfd *, struct bfd_link_info *))) bfd_false)
+#define _bfd_nolink_bfd_link_just_syms \
+ ((void (*) PARAMS ((asection *, struct bfd_link_info *))) bfd_void)
#define _bfd_nolink_bfd_final_link \
((boolean (*) PARAMS ((bfd *, struct bfd_link_info *))) bfd_false)
#define _bfd_nolink_bfd_link_split_section \
@@ -415,8 +417,6 @@ extern boolean _bfd_generic_link_add_archive_symbols
PARAMS ((bfd *, struct bfd_link_info *,
boolean (*checkfn) (bfd *, struct bfd_link_info *, boolean *)));
-
-
/* Forward declaration to avoid prototype errors. */
typedef struct bfd_link_hash_entry _bfd_link_hash_entry;
@@ -426,6 +426,10 @@ extern boolean _bfd_generic_link_add_one_symbol
asection *, bfd_vma, const char *, boolean copy,
boolean constructor, struct bfd_link_hash_entry **));
+/* Generic routine to mark section as supplying symbols only. */
+extern void _bfd_generic_link_just_syms
+ PARAMS ((asection *, struct bfd_link_info *));
+
/* Generic link routine. */
extern boolean _bfd_generic_final_link
PARAMS ((bfd *, struct bfd_link_info *));
diff --git a/bfd/libecoff.h b/bfd/libecoff.h
index c900ee8..eb90a8c 100644
--- a/bfd/libecoff.h
+++ b/bfd/libecoff.h
@@ -333,6 +333,7 @@ extern struct bfd_link_hash_table *_bfd_ecoff_bfd_link_hash_table_create
#define _bfd_ecoff_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
extern boolean _bfd_ecoff_bfd_link_add_symbols
PARAMS ((bfd *, struct bfd_link_info *));
+#define _bfd_ecoff_bfd_link_just_syms _bfd_generic_link_just_syms
extern boolean _bfd_ecoff_bfd_final_link
PARAMS ((bfd *, struct bfd_link_info *));
diff --git a/bfd/linker.c b/bfd/linker.c
index b4b9f29..8d22872 100644
--- a/bfd/linker.c
+++ b/bfd/linker.c
@@ -757,6 +757,19 @@ _bfd_generic_link_add_symbols_collect (abfd, info)
return generic_link_add_symbols (abfd, info, true);
}
+/* Indicate that we are only retrieving symbol values from this
+ section. We want the symbols to act as though the values in the
+ file are absolute. */
+
+void
+_bfd_generic_link_just_syms (sec, info)
+ asection *sec;
+ struct bfd_link_info *info ATTRIBUTE_UNUSED;
+{
+ sec->output_section = bfd_abs_section_ptr;
+ sec->output_offset = sec->vma;
+}
+
/* Add symbols from an object file to the global hash table. */
static boolean
diff --git a/bfd/mmo.c b/bfd/mmo.c
index fe70a18..9459383 100644
--- a/bfd/mmo.c
+++ b/bfd/mmo.c
@@ -3247,6 +3247,7 @@ mmo_canonicalize_reloc (abfd, section, relptr, symbols)
#define mmo_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
#define mmo_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
#define mmo_bfd_link_add_symbols _bfd_generic_link_add_symbols
+#define mmo_bfd_link_just_syms _bfd_generic_link_just_syms
#define mmo_bfd_final_link _bfd_generic_final_link
#define mmo_bfd_link_split_section _bfd_generic_link_split_section
diff --git a/bfd/nlm-target.h b/bfd/nlm-target.h
index 79877fe..e8f4626 100644
--- a/bfd/nlm-target.h
+++ b/bfd/nlm-target.h
@@ -47,6 +47,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define nlm_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
#define nlm_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
#define nlm_bfd_link_add_symbols _bfd_generic_link_add_symbols
+#define nlm_bfd_link_just_syms _bfd_generic_link_just_syms
#define nlm_bfd_final_link _bfd_generic_final_link
#define nlm_bfd_link_split_section _bfd_generic_link_split_section
diff --git a/bfd/oasys.c b/bfd/oasys.c
index 4cadb69..5c2bf5e 100644
--- a/bfd/oasys.c
+++ b/bfd/oasys.c
@@ -1493,6 +1493,7 @@ oasys_sizeof_headers (abfd, exec)
#define oasys_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
#define oasys_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
#define oasys_bfd_link_add_symbols _bfd_generic_link_add_symbols
+#define oasys_bfd_link_just_syms _bfd_generic_link_just_syms
#define oasys_bfd_final_link _bfd_generic_final_link
#define oasys_bfd_link_split_section _bfd_generic_link_split_section
diff --git a/bfd/ppcboot.c b/bfd/ppcboot.c
index d40590f..22043b5 100644
--- a/bfd/ppcboot.c
+++ b/bfd/ppcboot.c
@@ -472,6 +472,7 @@ ppcboot_bfd_print_private_bfd_data (abfd, farg)
#define ppcboot_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
#define ppcboot_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
#define ppcboot_bfd_link_add_symbols _bfd_generic_link_add_symbols
+#define ppcboot_bfd_link_just_syms _bfd_generic_link_just_syms
#define ppcboot_bfd_final_link _bfd_generic_final_link
#define ppcboot_bfd_link_split_section _bfd_generic_link_split_section
#define ppcboot_get_section_contents_in_window \
diff --git a/bfd/som.c b/bfd/som.c
index 4672379..55c9013 100644
--- a/bfd/som.c
+++ b/bfd/som.c
@@ -6335,6 +6335,7 @@ som_bfd_link_split_section (abfd, sec)
#define som_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
#define som_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
#define som_bfd_link_add_symbols _bfd_generic_link_add_symbols
+#define som_bfd_link_just_syms _bfd_generic_link_just_syms
#define som_bfd_final_link _bfd_generic_final_link
#define som_bfd_gc_sections bfd_generic_gc_sections
diff --git a/bfd/srec.c b/bfd/srec.c
index f40af69..b556f26 100644
--- a/bfd/srec.c
+++ b/bfd/srec.c
@@ -1273,6 +1273,7 @@ srec_print_symbol (abfd, afile, symbol, how)
#define srec_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
#define srec_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
#define srec_bfd_link_add_symbols _bfd_generic_link_add_symbols
+#define srec_bfd_link_just_syms _bfd_generic_link_just_syms
#define srec_bfd_final_link _bfd_generic_final_link
#define srec_bfd_link_split_section _bfd_generic_link_split_section
diff --git a/bfd/targets.c b/bfd/targets.c
index b9d3a93..c53afdd 100644
--- a/bfd/targets.c
+++ b/bfd/targets.c
@@ -396,6 +396,7 @@ the tokens.
.CONCAT2 (NAME,_bfd_link_hash_table_create), \
.CONCAT2 (NAME,_bfd_link_hash_table_free), \
.CONCAT2 (NAME,_bfd_link_add_symbols), \
+.CONCAT2 (NAME,_bfd_link_just_syms), \
.CONCAT2 (NAME,_bfd_final_link), \
.CONCAT2 (NAME,_bfd_link_split_section), \
.CONCAT2 (NAME,_bfd_gc_sections), \
@@ -418,6 +419,9 @@ the tokens.
. {* Add symbols from this object file into the hash table. *}
. boolean (*_bfd_link_add_symbols) PARAMS ((bfd *, struct bfd_link_info *));
.
+. {* Indicate that we are only retrieving symbol values from this section. *}
+. void (*_bfd_link_just_syms) PARAMS ((asection *, struct bfd_link_info *));
+.
. {* Do a link based on the link_order structures attached to each
. section of the BFD. *}
. boolean (*_bfd_final_link) PARAMS ((bfd *, struct bfd_link_info *));
diff --git a/bfd/tekhex.c b/bfd/tekhex.c
index 565568a..4391da1 100644
--- a/bfd/tekhex.c
+++ b/bfd/tekhex.c
@@ -1008,6 +1008,7 @@ tekhex_print_symbol (abfd, filep, symbol, how)
#define tekhex_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
#define tekhex_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
#define tekhex_bfd_link_add_symbols _bfd_generic_link_add_symbols
+#define tekhex_bfd_link_just_syms _bfd_generic_link_just_syms
#define tekhex_bfd_final_link _bfd_generic_final_link
#define tekhex_bfd_link_split_section _bfd_generic_link_split_section
diff --git a/bfd/versados.c b/bfd/versados.c
index 9a7bcc7..e1cd9f7 100644
--- a/bfd/versados.c
+++ b/bfd/versados.c
@@ -870,6 +870,7 @@ versados_canonicalize_reloc (abfd, section, relptr, symbols)
#define versados_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
#define versados_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
#define versados_bfd_link_add_symbols _bfd_generic_link_add_symbols
+#define versados_bfd_link_just_syms _bfd_generic_link_just_syms
#define versados_bfd_final_link _bfd_generic_final_link
#define versados_bfd_link_split_section _bfd_generic_link_split_section
diff --git a/bfd/vms.c b/bfd/vms.c
index 7ca7459..d2fb16b 100644
--- a/bfd/vms.c
+++ b/bfd/vms.c
@@ -132,6 +132,7 @@ static boolean vms_bfd_merge_private_bfd_data PARAMS ((bfd *ibfd, bfd *obfd));
static boolean vms_bfd_set_private_flags PARAMS ((bfd *abfd, flagword flags));
#define vms_make_empty_symbol _bfd_generic_make_empty_symbol
+#define vms_bfd_link_just_syms _bfd_generic_link_just_syms
/*===========================================================================*/