300-012_check_ldrunpath_length.patch 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #!/bin/sh -e
  2. ## 012_check_ldrunpath_length.dpatch by Chris Chimelis <[email protected]>
  3. ##
  4. ## All lines beginning with `## DP:' are a description of the patch.
  5. ## DP: Only generate an RPATH entry if LD_RUN_PATH is not empty, for
  6. ## DP: cases where -rpath isn't specified. (#151024)
  7. if [ $# -ne 1 ]; then
  8. echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
  9. exit 1
  10. fi
  11. [ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts
  12. patch_opts="${patch_opts:--f --no-backup-if-mismatch}"
  13. case "$1" in
  14. -patch) patch $patch_opts -p1 < $0;;
  15. -unpatch) patch $patch_opts -p1 -R < $0;;
  16. *)
  17. echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
  18. exit 1;;
  19. esac
  20. exit 0
  21. @DPATCH@
  22. Index: binutils-2.18/ld/emultempl/elf32.em
  23. ===================================================================
  24. --- binutils-2.18.orig/ld/emultempl/elf32.em 2007-06-28 09:19:34.796946512 +0200
  25. +++ binutils-2.18/ld/emultempl/elf32.em 2007-06-28 09:19:36.178736448 +0200
  26. @@ -1216,6 +1216,8 @@
  27. && command_line.rpath == NULL)
  28. {
  29. lib_path = (const char *) getenv ("LD_RUN_PATH");
  30. + if ((lib_path) && (strlen (lib_path) == 0))
  31. + lib_path = NULL;
  32. if (gld${EMULATION_NAME}_search_needed (lib_path, &n,
  33. force))
  34. break;
  35. @@ -1400,6 +1402,8 @@
  36. rpath = command_line.rpath;
  37. if (rpath == NULL)
  38. rpath = (const char *) getenv ("LD_RUN_PATH");
  39. + if ((rpath) && (strlen (rpath) == 0))
  40. + rpath = NULL;
  41. if (! (bfd_elf_size_dynamic_sections
  42. (output_bfd, command_line.soname, rpath,
  43. command_line.filter_shlib,