PATCH: Add x32 support to ldconfig

H.J. Lu hjl.tools@gmail.com
Fri Mar 16 20:59:00 GMT 2012


On Fri, Mar 16, 2012 at 1:12 PM, Roland McGrath <roland@hack.frob.com> wrote:
>> 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.
>
>

Does this look OK?

Thanks.


-- 
H.J.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libc-x32-ldconfig.patch
Type: text/x-patch
Size: 6453 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20120316/68f9fccf/attachment.bin>


More information about the Libc-alpha mailing list