On 16.07.2007 [17:39:40 -0500], Andrew Hastings wrote: > Use dl_iterate_phdr(3) to eliminate the need to set > HUGETLB_FORCE_ELFMAP_EXECSTART. > > Tested on x86_64. > > -Andrew Hastings > Cray Inc. > > -- > Signed-off-by: Andrew Hastings <[EMAIL PROTECTED]> on behalf of Cray Inc. > > --- libhugetlbfs-dev-20070716/elflink.c 2007-07-16 12:46:03.000000000 > -0500 > +++ libhugetlbfs-dev-20070716-modified/elflink.c 2007-07-16 > 16:28:37.000000000 -0500 > @@ -22,6 +22,7 @@ > #include <stdarg.h> > #include <stdio.h> > #include <stdlib.h> > +#include <link.h>
I also found that link.h (well, by looking at dl_iterate_phdr's man-page) defines a macro for the 32-bit/64-bit ELF struct namings. Currently, we do #ifdef __LP64__ #define Elf_Ehdr Elf64_Ehdr #define Elf_Phdr Elf64_Phdr #define Elf_Dyn Elf64_Dyn #define Elf_Sym Elf64_Sym #define ELF_ST_BIND(x) ELF64_ST_BIND(x) #define ELF_ST_TYPE(x) ELF64_ST_TYPE(x) #else #define Elf_Ehdr Elf32_Ehdr #define Elf_Phdr Elf32_Phdr #define Elf_Dyn Elf32_Dyn #define Elf_Sym Elf32_Sym #define ELF_ST_BIND(x) ELF64_ST_BIND(x) #define ELF_ST_TYPE(x) ELF64_ST_TYPE(x) #endif But, given #include <link.h> we can do #define Elf_Ehdr ElfW(Ehdr) #define Elf_Phdr ElfW(Phdr) #define Elf_Dyn ElfW(Dyn) #define Elf_Sym ElfW(Sym) #define ELF_ST_BIND(x) ELF64_ST_BIND(x) #define ELF_ST_TYPE(x) ELF64_ST_TYPE(x) (BTW why are those last two always 64-bit? -- probably deserves a comment) I'm not entirely sure that it makes much of a difference, but can make the change if it seems worth it. Certainly seems portable enough :) Thanks, Nish -- Nishanth Aravamudan <[EMAIL PROTECTED]> IBM Linux Technology Center ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Libhugetlbfs-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/libhugetlbfs-devel
