glibc:gabriel/powerpc-ieee128-printscan

Last commit made on 2019-12-13
Get this branch:
git clone -b gabriel/powerpc-ieee128-printscan https://git.launchpad.net/glibc

Branch merges

Branch information

Name:
gabriel/powerpc-ieee128-printscan
Repository:
lp:glibc

Recent commits

39a7b82... by "Gabriel F. T. Gomes" <email address hidden> on 2019-07-11

RFC: powerpc64le: Enable support for IEEE long double

Not for glibc-2.31 - Do not commit!

No changes since v3.

Changes since v2:

  - Added definition of LDBL_IBM128_COMPAT_VERSION and
    LDBL_IBM128_VERSION (moved from a previous commit).

Changes since v1:

  - Use __LONG_DOUBLE_USES_FLOAT128 directly.

-- 8< --
On platforms where long double may have two different formats, i.e.: the
same format as double (64-bits) or something else (128-bits), building
with -mlong-double-128 is the default and function calls in the user
program match the name of the function in Glibc. When building with
-mlong-double-64, Glibc installed headers redirect such calls to the
appropriate function.

This patch adds similar redirections to be used by user code builds in
IEEE long double mode (-mabi=ieeelongdouble). It also skips some uses
of libc_hidden_proto in internal headers, because they also produce
redirections, causing a redirection conflict.

PS: Missing NEWS entry.

b851fea... by "Gabriel F. T. Gomes" <email address hidden> on 2019-10-11

powerpc64le: Require a compiler with -mno-gnu-attribute

Not for glibc-2.31 - Do not commit!

No changes since v3.

No changes since v2.

Changes since v1:

  - Added mentions to the build requirement in manual/install.texi,
    INSTALL (regenerated) and NEWS.

-- 8< --
On powerpc64le, a few files are built on IEEE long double mode
(-mabi=ieeelongdouble), whereas most are built on IBM long double mode
(-mabi=ibmlongdouble, the default for -mlong-double-128). Since binutils
2.31, linking object files with different long double modes causes
errors similar to:

  ld: libc_pic.a(s_isinfl.os) uses IBM long double,
      libc_pic.a(ieee128-qefgcvt.os) uses IEEE long double.
  collect2: error: ld returned 1 exit status
  make[2]: *** [../Makerules:649: libc_pic.os] Error 1

The warnings are fair and correct, but in order for glibc to have
support for both long double modes on powerpc64le, they have to be
ignored. This can be accomplished with the use of -mno-gnu-attribute
option when building the few files that require IEEE long double mode.

However, -mno-gnu-attribute is not available in GCC 6, the minimum
version required to build glibc, so this patch adds a test for this
feature in powerpc64le builds, and fails early if it's not available.

Tested, on powerpc64le, that the build fails early with GCC 6 and that
it succeeds with GCC 7 or greater.

Reviewed-by: Joseph Myers <email address hidden>

5a304cd... by "Gabriel F. T. Gomes" <email address hidden> on 2019-09-10

ldbl-128ibm-compat: Do not mix -mabi=*longdouble and -mlong-double-128

No changes since v3.

No changes since v2.

Changes since v1:

  - Do not try to remove -mabi=ieeelongdouble, since it hasn't been
    added. The removal is a residue from our initial development.

-- 8< --
Some compiler versions, e.g. GCC 7, complain when -mlong-double-128 is
used together with -mabi=ibmlongdouble or -mabi=ieeelongdouble,
producing the following error message:

  cc1: error: ‘-mabi=ibmlongdouble’ requires ‘-mlong-double-128’

This patch removes -mlong-double-128 from the compilation lines that
explicitly request -mabi=*longdouble.

Tested for powerpc64le.

5b4ba3c... by "Gabriel F. T. Gomes" <email address hidden> on 2019-09-09

Avoid compat symbols for totalorder in powerpc64le IEEE long double

No changes since v3.

No changes since v2.

Changes since v1:

  - Added comment on the redefinition of libm_alias_float128_other_r_ldbl.

-- 8< --
On powerpc64le, the libm_alias_float128_other_r_ldbl macro is
used to create an alias between totalorderf128 and __totalorderlieee128,
as well as between the totalordermagf128 and __totalordermaglieee128.

However, the totalorder* and totalordermag* functions changed their
parameter type since commit ID 42760d764649 and got compat symbols for
their old versions. With this change, the aforementioned macro would
create two conflicting aliases for __totalorderlieee128 and
__totalordermaglieee128.

This patch avoids the creation of the alias between the IEEE long double
symbols (__totalorderl*ieee128) and the compat symbols, because the IEEE
long double functions have never been exported thus don't need such
compat symbol.

Tested for powerpc64le.

Reviewed-by: Joseph Myers <email address hidden>

11e1ab1... by Tulio Magno Quites Machado Filho <email address hidden> on 2018-07-30

ldbl-128ibm-compat: Compiler flags for stdio functions

No changes since v3.

No changes since v2.

No changes since v1.

-- 8< --
Some of the files that provide stdio.h and wchar.h functions have a
filename prefixed with 'io', such as 'iovsprintf.c'. On platforms that
imply ldbl-128ibm-compat, these files must be compiled with the flag
-mabi=ibmlongdouble. This patch adds this flag to their compilation.

Notice that this is not required for the other files that provide
similar functions, because filenames that are not prefixed with 'io'
have ldbl-128ibm-compat counterparts in the Makefile, which already adds
-mabi=ibmlongdouble to them.

9d353bf... by Tulio Magno Quites Machado Filho <email address hidden> on 2019-10-20

Do not redirect calls to __GI_* symbols, when redirecting to *ieee128

No changes since v3.

No changes since v2.

Changes since v1:

  - Reduced the number of changes to the minimum required to build *cvt
    files in -mabi=ieeelongdouble mode.
  - Added __LONG_DOUBLE_USES_FLOAT128 to all long-double.h files.

-- 8< --
On platforms where long double has IEEE binary128 format as a third
option (initially, only powerpc64le), many exported functions are
redirected to their __*ieee128 equivalents. This redirection is
provided by installed headers such as stdio-ldbl.h, and is supposed to
work correctly with user code.

However, during the build of glibc, similar redirections are employed,
in internal headers, such as include/stdio.h, in order to avoid extra
PLT entries. These redirections conflict with the redirections to
__*ieee128, and must be avoided during the build. This patch protects
the second redirections with a test for __LONG_DOUBLE_USES_FLOAT128, a
new macro that is defined to 1 when functions that deal with long double
typed values reuses the _Float128 implementation (this is currently only
true for powerpc64le).

Tested for powerpc64le, x86_64, and with build-many-glibcs.py.

Co-authored-by: Gabriel F. T. Gomes <email address hidden>
Reviewed-by: Florian Weimer <email address hidden>

ff65f70... by "Gabriel F. T. Gomes" <email address hidden> on 2019-07-11

ldbl-128ibm-compat: Add *cvt functions

No changes since v3.

  - Reviewed-by Paul Murphy. Waiting for the preceding patches.

Changes since v2:

  - Fix http URLs.

No changes since v1.

-- 8< --
This patch adds IEEE long double versions of q*cvt* functions for
powerpc64le. Unlike all other long double to/from string conversion
functions, these do not rely on internal functions that can take
floating-point numbers with different formats and act on them
accordingly, instead, the related files are rebuilt with the
-mabi=ieeelongdouble compiler flag set.

Having -mabi=ieeelongdouble passed to the compiler causes the object
files to be marked with a .gnu_attribute that is incompatible with the
.gnu_attribute in files built with -mabi=ibmlongdouble (the default).
The difference causes error messages similar to the following:

  ld: libc_pic.a(s_isinfl.os) uses IBM long double,
      libc_pic.a(ieee128-qefgcvt_r.os) uses IEEE long double.
  collect2: error: ld returned 1 exit status
  make[2]: *** [../Makerules:649: libc_pic.os] Error 1

Although this warning is useful in other situations, the library
actually needs to have functions with different long double formats, so
.gnu_attribute generation is explicitly disabled for these files with
the use of -mno-gnu-attribute.

Tested for powerpc64le on the branch that actually enables the
sysdeps/ieee754/ldbl-128ibm-compat for powerpc64le.

Reviewed-by: Paul E. Murphy <email address hidden>

cf2f86f... by "Gabriel F. T. Gomes" <email address hidden> on 2019-11-26

Refactor *cvt functions implementation (2/2)

Changes since v3:

  - Converted into a standalone patch not to be squashed with the
    preceding patch (1/2).
  - Updated commit message.
  - Tested that installed stripped binaries for powerpc64le and x86_64
    remain identical before and after this patch.

Changes since v2:

  - Moved the removal of unused macros to a previous patch

Changes since v1:

  - Adapted after patch v1 19/31 (remove hidden_* uses) was dropped.
  - Fixed unintended removal of cvt* symbols on alpha and s390x
    (now tested with build-many-glibcs.py).

-- 8< --
This patch refactors the *cvt functions implementation in a way that
makes it easier to re-use them for implementing the IEEE long double on
powerpc64le. By removing the macros that generate the function names
(APPEND combined with FUNC_PREFIX), the new code makes it easier to
define new function names, such as __qecvtieee128.

Tested that installed stripped binaries for powerpc64le and x86_64
remain identical before and after this patch. Also tested for
powerpc64le, x86_64, as well as with the following build-many-glibcs
targets: alpha-linux-gnu, mips-linux-gnu, powerpc-linux-gnu-soft,
s390x-linux-gnu, and sparc64-linux-gnu.

Reviewed-by: Paul E. Murphy <email address hidden>

35c436e... by "Gabriel F. T. Gomes" <email address hidden> on 2019-07-11

Refactor *cvt functions implementation (1/2)

Changes since v3:

  - Converted into a standalone patch not to be squashed with the
    subsequent patch (2/2).
  - Updated commit message.
  - Tested that installed stripped binaries for powerpc64le and x86_64
    remain identical before and after this patch.

Changes since v2:

  - Squashed patches 1-4 and trivial bits of patch 5.
  - Replaced http with https (like the rest of glibc).
  - Updated copyright years.
  - Removed refactoring noise reported by Paul Murphy.

No changes since v1.

-- 8< --
This patch refactors the *cvt functions implementation in a way that
makes it easier to re-use them for implementing the IEEE long double on
powerpc64le. By splitting the implementation per se in one file
(efgcvt-template.c) and the alias definitions in others (e.g. efgcvt.c),
the new code makes it easier to define new function names, such as
__qecvtieee128.

Tested that installed stripped binaries for powerpc64le and x86_64
remain identical before and after this patch. Also tested for
powerpc64le, x86_64, as well as with the following build-many-glibcs
targets: alpha-linux-gnu, mips-linux-gnu, powerpc-linux-gnu-soft,
s390x-linux-gnu, and sparc64-linux-gnu.

Reviewed-by: Paul E. Murphy <email address hidden>

f1a0eb5... by "Gabriel F. T. Gomes" <email address hidden> on 2019-07-11

ldbl-128ibm-compat: Add ISO C99 versions of scanf functions

In the format string for *scanf functions, the '%as', '%aS', and '%a[]'
modifiers behave differently depending on ISO C99 compatibility. When
_GNU_SOURCE is defined and -std=c89 is passed to the compiler, these
functions behave like ascanf, and the modifiers allocate memory for the
output. Otherwise, the ISO C99 compliant version of these functions is
used, and the modifiers consume a floating-point argument. This patch
adds the IEEE binary128 variant of ISO C99 compliant functions for the
third long double format on powerpc64le.

Tested for powerpc64le.

Reviewed-by: Paul E. Murphy <email address hidden>