This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: Add x32 support to ldconfig


> 2012-03-16  H.J. Lu  <hongjiu.lu@intel.com>
> 
> 	* sysdeps/generic/ldconfig.h (FLAG_X8664_LIBX32): New macro.
> 	* elf/cache.c (print_entry): Handle FLAG_X8664_LIBX32.
> 
> 	* sysdeps/unix/sysv/linux/i386/readelflib.c (process_elf_file):
> 	Move e_machine check before EI_CLASS check.  Handle x32 libraries.
> 	* sysdeps/unix/sysv/linux/x86_64/readelflib.c (process_elf_file):
> 	Likewise.
> 
> 	* sysdeps/unix/sysv/linux/x86_64/dl-cache.h

Missing a colon there.

> 	* sysdeps/unix/sysv/linux/x86_64/ldconfig.h

and here.

> +  switch (elf_header->e_machine)
>      {
> -      switch (elf_header->e_machine)
> +    case EM_386:
> +      break;

Move this case down to before the default, so you can
add an ELFCLASS32 check and fall through otherwise.
Always add a comment at the end of a fall-through case.
If you're already using fall-through for EM_IA_64, then
add a label next to default: so you can use goto.

> +      if (elf_header->e_ident [EI_CLASS] == ELFCLASS64)

Drop the space before [.

> +  if (elf_header->e_ident [EI_CLASS] == ELFCLASS32)

Here too.

> +    return process_elf32_file (file_name, lib, flag, osversion, soname,
> +			       file_contents, file_length);
> +  else
> +    return process_elf64_file (file_name, lib, flag, osversion, soname,
> +			       file_contents, file_length);

process_elf_file clobbers *flag unconditionally, so you need to keep the
setting of it after the call.  Either you can repeat the e_machine switch,
or you can have the sanity-check switch set a local variable that's tested
after the call.


Thanks,
Roland


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