diff options
author | "Steven J. Hill" <sjhill@realitydiluted.com> | 2005-08-17 14:48:11 +0000 |
---|---|---|
committer | "Steven J. Hill" <sjhill@realitydiluted.com> | 2005-08-17 14:48:11 +0000 |
commit | 54a7d559374ef72fa59bbe3a56d27ff5ec34d3aa (patch) | |
tree | 1fe7209313f2728c550d3eb75929b4af051fb349 | |
parent | b46868ff8b3d2fb592e3fca4a516695533eae9e5 (diff) | |
download | uClibc-alpine-54a7d559374ef72fa59bbe3a56d27ff5ec34d3aa.tar.bz2 uClibc-alpine-54a7d559374ef72fa59bbe3a56d27ff5ec34d3aa.tar.xz |
Merge/sync with trunk.
48 files changed, 460 insertions, 121 deletions
@@ -174,7 +174,13 @@ install_dev: $(INSTALL) -d $(PREFIX)$(DEVEL_PREFIX)lib $(INSTALL) -d $(PREFIX)$(DEVEL_PREFIX)include -$(INSTALL) -m 644 lib/*.[ao] $(PREFIX)$(DEVEL_PREFIX)lib/ - tar -chf - include | tar -xf - -C $(PREFIX)$(DEVEL_PREFIX) + if [ "$(KERNEL_SOURCE)" == "$(DEVEL_PREFIX)" ] ; then \ + extra_exclude="--exclude include/linux --exclude include/asm'*'" ; \ + else \ + extra_exclude="" ; \ + fi ; \ + tar -chf - include --exclude .svn --exclude CVS $$extra_exclude \ + | tar -xf - -C $(PREFIX)$(DEVEL_PREFIX) ifneq ($(strip $(UCLIBC_HAS_FLOATS)),y) # Remove floating point related headers since float support is disabled. $(RM) $(PREFIX)$(DEVEL_PREFIX)include/complex.h @@ -352,13 +358,13 @@ clean: @$(RM) -r tmp lib include/bits libc/tmp _install $(RM) libc/obj.* libc/obj-* headers $(MAKE) -C test clean - $(MAKE) -C utils clean $(MAKE) -C ldso clean $(MAKE) -C libc/misc/internals clean $(MAKE) -C libc/misc/wchar clean $(MAKE) -C libc/unistd clean $(MAKE) -C libc/sysdeps/linux/common clean $(MAKE) -C extra/locale clean + $(MAKE) -C utils clean $(MAKE) -C libpthread clean @set -e; \ for i in `(cd $(TOPDIR)/libc/sysdeps/linux/common/sys; ls *.h)` ; do \ @@ -340,16 +340,6 @@ ifneq ($(DOASSERTS),y) CFLAGS += -DNDEBUG endif -ifeq ($(HAVE_SHARED),y) - ifeq ($(BUILD_UCLIBC_LDSO),y) - LDSO:=$(TOPDIR)lib/$(UCLIBC_LDSO) - DYNAMIC_LINKER:=$(SHARED_LIB_LOADER_PREFIX)/$(UCLIBC_LDSO) - else - LDSO:=$(SYSTEM_LDSO) - DYNAMIC_LINKER:=/lib/$(strip $(subst ",, $(notdir $(SYSTEM_LDSO)))) - endif -endif - CFLAGS_NOPIC:=$(CFLAGS) ifeq ($(DOPIC),y) CFLAGS += $(PICFLAG) diff --git a/debian/changelog b/debian/changelog index 7f0beae18..efff186d8 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +uclibc (0.9.28-1) unstable; urgency=low + + * New upstream release. + + -- Erik Andersen <andersen@codepoet.org> Sun, 14 Aug 2005 23:15:03 -0600 + uclibc (0.9.26-3) unstable; urgency=low * minor updates diff --git a/debian/config b/debian/config index 4ee9f789f..a26f997c4 100644 --- a/debian/config +++ b/debian/config @@ -3,32 +3,57 @@ # # TARGET_alpha is not set # TARGET_arm is not set +# TARGET_bfin is not set # TARGET_cris is not set # TARGET_e1 is not set +# TARGET_frv is not set # TARGET_h8300 is not set # TARGET_i386 is not set # TARGET_i960 is not set # TARGET_m68k is not set # TARGET_microblaze is not set # TARGET_mips is not set +# TARGET_nios is not set +# TARGET_nios2 is not set # TARGET_powerpc is not set # TARGET_sh is not set +# TARGET_sh64 is not set # TARGET_sparc is not set # TARGET_v850 is not set +# TARGET_x86_64 is not set # # Target Architecture Features and Options # HAVE_ELF=y +# ARCH_SUPPORTS_LITTLE_ENDIAN is not set TARGET_ARCH="none" # ARCH_LITTLE_ENDIAN is not set +# CONFIG_GENERIC_386 is not set +# CONFIG_386 is not set +# CONFIG_486 is not set +# CONFIG_586 is not set +# CONFIG_586MMX is not set +# CONFIG_686 is not set +# CONFIG_PENTIUMII is not set +# CONFIG_PENTIUMIII is not set +# CONFIG_PENTIUM4 is not set +# CONFIG_K6 is not set +# CONFIG_K7 is not set +# CONFIG_ELAN is not set +# CONFIG_CRUSOE is not set +# CONFIG_WINCHIPC6 is not set +# CONFIG_WINCHIP2 is not set +# CONFIG_CYRIXIII is not set +# CONFIG_NEHEMIAH is not set # ARCH_BIG_ENDIAN is not set # ARCH_HAS_NO_MMU is not set +ARCH_HAS_MMU=y UCLIBC_HAS_FLOATS=y HAS_FPU=y DO_C99_MATH=y -WARNINGS="-Wall" KERNEL_SOURCE="/usr/src/linux" +C_SYMBOL_PREFIX="" HAVE_DOT_CONFIG=y # @@ -40,14 +65,19 @@ DOPIC=y HAVE_SHARED=y # ARCH_HAS_NO_LDSO is not set BUILD_UCLIBC_LDSO=y -# UCLIBC_BUILD_PIE is not set +# FORCE_SHAREABLE_TEXT_SEGMENTS is not set LDSO_LDD_SUPPORT=y +LDSO_CACHE_SUPPORT=y +# LDSO_PRELOAD_FILE_SUPPORT is not set +LDSO_BASE_FILENAME="ld.so" +LDSO_RUNPATH=y +# DL_FINI_CRT_COMPAT is not set UCLIBC_CTOR_DTOR=y -# UCLIBC_HAS_SSP is not set # HAS_NO_THREADS is not set UCLIBC_HAS_THREADS=y PTHREADS_DEBUG_SUPPORT=y UCLIBC_HAS_LFS=y +# UCLIBC_STATIC_LDCONFIG is not set # MALLOC is not set # MALLOC_SIMPLE is not set MALLOC_STANDARD=y @@ -72,6 +102,8 @@ UCLIBC_HAS_FULL_RPC=y # # String and Stdio Support # +UCLIBC_HAS_STRING_GENERIC_OPT=y +UCLIBC_HAS_STRING_ARCH_OPT=y UCLIBC_HAS_CTYPE_TABLES=y UCLIBC_HAS_CTYPE_SIGNED=y # UCLIBC_HAS_CTYPE_UNSAFE is not set @@ -93,6 +125,7 @@ UCLIBC_HAS_STDIO_BUFSIZ_4096=y UCLIBC_HAS_STDIO_BUILTIN_BUFFER_NONE=y # UCLIBC_HAS_STDIO_BUILTIN_BUFFER_4 is not set # UCLIBC_HAS_STDIO_BUILTIN_BUFFER_8 is not set +# UCLIBC_HAS_STDIO_SHUTDOWN_ON_ABORT is not set UCLIBC_HAS_STDIO_GETC_MACRO=y UCLIBC_HAS_STDIO_PUTC_MACRO=y UCLIBC_HAS_STDIO_AUTO_RW_TRANSITION=y @@ -122,10 +155,18 @@ RUNTIME_PREFIX="/usr/$(TARGET_ARCH)-linux-uclibc" DEVEL_PREFIX="/usr/$(TARGET_ARCH)-linux-uclibc" # +# uClibc security related options +# +# UCLIBC_SECURITY is not set + +# # uClibc development/debugging options # +CROSS_COMPILER_PREFIX="" # DODEBUG is not set +# DODEBUG_PT is not set # DOASSERTS is not set # SUPPORT_LD_DEBUG is not set # SUPPORT_LD_DEBUG_EARLY is not set +WARNINGS="-Wall" # UCLIBC_MJN3_ONLY is not set diff --git a/debian/control b/debian/control index b6587f769..53fb7510a 100644 --- a/debian/control +++ b/debian/control @@ -2,11 +2,11 @@ Source: uclibc Section: libs Priority: required Maintainer: Erik Andersen <andersen@codepoet.org> -Build-Depends: make (>= 3.78-4), dpkg-dev (>= 1.4.1.5), debianutils (>= 1.13.1), tar (>= 1.13.11), bzip2, texinfo (>= 4.0), kernel-source-2.4.22, sed (>= 4.0.5-4) -Standards-Version: 3.5.8 +Build-Depends: debhelper (>= 3), bzip2, texinfo, kernel-source-2.4.27, sed (>= 4.0.5-4) +Standards-Version: 3.6.1.1 Package: uclibc -Architecture: alpha arm i386 m68k mips mipsel powerpc sparc sh3 sh4 sh3eb sh4eb +Architecture: alpha arm i386 m68k mips mipsel powerpc sparc Section: base Priority: required Depends: @@ -17,12 +17,12 @@ Description: The uClibc C Library: Shared libraries systems. This package provides only the run-time libraries. Package: uclibc-dev -Architecture: alpha arm i386 m68k mips mipsel powerpc sparc sh3 sh4 sh3eb sh4eb +Architecture: alpha arm i386 m68k mips mipsel powerpc sparc Section: devel Priority: standard Depends: uclibc (= ${Source-Version}) Provides: libc-dev, libc6-dev -Recommends: c-compiler +Recommends: gcc | c-compiler Description: The uClibc C Library: Development Libraries and Header Files uClibc is an implementation of the standard C library that is much smaller than glibc, which makes it useful for embedded diff --git a/debian/copyright b/debian/copyright index f7562ade9..c6b554cf0 100644 --- a/debian/copyright +++ b/debian/copyright @@ -4,5 +4,19 @@ Wed, 12 Nov 2003 19:15:30 -0700 Maintainer: Erik Andersen <andersee@debian.org> Copyright: +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 2.1 of the License, or (at your option) any later version. -LGPL +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with this library; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +The full text of the LGPL can be found in +/usr/share/common-licenses/LGPL diff --git a/debian/docs b/debian/docs index 4860c7273..80e90b0dd 100644 --- a/debian/docs +++ b/debian/docs @@ -1,5 +1,4 @@ README -INSTALL TODO Changelog Changelog.full diff --git a/debian/rules b/debian/rules index 689ddc8b8..93c5f9b53 100755 --- a/debian/rules +++ b/debian/rules @@ -13,9 +13,9 @@ major=$(shell grep '^MAJOR_VERSION' Rules.mak|sed 's/.*=//') minor=$(shell grep '^MINOR_VERSION' Rules.mak|sed 's/.*=//') version:=$(strip $(major)).$(strip $(minor)) -kernel_version=2.4.25 -kernel_source=kernel-headers-$(kernel_version) -kernel_source_dir=linux +kernel_version=2.4.31 +kernel_source=kernel-source-$(kernel_version) +kernel_source_dir=$(kernel_source) builddir=$(shell pwd) diff --git a/debian/uclibc.shlibs b/debian/uclibc.shlibs index 4dc2e46c5..7bfbad208 100644 --- a/debian/uclibc.shlibs +++ b/debian/uclibc.shlibs @@ -1,10 +1,11 @@ -libc 0 uclibc (>= 0.9.26-1) -libm 0 uclibc (>= 0.9.26-1) -ld-uClibc 0 uclibc (>= 0.9.26-1) -libdl 0 uclibc (>= 0.9.26-1) -libcrypt 0 uclibc (>= 0.9.26-1) -libutil 0 uclibc (>= 0.9.26-1) -libresolv 0 uclibc (>= 0.9.26-1) -libnsl 0 uclibc (>= 0.9.26-1) -libthread_db 1 uclibc (>= 0.9.26-1) -libpthread 0 uclibc (>= 0.9.26-1) +libc 0 uclibc (>= 0.9.28-1) +libm 0 uclibc (>= 0.9.28-1) +ld-uClibc 0 uclibc (>= 0.9.28-1) +libdl 0 uclibc (>= 0.9.28-1) +libcrypt 0 uclibc (>= 0.9.28-1) +libutil 0 uclibc (>= 0.9.28-1) +libresolv 0 uclibc (>= 0.9.28-1) +libnsl 0 uclibc (>= 0.9.28-1) +libthread_db 1 uclibc (>= 0.9.28-1) +libpthread 0 uclibc (>= 0.9.28-1) +librt 0 uclibc (>= 0.9.28-1) diff --git a/docs/man/ldconfig.8 b/docs/man/ldconfig.8 new file mode 100644 index 000000000..208d63df1 --- /dev/null +++ b/docs/man/ldconfig.8 @@ -0,0 +1,73 @@ +.TH LDCONFIG 8 2005-08-15 uClibc "Linux Programmer's Manual" +.SH NAME +ldconfig \- updates symlinks and cache for shared libraries +.SH SYNOPSIS +.B ldconfig +[ +.B -DvqnNX +] [ +.B -f conf +] [ +.B -C cache +] [ +.B -r root +] +.B dir ... +.br +.B ldconfig -l +[ +.B -Dv +] +.B lib ... +.br +.B ldconfig -p +.SH DESCRIPTION +.B ldconfig +creates the necessary links and cache to the most recent shared libraries +found in the directories specified on the command line, in the file +\fI/etc/ld.so.conf\fR, and in the default trusted directories (\fI/lib\fR and +\fI/usr/lib\fR). The cache is used by the run-time linker. +.B ldconfig +checks the header and file names of the libraries it encounters when +determining which versions should have their links updated. + +.B Note: +Some features may not exist depending on how uClibc was built +.SH OPTIONS +.TP +.B -C cache +use specified \fIcache\fR instead of default +.TP +.B -D +debug mode, do not update links +.TP +.B -f conf +use specified \fIconf\fR instead of default +.TP +.B -l +library mode, manually link libraries +.TP +.B -n +do not process standard trusted directories +.TP +.B -N +do not update the library cache +.TP +.B -p +print the current library cache +.TP +.B -q +quiet mode, do not print warnings you should actually be reading +.TP +.B -r root +chroot to \fIroot\fR before running +.TP +.B -v +verbose mode, print things as we go, and generally be annoying +.TP +.B -X +do not update the library links +.SH BUGS +Probably, make sure you complain when you find them: +.br +http://bugs.uclibc.org/ diff --git a/docs/man/ldd.1 b/docs/man/ldd.1 new file mode 100644 index 000000000..0b69f730d --- /dev/null +++ b/docs/man/ldd.1 @@ -0,0 +1,17 @@ +.TH LDD 1 2005-08-15 uClibc "Linux Programmer's Manual" +.SH NAME +ldd \- Print shared library dependencies +.SH SYNOPSIS +.B ldd +[ +.B OPTIONS +] +.B FILE ... +.SH DESCRIPTION +Prints shared library dependencies. +.SH OPTIONS +None actually, we lied about that part. +.SH BUGS +Probably, make sure you complain when you find them: +.br +http://bugs.uclibc.org/ diff --git a/docs/uclibc.org/FAQ.html b/docs/uclibc.org/FAQ.html index 03dfe4f5b..313fc82b3 100644 --- a/docs/uclibc.org/FAQ.html +++ b/docs/uclibc.org/FAQ.html @@ -24,6 +24,8 @@ have additions to this FAQ document, we would love to add them, <li><a href="#wrapper">What happened to the old toolchain wrapper?</a> <li><a href="#dev_systems">Is a pre-compiled uClibc development system available?</a> <li><a href="#bugs">I think I found a bug in uClibc! What should I do?!</a> +<li><a href="#miscompile">My package builds fine but link fails with errors like "undefined reference + to __fputc_unlocked", who do I blame?!</a> <li><a href="#job_control">Why do I keep getting "sh: can't access tty; job control turned off" errors? Why doesn't Control-C work within my shell?</a> <li><a href="#autoconf">How do I make autoconf and automake behave?</a> @@ -379,6 +381,21 @@ How could it be smaller and not suck?</a></h2> strace, ltrace, and or valgrind to create a logfile showing the problem behavior. + +<hr /> +<p> +<h2><a name="miscompile">My package builds fine but link fails with errors like + "undefined reference to __fputc_unlocked", who do I blame?!</h2> +<p> + + This error crops up when a build system mixes system headers (say glibc) + with the target headers (say uClibc). Make sure your build system is not + including extraneous include options (-I) and double check that it is using + the correct compiler. Many build systems incorrectly force things like + -I/usr/include or -I/usr/local/include or -I${prefix}/include (which usually + just expands to -I/usr/include). + + <hr /> <p> <h2><a name="job_control">Why do I keep getting "sh: can't access tty; job control diff --git a/extra/Configs/Config.in b/extra/Configs/Config.in index 806d38226..dbd6514b2 100644 --- a/extra/Configs/Config.in +++ b/extra/Configs/Config.in @@ -1109,20 +1109,6 @@ config SHARED_LIB_LOADER_PREFIX sitting in the directory this points to, your binaries will not run. -config SYSTEM_LDSO - string "System shared library loader" - depends on HAVE_SHARED && !BUILD_UCLIBC_LDSO - default "/lib/ld-linux.so.2" - help - If you are using shared libraries, but do not want/have a native - uClibc shared library loader, please specify the name of your - target system's shared library loader here... - - BIG FAT WARNING: - If you do not have a shared library loader with the correct name - sitting in the directory this points to, your binaries will not - run. - config RUNTIME_PREFIX string "uClibc runtime library directory" default "/usr/$(TARGET_ARCH)-linux-uclibc/" diff --git a/include/stdlib.h b/include/stdlib.h index 2e437d3fc..b74271c7a 100644 --- a/include/stdlib.h +++ b/include/stdlib.h @@ -768,13 +768,6 @@ extern int ptsname_r (int __fd, char *__buf, size_t __buflen) __THROW; extern int getpt (void) __THROW; #endif -#ifdef __USE_BSD -/* Put the 1 minute, 5 minute and 15 minute load averages into the first - NELEM elements of LOADAVG. Return the number written (never more than - three, but may be less than NELEM), or -1 if an error occurred. */ -extern int getloadavg (double __loadavg[], int __nelem) __THROW; -#endif - #endif /* don't just need malloc and calloc */ #undef __need_malloc_and_calloc diff --git a/ldso/Makefile b/ldso/Makefile index b7ce3625a..dd7ff2052 100644 --- a/ldso/Makefile +++ b/ldso/Makefile @@ -44,10 +44,8 @@ $(LN_HEADERS): $(LN_ARCH_HEADERS): $(LN) -fs ../ldso/$(TARGET_ARCH)/$(patsubst include/%,%,$@) $@ include/dl-progname.h: - echo 'const char *_dl_progname="$(UCLIBC_LDSO)";' \ - > include/dl-progname.h echo '#include "$(TARGET_ARCH)/elfinterp.c"' \ - >> include/dl-progname.h + > include/dl-progname.h clean: set -e ; for d in $(DIRS) ; do $(MAKE) -C $$d $@ ; done diff --git a/ldso/include/dl-syscall.h b/ldso/include/dl-syscall.h index 1bcf95fb1..3f20229cd 100644 --- a/ldso/include/dl-syscall.h +++ b/ldso/include/dl-syscall.h @@ -104,8 +104,7 @@ static inline _syscall0(gid_t, _dl_getpid); static inline _syscall3(int, _dl_readlink, const char *, path, char *, buf, size_t, bufsiz); #ifdef __NR_mmap -#if defined(__powerpc__) || defined(__mips__) || defined(__sh__) || defined(__sparc__) || defined(__x86_64__) -/* PowerPC, MIPS and SuperH have a different calling convention for mmap(). */ +#ifdef MMAP_HAS_6_ARGS #define __NR__dl_mmap __NR_mmap static inline _syscall6(void *, _dl_mmap, void *, start, size_t, length, int, prot, int, flags, int, fd, off_t, offset); @@ -141,6 +140,8 @@ static inline void * _dl_mmap(void * addr, unsigned long size, int prot, return(__syscall_mmap2(addr, size, prot, flags, fd, (off_t) (offset >> MMAP2_PAGE_SHIFT))); } +#else +#error "Your architecture doesn't seem to provide mmap() !?" #endif #endif /* _LD_SYSCALL_H_ */ diff --git a/ldso/include/ldso.h b/ldso/include/ldso.h index db3fe054c..ceb8aaeb1 100644 --- a/ldso/include/ldso.h +++ b/ldso/include/ldso.h @@ -44,7 +44,6 @@ extern char *_dl_ldsopath; /* Where the shared lib loader was found extern const char *_dl_progname; /* The name of the executable being run */ extern int _dl_secure; /* Are we dealing with setuid stuff? */ extern size_t _dl_pagesize; /* Store the page size for use later */ -extern const char *_dl_progname; /* The name of the shared library loader */ #ifdef __SUPPORT_LD_DEBUG__ extern char *_dl_debug; diff --git a/ldso/ldso/Makefile b/ldso/ldso/Makefile index 9085254fb..1f385e58d 100644 --- a/ldso/ldso/Makefile +++ b/ldso/ldso/Makefile @@ -41,11 +41,11 @@ else XXFLAGS+=$(OPTIMIZATION) endif ifeq ($(PTHREADS_NATIVE),y) -XXFLAGS+= $(XARCH_CFLAGS) $(CPU_CFLAGS) $(PICFLAG) \ +XXFLAGS+= -DUCLIBC_LDSO=\"$(UCLIBC_LDSO)\" $(XARCH_CFLAGS) $(CPU_CFLAGS) $(PICFLAG) \ -DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" \ -fno-builtin -nostdinc -D_LIBC -I$(TOPDIR)ldso/include -I. -I$(TOPDIR)include $(PTINC) -DSHARED -DIS_IN_rtld else -XXFLAGS+= $(XARCH_CFLAGS) $(CPU_CFLAGS) $(PICFLAG) \ +XXFLAGS+= -DUCLIBC_LDSO=\"$(UCLIBC_LDSO)\" $(XARCH_CFLAGS) $(CPU_CFLAGS) $(PICFLAG) \ -DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" \ -fno-builtin -nostdinc -D_LIBC -I$(TOPDIR)ldso/include -I. -I$(TOPDIR)include endif diff --git a/ldso/ldso/i386/dl-syscalls.h b/ldso/ldso/i386/dl-syscalls.h index f0f4baed8..dc0cc6164 100644 --- a/ldso/ldso/i386/dl-syscalls.h +++ b/ldso/ldso/i386/dl-syscalls.h @@ -3,4 +3,3 @@ extern int _dl_errno; #define __set_errno(X) {(_dl_errno) = (X);} #include "sys/syscall.h" - diff --git a/ldso/ldso/ldso.c b/ldso/ldso/ldso.c index cfcf82b8c..8eca73ae4 100644 --- a/ldso/ldso/ldso.c +++ b/ldso/ldso/ldso.c @@ -64,7 +64,7 @@ int _dl_debug_file = 2; /* Needed for standalone execution. */ unsigned long attribute_hidden _dl_skip_args = 0; - +const char *_dl_progname = UCLIBC_LDSO; /* The name of the executable being run */ #include "dl-startup.c" /* Forward function declarations */ static int _dl_suid_ok(void); @@ -88,7 +88,6 @@ static unsigned char *_dl_mmap_zero = 0; /* Also used by _dl_malloc */ static struct elf_resolve **init_fini_list; static int nlist; /* # items in init_fini_list */ - extern void _start(void); static void __attribute__ ((destructor)) __attribute_used__ _dl_fini(void) @@ -544,7 +543,7 @@ void _dl_get_ready_to_run(struct elf_resolve *tpnt, unsigned long load_addr, lpntstr = (char*) (tcurr->dynamic_info[DT_STRTAB] + dpnt->d_un.d_val); name = _dl_get_last_path_component(lpntstr); - if (_dl_strcmp(name, "ld-uClibc.so.0") == 0) + if (_dl_strcmp(name, UCLIBC_LDSO) == 0) continue; _dl_if_debug_dprint("\tfile='%s'; needed by '%s'\n", lpntstr, _dl_progname); diff --git a/ldso/ldso/mips/dl-syscalls.h b/ldso/ldso/mips/dl-syscalls.h index f0f4baed8..a97ff562c 100644 --- a/ldso/ldso/mips/dl-syscalls.h +++ b/ldso/ldso/mips/dl-syscalls.h @@ -4,3 +4,4 @@ extern int _dl_errno; #define __set_errno(X) {(_dl_errno) = (X);} #include "sys/syscall.h" +#define MMAP_HAS_6_ARGS diff --git a/ldso/ldso/powerpc/dl-syscalls.h b/ldso/ldso/powerpc/dl-syscalls.h index 8b8c3b9ef..a5fa30a5d 100644 --- a/ldso/ldso/powerpc/dl-syscalls.h +++ b/ldso/ldso/powerpc/dl-syscalls.h @@ -3,6 +3,8 @@ * numbers used by the shared library loader. */ +#define MMAP_HAS_6_ARGS + #define __NR_exit 1 #define __NR_read 3 #define __NR_write 4 diff --git a/ldso/ldso/sh/dl-syscalls.h b/ldso/ldso/sh/dl-syscalls.h index dc0cc6164..a97ff562c 100644 --- a/ldso/ldso/sh/dl-syscalls.h +++ b/ldso/ldso/sh/dl-syscalls.h @@ -3,3 +3,5 @@ extern int _dl_errno; #define __set_errno(X) {(_dl_errno) = (X);} #include "sys/syscall.h" + +#define MMAP_HAS_6_ARGS diff --git a/ldso/ldso/sparc/dl-syscalls.h b/ldso/ldso/sparc/dl-syscalls.h index 1ae85ed88..b1fd73eb8 100644 --- a/ldso/ldso/sparc/dl-syscalls.h +++ b/ldso/ldso/sparc/dl-syscalls.h @@ -6,6 +6,8 @@ * sysdeps/linux/sparc/bits/syscalls.h at some point ... */ +#define MMAP_HAS_6_ARGS + #define __NR_exit 1 #define __NR_read 3 #define __NR_write 4 diff --git a/ldso/ldso/x86_64/dl-syscalls.h b/ldso/ldso/x86_64/dl-syscalls.h index dc0cc6164..a97ff562c 100644 --- a/ldso/ldso/x86_64/dl-syscalls.h +++ b/ldso/ldso/x86_64/dl-syscalls.h @@ -3,3 +3,5 @@ extern int _dl_errno; #define __set_errno(X) {(_dl_errno) = (X);} #include "sys/syscall.h" + +#define MMAP_HAS_6_ARGS diff --git a/ldso/libdl/Makefile b/ldso/libdl/Makefile index ccf9d1b30..f4dbf105a 100644 --- a/ldso/libdl/Makefile +++ b/ldso/libdl/Makefile @@ -80,7 +80,7 @@ shared: $(LIBDL_PIC) $(LD) $(LDFLAGS) -soname=$(LIBDL_SHARED).$(MAJOR_VERSION) \ -o $(LIBDL_SHARED_FULLNAME) -fini dl_cleanup --whole-archive $(LIBDL_PIC) \ --no-whole-archive $(TOPDIR)/libc/misc/internals/interp.o \ - -L$(TOPDIR)/lib -lc $(LDADD_LIBFLOAT) $(TOPDIR)lib/ld-uClibc.so.0 $(LIBGCC); + -L$(TOPDIR)/lib -lc $(LDADD_LIBFLOAT) $(TOPDIR)lib/$(UCLIBC_LDSO) $(LIBGCC); $(INSTALL) -d $(TOPDIR)lib $(RM) $(TOPDIR)lib/$(LIBDL_SHARED_FULLNAME) $(TOPDIR)lib/$(LIBDL_SHARED).$(MAJOR_VERSION) $(INSTALL) -m 644 $(LIBDL_SHARED_FULLNAME) $(TOPDIR)lib diff --git a/ldso/libdl/libdl.c b/ldso/libdl/libdl.c index add476b81..08952094c 100644 --- a/ldso/libdl/libdl.c +++ b/ldso/libdl/libdl.c @@ -72,6 +72,7 @@ extern char *_dl_debug; #ifdef __SUPPORT_LD_DEBUG__ char *_dl_debug = 0; #endif +const char *_dl_progname = ""; /* Program name */ char *_dl_library_path = 0; /* Where we look for libraries */ char *_dl_ldsopath = 0; /* Location of the shared lib loader */ int _dl_errno = 0; /* We can't use the real errno in ldso */ diff --git a/libc/Makefile b/libc/Makefile index 5f6b399ff..56669dd64 100644 --- a/libc/Makefile +++ b/libc/Makefile @@ -84,7 +84,7 @@ shared: shared_$(LIBNAME) $(LD) $(LDFLAGS) $(VERSION_SCRIPT) -soname=$(SHARED_MAJORNAME) -o $(SHARED_FULLNAME) \ --whole-archive shared_$(LIBNAME) \ $(TOPDIR)libc/misc/internals/interp.o --no-whole-archive \ - -init __uClibc_init $(TOPDIR)lib/ld-uClibc.so.0 $(LIBGCC) $(LDADD_LIBFLOAT) + -init __uClibc_init $(TOPDIR)lib/$(UCLIBC_LDSO) $(LIBGCC) $(LDADD_LIBFLOAT) @true #$(RM) -r tmp $(INSTALL) -d $(TOPDIR)lib $(RM) $(TOPDIR)lib/$(SHARED_FULLNAME) diff --git a/libc/misc/internals/Makefile b/libc/misc/internals/Makefile index 933b169a6..803181a8f 100644 --- a/libc/misc/internals/Makefile +++ b/libc/misc/internals/Makefile @@ -41,7 +41,7 @@ interp.c: Makefile echo "#include <features.h>" >> interp.c echo "#ifdef __HAVE_ELF__" >> interp.c echo "const char __dl_ldso__[] __attribute__ ((section " \ - "(\".interp\"))) =\""$(DYNAMIC_LINKER)"\";" >> interp.c + "(\".interp\"))) =\""$(SHARED_LIB_LOADER_PREFIX)/$(UCLIBC_LDSO)"\";" >> interp.c echo "#endif" >> interp.c $(COBJS) interp.o static.o: %.o : %.c diff --git a/libc/string/wstring.c b/libc/string/wstring.c index 6f54ae615..acf1a2b0a 100644 --- a/libc/string/wstring.c +++ b/libc/string/wstring.c @@ -1572,6 +1572,7 @@ int __xpg_strerror_r(int errnum, char *strerrbuf, size_t buflen) #ifdef L___glibc_strerror_r weak_alias(__glibc_strerror_r,__strerror_r); +weak_alias(__glibc_strerror_r,_glibc_strerror_r); /* for 0.9.27 compat ... remove after 0.9.28 */ char *__glibc_strerror_r(int errnum, char *strerrbuf, size_t buflen) { diff --git a/libc/sysdeps/linux/arm/Makefile b/libc/sysdeps/linux/arm/Makefile index 77245307a..65df75338 100644 --- a/libc/sysdeps/linux/arm/Makefile +++ b/libc/sysdeps/linux/arm/Makefile @@ -28,7 +28,7 @@ SSRC=__longjmp.S vfork.S clone.S setjmp.S bsd-setjmp.S \ bsd-_setjmp.S sigrestorer.S mmap64.S SOBJS=$(patsubst %.S,%.o, $(SSRC)) -CSRC=brk.c syscall.c ioperm.c sigaction.c __syscall_error.c +CSRC=brk.c syscall.c ioperm.c iopl.c sigaction.c __syscall_error.c COBJS=$(patsubst %.c,%.o, $(CSRC)) OBJS=$(SOBJS) $(COBJS) diff --git a/libc/sysdeps/linux/arm/bits/atomicity.h b/libc/sysdeps/linux/arm/bits/atomicity.h index def974f8a..97d278610 100644 --- a/libc/sysdeps/linux/arm/bits/atomicity.h +++ b/libc/sysdeps/linux/arm/bits/atomicity.h @@ -31,12 +31,23 @@ exchange_and_add (volatile uint32_t *mem, int val) int tmp2; int result; __asm__ ("\n" +#if defined(__thumb__) + "\t.align 0\n" + "\tbx pc\n" + "\tnop\n" + "\t.arm\n" +#endif "0:\tldr\t%0,[%3]\n\t" "add\t%1,%0,%4\n\t" "swp\t%2,%1,[%3]\n\t" "cmp\t%0,%2\n\t" "swpne\t%1,%2,[%3]\n\t" "bne\t0b" +#if defined(__thumb__) + "\torr %1, pc, #1\n" + "\tbx %1\n" + "\t.force_thumb" +#endif : "=&r" (result), "=&r" (tmp1), "=&r" (tmp2) : "r" (mem), "r"(val) : "cc", "memory"); @@ -51,12 +62,23 @@ atomic_add (volatile uint32_t *mem, int val) int tmp2; int tmp3; __asm__ ("\n" +#if defined(__thumb__) + "\t.align 0\n" + "\tbx pc\n" + "\tnop\n" + "\t.arm\n" +#endif "0:\tldr\t%0,[%3]\n\t" "add\t%1,%0,%4\n\t" "swp\t%2,%1,[%3]\n\t" "cmp\t%0,%2\n\t" "swpne\t%1,%2,[%3]\n\t" "bne\t0b" +#if defined(__thumb__) + "\torr %1, pc, #1\n" + "\tbx %1\n" + "\t.force_thumb" +#endif : "=&r" (tmp1), "=&r" (tmp2), "=&r" (tmp3) : "r" (mem), "r"(val) : "cc", "memory"); @@ -68,6 +90,12 @@ compare_and_swap (volatile long int *p, long int oldval, long int newval) { int result, tmp; __asm__ ("\n" +#if defined(__thumb__) + "\t.align 0\n" + "\tbx pc\n" + "\tnop\n" + "\t.arm\n" +#endif "0:\tldr\t%1,[%2]\n\t" "mov\t%0,#0\n\t" "cmp\t%1,%4\n\t" @@ -78,6 +106,11 @@ compare_and_swap (volatile long int *p, long int oldval, long int newval) "bne\t0b\n\t" "mov\t%0,#1\n" "1:" +#if defined(__thumb__) + "\torr %1, pc, #1\n" + "\tbx %1\n" + "\t.force_thumb" +#endif : "=&r" (result), "=&r" (tmp) : "r" (p), "r" (newval), "r" (oldval) : "cc", "memory"); diff --git a/libc/sysdeps/linux/arm/bits/syscalls.h b/libc/sysdeps/linux/arm/bits/syscalls.h index 245266730..21e5b8146 100644 --- a/libc/sysdeps/linux/arm/bits/syscalls.h +++ b/libc/sysdeps/linux/arm/bits/syscalls.h @@ -97,6 +97,7 @@ return (type) (INLINE_SYSCALL(name, 7, arg1, arg2, arg3, arg4, arg5, arg6, arg7) #define INTERNAL_SYSCALL_DECL(err) do { } while (0) #undef INTERNAL_SYSCALL +#if !defined(__thumb__) #define INTERNAL_SYSCALL(name, err, nr, args...) \ ({ unsigned int _sys_result; \ { \ @@ -109,6 +110,21 @@ return (type) (INLINE_SYSCALL(name, 7, arg1, arg2, arg3, arg4, arg5, arg6, arg7) _sys_result = _a1; \ } \ (int) _sys_result; }) +#else +#define INTERNAL_SYSCALL(name, err, nr, args...) \ + ({ unsigned int _sys_result; \ + { \ + register int _a1 asm ("a1"); \ + LOAD_ARGS_##nr (args) \ + register int _r7 asm ("r7") = (int) (SYS_ify(name)); \ + asm volatile ("swi 0 @ syscall " #name \ + : "=r" (_a1) \ + : "r" (_r7) ASM_ARGS_##nr \ + : "memory"); \ + _sys_result = _a1; \ + } \ + (int) _sys_result; }) +#endif #undef INTERNAL_SYSCALL_ERROR_P #define INTERNAL_SYSCALL_ERROR_P(val, err) \ diff --git a/libc/sysdeps/linux/arm/brk.c b/libc/sysdeps/linux/arm/brk.c index fa0326a0e..82b9835ae 100644 --- a/libc/sysdeps/linux/arm/brk.c +++ b/libc/sysdeps/linux/arm/brk.c @@ -26,22 +26,14 @@ void *__curbrk = 0; int brk (void *addr) { - void *newbrk; + void *newbrk = (void*)INTERNAL_SYSCALL(brk, , 1, addr); - asm ("mov a1, %1\n" /* save the argment in r0 */ - "swi %2\n" /* do the system call */ - "mov %0, a1;" /* keep the return value */ - : "=r"(newbrk) - : "r"(addr), "i" (__NR_brk) - : "a1"); + __curbrk = newbrk; - __curbrk = newbrk; + if (newbrk < addr) { + __set_errno (ENOMEM); + return -1; + } - if (newbrk < addr) - { - __set_errno (ENOMEM); - return -1; - } - - return 0; + return 0; } diff --git a/libc/sysdeps/linux/arm/ioperm.c b/libc/sysdeps/linux/arm/ioperm.c index 2fba676b1..357d987f8 100644 --- a/libc/sysdeps/linux/arm/ioperm.c +++ b/libc/sysdeps/linux/arm/ioperm.c @@ -202,19 +202,6 @@ int ioperm (unsigned long int from, unsigned long int num, int turn_on) } -int iopl (unsigned int level) -{ - if (level > 3) { - __set_errno (EINVAL); - return -1; - } - if (level) { - return ioperm (0, MAX_PORT, 1); - } - return 0; -} - - void outb(unsigned char b, unsigned long int port) { diff --git a/libc/sysdeps/linux/arm/iopl.c b/libc/sysdeps/linux/arm/iopl.c new file mode 100644 index 000000000..0cd306d42 --- /dev/null +++ b/libc/sysdeps/linux/arm/iopl.c @@ -0,0 +1,35 @@ +/* Copyright (C) 1998, 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Phil Blundell, based on the Alpha version by + David Mosberger. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sys/io.h> +#include <errno.h> + +#define MAX_PORT 0x10000 + +int iopl(int level) +{ + if (level > 3) { + __set_errno(EINVAL); + return -1; + } + if (level) + return ioperm(0, MAX_PORT, 1); + return 0; +} diff --git a/libc/sysdeps/linux/arm/syscall.c b/libc/sysdeps/linux/arm/syscall.c index 9938abe03..195c31c74 100644 --- a/libc/sysdeps/linux/arm/syscall.c +++ b/libc/sysdeps/linux/arm/syscall.c @@ -26,6 +26,7 @@ long syscall(long sysnum, long a, long b, long c, long d, long e, long f) { +#if !defined(__thumb__) register long _r0 asm("r0")=(long)(sysnum); register long _r6 asm("r6")=(long)(f); register long _r5 asm("r5")=(long)(e); @@ -40,6 +41,21 @@ long syscall(long sysnum, long a, long b, long c, long d, long e, long f) "r"(_r2), "r"(_r3), "r"(_r4), "r"(_r5), "r"(_r6) : "memory"); +#else + register long _r7 asm("r7")=(long)(sysnum); + register long _r5 asm("r5")=(long)(f); + register long _r4 asm("r4")=(long)(e); + register long _r3 asm("r3")=(long)(d); + register long _r2 asm("r2")=(long)(c); + register long _r1 asm("r1")=(long)(b); + register long _r0 asm("r0")=(long)(a); + asm volatile( + "swi 0" + : "=r"(_r0) + : "r"(_r0), "r"(_r1), "r"(_r2), "r"(_r3), + "r"(_r4), "r"(_r5), "r"(_r7) + : "memory"); +#endif if(_r0 >=(unsigned long) -4095) { long err = _r0; (*__errno_location())=(-err); @@ -47,4 +63,3 @@ long syscall(long sysnum, long a, long b, long c, long d, long e, long f) } return (long) _r0; } - diff --git a/libc/sysdeps/linux/common/getcwd.c b/libc/sysdeps/linux/common/getcwd.c index daf056e98..a1de4510c 100644 --- a/libc/sysdeps/linux/common/getcwd.c +++ b/libc/sysdeps/linux/common/getcwd.c @@ -10,7 +10,7 @@ #ifdef __NR_getcwd #define __NR___syscall_getcwd __NR_getcwd -static inline +static inline _syscall2(int, __syscall_getcwd, char *, buf, unsigned long, size); #else @@ -134,6 +134,15 @@ int __syscall_getcwd(char * buf, unsigned long size) olderrno = errno; len = -1; + + /* get stat for root to have a valid parameters for the terminating condition */ + if (stat("/", &st) < 0) { + /* root dir not found! */ + return -1; + } + /* start with actual dir */ + if (buf) strncpy(buf, ".", size); + cwd = recurser(buf, size, st.st_dev, st.st_ino); if (cwd) { len = strlen(buf); diff --git a/libc/sysdeps/linux/common/iopl.c b/libc/sysdeps/linux/common/iopl.c index 9e507bebc..dd45563c2 100644 --- a/libc/sysdeps/linux/common/iopl.c +++ b/libc/sysdeps/linux/common/iopl.c @@ -2,22 +2,19 @@ /* * iopl() for uClibc * - * Copyright (C) 2000-2004 by Erik Andersen <andersen@codepoet.org> + * Copyright (C) 2000-2005 by Erik Andersen <andersen@codepoet.org> * * GNU Library General Public License (LGPL) version 2 or later. */ #include "syscalls.h" -/* For arm there is a totally different implementation */ -#if !defined(__arm__) /* Tuns out the m68k unistd.h kernel header is broken */ -# if defined __ARCH_HAS_MMU__ && defined __NR_iopl && ( !defined(__mc68000__)) +#if defined __ARCH_HAS_MMU__ && defined __NR_iopl && ( !defined(__mc68000__)) _syscall1(int, iopl, int, level); -# else +#else int iopl(int level) { __set_errno(ENOSYS); return -1; } -# endif -# endif +#endif diff --git a/libc/sysdeps/linux/i386/clone.S b/libc/sysdeps/linux/i386/clone.S index 259982230..35a4e5b7f 100644 --- a/libc/sysdeps/linux/i386/clone.S +++ b/libc/sysdeps/linux/i386/clone.S @@ -51,19 +51,19 @@ __clone: /* no NULL function pointers */ movl FUNC(%esp),%ecx #ifdef __PIC__ - jecxz __syscall_error + jecxz __error #else testl %ecx,%ecx - jz __syscall_error + jz __error #endif /* no NULL stack pointers */ movl STACK(%esp),%ecx #ifdef __PIC__ - jecxz __syscall_error + jecxz __error #else testl %ecx,%ecx - jz __syscall_error + jz __error #endif /* Insert the argument onto the new stack. Make sure the new @@ -96,7 +96,7 @@ __clone: popl %ebx test %eax,%eax - jl __syscall_error + jl __error jz .Lthread_start ret @@ -114,6 +114,12 @@ __clone: movl $__NR_exit, %eax int $0x80 +/* Need to indirect jump to syscall error + * or we end up with TEXTREL's + */ +__error: + jmp __syscall_error + .size __clone,.-__clone .weak clone diff --git a/libc/sysdeps/linux/i386/mmap64.S b/libc/sysdeps/linux/i386/mmap64.S index 5c89c983b..5405c8a09 100644 --- a/libc/sysdeps/linux/i386/mmap64.S +++ b/libc/sysdeps/linux/i386/mmap64.S @@ -87,7 +87,7 @@ L_einval: popl %ebx popl %ebp movl $-EINVAL, %eax - jmp __error + jmp __syscall_error .size mmap64,.-mmap64 diff --git a/libm/math_private.h b/libm/math_private.h index 900e2a0db..2f6ebb0d9 100644 --- a/libm/math_private.h +++ b/libm/math_private.h @@ -40,7 +40,8 @@ * For VFP, floats words follow the memory system mode. */ -#if (__BYTE_ORDER == __BIG_ENDIAN) || defined(__arm__) && !defined(__VFP_FP__) +#if (__BYTE_ORDER == __BIG_ENDIAN) || \ + (!defined(__VFP_FP__) && (defined(__arm__) || defined(__thumb__))) typedef union { @@ -52,9 +53,7 @@ typedef union } parts; } ieee_double_shape_type; -#endif - -#if (__BYTE_ORDER == __LITTLE_ENDIAN) && (!defined(__arm__) || defined(__VFP_FP__)) +#else typedef union { diff --git a/libpthread/linuxthreads/Makefile b/libpthread/linuxthreads/Makefile index 2f66fab21..cca65d51c 100644 --- a/libpthread/linuxthreads/Makefile +++ b/libpthread/linuxthreads/Makefile @@ -39,9 +39,9 @@ CFLAGS :=$(CFLAGS:-O0=-O1) # set up system dependencies include dirs (NOTE: order matters!) +PTDIR = $(TOPDIR)libpthread/linuxthreads/ SYSDEPINC = -I$(PTDIR)sysdeps/pthread \ -I$(PTDIR)sysdeps/$(TARGET_ARCH) \ - -I$(PTDIR)sysdeps \ -I$(TOPDIR)libc/sysdeps/linux/$(TARGET_ARCH) CFLAGS += $(SYSDEPINC) diff --git a/libpthread/linuxthreads/sysdeps/arm/pt-machine.h b/libpthread/linuxthreads/sysdeps/arm/pt-machine.h index 71001ebc2..284567970 100644 --- a/libpthread/linuxthreads/sysdeps/arm/pt-machine.h +++ b/libpthread/linuxthreads/sysdeps/arm/pt-machine.h @@ -39,9 +39,24 @@ testandset (int *spinlock) { register unsigned int ret; +#if defined(__thumb__) + void *pc; + __asm__ __volatile__( + ".align 0\n" + "\tbx pc\n" + "\tnop\n" + "\t.arm\n" + "\tswp %0, %2, [%3]\n" + "\torr %1, pc, #1\n" + "\tbx %1\n" + "\t.force_thumb" + : "=r"(ret), "=r"(pc) + : "0"(1), "r"(spinlock)); +#else __asm__ __volatile__("swp %0, %1, [%2]" : "=r"(ret) : "0"(1), "r"(spinlock)); +#endif return ret; } diff --git a/test/Rules.mak b/test/Rules.mak index 20000cc35..8f3167c71 100644 --- a/test/Rules.mak +++ b/test/Rules.mak @@ -10,6 +10,10 @@ TESTDIR=$(TOPDIR)test/ -include $(TOPDIR).config +ifndef UCLIBC_LDSO +UCLIBC_LDSO := ld-uClibc.so.0 +endif + #-------------------------------------------------------- # Ensure consistent sort order, 'gcc -print-search-dirs' behavior, etc. LC_ALL:= C @@ -95,5 +99,5 @@ ifneq ($(strip $(HAVE_SHARED)),y) LDFLAGS += -static GLIBC_LDFLAGS += -static else - LDFLAGS += -Wl,-dynamic-linker,$(TOPDIR)lib/ld-uClibc.so.0 + LDFLAGS += -Wl,-dynamic-linker,$(TOPDIR)lib/$(UCLIBC_LDSO) endif diff --git a/test/rpc/Makefile b/test/rpc/Makefile new file mode 100644 index 000000000..58f04f634 --- /dev/null +++ b/test/rpc/Makefile @@ -0,0 +1,38 @@ +# Makefile for uClibc +# +# Copyright (C) 2005 Erik Andersen <andersen@uclibc.org> + +include ../Rules.mak + +# getrpcent_r_diff +TARGETS = getrpcent getrpcent_glibc getrpcent_diff + +all: $(TARGETS) + +getrpcent: getrpcent.c Makefile $(TESTDIR)/Rules.mak + -@ echo "-------" + -@ echo " " + -@ echo "Compiling $@ vs uClibc: " + -@ echo " " + $(CC) $(CFLAGS) -c $< -o $@.o + $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS) + $(STRIPTOOL) -x -R .note -R .comment $@ + ./$@ > getrpcent.out + -@ echo " " + +getrpcent_glibc: getrpcent.c Makefile $(TESTDIR)/Rules.mak + -@ echo "-------" + -@ echo " " + -@ echo "Compiling $@ vs glibc: " + -@ echo " " + $(HOSTCC) $(GLIBC_CFLAGS) -c $< -o $@.o + $(HOSTCC) $(GLIBC_LDFLAGS) $@.o -o $@ + $(STRIPTOOL) -x -R .note -R .comment $@ + ./$@ > getrpcent_glibc.out + -@ echo " " + +getrpcent_diff: getrpcent getrpcent_glibc + diff -u getrpcent_glibc.out getrpcent.out + +clean: + $(RM) *.[oa] *~ core $(TARGETS) *.out diff --git a/test/rpc/getrpcent.c b/test/rpc/getrpcent.c new file mode 100644 index 000000000..e12e76806 --- /dev/null +++ b/test/rpc/getrpcent.c @@ -0,0 +1,18 @@ +#include <netdb.h> +#include <stdio.h> + +int main(int argc, char *argv[]) +{ + struct rpcent *ent; + + while ((ent = getrpcent()) != NULL) { + printf("%s: %i", ent->r_name, ent->r_number); + while (ent->r_aliases[0]) + printf(" %s", *ent->r_aliases++); + printf("\n"); + } + + endrpcent(); + + return 0; +} diff --git a/test/rpc/getrpcent_r.c b/test/rpc/getrpcent_r.c new file mode 100644 index 000000000..29cd5c278 --- /dev/null +++ b/test/rpc/getrpcent_r.c @@ -0,0 +1,25 @@ +#include <netdb.h> +#include <stdio.h> +#include <errno.h> + +int main(int argc, char *argv[]) +{ + int ret; + char rpcdata[10024]; + struct rpcent rpcbuf, *ent; +memset(rpcdata, 0x00, sizeof(rpcdata)); + + while ((ret = getrpcent_r(&rpcbuf, rpcdata, sizeof(rpcdata), &ent)) == 0) { + printf("%s: %i", ent->r_name, ent->r_number); + while (ent->r_aliases[0]) + printf(" %s", *ent->r_aliases++); + printf("\n"); + } + + if (ret != ENOENT) + printf("Test failed: %s\n", strerror(ret)); + + endrpcent(); + + return 0; +} |