Commit Graph

551 Commits

Author SHA1 Message Date
Florian Weimer
0784e7913f scripts/build-many-glibcs.py: Use https:// for sourceware.org Git clones
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2022-09-05 15:52:24 +02:00
caiyinyu
930993921f LoongArch: Add soft float support. 2022-09-01 09:10:08 +08:00
Florian Weimer
89baed0b93 Revert "Detect ld.so and libc.so version inconsistency during startup"
This reverts commit 6f85dbf102.

Once this change hits the release branches, it will require relinking
of all statically linked applications before static dlopen works
again, for the majority of updates on release branches: The NEWS file
is regularly updated with bug references, so the __libc_early_init
suffix changes, and static dlopen cannot find the function anymore.

While this ABI check is still technically correct (we do require
rebuilding & relinking after glibc updates to keep static dlopen
working), it is too drastic for stable release branches.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2022-08-25 18:46:43 +02:00
Florian Weimer
6f85dbf102 Detect ld.so and libc.so version inconsistency during startup
The files NEWS, include/link.h, and sysdeps/generic/ldsodefs.h
contribute to the version fingerprint used for detection.  The
fingerprint can be further refined using the --with-extra-version-id
configure argument.

_dl_call_libc_early_init is replaced with _dl_lookup_libc_early_init.
The new function is used store a pointer to libc.so's
__libc_early_init function in the libc_map_early_init member of the
ld.so namespace structure.  This function pointer can then be called
directly, so the separate invocation function is no longer needed.

The versioned symbol lookup needs the symbol versioning data
structures, so the initialization of libc_map and libc_map_early_init
is now done from _dl_check_map_versions, after this information
becomes available.  (_dl_map_object_from_fd does not set this up
in time, so the initialization code had to be moved from there.)
This means that the separate initialization code can be removed from
dl_main because _dl_check_map_versions covers all maps, including
the initial executable loaded by the kernel.  The lookup still happens
before relocation and the invocation of IFUNC resolvers, so IFUNC
resolvers are protected from ABI mismatch.

The __libc_early_init function pointer is not protected because
so little code runs between the pointer write and the invocation
(only dynamic linker code and IFUNC resolvers).

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2022-08-24 17:35:57 +02:00
Florian Weimer
bd13cb19f5 scripts/glibcelf.py: Add hashing support
ELF and GNU hashes can now be computed using the elf_hash and
gnu_hash functions.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
2022-08-23 19:33:38 +02:00
Joseph Myers
9125e43daf Use binutils 2.39 branch in build-many-glibcs.py
This patch makes build-many-glibcs.py use binutils 2.39 branch.

Tested with build-many-glibcs.py (compilers and glibcs builds).  Note:
binutils 2.39 shows the same failures for i686-linux-gnu-no-pie,
x86_64-linux-gnu-no-pie and x86_64-linux-gnu-x32-no-pie building the
glibc testsuite as binutils mainline does.
2022-08-18 13:16:56 +00:00
Adhemerval Zanella
841afa116e glibcextract.py: Add compile_c_snippet
It might be used on tests to check if a snippet build with the provided
compiler and flags.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2022-08-12 09:15:03 -03:00
Joseph Myers
a3393b3380 Use Linux 5.19 in build-many-glibcs.py
This patch makes build-many-glibcs.py use Linux 5.19.

Tested with build-many-glibcs.py (host-libraries, compilers and glibcs
builds).
2022-08-02 14:09:24 +00:00
caiyinyu
3be5fc00ad LoongArch: Update build-many-glibcs.py for the LoongArch Port. 2022-07-26 12:35:12 -03:00
caiyinyu
2d83247d90 LoongArch: Add relocations and ELF flags to elf.h and scripts/glibcelf.py 2022-07-26 12:35:12 -03:00
Adhemerval Zanella
8b84fb862c Update scripts/config.* files from upstream GNU config version
This patch updates various miscellaneous files from their upstream
sources (version 2022-05-25).

It is required for loongarch support.

Checked on aarch64-linux-gnu.
2022-07-19 09:32:19 -03:00
Joseph Myers
c33ada0602 Use GCC 12 branch in build-many-glibcs.py
This patch makes build-many-glibcs.py use GCC 12 branch by default.

Tested with build-many-glibcs.py (host-libraries, compilers and glibcs
builds).
2022-07-04 13:15:58 +00:00
Adhemerval Zanella
8521001731 scripts/glibcelf.py: Add PT_AARCH64_MEMTAG_MTE constant
It was added in commit 603e5c8ba7.
This caused the elf/tst-glibcelf consistency check to fail.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2022-06-06 15:56:48 -03:00
Sam James
7df596a58c grep: egrep -> grep -E, fgrep -> grep -F
Newer versions of GNU grep (after grep 3.7, not inclusive) will warn on
'egrep' and 'fgrep' invocations.

Convert usages within the tree to their expanded non-aliased counterparts
to avoid irritating warnings during ./configure and the test suite.

Signed-off-by: Sam James <sam@gentoo.org>
Reviewed-by: Fangrui Song <maskray@google.com>
2022-06-05 12:09:02 -07:00
Joseph Myers
31ec883990 Use Linux 5.18 in build-many-glibcs.py
This patch makes build-many-glibcs.py use Linux 5.18.

Tested with build-many-glibcs.py (host-libraries, compilers and glibcs
builds).
2022-05-24 13:51:24 +00:00
Florian Weimer
d055481ce3 scripts/glibcelf.py: Add *T_RISCV_* constants
SHT_RISCV_ATTRIBUTES, PT_RISCV_ATTRIBUTES, DT_RISCV_VARIANT_CC were
added in commit 0b6c675073
("Update RISC-V specific ELF definitions").  This caused the
elf/tst-glibcelf consistency check to fail.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2022-05-16 22:22:38 +02:00
Florian Weimer
f787e138aa csu: Implement and use _dl_early_allocate during static startup
This implements mmap fallback for a brk failure during TLS
allocation.

scripts/tls-elf-edit.py is updated to support the new patching method.
The script no longer requires that in the input object is of ET_DYN
type.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2022-05-16 18:42:03 +02:00
Adhemerval Zanella
3a0588ae48 elf: Fix DFS sorting algorithm for LD_TRACE_LOADED_OBJECTS with missing libraries (BZ #28868)
On _dl_map_object the underlying file is not opened in trace mode
(in other cases where the underlying file can't be opened,
_dl_map_object  quits with an error).  If there any missing libraries
being processed, they will not be considered on final nlist size
passed on _dl_sort_maps later in the function.  And it is then used by
_dl_sort_maps_dfs on the stack allocated working maps:

222   /* Array to hold RPO sorting results, before we copy back to  maps[].  */
223   struct link_map *rpo[nmaps];
224
225   /* The 'head' position during each DFS iteration. Note that we start at
226      one past the last element due to first-decrement-then-store (see the
227      bottom of above dfs_traversal() routine).  */
228   struct link_map **rpo_head = &rpo[nmaps];

However while transversing the 'l_initfini' on dfs_traversal it will
still consider the l_faked maps and thus update rpo more times than the
allocated working 'rpo', overflowing the stack object.

As suggested in bugzilla, one option would be to avoid sorting the maps
for trace mode.  However I think ignoring l_faked object does make
sense (there is one less constraint to call the sorting function), it
allows a slight less stack usage for trace, and it is slight simpler
solution.

The tests does trigger the stack overflow, however I tried to make
it more generic to check different scenarios or missing objects.

Checked on x86_64-linux-gnu.

Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2022-04-27 08:36:09 -03:00
H.J. Lu
57292f5741 Add GLIBC_ABI_DT_RELR for DT_RELR support
The EI_ABIVERSION field of the ELF header in executables and shared
libraries can be bumped to indicate the minimum ABI requirement on the
dynamic linker.  However, EI_ABIVERSION in executables isn't checked by
the Linux kernel ELF loader nor the existing dynamic linker.  Executables
will crash mysteriously if the dynamic linker doesn't support the ABI
features required by the EI_ABIVERSION field.  The dynamic linker should
be changed to check EI_ABIVERSION in executables.

Add a glibc version, GLIBC_ABI_DT_RELR, to indicate DT_RELR support so
that the existing dynamic linkers will issue an error on executables with
GLIBC_ABI_DT_RELR dependency.  When there is a DT_VERNEED entry with
libc.so on DT_NEEDED, issue an error if there is a DT_RELR entry without
GLIBC_ABI_DT_RELR dependency.

Support __placeholder_only_for_empty_version_map as the placeholder symbol
used only for empty version map to generate GLIBC_ABI_DT_RELR without any
symbols.
2022-04-26 10:16:11 -07:00
H.J. Lu
4610b24f5e elf: Define DT_RELR related macros and types 2022-04-26 10:16:11 -07:00
Florian Weimer
b571f3adff scripts/glibcelf.py: Mark as UNSUPPORTED on Python 3.5 and earlier
enum.IntFlag and enum.EnumMeta._missing_ support are not part of
earlier Python versions.
2022-04-25 09:14:49 +02:00
Florian Weimer
30035d6772 scripts: Add glibcelf.py module
Hopefully, this will lead to tests that are easier to maintain.  The
current approach of parsing readelf -W output using regular expressions
is not necessarily easier than parsing the ELF data directly.

This module is still somewhat incomplete (e.g., coverage of relocation
types and versioning information is missing), but it is sufficient to
perform basic symbol analysis or program header analysis.

The EM_* mapping for architecture-specific constant classes (e.g.,
SttX86_64) is not yet implemented.  The classes are defined for the
benefit of elf/tst-glibcelf.py.

Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2022-04-22 10:58:32 +02:00
Joseph Myers
f7fbb99652 Use Linux 5.17 in build-many-glibcs.py
This patch makes build-many-glibcs.py use Linux 5.17.

Tested with build-many-glibcs.py (host-libraries, compilers and glibcs
builds).
2022-03-22 18:01:16 +00:00
Florian Weimer
a2211c76c3 scripts/dso-ordering-test.py: Fix C&P error in * callrefs processing
The elf/dso-sort-tests-src subdirectory is not changed by this commit,
so it seems that the cut-and-paste error was not material.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2022-03-18 18:18:45 +01:00
Joseph Myers
fb55d9b945 Use binutils 2.38 branch in build-many-glibcs.py
This patch makes build-many-glibcs.py use binutils 2.38 branch.

Tested with build-many-glibcs.py (compilers and glibcs builds).
2022-02-10 15:52:21 +00:00
Adhemerval Zanella
e4ba8fee1a elf: Replace tst-p_alignmod1-editX with a python script
This avoid the cross-compiling breakage when the test should not run
($(run-built-tests) equal to no).

Checked on x86_64-linux-gnu and i686-linux-gnu as well with a cross
compile to aarch64-linux-gnu and powerpc64-linux-gnu.
2022-01-26 08:57:47 -03:00
H.J. Lu
7de501f941 Disable debuginfod in printer tests [BZ #28757]
With gdb-11.1-6.fc35.x86_64, I got

FAIL: nptl/test-cond-printers
FAIL: nptl/test-condattr-printers
FAIL: nptl/test-mutex-printers
FAIL: nptl/test-mutexattr-printers
FAIL: nptl/test-rwlock-printers
FAIL: nptl/test-rwlockattr-printers

$ cat nptl/test-condattr-printers.out
Error: Response does not match the expected pattern.
Command: start
Expected pattern: main
Response:  Temporary breakpoint 1 at 0x11d5: file test-condattr-printers.c, line 43.
Starting program: /export/build/gnu/tools-build/glibc-cet-gitlab/build-x86_64-linux/nptl/test-condattr-printers

This GDB supports auto-downloading debuginfo from the following URLs:
https://debuginfod.fedoraproject.org/
Enable debuginfod for this session? (y or [n])

Disable debuginfod to avoid GDB messages.  This fixes BZ #28757.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2022-01-14 05:07:29 -08:00
Joseph Myers
a59cd1328a Use Linux 5.16 in build-many-glibcs.py
This patch makes build-many-glibcs.py use Linux 5.16.

Tested with build-many-glibcs.py (host-libraries, compilers and glibcs
builds).
2022-01-11 15:38:06 +00:00
Stafford Horne
e981650654 build-many-glibcs.py: add OpenRISC support
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2022-01-05 06:40:06 +09:00
Paul Eggert
0933a4a1b7 Sync move-if-change from Gnulib, updating copyright 2022-01-01 11:42:26 -08:00
Paul Eggert
634b5ebac6 Update copyright dates not handled by scripts/update-copyrights.
I've updated copyright dates in glibc for 2022.  This is the patch for
the changes not generated by scripts/update-copyrights and subsequent
build / regeneration of generated files.  As well as the usual annual
updates, mainly dates in --version output (minus csu/version.c which
previously had to be handled manually but is now successfully updated
by update-copyrights), there is a small change to the copyright notice
in NEWS which should let NEWS get updated automatically next year.

Please remember to include 2022 in the dates for any new files added
in future (which means updating any existing uncommitted patches you
have that add new files to use the new copyright dates in them).
2022-01-01 11:42:26 -08:00
Paul Eggert
581c785bf3 Update copyright dates with scripts/update-copyrights
I used these shell commands:

../glibc/scripts/update-copyrights $PWD/../gnulib/build-aux/update-copyright
(cd ../glibc && git commit -am"[this commit message]")

and then ignored the output, which consisted lines saying "FOO: warning:
copyright statement not found" for each of 7061 files FOO.

I then removed trailing white space from math/tgmath.h,
support/tst-support-open-dev-null-range.c, and
sysdeps/x86_64/multiarch/strlen-vec.S, to work around the following
obscure pre-commit check failure diagnostics from Savannah.  I don't
know why I run into these diagnostics whereas others evidently do not.

remote: *** 912-#endif
remote: *** 913:
remote: *** 914-
remote: *** error: lines with trailing whitespace found
...
remote: *** error: sysdeps/unix/sysv/linux/statx_cp.c: trailing lines
2022-01-01 11:40:24 -08:00
Siddhesh Poyarekar
72e4a717bd Fix The GNU ToolChain Authors copyright notice
I (and maybe one or two others) added a (C) to the copyright notice
regardless of the contribution checklist[1] not mentioning it.  Fix all
these instances so that the notice reads as "Copyright The GNU Toolchain
Authors" across the source code.

[1] https://sourceware.org/glibc/wiki/Contribution%20checklist

Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2021-12-17 07:59:45 +05:30
Siddhesh Poyarekar
23645707f1 Replace --enable-static-pie with --disable-default-pie
Build glibc programs and tests as PIE by default and enable static-pie
automatically if the architecture and toolchain supports it.

Also add a new configuration option --disable-default-pie to prevent
building programs as PIE.

Only the following architectures now have PIE disabled by default
because they do not work at the moment.  hppa, ia64, alpha and csky
don't work because the linker is unable to handle a pcrel relocation
generated from PIE objects.  The microblaze compiler is currently
failing with an ICE.  GNU hurd tries to enable static-pie, which does
not work and hence fails.  All these targets have default PIE disabled
at the moment and I have left it to the target maintainers to enable PIE
on their targets.

build-many-glibcs runs clean for all targets.  I also tested x86_64 on
Fedora and Ubuntu, to verify that the default build as well as
--disable-default-pie work as expected with both system toolchains.

Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2021-12-13 08:08:59 +05:30
H.J. Lu
b4bbedb1e7 dso-ordering-test.py: Put all sources in one directory [BZ #28550]
Put all sources for DSO sorting tests in the dso-sort-tests-src directory
and compile test relocatable objects with

$(objpfx)tst-dso-ordering1-dir/tst-dso-ordering1-a.os: $(objpfx)dso-sort-tests-src/tst-dso-ordering1-a.c
	$(compile.c) $(OUTPUT_OPTION)

to avoid random $< values from $(before-compile) when compiling test
relocatable objects with

$(objpfx)%$o: $(objpfx)%.c $(before-compile); $$(compile-command.c)
compile-command.c = $(compile.c) $(OUTPUT_OPTION) $(compile-mkdep-flags)
compile.c = $(CC) $< -c $(CFLAGS) $(CPPFLAGS)

for 3 "make -j 28" parallel builds on a machine with 112 cores at the
same time.

This partially fixes BZ #28550.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2021-11-15 11:53:40 -08:00
H.J. Lu
cbcd65c8b5 Add a comment for --enable-initfini-array [BZ #27945]
Document that --enable-initfini-array is enabled by default in GCC 12,
which can be removed when GCC 12 becomes the minimum requirement.
2021-11-13 09:50:07 -08:00
H.J. Lu
a586fe9c80 Configure GCC with --enable-initfini-array [BZ #27945]
Starting from GCC 12, the .init_array and .fini_array sections are enabled
unconditionally by

commit 13a39886940331149173b25d6ebde0850668d8b9
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Tue Jun 8 16:09:24 2021 -0700

    Always enable DT_INIT_ARRAY/DT_FINI_ARRAY on Linux

configure GCC with --enable-initfini-array to enable them when using GCC
release branches.

Fixes BZ #27945.
2021-11-05 15:30:02 -07:00
Joseph Myers
db432f033d Use Linux 5.15 in build-many-glibcs.py
This patch makes build-many-glibcs.py use Linux 5.15.

Tested with build-many-glibcs.py (host-libraries, compilers and glibcs
builds).
2021-11-02 16:54:59 +00:00
Chung-Lin Tang
e6fd79f379 elf: Testing infrastructure for ld.so DSO sorting (BZ #17645)
This is the first of a 2-part patch set that fixes slow DSO sorting behavior in
the dynamic loader, as reported in BZ #17645. In order to facilitate such a
large modification to the dynamic loader, this first patch implements a testing
framework for validating shared object sorting behavior, to enable comparison
between old/new sorting algorithms, and any later enhancements.

This testing infrastructure consists of a Python script
scripts/dso-ordering-test.py' which takes in a description language, consisting
of strings that describe a set of link dependency relations between DSOs, and
generates testcase programs and Makefile fragments to automatically test the
described situation, for example:

  a->b->c->d          # four objects linked one after another

  a->[bc]->d;b->c     # a depends on b and c, which both depend on d,
                      # b depends on c (b,c linked to object a in fixed order)

  a->b->c;{+a;%a;-a}  # a, b, c serially dependent, main program uses
                      # dlopen/dlsym/dlclose on object a

  a->b->c;{}!->[abc]  # a, b, c serially dependent; multiple tests generated
                      # to test all permutations of a, b, c ordering linked
                      # to main program

 (Above is just a short description of what the script can do, more
  documentation is in the script comments.)

Two files containing several new tests, elf/dso-sort-tests-[12].def are added,
including test scenarios for BZ #15311 and Redhat issue #1162810 [1].

Due to the nature of dynamic loader tests, where the sorting behavior and test
output occurs before/after main(), generating testcases to use
support/test-driver.c does not suffice to control meaningful timeout for ld.so.
Therefore a new utility program 'support/test-run-command', based on
test-driver.c/support_test_main.c has been added. This does the same testcase
control, but for a program specified through a command-line rather than at the
source code level. This utility is used to run the dynamic loader testcases
generated by dso-ordering-test.py.

[1] https://bugzilla.redhat.com/show_bug.cgi?id=1162810

Signed-off-by: Chung-Lin Tang  <cltang@codesourcery.com>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2021-10-21 11:23:53 -03:00
Fangrui Song
46baeb61e1 glibcextract.py: Place un-assemblable @@@ in a comment
Unlike GCC, Clang parses asm statements and verifies they are valid
instructions/directives. Place the magic @@@ into a comment to avoid
a parse error.
2021-10-19 09:58:16 -07:00
Paul E. Murphy
4ae2b8a423 build-many-glibcs.py: add powerpc64le glibc variant without multiarch
This configuration tests the float128 to ldouble128 redirect support
on powerpc64le without the extra wrappers needed to support ifunc
on this target.
2021-09-24 14:32:35 -05:00
Joseph Myers
876e51548c Fix build-many-glibcs.py --strip for installed library renaming
The renaming of installed shared libraries to use the SONAME directly
rather than linking to a versioned name stopped build-many-glibcs.py
--strip (used to facilitate comparing binaries before and after
changes that aren't meant to change any generated code in installed
glibc shared libraries) from stripping most of the installed shared
libraries, because it stripped only the *.so names.  Fix it to strip
*.so* names instead and to detect the case of linker scripts using
grep instead of hardcoding particular files that are linker scripts.

Tested with build-many-glibcs.py --strip.
2021-09-16 14:08:05 +00:00
Joseph Myers
4e04a47208 Use Linux 5.14 in build-many-glibcs.py
This patch makes build-many-glibcs.py use Linux 5.14.

Tested with build-many-glibcs.py (host-libraries, compilers and glibcs
builds).
2021-09-07 13:08:38 +00:00
Siddhesh Poyarekar
30891f35fa Remove "Contributed by" lines
We stopped adding "Contributed by" or similar lines in sources in 2012
in favour of git logs and keeping the Contributors section of the
glibc manual up to date.  Removing these lines makes the license
header a bit more consistent across files and also removes the
possibility of error in attribution when license blocks or files are
copied across since the contributed-by lines don't actually reflect
reality in those cases.

Move all "Contributed by" and similar lines (Written by, Test by,
etc.) into a new file CONTRIBUTED-BY to retain record of these
contributions.  These contributors are also mentioned in
manual/contrib.texi, so we just maintain this additional record as a
courtesy to the earlier developers.

The following scripts were used to filter a list of files to edit in
place and to clean up the CONTRIBUTED-BY file respectively.  These
were not added to the glibc sources because they're not expected to be
of any use in future given that this is a one time task:

https://gist.github.com/siddhesh/b5ecac94eabfd72ed2916d6d8157e7dc
https://gist.github.com/siddhesh/15ea1f5e435ace9774f485030695ee02

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2021-09-03 22:06:44 +05:30
Siddhesh Poyarekar
04f2125c6e Port shared code information from the wiki
Since the shared code now has special status with respect to
copyrights, port them into a more structured format in the source tree
and add a python function that parses and returns a dictionary with
the information.

I need this to exclude these files from the Contributed-by changes and
I reckon it would be useful to know these files for future tooling.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2021-09-03 22:00:37 +05:30
Joseph Myers
1d7b32ee61 Use binutils 2.37 branch in build-many-glibcs.py
This patch makes build-many-glibcs.py use binutils 2.37 branch.

Tested with build-many-glibcs.py (compilers and glibcs builds).
2021-08-09 17:00:36 +00:00
Florian Weimer
5f18453d1c build-many-glibcs.py: Add x86_64-linux-gnu-minimal configuration
This configuration exercises various --disable-* configure options.
It is expected to catch -Werror failures that only affect these
configurations.
2021-07-28 14:47:33 +02:00
Florian Weimer
1e5235c561 build-many-glibcs.py: Add glibcs-arm-linux-gnueabihf-thumb
Previously, there was no thumb variant, despite that building
glibc in Thumb-2 mode is supported.
2021-07-09 10:59:22 +02:00
Joseph Myers
38f58041ba Use Linux 5.13 in build-many-glibcs.py
This patch makes build-many-glibcs.py use Linux 5.13.

Tested with build-many-glibcs.py (host-libraries, compilers and glibcs
builds).
2021-06-30 13:29:08 +00:00
Florian Weimer
3640654575 nptl_db: Re-use the ELF-to-abilist converter for ABI checking
The previous approach uses readelf -DWs, which does not produce
a stable output format (older binutils versions do not include
symbol version information).  This commit re-uses scripts/abilist.awk
with a tweak to include GLIBC_PRIVATE symbols.  This awk script
is based on objdump -T output, which appears to be stable over time.

Reviewed-by: Szabolcs Nagy <szabolcs.nagy@arm.com>
2021-06-29 22:17:08 +02:00
Florian Weimer
c44838ebf8 Add libc ABI extension kludge for baseline-violating libdl symbols
Some targets have a GLIBC_2.0 baseline for libdl, while using
GLIBC_2.2 for libc.  This means that the generated libc.map file
does not have any version nodes for GLIBC_2.0 or GLIBC_2.1.  However,
moving symbols from libdl into libc needs such version nodes.
(Future symbol moves from librt will need this as well.)

This kludge is only necessary for symbols predating GLIBC_2.2 because
the affected targets use GLIBC_2.2 as the baseline for libc.  Given
the small number and fixed set of affected architectures, no generic
mechanism is implemented, and instead the map file fragment is
hard-coded in scripts/versions.mk.

The compat_symbol macro already emits the appropriate version strings,
so no adjustments are needed there.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2021-06-02 07:34:24 +02:00
Florian Weimer
d32ee64df7 scripts/versions.awk: Add local: * to all version nodes
This requires that all exported symbol versions are listed in
Versions files.  It results in more consistent behavior across
architectures because previously, symbols could be exported
via explicit versioned_symbol and compat_symbol macros if the
version node existed in some Versions file (without listing the
symbol), and it was not the base version for the library (which
already had the local: * directive).

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2021-06-02 07:32:44 +02:00
Florian Weimer
a64af8c9b6 scripts/versions.awk: Add strings and hashes to <first-versions.h>
This generates new macros of this from:

They are useful for symbol lookups using _dl_lookup_direct.

Tested-by: Carlos O'Donell <carlos@redhat.com>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2021-05-10 10:31:41 +02:00
Joseph Myers
876cdfd154 Use Linux 5.12 and GCC 11 branch in build-many-glibcs.py.
This patch makes build-many-glibcs.py use Linux 5.12 and GCC 11
branch.

Tested with build-many-glibcs.py (host-libraries, compilers and glibcs
builds).
2021-04-27 15:19:08 +00:00
Florian Weimer
3977477d48 glibcymbols.read_abilist: Add check for duplicate symbols
This detects some bogus abilist files.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2021-03-16 15:57:16 +01:00
Florian Weimer
b9e2903712 scripts/glibcsymbols.py: Extract from scripts/move-symbol-to-libc.py
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2021-03-16 15:57:04 +01:00
Stefan Liebler
e91f44089c Allow gdb version 10 in pretty printer tests.
With gdb 10, the pretty printer tests are UNSUPPORTED::
The gdb version string (gdb -v) is incorrectly formatted.

This is observable in:
nptl/test-cond-printers, nptl/test-condattr-printers,
nptl/test-mutex-printers, nptl/test-mutexattr-printers,
nptl/test-rwlock-printers, nptl/test-rwlockattr-printers

After updating the regexp and building with debug-info,
all those tests are passing.
2021-03-11 14:08:07 +01:00
Lukasz Majewski
496e36f225 tst: Extend cross-test-ssh.sh to specify if target date can be altered
This code adds new flag - '--allow-time-setting' to cross-test-ssh.sh
script to indicate if it is allowed to alter the date on the system
on which tests are executed. This change is supposed to be used with
test systems, which use virtual machines for testing.

The GLIBC_TEST_ALLOW_TIME_SETTING env variable is exported to the
remote environment on which the eligible test is run and brings no
functional change when it is not.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2021-03-08 22:37:16 +01:00
Joseph Myers
8a7b4dc6d0 Use Linux 5.11 in build-many-glibcs.py.
This patch makes build-many-glibcs.py use Linux 5.11.

Tested with build-many-glibcs.py (host-libraries, compilers and glibcs
builds).
2021-02-22 16:11:21 +00:00
Florian Weimer
418f5783d9 build-many-glibcs.py: Use make -O for more consistent log output
The -O option avoids interleaving (e.g.) compiler error messages
with other build messages, and makes attribution of messages to
commands easier.

According to my tests, the impact on build time is within the noise.
2021-02-22 09:39:14 +01:00
Joseph Myers
dfc3907cde Use binutils 2.36 branch in build-many-glibcs.py.
This patch makes build-many-glibcs.py use binutils 2.36 branch.

Tested with build-many-glibcs.py (compilers and glibcs builds).
2021-02-04 16:00:36 +00:00
Szabolcs Nagy
bfe04789a8 elf: Avoid RELATIVE relocs in __tunables_init
With static pie linking pointers in the tunables list need
RELATIVE relocs since the absolute address is not known at link
time. We want to avoid relocations so the static pie self
relocation can be done after tunables are initialized.

This is a simple fix that embeds the tunable strings into the
tunable list instead of using pointers.  It is possible to have
a more compact representation of tunables with some additional
complexity in the generator and tunable parser logic.  Such
optimization will be useful if the list of tunables grows.

There is still an issue that tunables_strdup allocates and the
failure handling code path is sufficiently complex that it can
easily have RELATIVE relocations.  It is possible to avoid the
early allocation and only change environment variables in a
setuid exe after relocations are processed.  But that is a
bigger change and early failure is fatal anyway so it is not
as critical to fix right away. This is bug 27181.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2021-01-21 14:05:15 +00:00
Szabolcs Nagy
058308066c elf: Make the tunable struct definition internal only
The representation of the tunables including type information and
the tunable list structure are only used in the implementation not
in the tunables api that is exposed to usage within glibc.

This patch moves the representation related definitions into the
existing dl-tunable-types.h and uses that only for implementation.

The tunable callback and related types are moved to dl-tunables.h
because they are part of the tunables api.

This reduces the details exposed in the tunables api so the internals
are easier to change.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2021-01-21 14:05:15 +00:00
Fangrui Song
87d583c6e8 install: Replace scripts/output-format.sed with objdump -f [BZ #26559]
GNU ld and gold have supported --print-output-format since 2011. glibc
requires binutils>=2.25 (2015), so if LD is GNU ld or gold, we can
assume the option is supported.

lld is by default a cross linker supporting multiple targets. It auto
detects the file format and does not need OUTPUT_FORMAT. It does not
support --print-output-format.

By parsing objdump -f, we can support all the three linkers.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2021-01-11 12:03:36 -08:00
Paul Eggert
ba74122538 Sync move-if-change from Gnulib
This alters move-if-change so that its --version option outputs
the correct copyright date automatically.  One less thing
to update by hand.
2021-01-02 12:43:58 -08:00
Paul Eggert
9fcdec7386 Update copyright dates not handled by scripts/update-copyrights.
I've updated copyright dates in glibc for 2021.  This is the patch for
the changes not generated by scripts/update-copyrights and subsequent
build / regeneration of generated files.  As well as the usual annual
updates, mainly dates in --version output (minus csu/version.c which
previously had to be handled manually but is now successfully updated
by update-copyrights), there is a small change to the copyright notice
in NEWS which should let NEWS get updated automatically next year.

Please remember to include 2021 in the dates for any new files added
in future (which means updating any existing uncommitted patches you
have that add new files to use the new copyright dates in them).
2021-01-02 12:17:34 -08:00
Paul Eggert
2b778ceb40 Update copyright dates with scripts/update-copyrights
I used these shell commands:

../glibc/scripts/update-copyrights $PWD/../gnulib/build-aux/update-copyright
(cd ../glibc && git commit -am"[this commit message]")

and then ignored the output, which consisted lines saying "FOO: warning:
copyright statement not found" for each of 6694 files FOO.
I then removed trailing white space from benchtests/bench-pthread-locks.c
and iconvdata/tst-iconv-big5-hkscs-to-2ucs4.c, to work around this
diagnostic from Savannah:
remote: *** pre-commit check failed ...
remote: *** error: lines with trailing whitespace found
remote: error: hook declined to update refs/heads/master
2021-01-02 12:17:34 -08:00
Samuel Thibault
016c64236d hurd: Accept including hurd/version.h
We need it to get the RPC API version.
2020-12-29 03:26:12 +01:00
Joseph Myers
1f3cb8d600 Use Linux 5.10 in build-many-glibcs.py.
This patch makes build-many-glibcs.py use Linux 5.10.

Tested with build-many-glibcs.py (host-libraries, compilers and glibcs
builds).
2020-12-15 23:36:41 +00:00
Joseph Myers
7366cb03f8 Use GMP 6.2.1 in build-many-glibcs.py.
This patch makes build-many-glibcs.py use the recent GMP 6.2.1
release.

Tested with build-many-glibcs.py (host-libraries, compilers and glibcs
builds).
2020-12-15 16:45:49 +00:00
Florian Weimer
7dc2f14bb3 Add scripts/move-symbol-to-libc.py
This helper script can be used to move symbols to libc.abilist across
all architectures, while preserving their symbol version.
2020-12-04 19:33:36 +01:00
Samuel Thibault
9446e02b0d hurd: Remove some remnants of cthreads
Libc has actually been using mach's lock-internal.h mutex for a long
time already.
2020-11-15 13:16:03 +01:00
Joseph Myers
b853a4176c Use MPC 1.2.1 in build-many-glibcs.py.
This patch makes build-many-glibcs.py use the new MPC 1.2.1 release.

Tested with build-many-glibcs.py (host-libraries, compilers and glibcs
builds).
2020-10-30 17:16:54 +00:00
Joseph Myers
f603224706 Use Linux 5.9 in build-many-glibcs.py.
This patch makes build-many-glibcs.py use Linux 5.9.

Tested with build-many-glibcs.py (host-libraries, compilers and glibcs
builds).
2020-10-22 14:29:13 +00:00
Florian Weimer
1a945ba5ad scripts/update-copyrights: Update csu/version.c, elf/dl-usage.c
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2020-10-08 15:37:59 +02:00
DJ Delorie
78e09591a5 Optimize scripts/merge-test-results.sh
The inner loop is called thousands of times per "make check" even
if there's otherwise nothing to do.  Avoid calling /bin/head all
those times when a builtin will do.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2020-10-05 17:16:03 -04:00
Zong Li
567b170501 Add RISC-V 32-bit target to build-many-glibcs.py
Support building three variants of 32-bit RISC-V glibc as follows:
- riscv32-linux-gnu-rv32imac-ilp32
- riscv32-linux-gnu-rv32imafdc-ilp32
- riscv32-linux-gnu-rv32imafdc-ilp32d

Reviewed-by: Maciej W. Rozycki <macro@wdc.com>
2020-08-27 08:17:44 -07:00
Siddhesh Poyarekar
cd71f47acc [vcstocl] Import ProjectQuirks from its own file
ProjectQuirks moved into its own file in gnulib because one cannot
import modules with hyphens in them.  Adjust the quirks file to
reflect this reality.
2020-08-20 23:23:01 +05:30
Stefan Liebler
33dd32fd79 build-many-glibcs.py: Add a s390x -O3 glibc variant.
On s390x, gcc inlines more aggresive compared to other architectures.
This occaisionally leads to build warnings / errors.

Therefore this patch adds a s390x glibc variant with optimization.

There is the ccopts field which contain ABI options which are passed
to configure as CC / CXX.  Now there is also the cflags field which
contains non-ABI options like -g or -O. Those are passed to configure
as CFLAGS / CXXFLAGS.

Currently CC is passed to conformtest.py or linknamespace.py but not
the CFLAGS.
2020-08-20 10:51:42 +02:00
Joseph Myers
c08df688f2 Use MPC 1.2.0 in build-many-glibcs.py.
This patch makes build-many-glibcs.py use the new MPC 1.2.0 release.

Tested with build-many-glibcs.py (host-libraries, compilers and glibcs
builds).
2020-08-19 13:48:14 +00:00
Joseph Myers
23a7896d06 Update build-many-glibcs.py for binutils ia64 obsoletion.
Since binutils has obsoleted ia64 support, use --enable-obsolete for
now when configuring binutils for ia64 in build-many-glibcs.py (which
requires adding support for architecture-specific binutils configure
options there).  As with other obsoletions, the removal of support for
ia64 in any of (binutils, GCC, Linux kernel) should imply its removal
from glibc.

Tested with build-many-glibcs.py for ia64-linux-gnu (compilers and
glibcs build).
2020-08-13 18:51:10 +00:00
Joseph Myers
42a00a0fb4 Use Linux 5.8 in build-many-glibcs.py.
This patch makes build-many-glibcs.py use Linux 5.8.

Tested with build-many-glibcs.py (host-libraries, compilers and glibcs
builds).
2020-08-07 14:38:12 +00:00
Joseph Myers
b51c1500e0 Use binutils 2.35 branch in build-many-glibcs.py.
This patch makes build-many-glibcs.py use binutils 2.35 branch.

Tested with build-many-glibcs.py (compilers and glibcs builds).
2020-07-27 14:55:10 +00:00
Joseph Myers
63ce2425c2 Use MPFR 4.1.0 in build-many-glibcs.py.
This patch makes build-many-glibcs.py use the new MPFR 4.1.0 release.

Tested with build-many-glibcs.py (host-libraries, compilers and glibcs
builds).
2020-07-20 18:16:50 +00:00
Petr Vorel
5500cdba40 Remove --enable-obsolete-rpc configure flag
Sun RPC was removed from glibc. This includes rpcgen program, librpcsvc,
and Sun RPC headers. Also test for bug #20790 was removed
(test for rpcgen).

Backward compatibility for old programs is kept only for architectures
and ABIs that have been added in or before version 2.28.

libtirpc is mature enough, librpcsvc and rpcgen are provided in
rpcsvc-proto project.

NOTE: libnsl code depends on Sun RPC (installed libnsl headers use
installed Sun RPC headers), thus --enable-obsolete-rpc was a dependency
for --enable-obsolete-nsl (removed in a previous commit).

The arc ABI list file has to be updated because the port was added
with the sunrpc symbols

Tested-by: Carlos O'Donell <carlos@redhat.com>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2020-07-13 19:36:35 +02:00
Vineet Gupta
2fc2260ba4 build-many-glibcs.py: Enable ARC builds
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2020-07-10 16:08:45 -07:00
Petr Vorel
ae7a94e5e3 Remove --enable-obsolete-nsl configure flag
this means that *always* libnsl is only built as shared library for
backward compatibility and the NSS modules libnss_nis and libnss_nisplus
are not built at all, libnsl's headers aren't installed.

This compatibility is kept only for architectures and ABIs that have
been added in or before version 2.28.

Replacement implementations based on TIRPC, which additionally support
IPv6, are available from <https://github.com/thkukuk/>.

This change does not affect libnss_compat which does not depended
on libnsl since 2.27 and thus can be used without NIS.

libnsl code depends on Sun RPC, e.g. on --enable-obsolete-rpc (installed
libnsl headers use installed Sun RPC headers), which will be removed in
the following commit.
2020-07-08 17:25:57 +02:00
Adhemerval Zanella
f13d260190 signal: Move sys_errlist to a compat symbol
The symbol is deprecated by strerror since its usage imposes some issues
such as copy relocations.

Its internal name is also changed to _sys_errlist_internal to avoid
static linking usage.  The compat code is also refactored by removing
the over enginered errlist-compat.c generation from manual entried and
extra comment token in linker script file.  It disantangle the code
generation from manual and simplify both Linux and Hurd compat code.

The definitions from errlist.c are moved to errlist.h and a new test
is added to avoid a new errno entry without an associated one in manual.

Checked on x86_64-linux-gnu and i686-linux-gnu. I also run a check-abi
on all affected platforms.

Tested-by: Carlos O'Donell <carlos@redhat.com>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2020-07-07 14:10:58 -03:00
Joseph Myers
c477beb2cc Use Linux 5.7 in build-many-glibcs.py.
This patch makes build-many-glibcs.py use Linux 5.7.

Tested with build-many-glibcs.py (host-libraries, compilers and glibcs
builds).
2020-06-10 22:53:55 +00:00
Joseph Myers
99a327f801 Use GCC 10 branch in build-many-glibcs.py.
This updates the default GCC version used in build-many-glibcs.py when
no version is specified explicitly.  I'm replacing my bot using GCC 8
with one using GCC 10 (leaving the GCC 9 and GCC mainline bots running
as at present).
2020-05-06 15:41:55 +00:00
Florian Weimer
076f09afba Linux: Remove <sys/sysctl.h> and the sysctl function
Linux 5.5 remove the system call in commit
61a47c1ad3a4dc6882f01ebdc88138ac62d0df03 ("Linux: Remove
<sys/sysctl.h>").  Therefore, the compat function is just a stub that
sets ENOSYS.

Due to SHLIB_COMPAT, new ports will not add the sysctl function anymore
automatically.

x32 already lacks the sysctl function, so an empty sysctl.c file is
used to suppress it.  Otherwise, a new compat symbol would be added.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2020-04-15 17:17:32 +02:00
Joseph Myers
6b89dbc3ca Use Linux 5.6 and GMP 6.2.0 in build-many-glibcs.py.
This patch makes build-many-glibcs.py use the current versions of
Linux (5.6) and GMP (6.2.0).

Tested with build-many-glibcs.py (host-libraries, compilers and glibcs
builds).
2020-03-31 00:22:22 +00:00
Florian Weimer
feaa150680 build-many-glibcs.py: Add list-compilers, list-glibcs commands
These commands are helpful for scripting the distribution of
build-many-glibcs.py runs across multiple builders.
2020-03-03 07:39:16 +01:00
Florian Weimer
c592721a5b build-many-glibcs.py: Add --shallow option
The history is not used by build-many-glibcs.py itself.
--replace-sources deletes an existing source tree before switching
the version.  But some users prefer to have the full history
available, therefore make shallow clones optional with the --shallow
option.
2020-03-03 07:39:16 +01:00
Florian Weimer
0499a353a6 elf: Add elf/check-wx-segment, a test for the presence of WX segments
Writable, executable segments defeat security hardening.  The
existing check for DT_TEXTREL does not catch this.

hppa and SPARC currently keep the PLT in an RWX load segment.
2020-03-02 14:25:20 +01:00
Stefan Liebler
5e6efd3ec2 Use gcc -finput-charset=ascii for check-installed-headers.
A non-ascii character in the installed headers leads now to:
error: failure to convert ascii to UTF-8

Such a finding in s390 specific fenv.h leads to fails in GCC testsuite.
See glibc commit 08aea89ef6.

Adding this gcc option also to our tests was proposed by Florian Weimer.

This change also found a hit in resource.h where now "microseconds" is used.
I've adjusted all the resource.h files.

I've used the following command to check for further hits in headers.
LC_ALL=C find -name "*.h" -exec grep -PHn "[\x80-\xFF]" {} \;

Tested on s390x and x86_64.

Reviewed-by: Zack Weinberg <zackw@panix.com>
2020-02-13 17:32:00 +01:00
Joseph Myers
a179673f3d Use --disable-gdbserver in build-many-glibcs.py.
Now that binutils-gdb has gdbserver at top level, an extra
--disable-gdbserver configure option is needed when configuring
binutils from a git checkout to avoid it also building gdbserver
unnecessarily (although fairly harmlessly).  This patch updates the
options used in build-many-glibcs.py accordingly (although this might
end up not being needed depending on what happens regarding whether
gdbserver gets built for host != target).

Tested with a build-many-glibcs.py compilers build for
aarch64-linux-gnu using binutils-gdb master.
2020-02-10 22:17:59 +00:00
Joseph Myers
286a01d7ab Use binutils 2.34 branch in build-many-glibcs.py.
This patch makes build-many-glibcs.py use binutils 2.34 branch.

Tested with build-many-glibcs.py (compilers and glibcs builds).
2020-02-03 20:38:27 +00:00
Joseph Myers
2db7feeb95 Use Linux 5.5 in build-many-glibcs.py.
This patch makes build-many-glibcs.py use Linux 5.5.

Tested with build-many-glibcs.py (compilers and glibcs builds).
2020-02-03 14:17:05 +00:00
Siddhesh Poyarekar
44b2d5f1ba list-fixed-bugs.py: Wrap at 72 chars
Wrap the bug list output at 72 chars to make it easy to paste into
emails.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2020-02-03 09:08:55 +05:30