Skip to contentSkip to conversation

ldd under 2.4.7 kernel

parisc-linux Richard Hirst 1 participant 1 message Aug 10, 2001 exec and binfmt

lore
Share & tools
lore
#0 lore raw

ldd doesn't work under a 2.4.7 kernel; Willy is working on the proper fix, but I thought it useful to post my work-around, as I'm about to take two weeks holiday.

Richard

Index: fs/binfmt_elf.c
===================================================================
RCS file: /home/cvs/parisc/linux/fs/binfmt_elf.c,v retrieving revision 1.20

binfmt_elf.c +13 -0
diff -u -r1.20 binfmt_elf.c
@@ -9,6 +9,8 @@
  * Copyright 1993, 1994: Eric Youngdale ([email protected]).
  */
 
+#define RGH_FIX
+
 #include <linux/module.h>
 
 #include <linux/fs.h>
@@ -153,6 +155,10 @@
 	 */
 	ARCH_DLINFO;
 #endif
+#ifdef RGH_FIX
+	if (exec)
+#endif
+	{
 	NEW_AUX_ENT(AT_PHDR, load_addr + exec->e_phoff);
 	NEW_AUX_ENT(AT_PHENT, sizeof (struct elf_phdr));
 	NEW_AUX_ENT(AT_PHNUM, exec->e_phnum);
@@ -163,6 +169,7 @@
 	NEW_AUX_ENT(AT_EUID, current->euid);
 	NEW_AUX_ENT(AT_GID, current->gid);
 	NEW_AUX_ENT(AT_EGID, current->egid);
+	}
 	NEW_AUX_ENT(AT_HWCAP, ELF_HWCAP);
 	NEW_AUX_ENT(AT_PAGESZ, ELF_EXEC_PAGESIZE);
 	NEW_AUX_ENT(AT_CLKTCK, CLOCKS_PER_SEC);
@@ -714,8 +721,14 @@
 
 	compute_creds(bprm);
 	current->flags &= ~PF_FORKNOEXEC;
+#ifdef RGH_FIX
+	create_elf_tables(bprm, (interpreter_type == INTERPRETER_ELF ? &elf_ex : NULL),
+			(interpreter_type == INTERPRETER_AOUT),
+			load_addr, interp_load_addr);
+#else
 	create_elf_tables(bprm, &elf_ex, (interpreter_type == INTERPRETER_AOUT),
 			load_addr, interp_load_addr);
+#endif
 	/* N.B. passed_fileno might not be initialized? */
 	if (interpreter_type == INTERPRETER_AOUT)
 		current->mm->arg_start += strlen(passed_fileno) + 1;