gas: fix symbol value calculation for versioned symbol aliases
authorChristian Eggers <ceggers@gmx.de>
Sun, 1 Nov 2020 08:10:14 +0000 (09:10 +0100)
committerAlan Modra <amodra@gmail.com>
Tue, 3 Nov 2020 07:47:35 +0000 (18:17 +1030)
Symbol value is in bytes while fragS::fr_address is in octets. Fixes GAS
symver12 and symver13 tests on ELF targets with with OCTETS_PER_BYTE>1.

* config/obj-elf (elf_frob_symbol): Fix symbol value calculation
for versioned symbol aliases.

Signed-off-by: Christian Eggers <ceggers@gmx.de>
gas/ChangeLog
gas/config/obj-elf.c

index b965dbb90ea201f57ff9fc6d03a259d0abb72679..3c2d6891dc445d30bfe9d7ff932d231588120c71 100644 (file)
@@ -1,3 +1,8 @@
+2020-11-03  Christian Eggers  <ceggers@gmx.de>
+
+       * config/obj-elf (elf_frob_symbol): Fix symbol value calculation
+       for versioned symbol aliases.
+
 2020-10-30  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR gas/26703
index f061ea61f3e0e554d7c554c5c8a55b43c4df535b..93eb81e98a422cc2de10a2d449429b131f974145 100644 (file)
@@ -2588,7 +2588,8 @@ elf_frob_symbol (symbolS *symp, int *puntp)
                 because we are in the middle of the final loop.  */
              S_SET_VALUE (symp2,
                           (S_GET_VALUE (symp)
-                           - symbol_get_frag (symp)->fr_address));
+                           - (symbol_get_frag (symp)->fr_address
+                              / OCTETS_PER_BYTE)));
 
              symbol_set_frag (symp2, symbol_get_frag (symp));