aboutsummaryrefslogtreecommitdiff
path: root/bfd/elflink.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2017-08-07 08:02:12 -0700
committerH.J. Lu <hjl.tools@gmail.com>2017-08-07 08:02:29 -0700
commit2980ccad5958af178f80fd2a2a0fa781bf91b0aa (patch)
tree695fd3892c2d21a8d7261943dd707ec9a5c3b88a /bfd/elflink.c
parente347efc38b8b1eb6561248875c4bb2f9b074894b (diff)
downloadgdb-2980ccad5958af178f80fd2a2a0fa781bf91b0aa.zip
gdb-2980ccad5958af178f80fd2a2a0fa781bf91b0aa.tar.gz
gdb-2980ccad5958af178f80fd2a2a0fa781bf91b0aa.tar.bz2
Move common symbol check after bed->common_definition
bfd/ * elflink.c (elf_link_add_object_symbols): Move common symbol check after bed->common_definition. ld/ * testsuite/ld-elf/pr21903.s (start): Removed. (_start): Likewise. (__start): Likewise. (main): Likewise. (bar): New.
Diffstat (limited to 'bfd/elflink.c')
-rw-r--r--bfd/elflink.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/bfd/elflink.c b/bfd/elflink.c
index b89d537..424de21 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -4250,15 +4250,16 @@ error_free_dyn:
override = FALSE;
- /* Treat common symbol as undefined for --no-define-common. */
- if (isym->st_shndx == SHN_COMMON
- && info->inhibit_common_definition)
- isym->st_shndx = SHN_UNDEF;
-
flags = BSF_NO_FLAGS;
sec = NULL;
value = isym->st_value;
common = bed->common_definition (isym);
+ if (common && info->inhibit_common_definition)
+ {
+ /* Treat common symbol as undefined for --no-define-common. */
+ isym->st_shndx = SHN_UNDEF;
+ common = FALSE;
+ }
discarded = FALSE;
bind = ELF_ST_BIND (isym->st_info);