0004-patchelf-Check-ELF-endianness-before-writing-new-run.patch 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. From 8c75599b674c73fbfe9c15afeccad54ae88243f5 Mon Sep 17 00:00:00 2001
  2. From: Bryce Ferguson <bryce.ferguson@rockwellcollins.com>
  3. Date: Mon, 25 Jun 2018 13:05:07 -0500
  4. Subject: [PATCH] patchelf: Check ELF endianness before writing new runpath
  5. This commit modifies the way fields are written in the dynamic
  6. section in order to account the architecture of the target ELF
  7. file. Instead of copying the raw data, use the helper functions
  8. to convert endianness.
  9. Link to upstream PR: https://github.com/NixOS/patchelf/pull/151
  10. Signed-off-by: Bryce Ferguson <bryce.ferguson@rockwellcollins.com>
  11. ---
  12. src/patchelf.cc | 4 ++--
  13. 1 file changed, 2 insertions(+), 2 deletions(-)
  14. diff --git a/src/patchelf.cc b/src/patchelf.cc
  15. index 35b4a33..a33f644 100644
  16. --- a/src/patchelf.cc
  17. +++ b/src/patchelf.cc
  18. @@ -1315,13 +1315,13 @@ void ElfFile<ElfFileParamNames>::modifyRPath(RPathOp op, string rootDir, string
  19. debug("new rpath is `%s'\n", newRPath.c_str());
  20. if (!forceRPath && dynRPath && !dynRunPath) { /* convert DT_RPATH to DT_RUNPATH */
  21. - dynRPath->d_tag = DT_RUNPATH;
  22. + wri(dynRPath->d_tag, DT_RUNPATH);
  23. dynRunPath = dynRPath;
  24. dynRPath = 0;
  25. }
  26. if (forceRPath && dynRPath && dynRunPath) { /* convert DT_RUNPATH to DT_RPATH */
  27. - dynRunPath->d_tag = DT_IGNORE;
  28. + wri(dynRunPath->d_tag, DT_IGNORE);
  29. }
  30. if (newRPath.size() <= rpathSize) {
  31. --
  32. 2.17.0