[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

pre-link for Debian ARM(EL)

debian-installer rc1 is going to be announced officially [this] week. ...


While it was working for me [see earlier message], I noticed that nothing
was pre-linked.  Prelinking shortens the startup time from execve() to main(),
and also increases page sharing across processes for instantiations of shared
libraries.  Prelinking can share [at least] two more pages of ld-linux.so.3,
and three more pages of libc.so.6.  The pages are those that contain
addresses that must be relocated.  That saves 20 KiB per typical process.
Often there were 30 to 50 processes displayed by 'ps', so the sharing
"provides" another 1/2 to 1 MiB of RAM; a boost of 3% on a 32MB NSLU2.

Investigating, Debian supports prelink (0.0.20061027-1) on i386, amd64,
powerpc, and alpha; but not on arm.  "Blindly" hacking the source by
analogy with i386 (see attached patch) produced something that worked for me.
I prelinked ld-linux.so.3, libc.so.6, and libgcc_s.so.1 successfully;
at least, they rebooted and ran the _installed_ system OK.  Obviously
more testing is appropriate, especially testing of an installer system
that has been pre-linked.


diff -Nur prelink-0.0.20071009/src/arch-arm.c prelink-0.0.20071009.new/src/arch-arm.c
--- prelink-0.0.20071009/src/arch-arm.c	2006-12-01 10:21:24.000000000 -0800
+++ prelink-0.0.20071009.new/src/arch-arm.c	2008-11-11 10:29:23.000000000 -0800
@@ -141,6 +141,24 @@
 	/* Tell prelink_rel routine *rel has changed.  */
 	return 2;
+    case R_ARM_TLS_DTPOFF32:
+      write_le32 (dso, rel->r_offset, value);
+      break;
+    /* DTPMOD32 and TPOFF32 is impossible to predict unless prelink
+       sets the rules.  Also for TPOFF32 there is REL->RELA problem.  */
+    case R_ARM_TLS_DTPMOD32:
+      if (dso->ehdr.e_type == ET_EXEC)
+	{
+	  error (0, 0, "%s: R_386_TLS_DTPMOD32 reloc in executable?",
+		 dso->filename);
+	  return 1;
+	}
+      break;
+    case R_ARM_TLS_TPOFF32:
+      if (dso->ehdr.e_type == ET_EXEC)
+	error (0, 0, "%s: R_ARM_TLS_TPOFF32 relocs should not be present in prelinked ET_EXEC REL sections",
+	       dso->filename);
+      break;
     case R_ARM_PC24:
       error (0, 0, "%s: R_ARM_PC24 relocs with non-zero addend should not be present in prelinked REL sections",
@@ -648,7 +666,7 @@
-  .dynamic_linker = "/lib/ld-linux.so.2",
+  .dynamic_linker = "/lib/ld-linux.so.3",
   .adjust_dyn = arm_adjust_dyn,
   .adjust_rel = arm_adjust_rel,
   .adjust_rela = arm_adjust_rela,

Reply to: