소스 검색

patch from Bernd Schmidt to abstract away initializing of prog load addresses

Mike Frysinger 18 년 전
부모
커밋
f088c1cd44
2개의 변경된 파일9개의 추가작업 그리고 1개의 파일을 삭제
  1. 8 0
      ldso/include/dl-defs.h
  2. 1 1
      ldso/ldso/ldso.c

+ 8 - 0
ldso/include/dl-defs.h

@@ -84,6 +84,14 @@ typedef struct {
 	((LOADADDR) = (BASEADDR))
 #endif
 
+/* Initialize a LOADADDR representing the program.  It's called from
+ * DL_BOOT only.
+ */
+#ifndef DL_INIT_LOADADDR_PROG
+# define DL_INIT_LOADADDR_PROG(LOADADDR, BASEADDR) \
+	((LOADADDR) = (DL_LOADADDR_TYPE)(BASEADDR))
+#endif
+
 /* Test whether a given ADDR is more likely to be within the memory
  * region mapped to TPNT (a struct elf_resolve *) than to TFROM.
  * Everywhere that this is used, TFROM is initially NULL, and whenever

+ 1 - 1
ldso/ldso/ldso.c

@@ -295,7 +295,7 @@ void _dl_get_ready_to_run(struct elf_resolve *tpnt, DL_LOADADDR_TYPE load_addr,
 
 		for (idx = 0; idx < auxvt[AT_PHNUM].a_un.a_val; idx++, phdr++)
 			if (phdr->p_type == PT_PHDR) {
-				app_tpnt->loadaddr = (ElfW(Addr)) (auxvt[AT_PHDR].a_un.a_val - phdr->p_vaddr);
+				DL_INIT_LOADADDR_PROG(app_tpnt->loadaddr, auxvt[AT_PHDR].a_un.a_val - phdr->p_vaddr);
 				break;
 			}