This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[patch] rtld.c:246: warning: passing arg 2 of `_dl_sysdep_start' from incompatible pointer type



I get this warning when compiling glibc:
rtld.c:246: warning: passing arg 2 of `_dl_sysdep_start' from incompatible pointer type

dl_main is declared as:
dl_main (const ElfW(Phdr) *phdr,
	 ElfW(Half) phent,
	 ElfW(Addr) *user_entry)

but _dl_sysdep_start has the following:
extern ElfW(Addr) _dl_sysdep_start (void **start_argptr,
				    void (*dl_main) (const ElfW(Phdr) *phdr,
						     ElfW(Word) phnum,
						     ElfW(Addr) *user_entry));

Note the difference between phent and phnum.  Looking at the
implementation of dl_main, I've come up with the appended patch.

Ok to commit?

Andreas

2000-12-31  Andreas Jaeger  <aj@suse.de>

	* elf/rtld.c (dl_main): Fix prototype.

============================================================
Index: elf/rtld.c
--- elf/rtld.c	2000/12/05 17:29:37	1.186
+++ elf/rtld.c	2000/12/31 17:25:02
@@ -119,7 +119,7 @@
 
 
 static void dl_main (const ElfW(Phdr) *phdr,
-		     ElfW(Half) phent,
+		     ElfW(Word) phnum,
 		     ElfW(Addr) *user_entry);
 
 struct link_map _dl_rtld_map;
@@ -371,7 +371,7 @@
 
 static void
 dl_main (const ElfW(Phdr) *phdr,
-	 ElfW(Half) phent,
+	 ElfW(Word) phnum,
 	 ElfW(Addr) *user_entry)
 {
   const ElfW(Phdr) *ph;
@@ -513,7 +513,7 @@
 	}
 
       phdr = _dl_loaded->l_phdr;
-      phent = _dl_loaded->l_phnum;
+      phnum = _dl_loaded->l_phnum;
       /* We overwrite here a pointer to a malloc()ed string.  But since
 	 the malloc() implementation used at this point is the dummy
 	 implementations which has no real free() function it does not
@@ -529,7 +529,7 @@
       if (_dl_loaded == NULL)
 	_dl_sysdep_fatal ("cannot allocate memory for link map\n", NULL);
       _dl_loaded->l_phdr = phdr;
-      _dl_loaded->l_phnum = phent;
+      _dl_loaded->l_phnum = phnum;
       _dl_loaded->l_entry = *user_entry;
 
       /* At this point we are in a bit of trouble.  We would have to
@@ -557,7 +557,7 @@
   _dl_loaded->l_map_start = ~0;
 
   /* Scan the program header table for the dynamic section.  */
-  for (ph = phdr; ph < &phdr[phent]; ++ph)
+  for (ph = phdr; ph < &phdr[phnum]; ++ph)
     switch (ph->p_type)
       {
       case PT_PHDR:

-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.inka.de
    http://www.suse.de/~aj

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]