CodeSourcery ARM NPTL patch updated for uClibc trunk r16105

Jim Blandy jimb at codesourcery.com
Mon Sep 18 16:08:53 PDT 2006


Hi, folks.  We've updated our ARM NPTL patch to apply relative to
r16105 of the public uClibc trunk.  There are some regressions; we'll
iron them out and publish a new patch shortly.  However, we thought it
would be a good idea to at least put this out for people to experiment
with.

There have been a number of comments and suggestions posted for fixing
and improving the original patch.  I haven't implemented those
suggestions in this revision of the patch, although there were quite a
few that seem like clearly good and valuable things to do.  Now that
the patch is back up to date, I'll be able to take a look at those
again.

As before, it's a very large patch --- 3MB uncompressed.  There are
changes throughout the uClibc tree.  The patch is available at the
following URL:

    http://www.codesourcery.com/public/uClibc-0.9.28-csl-nptl-6.patch.gz

The patch is relative to revision 16105 of the public uClibc trunk.
You can retrieve this base tree from the public uClibc repository with
the following command:

    $ svn checkout -r 16105 svn://uclibc.org/trunk/uClibc

This work was done for MontaVista; from our release notes to them:

----

RECENT CHANGES

- uClibc-0.9.28-csl-nptl-6

  This is an intermediate release, based on revision 16105 of the
  public uClibc trunk.  This merge introduced some test suite
  regressions, but we felt it was worthwhile making the merged patch
  available immediately.  When the regressions have been addressed, we
  will make a new release.

- uClibc-0.9.28-csl-nptl-5

  This release fixes a compilation problem in libc/inet/rpc/rpc_thread.c,
  and avoids a duplicate definition of __USE_BX__ in libpthread/nptl/
  sysdeps/arm/sysdep.h.

- uClibc-0.9.28-csl-nptl-4

  This release is based on the public uClibc trunk, not the public
  uClibc NPTL branch.

- uClibc-0.9.28-csl-nptl-3

  This release is identical to the -2 release, except that it omits
  patches to remove the 'CVS' directories present in the public
  sources (r14664).  Those directories are not included in the
  complete source tree.

- uClibc-0.9.28-csl-nptl-2

  The release uClibc-0.9.28-csl-nptl-1 omitted two changes:
  - a fix for a space leak in dynamic linker related to thread-local
    storage, and
  - a fix to the test suite.

  These changes are included in uClibc-0.9.28-csl-nptl-2.

- uClibc-0.9.28-csl-nptl-1

  This is the initial release, based on revision 14664 of the public
  uClibc NPTL branch, svn://uclibc.org/branches/uClibc-nptl


KNOWN LIMITATIONS

This release has some known limitations:

- The merge with public uClibc trunk revision r16105 has introduced
  some test suite regressions.  We will address these and make a new
  release.

- When linking statically against uClibc, the dlopen function does not
  work properly.  The unmodified uClibc trunk has this problem as
  well, so CodeSourcery does not believe that our NPTL patches are
  responsible; in fact, we believe dlopen works better with our
  patches than without.

  However, many uClibc tests depend on dlopen, so this issue makes it
  difficult to test static linking.  It would be a good idea to
  re-test if statically-linked dlopen is fixed in the future.

- The unmodified public uClibc trunk does not work in Thumb mode.  Our
  patch does not address those problems, since they are unrelated to
  NPTL support.

  However, the existing Thumb issues make it difficult to test our
  changes in Thumb mode.  Once Thumb mode support has been fixed in
  the public sources, CodeSourcery will ensure that NPTL works in
  Thumb mode as well.

- There is one regression in the test suite relative to the GNU C
  library (tls/tst-tls6).  This test checks the allocation of TLS
  module ID numbers to shared libraries; failure to do this correctly
  could result in some dynamic linker data structures growing larger
  than necessary as the program loads and unloads shared libraries.
  CodeSourcery will investigate this failure.


TEST RESULTS

This release has no test suite regressions relative to the unmodified
public uClibc sources, and one regression relative to the GNU C
library (glibc) thread tests.

As a basis for comparison with uClibc, we use test results from the
unmodified public uClibc trunk, configured in two ways:
- with no thread support (called "none" in the chart below)
- with the old LinuxThreads thread library,
  libpthread/linuxthreads.old (called "old")

We configured our uClibc with our changes in three ways:
- with no thread support ("none")
- with the old LinuxThreads thread library ("old")
- with the NPTL thread library ("nptl")

All tests pass in all configurations, except as follows:

                        unpatched trunk         uClibc-0.9.28-csl-nptl-5
test                    none    old             none    old     nptl
==============          ======  ======          ======  ======  ======
assert/assert (1)       fail    fail            fail    fail    fail
mmap/mmap (2)           fail    fail            pass    pass    pass
pwd_grp/getgroups (3)   fail    fail            fail    fail    fail
time/clocktest          hang    hang            hang    hang    hang          
regex/testregexi        hang    hang            hang    hang    hang
regex/tst-regex2        hang    hang            hang    hang    hang
pthread/ex1             N/A     fail            N/A     hang    pass
pthread/ex6             N/A     fail            N/A     hang    pass

"N/A" indicates that the test does not run in that configuration.
"hang" indicates that the test program runs indefinitely.

(1) The harness for this test is not designed for use with
    cross-compilation.
(2) The mmap system call does not exist on ARM EABI Linux; it should
    forward to mmap64.
(3) The test is not written portably.


The directories 'test/nptl' and 'test/tls' include tests copied from
the GNU C library 'nptl' and 'elf' directories.  (Some GNU C library
tests are omitted; these tests are for features not implemented by
uClibc, like POSIX asynchronous I/O.)  These tests run only when the
NPTL thread library is in use.  All these tests pass with both the GNU
C library and our sources, except as follows:

test                    GNU C Library           uClibc-0.9.28-csl-nptl-5
================        =============           ========================
nptl/tst-cancel7        fail                    fail
nptl/tst-cancelx7       fail                    fail
nptl/tst-exec4          fail                    fail
tls/tst-tls6            pass                    fail (regression)


BUILD TOOLS

This release has been built and tested using the SourceryG++ 4.1.0
arm-none-linux-gnueabi toolchain, modified to link against uClibc
instead of glibc.  It should also work with other compilers, as long as
they have EABI+TLS support; however, this has not been tested.


KERNEL SOURCES 

This release was built and tested using the headers from version
2.6.16 of the Linux kernel.


CONFIGURATION

uClibc uses a configuration system similar to that of the Linux
kernel: all Makefiles in the tree include a file in the top directory
named '.config', which sets variables affecting which portions of the
tree are built, and how.

To build uClibc for the ARM with the NPTL libpthread, make the
following selections in '.config':

- Target Architecture: arm                    (TARGET_arm=y; others unset)
- Use ARM EABI: yes                           (CONFIG_ARM_EABI=y)
- Target Processor Endianness: little         (ARCH_LITTLE_ENDIAN=y)
- Linux kernel header location                (KERNEL_SOURCE)
  Set this to the path of the top of a Linux kernel source tree.
- POSIX Threading Support: yes                (UCLIBC_HAS_THREADS=y)
- Build pthreads debugging support: yes       (PTHREADS_DEBUG_SUPPORT=y)
- Native POSIX Threading (NPTL) Support: yes  (UCLIBC_HAS_THREADS_NATIVE=y)
- Use the older (stable) version of           (LINUXTHREADS_OLD unset)
  linuxthreads: no
- Malloc Implementation: malloc-standard      (MALLOC_STANDARD=y; others unset)
  This is necessary to run the NPTL tests in test/nptl; some depend on
  features of the "standard" malloc implementation.

The release file 'csl-nptl.config', mentioned above, includes these
settings.


ACKNOWLEDGEMENTS

This work is based on Steve Hill's NPTL support for the MIPS
architecture, available from the public uClibc Subversion repository
on the branch mentioned above.


More information about the uClibc mailing list