Updated ARM NPTL patch

Paul Brook paul at codesourcery.com
Thu Dec 7 09:39:03 PST 2006


We've updated our ARM NPTL patch to apply relative to
r16195 of the public uClibc trunk. It also includes support for Thumb mode.

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-7.patch.gz

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

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

--

RECENT CHANGES

- uClibc-0.9.28-csl-nptl-9 --- vs. public uClibc trunk r16550

  This release incorporates uClibc trunk changes, including Thumb ldso
  fixes.  It also incorporates Thumb NPTL support.

- uClibc-0.9.28-csl-nptl-8 --- vs. public uClibc trunk r16195

  This release incorporates patches from Khem Raj to fix the handling
  of the 'res_init' function by making it resemble the uClibc trunk
  sources more closely.

- uClibc-0.9.28-csl-nptl-7 --- vs. public uClibc trunk r16195

  A new release of our NPTL work, incorporating the public changes as
  of Friday, 2006-9-22.  There are two main regressions relative to
  the -5 release:

  - Due to a bug inherited from the public uClibc sources, when uClibc
    is configured without thread support, user code cannot see errno
    values set by functions in uClibc.  For this reason, this release
    is not useful in a non-threaded configuration.

    The bug is described in more detail here:

       http://uclibc.org/lists/uclibc/2006-September/016498.html

  - When configured to use the NPTL pthread implementation, the call
    'sysconf (_SC_THREAD_THREADS_MAX)' reports that the number of
    threads is limited to roughly 16ki.  This is incorrect; there is
    no limit on the number of threads under NPTL.

- uClibc-0.9.28-csl-nptl-6 --- vs. public uClibc trunk r16105

  This is an intermediate release.  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 --- vs. public uClibc trunk r15891

  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 introduced
  some test suite regressions, as described above.

- 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 test tls/tst-tls6 fails in our tree, but passes under the GNU C
  library.  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-8
test                    none    old             none    old     nptl
==============          ======  ======          ======  ======  ======
assert/assert (1)       fail    fail            fail    fail    fail
inet/bug-if1(4)         fail    pass            fail    pass    pass
malloc/tst-malloc(4)    fail    pass            fail    pass    pass
malloc/tst-mcheck(4)    fail    pass            fail    pass    pass
misc/bug-readdir1(4)    fail    pass            fail    pass    pass
misc/opendir-tst1(4)    fail    pass            fail    pass    pass
mmap/mmap (2)           fail    fail            pass    pass    pass
pthread/ex1             N/A     fail            N/A     pass    pass
pthread/ex6             N/A     fail            N/A     pass    pass
pwd_grp/getgroups (3)   fail    fail            fail    fail    fail
regex/testregexi        hang    hang            pass    pass    pass
regex/tst-regex2        hang    hang            fail    fail    fail
signal/tst-sigsimple(4) fail    pass            fail    pass    pass
time/clocktest          hang    hang            pass    pass    pass
unistd/errno(4)         fail    pass            fail    pass    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.
(4) This test fails in non-threaded configurations of uClibc because
    user code does not see errno values set by uClibc.  This bug is
    present in the public sources, and thus also present in our merged
    sources.

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-8
================        =============           ========================
nptl/tst-cancel7        fail                    fail
nptl/tst-cancelx7       fail                    fail
nptl/tst-exec4          fail                    fail
nptl/tst-sysconf        pass                    fail (regression)
tls/tst-tls6            pass                    fail (regression)


BUILD TOOLS

This release has been built and tested using the SourceryG++ 4.1.1
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.

In Thumb mode problems may be experienced with older linkers (eg. the
CodeSourcery 2006Q1 release). In particular there are known issues with
linking against Thumb symbols in shared libraries, and with calls that
require a PLT entry in Thumb mode. Binutils HEAD and CodeSourcery 2006Q3
have fixed for these issues.

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.

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