glibc:hjl/pr18422

Last commit made on 2015-05-23
Get this branch:
git clone -b hjl/pr18422 https://git.launchpad.net/glibc

Branch merges

Branch information

Name:
hjl/pr18422
Repository:
lp:glibc

Recent commits

df5dc4f... by "H.J. Lu" <email address hidden>

Don't build ld.so with -Wl,-z,now

PLT entries aren't required when -z now used. Linker on master with:

commit 25070364b0ce33eed46aa5d78ebebbec6accec7e
Author: H.J. Lu <email address hidden>
Date: Sat May 16 07:00:21 2015 -0700

    Don't generate PLT relocations for now binding

    There is no need for PLT relocations with -z now. We can use GOT
    relocations, which take less space, instead and replace 16-byte .plt
    entres with 8-byte .plt.got entries.

    bfd/

      * elf32-i386.c (elf_i386_check_relocs): Create .plt.got section
      for now binding.
      (elf_i386_allocate_dynrelocs): Use .plt.got section for now
      binding.
      * elf64-x86-64.c (elf_x86_64_check_relocs): Create .plt.got
      section for now binding.
      (elf_x86_64_allocate_dynrelocs): Use .plt.got section for now
      binding.

won't generate PLT entries with -z now. elf/tst-audit2.c has

/* This calloc definition will be called by the dynamic linker itself.
   We test that it has initialized our TLS block by the time it does so.
*/

void *
calloc (size_t n, size_t m)
{
  if (magic[0] != MAGIC1 || magic[1] != MAGIC2)
    {
      printf ("{%x, %x} != {%x, %x}\n", magic[0], magic[1], MAGIC1, MAGIC2);
      abort ();
    }
  magic[0] = MAGIC2;
  magic[1] = MAGIC1;

Since ld.so is built with -z now, there are no PLT relocations and this
calloc won't be used:

Relocation section '.rela.dyn' at offset 0x66c contains 16 entries:
 Offset Info Type Sym.Value Sym. Name + Addend
00222e88 00000008 R_X86_64_RELATIVE 10970
00222e8c 00000008 R_X86_64_RELATIVE f8f0
00222e90 00000008 R_X86_64_RELATIVE f6c0
00222e94 00000008 R_X86_64_RELATIVE 11bd0
00222e98 00000008 R_X86_64_RELATIVE a1b0
00222e9c 00000008 R_X86_64_RELATIVE 130c0
00222ea0 00000008 R_X86_64_RELATIVE 13c50
00222ea4 00000008 R_X86_64_RELATIVE 15fc0
00222ea8 00000008 R_X86_64_RELATIVE 12cd0
00222eac 00000008 R_X86_64_RELATIVE 17f90
00222fbc 00000a06 R_X86_64_GLOB_DAT 00018230 __libc_memalign@@GLIBC_2.16 + 0
00222fc4 00001506 R_X86_64_GLOB_DAT 00018300 malloc@@GLIBC_2.16 + 0
00222fcc 00000d06 R_X86_64_GLOB_DAT 00018310 calloc@@GLIBC_2.16 + 0
00222fd4 00000506 R_X86_64_GLOB_DAT 000184a0 realloc@@GLIBC_2.16 + 0
00222fdc 00000706 R_X86_64_GLOB_DAT 002239a0 _r_debug@@GLIBC_2.16 + 0
00222fe4 00000406 R_X86_64_GLOB_DAT 00018340 free@@GLIBC_2.16 + 0

Assuming we do want to keep PLT relocations in ld.so so that malloc
functions in ld.so can be overridden, ld.so should be built with -z now.
There is no reason to build ld.so with -z now since ld.so is the one
doing BIND_NOW. The only thing we get with -z now on ld.so is DT tag:

 0x0000000000000018 (BIND_NOW)
 0x000000006ffffffb (FLAGS_1) Flags: NOW

This patch removes -Wl,-z,now from ld.so build.

 [BZ #18422]
 * elf/Makefile (z-now-yes): Removed.
 ($(objpfx)ld.so): Remove $(z-now-$(bind-now)).

3e058c9... by "H.J. Lu" <email address hidden>

Don't issue an error if DT_PLTRELSZ is missing

A shared object doesn't need PLT if there are no PLT relocations. It
shouldn't be an error if DT_PLTRELSZ is missing.

 [BZ #18410]
 * elf/dl-reloc.c (_dl_relocate_object): Don't issue an error
 for missing DT_PLTRELSZ.

333e1ba... by Paul Eggert

Remove obsolete aliases that broke 'locale -a'

[BZ #18412]
* intl/locale.alias: Remove obsolete aliases "bokmål" and "français"
which caused 'locale -a' to output Latin-1 data in UTF-8 locales,
breaking some applications that use 'locale -a' output.
Change the encoding of this file from Latin-1 to ASCII to avoid
other potential problems with people grepping this file.

60dce8b... by Adhemerval Zanella

Remove socket.S implementation

This patch removes the socket.S implementation for all ports and replace
it by a C implementation using socketcall. For ports that implement
the syscall directly, there is no change.

The patch idea is to simplify the socket function implementation that
uses the socketcall to be based on C implemetation instead of a pseudo
assembly implementation with arch specific parts. The patch then remove
the assembly implementatation for the ports which uses socketcall
(i386, microblaze, mips, powerpc, sparc, m68k, s390 and sh).

I have cross-build GLIBC for afore-mentioned ports and tested on both
i386 and ppc32 without regressions.

dc6b5ae... by Joseph Myers <email address hidden>

Fix soft-fp fma for -Wuninitialized.

The soft-fp implementations of fma produce -Wuninitialized warnings
because, in the cases where the result is not a nonzero finite value,
the soft-fp does not set the exponent of the result since the (cooked)
packing will do so, but the compiler does not then see that the
exponent is always set in packing before it's used if it wasn't set
earlier. This patch uses DIAG_* macros to suppress those warnings.

Tested for mips64. (In fact this allows the mips64 build to complete
with the -Wno-uninitialized removed from math/Makefile, but more
cleanups are still needed in the ldbl-128ibm code for uninitialized
warnings there.)

 * soft-fp/fmadf4.c: Include <libc-internal.h>.
 (__fma): Ignore uninitialized warnings around packing.
 * soft-fp/fmasf4.c: Include <libc-internal.h>.
 (__fmaf): Ignore uninitialized warnings around packing.
 * soft-fp/fmatf4.c: Include <libc-internal.h>.
 (__fmal): Ignore uninitialized warnings around packing.

0c3717e... by Joseph Myers <email address hidden>

Fix ldbl-128 / ldbl-128ibm tanl for -Wuninitialized.

The ldbl-128 and ldbl-128ibm implementations of tanl produce
uninitialized variable warnings with -Wuninitialized because of a
variable that is initialized only conditionally, then used under the
same conditions under which it is set. This patch uses DIAG_* macros
to suppress those warnings.

Tested for powerpc and mips64.

 * sysdeps/ieee754/ldbl-128/k_tanl.c: Include <libc-internal.h>.
 (__kernel_tanl): Ignore uninitialized warnings around use of SIGN.
 * sysdeps/ieee754/ldbl-128ibm/k_tanl.c: Include <libc-internal.h>.
 (__kernel_tanl): Ignore uninitialized warnings around use of SIGN.

31a8780... by Joseph Myers <email address hidden>

Fix ldbl-128 / ldbl-128ibm erfcl for -Wuninitialized

The ldbl-128 and ldbl-128ibm implementations of erfcl produce
uninitialized variable warnings with -Wuninitialized because of switch
statements where in fact one of the cases will always be executed, but
the compiler does not see that these cases cover all possibilities
(and because the reasoning that it does involves inequalities on the
representation of a floating point value leading to a set of possible
values for 8.0 times that value, converted to int, it's highly
nontrivial for the compiler to see that). This patch fixes those
warnings by converting the last case in those switch statements to a
"default" case.

Tested for powerpc and mips64.

 * sysdeps/ieee754/ldbl-128/s_erfl.c (__erfcl): Make case 9 in
 switch statement into default case.
 * sysdeps/ieee754/ldbl-128ibm/s_erfl.c (__erfcl): Likewise.

fded7ed... by Joseph Myers <email address hidden>

Fix ldbl-128 / ldbl-128ibm asinl for -Wuninitialized.

The ldbl-128 and ldbl-128ibm implementations of asinl produce
uninitialized variable warnings with -Wuninitialized because the code
for small arguments in fact always returns but the compiler cannot see
this and instead sees that a variable would be uninitialized if the
"if (huge + x > one)" conditional used to force the "inexact"
exception were false.

All the code in libm trying to force "inexact" for functions that are
not exactly defined is suspect and should be removed at some point
given that we now have a clear definition of the accuracy goals for
libm functions which, following C99/C11, does not require anything
about "inexact" for most functions (likewise, the multi-precision code
that tries to give correctly-rounded results, very slowly, for
functions for which the goals clearly do not include correct rounding,
if the faster paths are accurate enough). However, for now this patch
simply changes the code to use math_force_eval, rather than "if", to
ensure the evaluation of the inexact computation.

Tested for powerpc and mips64.

 * sysdeps/ieee754/ldbl-128/e_asinl.c (__ieee754_asinl): Don't use
 a conditional in forcing "inexact".
 * sysdeps/ieee754/ldbl-128ibm/e_asinl.c (__ieee754_asinl):
 Likewise.

992328e... by Roland McGrath <email address hidden>

Fix nptl-init.c use of INTERNAL_SYSCALL_DECL.

4e5f925... by Joseph Myers <email address hidden>

Restore _POSIX2_C_VERSION definition (bug 438).

My review of conformtest expectations for POSIX showed up that the
_POSIX2_C_VERSION macro, required by POSIX and XPG standards before
2001, was missing in unistd.h, having been removed on 2003-04-03
despite those standards still being supported. This patch adds it
back. As it's in the implementation namespace, there's no need for it
to be conditional, and other such macros aren't conditional in this
header either.

Tested for x86_64 and x86 (testsuite). Note that this *does* change
the installed libraries, because it affects the sysconf support
(present all along) for _SC_2_C_VERSION.

 [BZ #438]
 * posix/unistd.h (_POSIX2_C_VERSION): New macro.
 * conform/Makefile (test-xfail-POSIX/unistd.h/conform): Remove
 variable.