sourceware_bz_21666.patch 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. From 388b4f1a02f3a801965028bbfcd48d905638b797 Mon Sep 17 00:00:00 2001
  2. From: "H.J. Lu" <hjl.tools@gmail.com>
  3. Date: Fri, 23 Jun 2017 14:38:46 -0700
  4. Subject: [PATCH] Avoid .symver on common symbols [BZ #21666]
  5. The .symver directive on common symbol just creates a new common symbol,
  6. not an alias and the newer assembler with the bug fix for
  7. https://sourceware.org/bugzilla/show_bug.cgi?id=21661
  8. will issue an error. Before the fix, we got
  9. $ readelf -sW libc.so | grep "loc[12s]"
  10. 5109: 00000000003a0608 8 OBJECT LOCAL DEFAULT 36 loc1
  11. 5188: 00000000003a0610 8 OBJECT LOCAL DEFAULT 36 loc2
  12. 5455: 00000000003a0618 8 OBJECT LOCAL DEFAULT 36 locs
  13. 6575: 00000000003a05f0 8 OBJECT GLOBAL DEFAULT 36 locs@GLIBC_2.2.5
  14. 7156: 00000000003a05f8 8 OBJECT GLOBAL DEFAULT 36 loc1@GLIBC_2.2.5
  15. 7312: 00000000003a0600 8 OBJECT GLOBAL DEFAULT 36 loc2@GLIBC_2.2.5
  16. in libc.so. The versioned loc1, loc2 and locs have the wrong addresses.
  17. After the fix, we got
  18. $ readelf -sW libc.so | grep "loc[12s]"
  19. 6570: 000000000039e3b8 8 OBJECT GLOBAL DEFAULT 34 locs@GLIBC_2.2.5
  20. 7151: 000000000039e3c8 8 OBJECT GLOBAL DEFAULT 34 loc1@GLIBC_2.2.5
  21. 7307: 000000000039e3c0 8 OBJECT GLOBAL DEFAULT 34 loc2@GLIBC_2.2.5
  22. [BZ #21666]
  23. * misc/regexp.c (loc1): Add __attribute__ ((nocommon));
  24. (loc2): Likewise.
  25. (locs): Likewise.
  26. ---
  27. ChangeLog | 7 +++++++
  28. misc/regexp.c | 9 +++++----
  29. 2 files changed, 12 insertions(+), 4 deletions(-)
  30. diff --git a/misc/regexp.c b/misc/regexp.c
  31. index 19d76c0..eaea7c3 100644
  32. --- a/misc/regexp.c
  33. +++ b/misc/regexp.c
  34. @@ -29,14 +29,15 @@
  35. #if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_23)
  36. -/* Define the variables used for the interface. */
  37. -char *loc1;
  38. -char *loc2;
  39. +/* Define the variables used for the interface. Avoid .symver on common
  40. + symbol, which just creates a new common symbol, not an alias. */
  41. +char *loc1 __attribute__ ((nocommon));
  42. +char *loc2 __attribute__ ((nocommon));
  43. compat_symbol (libc, loc1, loc1, GLIBC_2_0);
  44. compat_symbol (libc, loc2, loc2, GLIBC_2_0);
  45. /* Although we do not support the use we define this variable as well. */
  46. -char *locs;
  47. +char *locs __attribute__ ((nocommon));
  48. compat_symbol (libc, locs, locs, GLIBC_2_0);
  49. --
  50. 2.9.3