aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2019-06-24Detect PIE executables w/ COPY relocs, and prevent running over the sectionscross_prelink_stagingcross_prelinkMark Hatle
before the commit (a89297f08cda5ca48d21088891150e7ccc9ddac3) the system would report: COPY relocations don't point into .bss or .sbss section Now, it often reports: file offsets not monotonically increasing This was tracked down (using this debug code) to the .gnu.conflict section being added. In one example the offset ranges ended up being: ../src/prelink: section 15 .fini file offset range 000012f4 and 000012fd ../src/prelink: section 16 .gnu.conflict file offset range 00001300 and 00002080 ../src/prelink: section 17 .rodata file offset range 00002000 and 000020a3 ../src/prelink: section 18 .eh_frame_hdr file offset range 000020a4 and 00002118 This indicates that the new .gnu.conflict section overwrites .rodata by 0x80 bytes. This commit includes a check and error return for this condition. Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
2018-10-12Add option to return an error if all binaries cannot be prelinkedKyle Russell
Otherwise, there's no way to validate whether or not the operation was actually successful without rescanning. Signed-off-by: Kyle Russell <bkylerussell@gmail.com> Added ChangeLog entry Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
2018-10-12testsuite/order.sh: Make it clear what the error isMark Hatle
Many host ld.so seem to have a broken 'depth-first' search, not 'breadth-first' as required by the ELF spec. See: http://refspecs.linuxbase.org/elf/gabi4+/ch5.dynamic.html Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
2018-10-12testsuite/reloc12.sh: Detect if compiler/linker support testMark Hatle
If the compiler and don't support protected symbols in certain relocations, and error may occur such as: relocation R_X86_64_PC32 against protected symbol `foo' can not be used when making a shared object Detect this and skip the test if it is not possible to run. Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
2018-10-12src/arch-mips.c: check info->resolvetls before use its memberRobert Yang
The info->resolvetls might be NULL according to src/prelink.c: [snip] /* Dynamic linker does not depend on any other library, all symbols resolve to themselves with the exception of SHN_UNDEF symbols which resolve to 0. */ if (info->symtab[r_sym].st_shndx == SHN_UNDEF) { info->resolveent = NULL; info->resolvetls = NULL; [snip] So we must check it before use its members, otherwise, there might be Segmentation fault error. Fixed: MACHINE = "qemumips" IMAGE_INSTALL_append = " qemu" $ bitbake core-image-minimal [snip] | /path/to/qemumips-poky-linux/core-image-minimal/1.0-r0/temp/run.prelink_image.1000: line 111: 1010 Segmentation fault (core dumped) /path/to/qemumips-poky-linux/core-image-minimal/1.0-r0/recipe-sysroot-native/usr/sbin/prelink --root /path/to/qemumips-poky-linux/core-image-minimal/1.0-r0/rootfs -amR -N -c /etc/prelink.conf --dynamic-linker $dynamic_loader [snip] Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Added ChangeLog Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
2018-10-12x86_64: allow prelinking of PIE executables with COPY relocsSergei Trofimovich
COPY relocs are fine to have in PIE executables (as opposed to shared libraries). By enabling prelink on PIEs we achieve a few goals: - prelink more PIE files on system: nicer for uniformity, - avoid spurious warnings about shared libraries with COPY relocs It's usefult to prelink PIEs when kernel ASLR is disabled: kernel.randomize_va_space=0 + PIE-randomization patches. I have gcc built as `--enable-default-pie` (generates PIE executables by default). Testsute results before the change: PASS: 14 FAIL: 31 After the change: PASS: 32 FAIL: 13 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> Added ChangeLog entry Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
2018-10-12testsuite/functions.sh: produce deterministic GNU_PRELINK sectionSergei Trofimovich
Before the change one test failed due to timestamp drift: FAIL: shuffle7.sh This happens because prelinking takes time on the file and timestamp differs slightly. Avoid timestamp drift by overriding real timestamp with PRELINK_TIMESTAMP variable. Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> Added ChangeLog entry Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
2018-10-12Fix prelink testsuite/unprel1.sh for cross-testingJoseph Myers
Prelink testsuite/unprel1.sh needs to use $RUN to work correctly for cross testing. mhatle changes: Added ChangeLog to Joseph's commit. Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
2018-10-12Support copy relocations in .data.rel.roKyle Russell
binutils-2.28 (17026142ef35b62ac88bfe517b4160614902cb28) adds support for copying read-only dynamic symbols into .data.rel.ro instead of .bss since .bss is technically writable. This causes prelink to error out on any binary containing COPY relocations in .data.rel.ro. Read-only variables defined in shared libraries should be copied directly into the space allocated for them in .data.rel.ro by the linker. To achieve this, we determine whether either of the two sections containing copy relocations is .data.rel.ro. If so, we relocate the symbol memory directly into the existing section instead of constructing a new .(s)dynbss section once prelink_build_conflicts() returns. Fixes cxx1.sh, cxx2.sh, and cxx3.sh on Fedora 28 (which uses binutils-2.29). Signed-off-by: Kyle Russell <bkylerussell@gmail.com> DCO for Kyle added per email on YP list. Added ChangeLog entry. Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
2018-10-12rtld: get machine from undef_map for protected symbolsKyle Russell
Avoids rtld segfault when _dl_lookup_symbol_x is called with NULL for skip_map on a protected symbol relocation. Global protected symbols may not actually require a copy relocaton, in which case skip_map is undefined, so use the undef_map to determine the symbol arch. Signed-off-by: Kyle Russell <bkylerussell@gmail.com> DCO for Kyle added per email on YP list. Added ChangeLog entry. Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
2018-10-12README: Indicate we now are requring a Signed-off-by line in patchesMark Hatle
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
2018-08-29prelink: Add RISC-V supportKhem Raj
2018-08-29 Khem Raj <raj.khem@gmail.com> * src/elf.h: Add RISC-V defines * src/rtld/dl-tls.c: Add RISC-V support * src/rtld/rtld.c: Add RISC-V support Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
2018-08-29src/dso.c: use ehdr.e_shstrndx as indexRobert Yang
According to struct elf32_hd, the e_shnum is section header number, and the index is e_shstrndx, not e_shnum. This can fix segmention fault when handle libqb.so.0.18.2 from libqb_1.0.3. It fails to handle libqb.so.0.18.2 and get errors: Symbol section index outside of section numbers Then segmentation fault, this is because the e_shnum is 34, while e_shstrndx is 27 (it would be 33 when no errors), I've checked several elf files to confirm that the ones after e_shstrndx is NULL, so use e_shstrndx should be correct. Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
2017-06-20Fix x32 layout1 test.Andrew Stubbs
The layout1 test case currently fails for x32 because there is insufficient address space for all the libraries. There's two ways to fix this: 1. Increase mmap_end such that there's more space. 2. Reduce max_page_size so that less space is wasted. I'm not sure what the implications of option 2 would be, so the attached patch implements option 1. This still limits the number of possible libraries somewhat severely, but it's more than enough to pass the layout1 test. Andrew 2016-12-16 Andrew Stubbs <ams@codesourcery.com> * src/arch-x86_64.c (PL_ARCH(x32)): Set mmap_end to 0x60000000.
2017-06-20Fix ifunc on x86_64 x32Andrew Stubbs
The ifunc1, ifunc2, and ifunc3 tests currently fail on x86_64 x32 ABI because the testcase crashes at runtime. The testcases run fine when not prelinked. In the case of ifunc1, the test tries to call the "lib2t2" function directly, instead of using it as an indirect call, which leads to the testcase aborting. In real code this would not cause an immediate crash, but presumably would lead to undefined behaviour. The attached patch fixes the problem by converting R_X86_64_32 conflict relocations to R_X86_64_IRELATIVE (in the same way as R_X86_64_64 relocations are). I've tested this with the cross_prelink branch and a suitably configured cross-toolchain. I expect it would be fine on the master branch also, but I can't test that. Andrew Stubbs Mentor Graphics/CodeSourcery 2016-12-09 Andrew Stubbs <ams@codesourcery.com> * src/arch-x86_64.c (x86_64_prelink_conflict_rela): Also convert R_X86_64_32 conflicts to R_X86_64_IRELATIVE for ifuncs. Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
2017-06-20Support x32 libx32 directoryJoseph Myers
Cross-prelink's prelink-rtld is missing suport for the /libx32 directory used with the x86_64 x32 ABI. This patch adds such support. 2016-09-14 Joseph Myers <joseph@codesourcery.com> * src/rtld/rtld.c (load_ld_so_conf): Add argument use_x32. (main): Update call to load_ld_so_conf. Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
2017-06-20rtld: Add missing DT_NEEDED DSOs to needed_listKyle Russell
prelink-rtld may report an "error while loading shared libraries" for the wrong library. If some set of DT_NEEDED DSOs are not in the default search path, they may have a dso_list entry added, but no matching entry is added to the needed_list. This causes the linker to miscalculate the max number of dsos during build_local_scope(), which later causes find_needed() to not search the entire l_local_scope[0]->r_list during _dl_check_map_versions() (since the max from build_local_scope() becomes l_local_scope[0]->r_nlist). Since find_needed() searches through the r_list, which would have the dso_list entries for the libraries that weren't found earlier, this cuts the search short, meaning libraries near the end of the local scope don't get included in the map version search. As the comment in _dl_check_map_versions() suggests, if needed is NULL, that means a dependency was not found and no stub entry created, which should never happen. Signed-off-by: Kyle Russell <bkylerussell@gmail.com> Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
2017-06-20doc/Makefile.am: Disable automatic generation of prelink.pdfMark Hatle
On modern Linux hosts, the prelink.pdf doesn't seem to work reliably. Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
2017-06-20src/rtld: Add MicroBlaze support based on glibc-2.24Nathan Rossi
Add definitions/config to support MicroBlaze, using glibc-2.24 as reference. Signed-off-by: Nathan Rossi <nathan@nathanrossi.com> Added ChangeLog entry. Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
2016-08-19README: update information on reloc8/reloc9 failuresMark Hatle
2016-08-19 Mark Hatle <mark.hatle@windriver.com> * README, testsuite/reloc8.sh, testsuite/reloc9.sh: update to expand on reloc8 and reloc9 failures Reloc8/9 failures appear to be as a result of a binutils failure. The change to the test suite shows that the reloc8/9 did not work before prelinking. Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
2016-08-18README: Add known issues to the READMEMark Hatle
2016-08-17 Mark Hatle <mark.hatle@windriver.com> * README: Update to include a few known issues Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
2016-08-17src/rtld/dl-open.c: Change to work with older compilersMark Hatle
2016-08-17 Mark Hatle <mark.hatle@windriver.com> * src/rtld/dl-open.c: Change to work with older compilers Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
2016-06-03Fix prelink section ordering on subsequent prelinkDave Lerner
Some linkers create a binary which has a section header table that is not in section header offset order. However, as noted in check_dso(), several routines in prelink and in libelf-0.7.0 too rely on sh_offsets monotonically increasing, and if that fails then prelink quits. But the check is only on dso's, not binaries. For binaries, fdopen_dso() reorders the section headers to section header offset order prior to work on the section data, so that the new prelinked binary is written in section order. However, on subsequent prelinks of a prelinked binary, the prelink_exec() works on the undone section, not the fdopen_dso() reordered sections, and may construct a section header table with section orders different than the first prelink of the binary. The function below tests for that case and resets the section header order to the offset order by enforcing the binutils linker change: 'The net effect is .shstrab section is now placed after .symtab and .strtab sections'. See binutils-gdb.git commit 3e19fb8f990e4c. Signed-off-by: Dave Lerner <dave.lerner@windriver.com> 2016-06-03 Dave Lerner <dave.lerner@windriver.com> * src/exec.c: New check_reorder_needed, section_reorder_fix functions Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
2016-03-22Fix LD_PRELOAD w/o rtld caseMark Hatle
2016-03-22 Mark Hatle <mark.hatle@windriver.com> * src/gather.c, src/get.c: Fix LD_PRELOAD Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
2016-03-22Fix prelink-rtld depth-first search, should be breadth firstMark Hatle
2016-03-18 Donn Seeley <donn.seeley@windriver.com> * src/rtld/rtld.c: rewrite build_local_scope to ensure breadth-first processing * testsuite/order: Add test to verify prelink/prelink-rtld resolution order This problem was causing a conflict in the Yocto Project between 'fork' from libc and libpthread. See Yocto Project bug 9131. Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
2016-03-22Fix compilation warningsMark Hatle
2016-03-18 Mark Hatle <mark.hatle@windriver.com> * src/rtld/rtld.h, src/dso.c: Fix compilation warning Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
2016-03-22src/rtld: Add ability to debug scopeMark Hatle
2016-03-18 Mark Hatle <mark.hatle@windriver.com> * dl-open.c, rtld.h, Makefile.am: Add _dl_show_scope function * rtld.c: Use _dl_show_scope if RTLD_DEBUG=scopes defined Generate a scope for the exectuable Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
2016-03-22rtld/dl-load.c: Fix segfault on uninitialized DSOMark Hatle
2016-03-10 Mark Hatle <mark.hatle@windriver.com> * dl-load.c: Fix segfault on empty dso entry Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
2016-03-22rtld: Resync to glibc-2.23Mark Hatle
2016-03-10 Mark Hatle <mark.hatle@windriver.com> * rtld/: Rsync to glibc-2.23 (no functional changes) Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
2016-03-22Update .gitignoreMark Hatle
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
2016-03-22configure.ac/makefile.am: Update to newer autoconf/automake formatMark Hatle
Resolves an issue: configure.ac:8: warning: AM_INIT_AUTOMAKE: two- and three-arguments change based on a patch from Vaneet Narang <v.narang@samsung.com> and Maninder Singh <maninder1.s@samsung.com> Add AC_CONFIG_MACRO_DIR([m4]) to configure.ac to resolve warning. Quote AC_LIBELF_SXWORD in m4/libelf.m4 to resolve: warning: underquoted definition of AC_LIBELF_SXWORD in m4/libelf.m4 In Makefile.am files, replace INCLUDES w/ AM_CPPFLAGS as appropriate. Remove 'AUTOMAKE_OPTIONS = 1.4 gnu', no longer necessary. 2016-03-10 Mark Hatle <mark.hatle@windriver.com> * configure.ac, m4/libelf.m4, doc/Makefile.am, gelf/Makefile.am, gelfx/Makefile.am, gelfx32/Makefile.am, patches/Makefile.am, src/Makefile.am, src/rtld/Makefile.am, testsuite/Makefile.am: Update to avoid autoconf/automake warnings Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
2015-10-29Fix ARM IFUNC support20151030_crossMark Hatle
In the original ARM IFUNC support, it appears a small chunk of code in the arm_prelink_conflict_rela function was missed. This commit adds the missing code from the original work. See: https://bugzilla.redhat.com/show_bug.cgi?id=1009601 2015-10-29 Mark Hatle <mark.hatle@windriver.com> Kyle McMartin <kmcmartin@redhat.com> Jakub Jelinek <jakub@redhat.com> Julian Brown <julian@codesourcery.com> * testsuite/ifunc.h: Fix missing # * src/arch-arm.c (arm_prelink_conflict_rela): Add missing hunk that implemented R_ARM_IRELATIVE, and ifunc conflicts. See: https://bugzilla.redhat.com/show_bug.cgi?id=1009601 Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
2015-10-29prelink: Fix MIPS section header checkMark Hatle
MIPS has added a new SHT_MIPS_ABIFLAGS section, which the prelinker did not know it could skip. Add this to the list of items to be OK to skip. 2015-10-29 Mark Hatle <mark.hatle@windriver.com> * prelink.h: Define SHT_MIPS_ABIFLAGS if not set * prelink.c: OK to skip SHT_MIPS_ABIFLAGS optimize the loop to stop on the first bad entry adjust the error to give us more info on the bad section Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
2015-10-28testsuite/.gitignore: Ignore all of the misc artifacts from the tests.Mark Hatle
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
2015-10-28src/get.c: Sync the rtld and prelinker to the same defineMark Hatle
No actual change in the defined value occurs, but the format on both sides of the interface (rtld and prelinker) are now using the same define. 2015-10-28 Mark Hatle <mark.hatle@windriver.com> * get.c: Sync rtld/prelink type_class values Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
2015-10-28rtld: Fix the prelink-rtld to use the same method as ld.soMark Hatle
2015-10-28 Mark Hatle <mark.hatle@windriver.com> * dl-lookupX.h: Sync with glibc fix for ld.so / prelink mismatch 2015-10-28 H.J. Lu <hongjiu.lu@intel.com> [BZ #19178] * elf/dl-lookup.c (RTYPE_CLASS_VALID): New. (RTYPE_CLASS_PLT): Likewise. (RTYPE_CLASS_COPY): Likewise. (RTYPE_CLASS_TLS): Likewise. (_dl_debug_bindings): Use RTYPE_CLASS_TLS and RTYPE_CLASS_VALID to set relocation type class for DL_DEBUG_PRELINK. Clear the ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA bit for DL_DEBUG_PRELINK. Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
2015-10-28Upstream prelink project appears abandoned, take over the projectMark Hatle
The upstream project appears to be dead now. So switch to a more git friendly directory, no reason to maintain the SVN trunk any longer. 2015-10-22 Mark Hatle <mark.hatle@windriver.com> * Upstream project appears to have been abandoned * Update the project to remove the SVN like 'trunk' dir * Adjust the AUTHORS file * Move the README.cross to replace README and update it * Move the previous ChangeLog to ChangeLog.1 * Move the current ChangeLog.cross to ChangeLog Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
2015-10-28prelink: Add debugging to conflict resolution errorMark Hatle
2015-10-21 Mark Hatle <mark.hatle@windriver.com> * get.c, prelink.h: Add symname to conflict structure * conflict.c: Provide more debuggign on a conflict (symname) Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
2015-10-28rtld: Update debugging to be more glibc-2.22 likeMark Hatle
2015-10-21 Mark Hatle <mark.hatle@windriver.com> * rtld/rtld.c: Update debug msg Fix missing dso_list->map = NULL * rtld/dl-lookupX.h: update debug msgs * rtld/dl-load.c: (create_map_object_from_dso_ent) Add ld.so like debug When an executable sets a load address use it Update the load address calculation, prevents visual overlaps * rtld/dl-version.c: update debug msgs * rtld/rtld.h: define _dl_debug_printf to act like ld.so debug define RTLD_DEBUG_PID to set the debug prefix Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
2015-10-28rtld: Start sync to glibc 2.22Mark Hatle
2015-10-21 Mark Hatle <mark.hatle@windriver.com> * Resync src/rtld to glibc-2.22 * src/elf.h, src/rtld/*: Update elf.h to glibc 2.22 version 2015-10-21 Mark Hatle <mark.hatle@windriver.com> * rtld/: Resync to glibc-2.22 * rtld/*: Update copyright dates to match glibc-2.22 * rtld/rtld.c: Update the elf_machine_type class entries Add support for ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA via new extern_protected_data function. rename reloc_typeclass to elf_machine_type_class add machine_no_rela, machine_no_rel funcs * rtld/dl-tls.c: (rtld_determine_tlsoffsets) add NIOS2 definition * rtld/dl-lookup.c * rtld/dl-lookupX.h: Add EXTERN_PROTECTED_DATA support * glibc changes directly affecting the implementation: 2013-12-04 Ulrich Weigand <Ulrich.Weigand@de.ibm.com> Alan Modra <amodra@gmail.com> * libc/sysdeps/powerpc/powerpc64/dl-machine.h (elf_machine_type_class): Use SHN_UNDEF PLT handling for ELFv2 ABI. 2015-01-18 Chung-Lin Tang <cltang@codesourcery.com> Sandra Loosemore <sandra@codesourcery.com> Andrew Jenner <andrew@codesourcery.com> Joseph Myers <joseph@codesourcery.com> * sysdeps/nios2/dl-machine.h: New file. 2015-03-31 H.J. Lu <hongjiu.lu@intel.com> * elf/dl-lookup.c (do_lookup_x): When UNDEF_MAP is NULL, which indicates it is called from do_lookup_x on relocation against protected data, skip the data definion in the executable from copy reloc. (_dl_lookup_symbol_x): Pass ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA, instead of ELF_RTYPE_CLASS_PLT, to do_lookup_x for EXTERN_PROTECTED_DATA relocation against STT_OBJECT symbol. * sysdeps/i386/dl-machine.h (elf_machine_type_class): Set class to ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA for R_386_GLOB_DAT. * sysdeps/x86_64/dl-machine.h (elf_machine_type_class): Set class to ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA for R_X86_64_GLOB_DAT. 2015-07-24 Szabolcs Nagy <szabolcs.nagy@arm.com> * sysdeps/aarch64/dl-machine.h (elf_machine_type_class): Handle ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA. * sysdeps/arm/dl-machine.h (elf_machine_type_class): Handle ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA. Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
2015-09-11prelink: --ld-preload= add man page entry and testsuiteMark Hatle
2015-09-11 Mark Hatle <mark.hatle@windriver.com> * doc/prelink.8: Add --ld-preload docs * testsuite/Maekfile.am, testsuite/preload1*: Add test Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
2015-09-11src/main.c, rtld/rtld.c: Add --ld-preload optionManinder Singh
prelink fails if there are ld_preload libs present at target with below error. expect libsX.so.1, found /lib/libY.so in dependency order where libY.so.1 is ld_preload lib To use this feature : ./prelink --ld-preload=libpreload1.so:libpreload2.so:.... upto 20 libs Order of libraries to be preloaded is significant. Make sure sequence mentioned in prelink should be same as runtime sequence. 2015-09-11 Vaneet Narang <v.narang@samsung.com> * src/gather.c, src/get.c, src/main.c, src/prelink.h: Add ability to specify preloaded libraries that influence the prelinker. 2015-09-11 Vaneet Narang <v.narang@samsung.com> * rtld/rtld.c: Add ability to specify preloaded libraries Signed-off-by: Vaneet Narang <v.narang@samsung.com> Signed-off-by: Maninder Singh <maninder1.s@samsung.com> Reviewed-by: Ajeet Yadav <ajeet.v@samsung.com> Reviewed-by: Geon-ho Kim <gh007.kim@samsung.com> Adjusted the --help in main.c and rtld/rtld.c slightly. Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
2015-09-09src/gather.c: cleanup codeManinder Singh
Remove dso NULL check because before calling this API already checking for dso NULL and also dso pointer is used before this check. 2015-09-09 Akhilesh Kumar <akhilesh.k@samsung.com> * src/gather.c: Remove unnecessary dso NULL check Signed-off-by: Akhilesh Kumar <akhilesh.k@samsung.com> Reviewed-by: Ajeet Yadav <ajeet.y@samsung.com> Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
2015-09-09src/rtld/rtld.c: dso validation check fixManinder Singh
dso null pointer check is wrongly placed. 2015-09-09 Maninder Singh <maninder1.s@samsung.com> Mark Hatle <mark.hatle@windriver.com> * rtld/rtld.c: dso null pointer check fix Signed-off-by: Maninder Singh <maninder1.s@samsung.com> Signed-off-by: Vaneet Narang <v.narang@samsung.com> Reviewed-by: Ajeet Yadav <ajeet.y@samsung.com> Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
2015-09-09src/*: realloc fix memory leakManinder Singh
Free previously allocated memory if realloc fails. 2015-09-09 Maninder Singh <maninder1.s@samsung.com> * src/doit.c, src/gather.c, src/undoall.c: Fix realloc memory leak Signed-off-by: Maninder Singh <maninder1.s@samsung.com> Signed-off-by: Vaneet narang <v.narang@samsung.com> Reviewed-by: Akhilesh Kumar <akhilesh.k@samsung.com> Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
2015-09-08src/arch-arm.c: set max_page_size to match new ARM BDF defaultAndrew Stubbs
The maximum page size setting for ARM32 has been changed: https://sourceware.org/ml/binutils/2014-06/msg00228.html The attached patch updates prelink to match. It ought to be harmless when the default page size is smaller. Andrew 2015-09-07 Andrew Stubbs <ams@codesourcery.com> * src/arch-arm.c (PL_ARCH(arm)): Set max_page_size to match the new BFD default. Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
2015-04-07src/gather.c: Add debug messages for dependencies when not foundManinder Singh
2015-04-06 Mark Hatle <mark.hatle@windriver.com> Maninder Singh <maninder1.s@samsung.com> * src/gather.c: Return rtld error messages on failure prelink gives below error message for failure dependency: ./prelink: /test_binary: Could not find one of the dependencies This provides name of dependent library which is missing like below: ./prelink: /test_binary: Could not find one of the dependencies: ./prelink-rtld: error while loading shared libraries: libB.so: cannot open shared object file: No such file or directory where libB.so is missing dependecy Signed-off-by: Maninder Singh <maninder1.s@samsung.com> Signed-off-by: Vaneet Narang <v.narang@samsung.com> Reviewed-by: Ajeet Yadav <ajeet.y@samsung.com> Reviewed-by: Geon-ho Kim <gh007.kim@samsung.com> Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
2015-04-06rtld/dl-version.c: Add debug for missing load and libcManinder Singh
2015-04-06 Mark Hatle <mark.hatle@windriver.com> Maninder Singh <maninder1.s@samsung.com> * src/rtld/dl-version.c: Add debug for mising ld-linux or libc During cross prelink if we miss out ld-linux.so.* or libc.so.* It prints below info: ./prelink: /test_binary: Could not parse `prelink-rtld: dl-version.c:219: rtld_check_map_versions: Assertion `needed != ((void *)0)' failed.' And thus we miss actual cause for this failure, by this patch we will know failure reason. ./prelink: /test_binary: Could not parse `./prelink-rtld: error while loading shared libraries: ld-linux.so.3' (In this case ld-linux.so.3 was missing) Signed-off-by: Maninder Singh <maninder1.s@samsung.com> Signed-off-by: Vaneet Narang <v.narang@samsung.com> Reviewed-by: Ajeet Yadav <ajeet.v@samsung.com> Reviewed-by: Geon-ho Kim <gh007.kim@samsung.com> Changed the exit code to 1. Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
2015-04-06src/get.c: Remove extra check for ld-linux.so.3 in strcmpMark Hatle
2015-03-31 Mark Hatle <mark.hatle@windriver.com> * Based on submission by Maninder Singh <maninder1.s@samsung.com> src/get.c: Remove extra check for ld-linux.so.3 in strcmp (remove first entry, second is already in upstream code) The original submission removed the second entry, maintaining the first. I choose to remove the first entry, and maintain the second as that more closely matches the upstream prelink project and helps remove a minor difference. Signed-off-by: Mark Hatle <mark.hatle@windriver.com> Signed-off-by: Maninder Singh <maninder1.s@samsung.com>
2014-12-10testsuite/Makefile.am: Fix tests for latest autotoolsMark Hatle
2014-12-10 Mark Hatle <mark.hatle@windriver.com> * testsuite/Makefile.am: latest autotools has changed the way TEST_ENVIRONMENT is defined. Remove the $(SHELL) Signed-off-by: Mark Hatle <mark.hatle@windriver.com>