This is the mail archive of the binutils-cvs@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] bfd/elf32-arm.c: Improve comment in elf32_arm_finish_dynamic_symbol


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=3a63561744873b54e13c45923fba4aaca7a2fec7

commit 3a63561744873b54e13c45923fba4aaca7a2fec7
Author: Will Newton <will.newton@linaro.org>
Date:   Tue Feb 3 12:51:14 2015 +0000

    bfd/elf32-arm.c: Improve comment in elf32_arm_finish_dynamic_symbol
    
    Improve the comment discussing why we clear st_value for some
    symbols.
    
    bfd/ChangeLog:
    
    2015-02-03  Will Newton  <will.newton@linaro.org>
    
    	* elf32-arm.c (elf32_arm_finish_dynamic_symbol): Improve
    	  comment discussing why we clear st_value for some symbols.

Diff:
---
 bfd/ChangeLog   |  5 +++++
 bfd/elf32-arm.c | 10 +++++++---
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 5942e1c..e6f0418 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+2015-02-03  Will Newton  <will.newton@linaro.org>
+
+	* elf32-arm.c (elf32_arm_finish_dynamic_symbol): Improve
+	  comment discussing why we clear st_value for some symbols.
+
 2015-02-02  Kuan-Lin Chen  <kuanlinchentw@gmail.com>
 
 	* elf32-nds32.c (nds32_get_section_contents): Add one more argument.
diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
index 3ebd1f3..5801fe9 100644
--- a/bfd/elf32-arm.c
+++ b/bfd/elf32-arm.c
@@ -14238,12 +14238,16 @@ elf32_arm_finish_dynamic_symbol (bfd * output_bfd,
       if (!h->def_regular)
 	{
 	  /* Mark the symbol as undefined, rather than as defined in
-	     the .plt section.  Leave the value alone.  */
+	     the .plt section.  */
 	  sym->st_shndx = SHN_UNDEF;
-	  /* If the symbol is weak, we do need to clear the value.
+	  /* If the symbol is weak we need to clear the value.
 	     Otherwise, the PLT entry would provide a definition for
 	     the symbol even if the symbol wasn't defined anywhere,
-	     and so the symbol would never be NULL.  */
+	     and so the symbol would never be NULL.  Leave the value if
+	     there were any relocations where pointer equality matters
+	     (this is a clue for the dynamic linker, to make function
+	     pointer comparisons work between an application and shared
+	     library).  */
 	  if (!h->ref_regular_nonweak || !h->pointer_equality_needed)
 	    sym->st_value = 0;
 	}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]