aboutsummaryrefslogtreecommitdiff
path: root/bfd/linker.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2002-05-22 05:06:18 +0000
committerH.J. Lu <hjl.tools@gmail.com>2002-05-22 05:06:18 +0000
commitc5a43a5dc59c58726cde44ba374c66434ef75bc5 (patch)
treea5baf30af7478e6a86aa71b9cd041a2a5e567374 /bfd/linker.c
parentfcf4f89174eb264391b74f5b39b15ec354c3a2f7 (diff)
downloadfsf-binutils-gdb-c5a43a5dc59c58726cde44ba374c66434ef75bc5.zip
fsf-binutils-gdb-c5a43a5dc59c58726cde44ba374c66434ef75bc5.tar.gz
fsf-binutils-gdb-c5a43a5dc59c58726cde44ba374c66434ef75bc5.tar.bz2
2002-05-21 H.J. Lu (hjl@gnu.org)
* linker.c (_bfd_generic_link_add_one_symbol): Allow multiple definition.
Diffstat (limited to 'bfd/linker.c')
-rw-r--r--bfd/linker.c57
1 files changed, 29 insertions, 28 deletions
diff --git a/bfd/linker.c b/bfd/linker.c
index 8d22872..228f088 100644
--- a/bfd/linker.c
+++ b/bfd/linker.c
@@ -1813,37 +1813,38 @@ _bfd_generic_link_add_one_symbol (info, abfd, name, flags, section, value,
/* Fall through. */
case MDEF:
/* Handle a multiple definition. */
- {
- asection *msec = NULL;
- bfd_vma mval = 0;
+ if (!info->allow_multiple_definition)
+ {
+ asection *msec = NULL;
+ bfd_vma mval = 0;
- switch (h->type)
- {
- case bfd_link_hash_defined:
- msec = h->u.def.section;
- mval = h->u.def.value;
- break;
- case bfd_link_hash_indirect:
- msec = bfd_ind_section_ptr;
- mval = 0;
- break;
- default:
- abort ();
- }
+ switch (h->type)
+ {
+ case bfd_link_hash_defined:
+ msec = h->u.def.section;
+ mval = h->u.def.value;
+ break;
+ case bfd_link_hash_indirect:
+ msec = bfd_ind_section_ptr;
+ mval = 0;
+ break;
+ default:
+ abort ();
+ }
- /* Ignore a redefinition of an absolute symbol to the same
- value; it's harmless. */
- if (h->type == bfd_link_hash_defined
- && bfd_is_abs_section (msec)
- && bfd_is_abs_section (section)
- && value == mval)
- break;
+ /* Ignore a redefinition of an absolute symbol to the
+ same value; it's harmless. */
+ if (h->type == bfd_link_hash_defined
+ && bfd_is_abs_section (msec)
+ && bfd_is_abs_section (section)
+ && value == mval)
+ break;
- if (! ((*info->callbacks->multiple_definition)
- (info, h->root.string, msec->owner, msec, mval, abfd,
- section, value)))
- return false;
- }
+ if (! ((*info->callbacks->multiple_definition)
+ (info, h->root.string, msec->owner, msec, mval,
+ abfd, section, value)))
+ return false;
+ }
break;
case CIND: