OpenSDE Packages Database (without history before r20070)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

101 lines
3.0 KiB

  1. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  2. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  3. #
  4. # Filename: package/.../binutils/ld-glob.patch
  5. # Copyright (C) 2006 The OpenSDE Project
  6. # Copyright (C) 2004 - 2006 The T2 SDE Project
  7. #
  8. # More information can be found in the files COPYING and README.
  9. #
  10. # This patch file is dual-licensed. It is available under the license the
  11. # patched project is licensed under, as long as it is an OpenSource license
  12. # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
  13. # of the GNU General Public License as published by the Free Software
  14. # Foundation; either version 2 of the License, or (at your option) any later
  15. # version.
  16. # --- SDE-COPYRIGHT-NOTE-END ---
  17. This adds /etc/ld.so.conf globbing to the gnu linker. We need this, since we
  18. also patch the glibc's dynamic linker and the linker needs to be able to
  19. scan the directories, too.
  20. - Rene Rebe <rene@exactcode.de>
  21. --- binutils-2.15.94.0.1/ld/emultempl/elf32.em 2004-11-22 21:33:33.000000000 +0100
  22. +++ binutils-2.15.94.0.1-glob/ld/emultempl/elf32.em 2004-12-23 23:40:56.549479128 +0100
  23. @@ -633,7 +633,7 @@
  24. }
  25. while (c != '\0');
  26. }
  27. - else
  28. + else /* normal dir (e.g. no include) */
  29. {
  30. char *dir = p;
  31. while (*p && *p != '=' && *p != ' ' && *p != '\t' && *p != '\f'
  32. @@ -642,14 +642,48 @@
  33. while (p != dir && p[-1] == '/')
  34. --p;
  35. - if (info->path == NULL)
  36. +
  37. + /* cut trailing comments and such */
  38. + p[1] = 0;
  39. +
  40. + /* assume path is a pattern - compare with quite equal glibc patch
  41. + -ReneR */
  42. +
  43. + glob_t result;
  44. + #ifdef GLOB_ONLYDIR
  45. + if (glob(dir, GLOB_ONLYDIR, NULL, &result) == 0) {
  46. + #else
  47. + if (glob(dir, 0, NULL, &result) == 0) {
  48. + #endif
  49. + size_t j;
  50. + for (j = 0; j < result.gl_pathc; j++)
  51. {
  52. + char* x = result.gl_pathv[j];
  53. +
  54. + if (info->path == NULL) {
  55. + info->alloc = strlen(x) + 256;
  56. + info->path = xmalloc (info->alloc);
  57. + info->len = 0;
  58. + }
  59. + else {
  60. + if (info->len + 1 + strlen(x) + 1 >= info->alloc) {
  61. + info->alloc += strlen(x) + 1 + 256;
  62. + info->path = xrealloc (info->path, info->alloc);
  63. + }
  64. + info->path[info->len++] = ':';
  65. + }
  66. + strcpy (info->path + info->len, x);
  67. + info->len += strlen(x);
  68. +
  69. + }
  70. + } else {
  71. + /* error orig. code from binutils - in theory we do not need it */
  72. + if (info->path == NULL) {
  73. info->alloc = p - dir + 1 + 256;
  74. info->path = xmalloc (info->alloc);
  75. info->len = 0;
  76. }
  77. - else
  78. - {
  79. + else {
  80. if (info->len + 1 + (p - dir) >= info->alloc)
  81. {
  82. info->alloc += p - dir + 256;
  83. @@ -657,9 +688,11 @@
  84. }
  85. info->path[info->len++] = ':';
  86. }
  87. - memcpy (info->path + info->len, dir, p - dir);
  88. - info->len += p - dir;
  89. - info->path[info->len] = '\0';
  90. + memcpy (info->path + info->len, dir, p - dir);
  91. + info->len += p - dir;
  92. + info->path[info->len] = '\0';
  93. + }
  94. + globfree (&result);
  95. }
  96. }
  97. while (! feof (f));