Compare commits

...

1272 Commits

Author SHA1 Message Date
Vineet Gupta
ca1c74d67d NPTL/arc: notify kernel of the TP value
Native gdb makes a ptrace (GET_THREAD_AREA) which needs to return the
TP. however when libc sets up TP reg (for main thread), it doesn't call
arc_settls syscall so kernel doesn't know of TP register details
(moreso because clone doesnt have SETTLS flag)

Note that kernel doesn't know about r25 being TP etc.

This commit got lost in merge of NPTL tools into arc-mainline-dev and
showed up again as STAR 9000919529 (native gdb can't debug threaded
apps)

	------->8---------------
	[ARCLinux]# gdb ./pth
	Reading symbols from ./pth...(no debugging symbols found)...done.
	(gdb) b main
	Breakpoint 1 at 0x106f2
	(gdb) r
	Starting program: /pth
	[Thread debugging using libthread_db enabled]
	Using host libthread_db library "/lib/libthread_db.so.1".
	thread_get_info_callback: cannot get thread info: generic error
	(gdb) q
	------->8---------------
Debugged-by: Anton Kolesov <akolesov@synopsys.com>
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-07-05 22:09:46 +02:00
Bernhard Reutner-Fischer
9930f8b92b getconf.c: undef VERSION
might come in via nptl so undef it before redefining it

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-05-28 17:05:43 +02:00
Alexey Brodkin
c058c0578d ARC: enable IPv6 in defconfigs
These days IPv6 is used more and more in different software
packages. And so we're adding IPv6 support by default in uClibc
for ARC cores.

Signed-off-by: Alexey Brodkin <Alexey.Brodkin@synopsys.com>
Cc: Vineet Gupta <vgupta@synopsys.com>
Cc: Anton Kolesov <akolesov@synopsys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-05-26 22:22:00 +02:00
Yoshinori Sato
e158f13f3d h8300: Makefile update
Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-05-26 22:20:12 +02:00
Yoshinori Sato
8c79e4541e h8300: Add new feature
Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-05-26 22:15:35 +02:00
Yoshinori Sato
dc19aa5479 h8300: headers update
- wire up new kernel

Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-05-26 22:15:35 +02:00
Yoshinori Sato
5e3820a8c6 h8300: Assembly functions
- remove symbol prefix
- new startup
- new clone syscall support

Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-05-26 22:15:26 +02:00
Yoshinori Sato
62775f4518 h8300: 64bit integer support
Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-05-26 21:59:19 +02:00
Yoshinori Sato
7a8856c38c h8300: config update
- New toolchain
- Add new flags

Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-05-26 21:59:18 +02:00
Daniel Golle
274f3c8456 siginfo: add signal info for seccomp related SIGSYS
uClibc doesn't define signal info for the SIGSYS signal which is issued
in case of hitting a syscall prohibited by seccomp.
This is sad as it makes debugging seccomp filter policies impossible on
some architectures (at least ARM and PowerPC, maybe also others) which
do not coincidentally set si_value.sival_int as the syscall number.

To fix this, import the definitions and macros needed from glibc.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-05-20 12:26:26 +02:00
Andrew Burgess
ec0827d3c2 test/silly: Extend include path.
When attempting to build uClibc under buildroot, including building the
tests, the silly tests don't currently compile, a result of attempting
to build using a compiler that does not yet have an installed version of
uClibc available.  The error is a missing header file, specifically
atomic.h.

Taking inspiration from the nptl tests, I have extended the EXTRA_CFLAGS
variable to add the required include paths.  The tests can now be built
under buildroot.

Signed-off-by: Andrew Burgess <andrew.burgess@embecosm.com>
Acked-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-05-20 12:18:19 +02:00
Will Newton
fe7d30e633 _scanf.c: Implement 'm' modifier for 'c' and '[' conversions.
The current code implements the 'm' modifier only for 's'
conversions and would cause a segfault if it was used for 'c'
or '[' conversions. This patch extends the code to cover these
cases too.

The original version could write scanned data outside the passed buffer
because index i used in the '[' conversion handling block was clobbered.

Signed-off-by: Will Newton <will.newton@imgtec.com>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-05-20 10:59:30 +02:00
Bernhard Reutner-Fischer
bfbcc35b0f nptl_db: fix ommitting td_ta_setconcurrency
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-05-06 22:38:38 +02:00
Roland McGrath
62175247d9 init.c (__nptl_initial_report_events): New variable.
(__pthread_initialize_minimal_internal): Initialize pd->report_events
	to that.

This patch helps NPTL report TD_CREATE event, so that GDB could catch the
event and update its thread_list.
Link: http://lists.uclibc.org/pipermail/uclibc/2015-April/048921.html
[shengyong:
 - original patch from glibc: commit 7d9d8bd18906fdd17364f372b160d7ab896ce909
 - context adjust
 - update nptl_db/ChangeLog]

Signed-off-by: Roland McGrath <roland@gnu.org>
Signed-off-by: Sheng Yong <shengyong1@huawei.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-05-06 22:19:31 +02:00
Bernhard Reutner-Fischer
5b691e38f4 buildsys: pregen depends on xlocale
pt-initfini eventually depends on xlocale

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-04-29 23:52:18 +02:00
Bernhard Reutner-Fischer
9a1e4d650e strftime: comment on %0xY %+nY %-nY
Would fix: date -u +%4Y%2m%2d%2H%2M%2S

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-04-29 10:41:42 +02:00
Bernhard Reutner-Fischer
3010966c6d buildsys: swap V=1 with V=2 command printing
Previously V=1 did print abbreviated commands and V=2 the full commands.

Kbuild-based build-systems behave in the opposite way and this is
apparently confusing or inconvenient for users so swap our V handling to
be in line with kbuild (and automake as far as V=0 / V=1 is concerned).

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-04-29 10:22:18 +02:00
Bernhard Reutner-Fischer
d5ecf4cf9e buildsys: LT{,.old} CRT prereq
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-04-23 23:17:00 +02:00
Bernhard Reutner-Fischer
22176277c8 buildsys: Tweak pregen wrt headers_dep
Required for !NPTL, !context-funcs for example.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-04-23 23:15:45 +02:00
Alexey Brodkin
f1f98784e6 ARC: enable more options to satisfy build requirements of applications
As reported by Buildroot autobuilder following options were missing:

 * Libutil stub (UCLIBC_HAS_LIBUTIL option)
   http://autobuild.buildroot.org/results/ce3/ce39eb9b9ece0968563641fb2207099d1a37b191/

 * Program_invocation_name (UCLIBC_HAS_PROGRAM_INVOCATION_NAME=y)
   http://autobuild.buildroot.org/results/154/1546d909e606daefd41b87dece94d642c0fdeba4/
   http://autobuild.buildroot.org/results/bd5/bd54581d7b0cc73bc501072d27e870a443dfce79/

 * Ifaddrd support (UCLIBC_SUPPORT_AI_ADDRCONFIG=y)
   http://autobuild.buildroot.org/results/134/134e78ef1fa87f7fbf26c23ec5dfc68785d79613/

 * Libnsl (UCLIBC_HAS_LIBNSL_STUB=y)
   http://autobuild.buildroot.net/results/331/331ed781b422448205fb9e7c9730ec0c438d6306/
   http://autobuild.buildroot.net/results/402/402d64965ac7ac6e1d4e1990080394958802fe8c/
   http://autobuild.buildroot.net/results/960/9605bac2972d3e3d3fb91947ae6921e89210247b/
   http://autobuild.buildroot.net/results/6b6/6b61ea80a3a6dcead233c4b408eba8b8d647e841/

* UTMP got reworked recently, which breaks packages such as busybox, gdbserver
  etc so enable that too

Enabling mentioned options to make sure more packages could be built with ARC pre-built uClibc tools.

Note UCLIBC_USE_NETLINK is a prerequisite for UCLIBC_SUPPORT_AI_ADDRCONFIG.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Anton Kolesov <akolesov@synopsys.com>
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-04-22 20:02:15 +02:00
Bernhard Reutner-Fischer
6173ee4f61 buildsys: pregen depends on xlocale
since ae9e3f46 sched.h pulls in stdlib.h (for malloc() and free()) and
thus also xlocale..

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-04-22 20:00:48 +02:00
Bernhard Reutner-Fischer
e71fc570ca arm: Add BX and BXC macros
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-04-22 20:00:24 +02:00
Bernhard Reutner-Fischer
298f58e073 arm: Fix POP_RET for armv4t && interworking
It seems the condition was reversed which lead to e.g. arm-920t being
confused

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-04-22 20:00:09 +02:00
Bernhard Reutner-Fischer
7c78a5c52b NPTL: Rename a variable
There seems to be a bug in gold with static TLS at least on x86_64 (?)

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-04-22 19:59:09 +02:00
Bernhard Reutner-Fischer
8e04c064c4 ldso: PRELINK: Remove surplus newline
in early debugging code

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-04-22 19:58:40 +02:00
Bernhard Reutner-Fischer
9058b43530 buildsys: try to merge all constants
Saves a couple of bytes

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-04-22 19:57:40 +02:00
Bernhard Reutner-Fischer
c78cc48514 arm: thumb1: Fix conflicting types for _v3
In file included from ./include/sys/syscall.h:33:0,
                 from libc/sysdeps/linux/common/sync_file_range.c:10:
libc/sysdeps/linux/common/sync_file_range.c: In function '__sync_file_range_nocancel':
./include/bits/syscalls.h:144:16: error: conflicting types for '_v3'
   register int _v3 __asm__ ("v3") = _v3tmp;
                ^
./libc/sysdeps/linux/arm/sysdep.h:281:7: note: in expansion of macro 'LOAD_ARGS_7'
       LOAD_ARGS_##nr (args)     \
       ^
./libc/sysdeps/linux/arm/sysdep.h:324:2: note: in expansion of macro 'INTERNAL_SYSCALL_RAW'
  INTERNAL_SYSCALL_RAW(SYS_ify(name), err, nr, args)
  ^
./libc/sysdeps/linux/arm/sysdep.h:256:40: note: in expansion of macro 'INTERNAL_SYSCALL'
   ({ unsigned int _inline_sys_result = INTERNAL_SYSCALL (name, , nr, args); \
                                        ^
libc/sysdeps/linux/common/sync_file_range.c:32:9: note: in expansion of macro 'INLINE_SYSCALL'
  return INLINE_SYSCALL(sync_file_range, 7, fd, 0,
         ^
In file included from ./libpthread/nptl/sysdeps/unix/sysv/linux/arm/sysdep-cancel.h:18:0,
                 from ./include/cancel.h:58,
                 from libc/sysdeps/linux/common/sync_file_range.c:15:
./libc/sysdeps/linux/arm/sysdep.h:280:21: note: previous definition of '_v3' was here
       register int *_v3 __asm__ ("v3") = _sys_buf;  \
...

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-04-14 23:58:41 +02:00
Bernhard Reutner-Fischer
03cc2041fc librt: Add missing __dso_handle
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-04-14 23:58:41 +02:00
Bernhard Reutner-Fischer
efc26521e8 librt: Refine LIBS
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-04-14 23:58:41 +02:00
Bernhard Reutner-Fischer
a8cf23486e librt: honour HAS_STUBS in buildsys
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-04-14 23:58:41 +02:00
Bernhard Reutner-Fischer
a68d786f30 include/: ignore sys/random.h symlink
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-04-14 23:58:41 +02:00
Bernhard Reutner-Fischer
19c4bf396e librt: Rephrase librt.so library dependencies
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-04-14 23:58:41 +02:00
Bernhard Reutner-Fischer
04cd09eb3a librt: Fix librt.so depends for !NPTL
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-04-14 23:58:41 +02:00
Bernhard Reutner-Fischer
1df50b08df prelink: handle _begin in a gold-agnostic way
The nostartfiles is redundant but better be safe

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-04-14 23:58:41 +02:00
Bernhard Reutner-Fischer
f820f4ce07 buildsys: pass -O to ld unless DODEBUG
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-04-14 23:58:41 +02:00
Bernhard Reutner-Fischer
cf0234de47 libc: Fix page-size in getifaddrs()
TODO: this could need a cleanup..

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-03-31 23:47:51 +02:00
Bernhard Reutner-Fischer
5fe8fc1ac4 buildsys: Do not build crt upon pregen
No need to build crt when just generating headers

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-03-31 23:47:43 +02:00
Bernhard Reutner-Fischer
e51d746b4b buildsys: tweak ucontext_i.h prerequisites
ucontext_i.h too depends on uClibc_config.h.
Update it to look like the other MANGLE generated files and tweak
prereqs

Fixes: make realclean ; make -j libc/misc/internals/__uClibc_main.i

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-03-31 22:44:19 +02:00
Bernhard Reutner-Fischer
5f374c1fe8 buildsys: Fix setting LIBGCC
We were ending up with multiple entries in LIBGCC for recursive child
make instances, avoid that.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-03-31 22:44:12 +02:00
Bernhard Reutner-Fischer
3a14ea8812 Revert "librt: Use -nodefaultlibs instead of -nostdlib"
This reverts commit 534f44d53146457b3ca686c47efb9207543b88e1.

I don't think this is wanted.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-03-31 22:43:52 +02:00
Alexey Brodkin
2494628931 ARC: don't hard-code ELF_NGREG
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
[updated changelog]

Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-03-27 00:08:47 +01:00
Vineet Gupta
d3c60fc490 ARC/signal: shield sa_restorer from compiler toggle side-effects
when building uClibc with -O0 (DODEBUG build) the default sigrestorer
had some extra glue code generated for stack manipulation which was
messing up resume from signal path.

So annotate the function with -Os so that gcc would only generate the
bare min 2 instruction TRAP sequence

Reported-and-Debugged-by: Alexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-03-27 00:08:47 +01:00
Vineet Gupta
70bafe7e4d ARC: switch to NPTL
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-03-27 00:08:47 +01:00
Andrew Burgess
8fde02feb2 Add support for R_ARC_NONE relocations.
The R_ARC_NONE relocation is generated when --gc-sections, used by the
compile time linker, removes some sections.  This is completely normal,
and we can see that all other targets (based on random sampling) have
support for R_*_NONE relocations (named for each target).

Handling R_ARC_NONE involves doing nothing with it, which is nice and
easy.

Signed-off-by: Andrew Burgess <andrew.burgess@embecosm.com>
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-03-27 00:08:46 +01:00
Bernhard Reutner-Fischer
cc8d7d062e include: update atomic.h from glibc
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-03-27 00:08:46 +01:00
Bernhard Reutner-Fischer
560f416794 test: Add SIMULATOR_uclibc and SIMULATOR_glibc
where SIMULATOR_glibc is an optional simulator to run host binaries and
SIMULATOR_uclibc is an optional simulator to run target (uClibc)
binaries.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-03-27 00:08:45 +01:00
Bernhard Reutner-Fischer
cf80a7fc2d utmp: always have at least utmpx
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-03-26 00:50:17 +01:00
Bernhard Reutner-Fischer
8836d184d4 NPTL: SH: silence warning
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-03-26 00:03:09 +01:00
Bernhard Reutner-Fischer
fc673e1420 SH: add 't' to syscall clobber list
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-03-26 00:03:05 +01:00
Bernhard Reutner-Fischer
2c8a776668 ldso: mark _dl_exit as noreturn
Otherwise gcc might not understand that oom() ended control-flow and
might emit an (untaken) reference to abort() in _dl_update_slotinfo()
on e.g. SH4 which breaks linking ld-uClibc.so.
Arguably -ffreestanding should prevent GCC from emitting this
'.global abort' but alas, it does not, which is another bug..

Also mark the function cold to further lower the incoming frequency and
branch probability.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-03-26 00:02:58 +01:00
Bernhard Reutner-Fischer
9e552e6a2d test: tweaks
Fix arc4random exclusion for real.
Silence warning about missing prototype for external helper-function in
tst-scandir

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-03-25 23:59:52 +01:00
Bernhard Reutner-Fischer
6f363f6922 include: Expand malloc-family comments
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-03-25 23:59:49 +01:00
Bernhard Reutner-Fischer
6ff9c31abc utmp: favour POSIX utmpx over SVID utmp
Note: _PATH_UTMPX == _PATH_UTMP and the utmp struct is identical to the
utmpx struct so this only changes the external API entrypoints and NOT
the underlying data source.

This saves about 500b (~1300b from previously ~1950) while at it.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-03-25 23:59:45 +01:00
Bernhard Reutner-Fischer
2b33716c08 utmp: Remove unneeded alias
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-03-25 23:59:37 +01:00
Bernhard Reutner-Fischer
40effcf4c1 mips: switch float_t to float
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-03-24 00:11:49 +01:00
Bernhard Reutner-Fischer
730db44f08 libm: honor NO_LONG_DOUBLE in ldouble_wrappers
Fixes SH build breakage due to attempts to define hidden defs for
unavailable long double functions.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-03-24 00:11:47 +01:00
Bernhard Reutner-Fischer
272e4fa4d3 libcrypt: Rename some internal macros
to avoid clashes

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-03-24 00:11:44 +01:00
Bernhard Reutner-Fischer
c846358a61 buildsys: fix IS_IN_lib* for .s
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-03-24 00:11:41 +01:00
Bernhard Reutner-Fischer
6cba32e6e9 utmp: indent
indent only, no code changes

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-03-24 00:11:38 +01:00
Bernhard Reutner-Fischer
97c9f52239 utmp: Remove unneeded aliases
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-03-24 00:11:28 +01:00
Bernhard Reutner-Fischer
d0f60a600b utmp: add _unlocked suffix to internal helpers
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-03-24 00:11:24 +01:00
Bernhard Reutner-Fischer
4da43e9f2e buildsys: HAS_UTMP (XPG2, SVr4 compat) knob
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-03-24 00:11:21 +01:00
Bernhard Reutner-Fischer
eee76e42f3 libc: TIME64_COMPAT32 for sparc, mips
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-03-24 00:11:15 +01:00
Bernhard Reutner-Fischer
9277fe1315 Revert "utent.c, wtent.c: move functions from utxent.c"
This reverts commit 84135275cfeebc0b233c1c96eeada4d4178a0b18.

This change is said to make systemd deadlock (cannot reproduce this)

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>

Conflicts:
	include/utmp.h
2015-03-24 00:09:45 +01:00
Bernhard Reutner-Fischer
6372941899 test: add utmpx test
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-03-22 14:49:27 +01:00
Bernhard Reutner-Fischer
09ff424905 libc: add getrandom(2)
Introduce a <sys/random.h> for it.

/* FIXME: aren't there a couple of __restrict and const missing ?
 */
extern int getrandom(void *__buf, size_t count, unsigned int flags)
    __nonnull ((1)) __wur;

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-03-22 14:49:27 +01:00
Khem Raj
534f44d531 librt: Use -nodefaultlibs instead of -nostdlib
nostdlib disables linking in startup files too which is not
what we want here since it needs to resolve __dso_handle
which comes from crtbeginS.o, otherwise librt has this
undefined reference to a weak undefined __dso_handle that
shows up as error (with gold linker)
when shared libraries are being built which are
linking in librt

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-03-22 14:49:27 +01:00
Khem Raj
bf6f131313 nptl/atfork: Hide pthread_atfork in shared versions
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-03-22 14:49:27 +01:00
Bernhard Reutner-Fischer
5c3661fda9 libc: Fix vfprintf compilation without HAS_FLOATS
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-03-22 14:49:27 +01:00
Khem Raj
bfb988452c nptl/arm: Move aeabi_read_tp to uclibc_nonshared.a
Otherwise it creates wrong references from shared libs

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-03-22 14:49:27 +01:00
Khem Raj
9faa7e94b8 atexit_old: Do not add it to shared libc
atexit should only be in either uclibc_nonshared.a
shared libc case or libc.a in static build case

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-03-22 14:49:27 +01:00
Bernhard Reutner-Fischer
fdebbe2044 test: enable libm test log2
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-03-22 14:49:27 +01:00
Bernhard Reutner-Fischer
74e49a5e54 extra: add clang flags for gen_bits_syscall_h
Closes bugzilla #6008

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-03-22 14:49:27 +01:00
Bernhard Reutner-Fischer
39206e01eb malloc.h: Add missing feature guard
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-03-18 23:12:58 +01:00
Bernhard Reutner-Fischer
be61486447 malloc-standard: Add locking to malloc_trim
Closes bugzilla #4586

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-03-18 23:11:39 +01:00
Zhiqiang Zhang
85cfbc0353 malloc: checked_request2size failure deadlocks
For some rarely cases(almost App bugs), calling malloc with
a very largre size, checked_request2size check will fail,set
ENOMEM, and return 0 to caller.

But this will let __malloc_lock futex locked and owned by the
caller. In multithread circumstance, other thread calling
malloc/calloc will NOT succeed and get locked.

Signed-off-by: Zhiqiang Zhang <zhangzhiqiang.zhang@huawei.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-03-18 22:33:43 +01:00
Bernhard Reutner-Fischer
6c4538905e libm: Add missing C99 float/ld wrappers
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-03-18 22:32:22 +01:00
Bernhard Reutner-Fischer
78e6494c2c test: skip arc4random on glibc
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-03-18 22:32:13 +01:00
Bernhard Reutner-Fischer
5d3c0cc2aa buildsys: fix IS_IN_lib* for .i
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-03-18 22:31:53 +01:00
Bernhard Reutner-Fischer
6f4d5a7f53 libc: update strverscmp
Closes bugzilla #7936

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-03-17 21:19:10 +01:00
Bernhard Reutner-Fischer
8d15cd677d nptl: fix exclusion of pthread_setconcurrency.c
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-03-17 21:00:51 +01:00
Bernhard Reutner-Fischer
75d9bf2dc5 include: silence __leaf warning
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-03-17 21:00:51 +01:00
Bernhard Reutner-Fischer
f334556476 test: Tweak arc4random exclusion
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-03-17 21:00:51 +01:00
Alexey Brodkin
8ee422cffb resolv: fix unaligned tmp buffer corner-case
On execution of "inet/gethost_r-align" test I noticed failure due
to unaligned access (instaed of 4-byte aligned 1-byte aligned
address was attempted to be accessed).

Further investigation confirmed this nice and helpful test failure.
Following commit removed usage of ALIGN_BUFFER_OFFSET on entry to
__read_etc_hosts_r():
http://git.uclibc.org/uClibc/commit/?id=f65e66078b9f4d2d7f0fc336dee36e78fc467c0f

So indeed if target architecture doesn't allow unaligned access
and provided tmp buffer is not word aligned (and we will deal with pointers
which means word-sized data units), then CPU will fail during execution.

In case of ARC we'll see "Unaligned access" exception like this:
 --->8---
 # potentially unexpected fatal signal 7.
 Path: /root/uClibc/test/inet/gethost_r-align
 CPU: 0 PID: 5514 Comm: gethost_r-align Not tainted 3.13.11 #2
 task: 8f42a580 ti: 8f40e000 task.ti: 8f40e000

 [ECR   ]: 0x00230400 => Misaligned r/w from 0x5fdab341
 [EFA   ]: 0x5fdab341
 [BLINK ]: 0x20032a18
 [ERET  ]: 0x20032a3c
     @off 0x12a3c in [/lib/libuClibc-0.9.34-git.so]
     VMA: 0x20020000 to 0x20062000
 [STAT32]: 0x00000086 : U         E2 E1
 BTA: 0x20046014  SP: 0x5fdab260  FP: 0x00000000
 LPS: 0x20046064 LPE: 0x20046068 LPC: 0x00000000
 r00: 0x5fdab341 r01: 0x00000005 r02: 0x00000015
 r03: 0x00000000 r04: 0x5fdab358 r05: 0x00000000
 r06: 0x0a0a0a00 r07: 0x00000000 r08: 0x0000003f
 r09: 0x20067050 r10: 0x00000000 r11: 0x00000014
 r12: 0x00000001 r13: 0x00000000 r14: 0x20060660
 r15: 0x20060661 r16: 0x00000006 r17: 0x5fdab371
 r18: 0x00000018 r19: 0x5fdab2b4 r20: 0x00020000
 r21: 0x00000000 r22: 0x00029068 r23: 0x5fdab371
 r24: 0x00010000 r25: 0x00000000
 --->8---

To fix this problem we'll re-introduce tmp buffer force alignment
before config parser invocation.

Signed-off-by: Alexey Brodkin <Alexey.Brodkin@synopsys.com>
Cc: Vineet Gupta <vgupta@synopsys.com>
Cc: Waldemar Brodkorb <wbx@openadk.org>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-03-16 11:06:18 +01:00
Bernhard Reutner-Fischer
21cbb6fe88 unistd.h: put getppid under XOPEN2K8
Add __LEAF to all __THROW, introduce non-leaf __THROWNL
Adjust affected spots accordingly.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-03-13 21:12:37 +01:00
Bernhard Reutner-Fischer
8c66e0a6c7 buildsys: create linker script with proper flags
We were not passing the correct use-ld and -m{32,64,...} when creating
the linker script. Revisit for gold later on anyway.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-03-12 14:20:57 +01:00
Bernhard Reutner-Fischer
c3ddc18409 spawn.h: Fix !_GNU_SOURCE compilation
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-03-12 14:20:50 +01:00
Gustavo Zacarias
8e5113112a sparc/clone.S: guard tcb-offsets.h include with RESET_PID
Otherwise we have a broken scenario with non-threading builds.

Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-03-03 19:10:47 +01:00
Bernhard Reutner-Fischer
b4e0915626 libc: silence warning
include/bits/sigset.h:219:62: warning: right-hand operand of comma expression has no effect [-Wunused-value]
include/bits/sigset.h:210:63: warning: right-hand operand of comma expression has no effect [-Wunused-value]

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-02-27 19:50:09 +01:00
Bernhard Reutner-Fischer
cb5af0bed8 ldso: silence warning
In file included from ldso/ldso/ldso.c:87:0:
ldso/ldso/dl-startup.c: In function '_dl_start':
ldso/ldso/dl-startup.c:184:32: warning: cast from pointer to integer of differennt size [-Wpointer-to-int-cast]
   auxvt[AT_BASE].a_un.a_val =  (Elf32_Addr) &_begin;

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-02-27 10:41:30 +01:00
Bernhard Reutner-Fischer
0544e23925 ldso: silence warning
symbol_addr was set but not used

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-02-20 18:52:45 +01:00
Steve Ellcey
409f14d9b5 Allow use of executable RUNPATH/RPATH when finding libraries.
This option will modify ldso so that it will use the executables
RUNPATH/RPATH to find to find libraries even though this behavour
is not standard.  Setting this option causes the uclibc dynamic linker
behavour to match the glibc dynamic linker.

Signed-off-by: Steve Ellcey <sellcey@imgtec.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-02-20 15:41:13 +01:00
Vineet Gupta
30a92760ab ARC: Remove unused EM_ARC_A5
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-02-20 14:05:29 +01:00
Bernhard Reutner-Fischer
cf8e466f89 include/elf.h: bump EM_NUM
and remove a few ancient entries

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-02-20 12:35:36 +01:00
Vineet Gupta
be58779614 elf: Add STT_GNU_IFUNC from glibc
perf in upstream Linux kernel 3.17 onwards expects STT_GNU_IFUNC
replicate it from glibc

Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-02-20 11:36:25 +01:00
Vineet Gupta
cd03281d3c sync_file_range: fix standard UCLIBC_SYSCALL_ALIGN_64BIT handling
Currently UCLIBC_SYSCALL_ALIGN_64BIT is not explicitly handled. Fix that
and make sure the special handling is done for powerpc/xtensa which use
UCLIBC_SYSCALL_ALIGN_64BIT but don't use hole punched syscall handler in
kernel.

Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Cc: Baruch Siach <baruch@tkos.co.il>
Cc: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-02-20 11:35:33 +01:00
Vineet Gupta
2a2b1d2a3e posix_fadvise: handle 2 variants for SYSCALL_ALIGN_64BIT
arm/powerpc/xtensa pass @advice as 2nd arg to syscall (vs. canonical 4th)

Current code however does this for UCLIBC_SYSCALL_ALIGN_64BIT which
powerpc/xtensa also happen to define.

This is not true for ARCv2 ISA and possibly other arch of future with
64-bit even register requirement, which uses the standard syscall
handler in kernel.

Fix that by providing 2 variants of SYSCALL_ALIGN_64BIT

Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Cc: Baruch Siach <baruch@tkos.co.il>
Cc: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-02-20 11:34:55 +01:00
Vineet Gupta
df273fedf4 ARCv2: optimised string routines
Signed-off-by: Claudiu Zissulescu <claziss@synopsys.com>
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-02-20 11:32:02 +01:00
Vineet Gupta
afab56958f ARCv2 ISA support
This is next gen Instruction Set Architecture from Synopsys and basis
for the ARC HS family of processors.

http://www.synopsys.com/dw/ipdir.php?ds=arc-hs38-processor&elq_mid=5732&elq_cid=458802
http://www.synopsys.com/IP/ProcessorIP/ARCProcessors/arc-hs/Pages/default.aspx

Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-02-20 11:30:20 +01:00
Anton Kolesov
89b63496e8 ARC: Add GNU glob to ARC defconfigs
GNU glob is required by make.

Signed-off-by: Anton Kolesov <anton.kolesov@synopsys.com>
Cc: Vineet Gupta <Vineet.Gupta1@synopsys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-02-17 23:59:54 +01:00
Bernhard Reutner-Fischer
5d5c77daae libc: add setns()
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-02-17 23:42:34 +01:00
Khem Raj
9fc6da20da Add eventfd_read() and eventfd_write()
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-02-17 23:42:30 +01:00
Vineet Gupta
31b0af2da8 signal.h: elide memset from sigemptyset
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-02-16 21:52:13 +01:00
Vineet Gupta
f74294bd67 ARC: sigaction: inline syscall trap
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-02-16 21:52:13 +01:00
Vineet Gupta
65bc357213 ARC: sigaction: fold default sigrestorer into "C"
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-02-16 21:52:13 +01:00
Vineet Gupta
90b115c036 ARC: siagction: opencode memcpy
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-02-16 21:52:13 +01:00
Vineet Gupta
7bb51423cc ARC: remove stale TRUNCATE64_HAS_4_ARGS
Not relevant anymore since commit e8cc14e59ed3f66b84e,
"libc: rename TRUNCATE64_HAS_4_ARGS to SYSCALL_ALIGN_64BIT"

Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-02-16 21:52:13 +01:00
Alexey Brodkin
c2460b9b7b ARC defconfigs: enable some items
perf: UCLIBC_HAS_GLIBC_CUSTOM_STREAMS
elfutils: UCLIBC_HAS_PROGRAM_INVOCATION_NAME

Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-02-16 21:52:13 +01:00
Alexey Brodkin
c049c4d872 ARC: add configuration option for MMU page size
ARC CPU may have MMU page size of 4/8(default)/16k.
uClibc needs to have page size configured accodring to HW it will be run on.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-02-16 21:52:13 +01:00
Vineet Gupta
181d410ad0 ARC: Conditionalise certain relocations as provided by TLS tools only
uClibc mainline supports NPTL which in turns depends on TLS support in
the tools (gcc/binutils), which is yet to be merged in dev branches.

However there is some non NPTL code in uClibc, added as part of NPTL
effort, which relies on certain relocations only provided by NPTL
binutils. As a result building the current upstream even for LT.old
breaks.

So conditionalize that code on tools, bu tin lack of specific versions,
we use NPTL enabling as a sign the tools are equipped to handle those
relos.

Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-02-16 21:52:13 +01:00
Steve Ellcey
673c426bfb Update MIPS configuration rules.
Add a configuration choice for the NaN format on MIPS (either the
standard (legacy) format or the newer IEEE 2008 format.

Change how CPU_LDFLAGS are set for MIPS.  Use the same value as
CPU_CFLAGS since CC is used to do linking.  This ensures consistency
between compiles and links and adds support for N32 ABI to linking.

Signed-off-by: Steve Ellcey <sellcey@imgtec.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-02-12 22:54:59 +01:00
Bernhard Reutner-Fischer
343f6b8f1f buildsys: fix IS_IN_lib* for out-of-tree builds
41537a770b46f2376e74af58ba4885749339e81e erroneously stripped the
top_builddir off the per-directory flag setting which works fine for
in-tree builds but is not correct for O=
Just use the full path of the target files to apply the flags to fix
that thinko.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-01-28 10:50:34 +01:00
Bernhard Reutner-Fischer
92de8a5f6f libc: sync_file_range missing comma
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-01-26 16:50:29 +01:00
Bernhard Reutner-Fischer
d88e1855ff libc: ppc64 etc: Fix sync_file_range
Fix copy'n paste error for ppc64 and other sync_file_range2 arches

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-01-24 20:50:02 +01:00
Max Filippov
4449e47c2b xtensa: ldso: drop unused address calculation from _dl_linux_resolve
The result of the calculation in register a12 is never used as the
function _dl_linux_resolver only accepts 2 arguments. Drop it.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-01-23 21:21:55 +01:00
Max Filippov
59f06d06f0 xtensa: ldso: coalesce dl_mprotect address ranges
This noticeably lowers the number of mprotect calls at program startup,
e.g. for busybox: 7 calls vs 1835 calls.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-01-23 21:16:12 +01:00
Wang Yufen
e55f589191 add argument check in mknod
mknod() in glibc/eglibc will check the argument, like this,
  ...
  if (k_dev != dev) {
      __set_errno (EINVAL);
      return -1;
   }
  ...
So add argument check in uclibc's mknod() too.

Signed-off-by: Wang Yufen <wangyufen@huawei.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-01-23 21:13:27 +01:00
Xishi Qiu
217f0a86c0 add argument check in setenv()
setenv() in glibc/eglibc will check the argument, like this,
  ...
  if (name == NULL || *name == '\0' || strchr (name, '=') != NULL)
    {
      __set_errno (EINVAL);
      return -1;
    }
  ...
So add argument check in uclibc's setenv() too.

Signed-off-by: Xishi Qiu <qiuxishi@huawei.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-01-23 20:59:27 +01:00
Bernhard Reutner-Fischer
a952a1dd2b nptl: compile pt-vfork in ARM-mode
amending commit 49a67cf67d5a7194214566bc730ee7e28d55bbe1
could need a thumb implementation..

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-01-23 15:47:02 +01:00
Bernhard Reutner-Fischer
920db6d393 libc: Avoid redundant setting of ENOMEM
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-01-22 11:39:24 +01:00
Bernhard Reutner-Fischer
78b154a95b libcrypt: return NULL on unsupported salt
BZ #7808 asks us not to fallback to DES if the optional SHA are disabled
but requested by the user.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-01-19 17:29:21 +01:00
Bernhard Reutner-Fischer
516c45013d test: Adjust passed options
to follow suit 067637375658047d70c296606ae17ef0bc86499d

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-01-07 13:26:42 +01:00
Anthony G. Basile
638a23483b mkostemp: fix implementation
mkostemp(char *template, int flags) generates a unique temporary
filename from a template.  The flags parameter accepts three of
the same flags as open(2): O_APPEND, O_CLOEXEC, and O_SYNC.  The
current implementation of mkostemp(3) does not respect the flags
and in fact confuses the flags with the file mode which should
always be S_IRUSR | S_IWUSR.  This patch corrects this issue.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-12-15 17:53:06 +01:00
Bernhard Reutner-Fischer
bff3a664e6 test: Some more tests under conditionals
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-12-15 17:32:57 +01:00
Bernhard Reutner-Fischer
f8e05f3850 stdio: Fix printing 0.0
We were relying on FE_DIVBYZERO being turned off when printing
"%f", +-.0
Avoid the whole issue by looking at the sign-bit (in a rough
approximation).

Note that we do not handle gracefully:
  printf ("\n%llf\n", -0.0);
  printf ("\n%llf\n",  0.0);
nor %Lf for both when NOT cast to long double. Avoiding an FPE due to
broken numbers like these does not make sense to me.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-12-15 17:27:49 +01:00
Bernhard Reutner-Fischer
0676373756 unistd: allow to turn off getopt_long
The GNU variant of getopt() previously had no way to turn off
getopt_long() support.
2014-12-12 16:18:12 +01:00
Bernhard Reutner-Fischer
d6da534cbf test: disable ptytest unless HAS_PTY
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-12-12 16:06:17 +01:00
Bernhard Reutner-Fischer
926a698c5a config: move STDIO_FUTEXES up a bit
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-12-12 14:43:55 +01:00
Bernhard Reutner-Fischer
ffc0bd03c4 sigaction: Fix !HAS_REALTIME compilation
In file included from ./include/signal.h:279:0,
				 from libc/sysdeps/linux/x86_64/sigaction.c:22:
./include/bits/sigaction.h:32:29: error: unknown type name 'siginfo_t'
   void (*sa_sigaction)(int, siginfo_t *, void *);

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-12-09 14:30:39 +01:00
Bernhard Reutner-Fischer
a1b88fe87a mips: rename siginfo _timer members
Rename _timer[12] to si_tid and si_overrun to fix compilation of
strace-4.9+

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-12-03 17:43:25 +01:00
Bernhard Reutner-Fischer
a58f1e2a53 buildsys: remove some obsolete optimization CFLAGS
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-12-03 16:18:54 +01:00
Bernhard Reutner-Fischer
b364229604 locale: Add wcsftime()
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-11-19 17:29:09 +01:00
Bernhard Reutner-Fischer
49a67cf67d nptl: compile pt-vfork in ARM-mode
could need a thumb implementation..

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-11-13 20:58:52 +01:00
Max Filippov
7badf754cb Config.in.arch: enable long double math for xtensa
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-11-10 10:40:22 +01:00
Anthony G. Basile
8c57a5d9c2 statfs: fix compile error when UCLIBC_LINUX_SPECIFIC is not set
statfs() is a Linux-specific function.  When building without
UCLIBC_LINUX_SPECIFIC set, libc_hidden_proto(statfs) in
include/sys/statfs.h is unmatched with libc_hidden_def(statfs)
in libc/sysdeps/linux/common/statfs.c, leading to a compile
error.  This patch fixes this, as well as adds statfs() to the
list of Linux-specific functions in extra/Configs/Config.in.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-11-10 10:08:17 +01:00
Bernhard Reutner-Fischer
a9bdc5d28e m68k: libc: add fmovem* mcffpu condition
add fmovem{x,.d,.*} ISA conditional
Fixes assembler errors for 5206.
isa_a, isa_b (or a+, don't remember) do not have emx, use em.d there.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-09-17 20:50:35 +02:00
Gustavo Zacarias
085465e5c5 sparc: update ptrace.h to latest from glibc
Update sys/ptrace.h to latest glibc release for a lot of missing
definitions.

Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-09-16 23:52:00 +02:00
Gustavo Zacarias
56824024e4 powerpc: update ptrace.h to latest from glibc
Update sys/ptrace.h to latest glibc release for a lot of missing
definitions.

Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-09-16 23:51:59 +02:00
Bernhard Reutner-Fischer
95acdd4b30 buildsys: remove now redundant lib placement defines
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-09-16 22:42:06 +02:00
Bernhard Reutner-Fischer
cce3af55b3 libc: silence missing prototype warning
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-09-16 22:42:06 +02:00
Bernhard Reutner-Fischer
41537a770b buildsys: fix IS_IN_lib*
define NOT_IN_libc / IS_IN_libxxx appropriately
to fix pthread_once

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-09-16 22:42:06 +02:00
Bernhard Reutner-Fischer
143b7505a2 nptl: rephrase *.sym handling
Avoids circular dependency warning from make by generating the .h
directly from the .sym files, elimination intermediate files.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-09-16 22:42:00 +02:00
Bernhard Reutner-Fischer
62d3a427af buildsys: Fix typo
LDFLAG-fuse-ld looked at a non-existing var, use the correct one

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-09-09 13:49:34 +02:00
Anthony G. Basile
33a12b5540 libc: add fallocate() and fallocate64()
We add the Linux-specific function fallocate() which allows the user to
directly manipulate allocate space for a file.  fallocate() can operate
in different modes, but the default mode is equivalent to posix_fallocate()
which is specified in POSIX.1.

Recent releases of e2fsprogs 1.42.11 and above expect fallocate64() to be
available.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-09-09 13:48:45 +02:00
Bernhard Reutner-Fischer
7efe10ec5f libc: split multi-source epoll.c
We cannot override individual functions on a per-arch basis otherwise

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-09-05 13:59:28 +02:00
Waldemar Brodkorb
6d550ddd12 sparc: remove sparc64/sparcv9 code
The sparc64/sparcv9 code is incomplete. Furthermore there is
no real embedded hardware for sparc64 available, so better remove
it until someone comes up with a complete port.

Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-09-04 13:56:34 +02:00
Bernhard Reutner-Fischer
b212e3804f ldso: Fix compile-error on noMMU
Thanks to Waldemar Brodkorb for noticing!

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-09-04 13:24:34 +02:00
Bernhard Reutner-Fischer
bc23c6440d test: wcsftime depends on XLOCALE
Thanks to Waldemar Brodkorb for noticing.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-09-04 13:16:35 +02:00
Bernhard Reutner-Fischer
ff48662bba test: disable librt shmtest on non-MMU systems
This test fails for non-MMU systems, because it uses fork()
Thanks to Waldemar Brodkorb!

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-09-04 13:12:52 +02:00
Bernhard Reutner-Fischer
7a3acb243b buildsys: tweak check_ld flag probing
ld was (erroneously) complaining that it failed to merge private bfd
data. Silence this mismatch as seen on m68k with obfd binary.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-09-04 12:46:56 +02:00
Bernhard Reutner-Fischer
5c0c667fb2 buildsys: refine compile.S
filter out all -std=

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-08-29 21:06:18 +02:00
Bernhard Reutner-Fischer
61ae023e5b buildsys: use SED for create-lds
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-08-29 20:53:04 +02:00
Waldemar Brodkorb
88041f133f test: disable test for systems without FPU
This test fails for systems without fpu.
For example m68k build for non-mmu/non-fpu systems fail.

Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-08-29 16:24:19 +02:00
Waldemar Brodkorb
512fd3804b test: sync with glibc, use do_test
This breaks out of a deadlock, which occurs when testing for powerpc. (qemu)
Otherwise the test suite does not finish.

Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-08-28 13:15:55 +02:00
Waldemar Brodkorb
697dbb016e test: get out of the endless while loop, when bind failed
When bind() fails in this test, then /tmp get filled up with
temp files and upcoming tests will fail, because they need to create
temp files, too. Better exit from the loop.
Test still needs to be investigated to fix the failing bind().

Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-08-28 13:13:36 +02:00
Waldemar Brodkorb
5a89f1c696 m68k: fix typo
otherwise you get compile warnings, when building for m68k.

Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-08-28 13:09:29 +02:00
Waldemar Brodkorb
ad687dda63 test: do not depend on compile
When you cross-compile the testsuite and then try to run
on a system without gcc/binutils it would be nice if no compiling
or linking is tried. Refresh test/README (suggested by Khem)

Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-08-28 13:04:46 +02:00
Waldemar Brodkorb
23abbfa633 test: NPTL: sync WRITE_BUFFER_SIZE with glibc test
Test on Linux 3.16.1 in Qemu ARM fails with:
 TEST_EXEC nptl/ tst-cancel4
ret == 1 ; expected_ret == 0
make[1]: *** [tst-cancel4.exe] Error 1
The output of failed test is:
minimum write buffer size too large
../Test.mak:89: recipe for target 'tst-cancel4.exe' failed

Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-08-28 13:02:45 +02:00
Waldemar Brodkorb
68d700d66b sparc: add missing pthread_spin_lock/pthread_spin_trylock
tst-spin1.c compile breaks with:
test/nptl/tst-spin1.c:34: undefined reference to `pthread_spin_lock'

pthread_spin_lock and pthread_spin_trylock is missing while
building sparc. add the meta c files here.

Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-08-28 13:00:56 +02:00
Waldemar Brodkorb
10d05ca07c sparc: remove unused subdirs variable
For sparc TARGET_SUBARCH is never used. And there is a typo in the
path.

Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-08-28 13:00:56 +02:00
Waldemar Brodkorb
789fca90bf Revert "sparc: disable cancellable system, as it fails in strange ways right now"
This reverts commit 1db4f8f8389f6a935ecd83aff7fcce5d1cf2c0f3.

It is unclear in which way this is breaking sparc systems.
With this change added you get following linking error:
libpthread/nptl/libpthread_so.a(pt-system.oS): In function `__libc_system':
libc/stdlib/system.c:64: undefined reference to `__wait4_nocancel'

Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-08-28 12:38:34 +02:00
Waldemar Brodkorb
c09e41ef92 Revert "sparc: use HIDDEN_JUMPTARGET for errno"
This reverts commit f51fb26dbcceee9e48d10facc830bd4a549f6cc2.

This fixes linking error for sparc build.
While building a sparc system you get following linking error:
libc/sysdeps/linux/sparc/pipe.S:54: undefined reference to `__GI___errno_location'

Removing the HIDDEN_JUMPTARGET fixes the issue, while using gcc 4.8.3/binutils 2.24.

The definition of __errno_location was changed recently here:
http://git.uclibc.org/uClibc/commit/?id=8f550715c2b211036fc273add3cb5219397ed312

Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-08-28 12:38:34 +02:00
Khem Raj
c6e8f34a35 timex: Sync with glibc
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-08-26 20:46:48 +02:00
Khem Raj
a15c934313 Define IPTOS_CLASS_* macros according to RFC 2474
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-08-26 20:46:42 +02:00
Bernhard Reutner-Fischer
86869a8620 buildsys: remove duplicate UCLIBC_EXTRA_CFLAGS
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-08-26 20:07:08 +02:00
Bernhard Reutner-Fischer
48a0006012 microblaze: Remove duplicate F_{S,G}ETPIPE_SZ
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-08-25 10:41:08 +02:00
Khem Raj
cae2aea39a fcntl.h: Define F_SETPIPE_SZ and F_GETPIPE_SZ
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-08-25 10:14:36 +02:00
Bernhard Reutner-Fischer
8a64e1f53f mathinline.h: Use __extern_inline
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-08-25 10:07:44 +02:00
Khem Raj
5128015145 Add clock_adjtime syscall
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-08-25 09:50:43 +02:00
Waldemar Brodkorb
3a085a2a64 fix for pipe() on sparc
When using something like this:
 $ echo foo|grep foo|wc -l
with mksh shell, you get an runtime error.

Glibc and klibc does not do these extra check.
After removing this check using double pipes work fine.
Tested with Qemu 2.1.0.

Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
Signed-off-by: Thorsten Glaser <tg@mirbsd.org>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-08-20 10:08:33 +02:00
Anthony G. Basile
94246e65e2 libc: add issetugid()
issetugid() returns 1 if the process environment or memory address space
is considered tainted, and returns 0 otherwise.  This happens, for example,
when a process's privileges are elevated by the setuid or setgid flags on
an executable belonging to root.  This function first appeard in OpenBSD 2.0
and is needed for the LibreSSL.

This patch follows the same logic as the equivalent musl commit.  For more
information see the commit message at

http://git.musl-libc.org/cgit/musl/commit/?id=ddddec106fd17c3aca3287005d21e92f742aa9d4

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-08-18 15:19:46 +02:00
Alexey Brodkin
8c93ff92c3 test/math: fix for MIPS that takes 32/64 suffix into account
This fixes a breakage for MIPS32/64 introduced in:
http://git.uclibc.org/uClibc/commit/?id=c02bc5763ba9c8f8b464bca89fba28e091ce1ffc

Now ULP_SUFFIX is taken into account when searching for existing
libm-test-ulps-ARCH

Signed-off-by: Alexey Brodkin <Alexey.Brodkin@synopsys.com>

Cc: Waldemar Brodkorb <wbx@openadk.org>
Cc: Vineet Gupta <vgupta@synopsys.com>
Cc: Anton Kolesov <akolesov@synopsys.com>
Cc: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-08-18 12:22:02 +02:00
Alexey Brodkin
50442f4530 test/math: fix for disabled long double math
Commit "test: cater for config" http://git.uclibc.org/uClibc/commit/test/math/Makefile.in?id=7598eeaa1defa2884adaa890bb115c493d69cc35 inverted check from
	ifeq ($(UCLIBC_HAS_LONG_DOUBLE_MATH),y)
to
	ifeq ($(UCLIBC_HAS_LONG_DOUBLE_MATH),)
with first branch indeed inverted - instead of adding tests they were excluded.
But "else" branch was not moved up (remember check was inverted).

This causes compile breakage when building basic-test.c:
--->---
TEST_LINK math/ basic-test
basic-test.c: In function 'ldouble_test':
basic-test.c:111:1: warning: implicit declaration of function 'nanl' [-Wimplicit-function-declaration]
 TEST_FUNC (ldouble_test, long double, nanl, LDBL_EPSILON, HUGE_VALL)
 ^
basic-test.o: In function `main':
basic-test.c:(.text.startup+0x834): undefined reference to `nanl'
basic-test.c:(.text.startup+0x858): undefined reference to `nanl'
basic-test.c:(.text.startup+0x880): undefined reference to `nanl'
basic-test.c:(.text.startup+0x8a8): undefined reference to `nanl'
basic-test.c:(.text.startup+0x8d4): undefined reference to `nanl'
basic-test.o:basic-test.c:(.text.startup+0x8e0): more undefined references to `nanl' follow
collect2: error: ld returned 1 exit status
make[3]: *** [basic-test] Error 1
--->---

Fix is simple - merge "old else" branch with the first current one.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>

Cc: Vineet Gupta <vgupta@synopsys.com>
Cc: Anton Kolesov <akolesov@synopsys.com>
Cc: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Cc: Waldemar Brodkorb <wbx@openadk.org>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-08-18 12:11:52 +02:00
Anton Kolesov
be103d1440 ARC: Enable OBSTACK in defconfig for ARC
OBSTACK is required for native builds of binutils and GDB.

Signed-off-by: Anton Kolesov <Anton.Kolesov@synopsys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-08-18 12:09:42 +02:00
Tony Wu
2d9740a65a uclibc: nptl: fix __lll_lock_wait_private multiple definition
Mark non-pthread __lll_lock_wait_private weak to avoid multiple
definition error in static link mode.

Signed-off-by: Tony Wu <tung7970@gmail.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-08-18 12:05:45 +02:00
Anton Kolesov
361285886a lseek: Correct order of offset arguments
There was a runtime error in systems without large file support. Call
fseek(fd, 4096, SEEK_SET) has been failing with EINVAL, though it was
succeeding for offset = 4092. This has been happening because llseek system
call accepts 64-bit value as an offset argument and lseek function has been
ordering 32-bits words that form this offset value, according to the
endianness. However this ordering to match endianness is not required,
because llseek doesn't accept one 64-bit offset argument, it accepts two
32-bit offset argument, then stitches them into one following its
endianness. As a result on little endian system, order of words has been
swapped two time: in libc and in kernel. Thus call to fseek with offset 4096
(0x1000) was doing a system call to llseek with offset 0x1000_0000_0000. I'm
not entirely sure why then offset = 4092 hasn't been failing then.

This patch removes malicious swap of words when calling llseek.

Signed-off-by: Anton Kolesov <Anton.Kolesov@synopsys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-08-18 12:01:36 +02:00
Vineet Gupta
95ec1755ef libc: posix_fadvise: Fix build breakage for !LFS
commit 00571b43df2e "libc: posix_fadvise: restore implementation for xtensa"
enabled posix_fadvise() for all arches (it was just not generated
before).

However this also unearthed an issue introduced by ee84b8b400
"linux: posix_fadvise: use new SYSCALL_ALIGN_64BIT" which is to
referencing LFS'ish code (off64_t) w/o proper checks which causes build
to break for !LFS.

Fix this by calling posix_fadvise64() only for LFS case and open-code
it's equivalent for !LFS.

Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Cc: Mike Frysinger <vapier@gentoo.org>
Cc: Baruch Siach <baruch@tkos.co.il>
Cc: Khem Raj <raj.khem@gmail.com>
Cc: markos Chandras <markos.chandras@gmail.com>
Cc: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-08-18 12:00:49 +02:00
Waldemar Brodkorb
775d660544 unbreak networking code for sparc
This commit 1e2e4ac6193ffe0900bd392fa3c596883771eb34 breaks networking
on sparc systems. In Linux the socket functions are declared, but not
implemented and must be routed through socketcall().

Tested via Qemu 2.0.0.

Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-08-18 11:57:39 +02:00
Alexey Brodkin
fe1075ea83 test_nptl: replace __sigpause with sigpause
On attempt to build uClibc tests following error message appears:
=========
TEST_LINK nptl/ tst-cancel4
tst-cancel4.c: In function 'tf_sigpause':
tst-cancel4.c:765:3: warning: implicit declaration of function
'__sigpause' [-Wimplicit-function-declaration]
__sigpause (SIGCANCEL, 1);
^
tst-cancel4.o: In function `tf_sigpause':
tst-cancel4.c:(.text+0x1054): undefined reference to `__sigpause'
collect2: error: ld returned 1 exit status
=========

This commit http://git.uclibc.org/uClibc/commit/?id=cef1f9517c319d86b4b426ecc14a10d0fa5494c7
makes __sigpause static limiting its scope to "libc/signal/sigpause.c".

Switching to common implementation "sigpause()" fixes this issue.

Signed-off-by: Alexey Brodkin <Alexey.Brodkin@synopsys.com>

Suggested-by: Vineet Gupta <vgupta@synopsys.com>
Cc: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-08-18 11:55:43 +02:00
Vineet Gupta
99ac739b20 ARC/NPTL: clone to set TP if CLONE_SETTLS
Typically kernel would set the TP register of newly created thread in
clone syscall with CLONE_SETTLS.

However this implies that:
* kernel knows of the exact TP register (which is already different for
  ARCompact and ARCv2) and is a detail which becomes part of the ABI
* kernel also needs to handle the unlikely but possible case of !TLS
  userspace (e.g. Android libc) case where TP reg is not reserved and
  thus need not be mucked with (using ELF personality based detection)

It is better to confine this detail to userspace runtime and set TP reg
right after clone syscall returns.

Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-08-18 11:52:35 +02:00
Vineet Gupta
fd4a5861e2 ARC/NPTL: Add tests
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-08-18 11:52:35 +02:00
Vineet Gupta
0550c0c519 ARC/NPTL: Fix __libc_sigaction redefinition with static links
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-08-18 11:52:34 +02:00
Vineet Gupta
873fa5becc NPTL: ARC support
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-08-18 11:52:34 +02:00
Joern Rennecke
6915b3a6b9 ARC: ldso: Use @pcl syntax.
Signed-off-by: Joern Rennecke <joern.rennecke@embecosm.com>
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-08-18 11:52:16 +02:00
Mike Frysinger
e2cf30bb75 bits/time.h: sync with latest glibc
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2014-08-01 04:16:12 -04:00
Jian Peng
c02bc5763b test/math: add fallback to libm-test-ulps-generic logic
Under test/math/, there is libm-test-ulps-generic used as fallback
in case that libm-test-ulps-$(TARGET_ARCH) does not exist.

This is required for arches that don't have ULPS yet.

Original patch from Jian Peng was found here:
http://lists.uclibc.org/pipermail/uclibc/2011-April/045172.html

Signed-off-by: Jian Peng <jipeng2005@gmail.com>
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>

Cc: Vineet Gupta <vgupta@synopsys.com>
Cc: Anton Kolesov <akolesov@synopsys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-07-24 21:56:31 +02:00
Bernhard Reutner-Fischer
53eb441800 Changelog: complete old data and cycle
We switched to detailed per-release Changelog some time ago, available
on the website.
Move the old Changelog for historical reasons.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-07-24 20:52:38 +02:00
Anton Kolesov
d5e3720ee1 ARC: Implement native GDB requirements in procfs.h
Native GDB requires elf_fpregset_t to be defined, even if floating point
registers are absent. In this case we use empty structure. Additionally we
redefined prfpregset_t to use this new type.

And there has been an error: it was defined that user_regs_struct has 20
registers, while it has 40.

Signed-off-by: Anton Kolesov <Anton.Kolesov@synopsys.com>
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-07-22 09:50:50 +02:00
Vineet Gupta
be5ba36bf6 ARC: clone: Ensure that @fn returns back to clone
This showed up due to longstanding test/unistd/clone failure where post
clone, the callback was not exiting and rather falling thru in into main
program.

Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-07-22 09:50:50 +02:00
Vineet Gupta
b6e08a6715 ARC: ldso: Dont force frame pointer as it useless for unwinding on ARC
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-07-22 09:50:50 +02:00
Vineet Gupta
84108f44cc ARC: make sigaction inline with other arches
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-07-22 09:50:50 +02:00
Vineet Gupta
e16dc63978 ARC: syscalls.h: code-reuse/fix-arg-annotations
- Use syscalls-common.h vers of INTERNAL_SYSCALL / INLINE_SYSCALL_NOERR
- INLINE_SYSCALL takes syscall name (e.g. write)
- {INLINE,INTERNAL}_SYSCALL_NCS macros take syscall num (__NR_write)

Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-07-22 09:50:50 +02:00
Vineet Gupta
a427368f14 syscalls-common.h: Rename some macro args for correct documentation
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Cc: Mike Frysinger <vapier@gentoo.org>
Cc: Denys Vlasenko <vda.linux@googlemail.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-07-22 09:50:50 +02:00
Vineet Gupta
7e829db6ae open64: ensure that openat check works
For ARC builds atleast, __NR_xxx was not trickling into in open64.c
causing open64->openat a needless detour via open

Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-06-24 13:13:18 +02:00
Zhang Pu
1608819110 fix pthread_cancel lead to segmentation fault for x86_64.
When x86_64 cpu contains 'cpu_has_xsave' flag(in kernel),call the
pthread_cancel will have a segmentation fault. Because gcc could
not find the end of stack in user signal stack.

Signed-off-by: Zhang Pu <glen4linux@gmail.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-06-12 17:33:39 +02:00
Yann E. MORIN
8b8ad6ed0f arm: move check for BX to its own header
As Will noticed, the header this check is currently done in
is asm-only, and is not meant to be included from C code.
This breaks compilation when compiled for a Thumb2-aware CPU.

Move the BX check to its own header, and revert 7a246fd.

Reported-by: Will Newton <will.newton@gmail.com>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
Cc: Will Newton <will.newton@gmail.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-06-12 17:08:39 +02:00
Dan Moulding
3b688f42f0 NPTL: Fix undefined reference to PRIVATE_FUTEX with 2.6.18 kernel
When compiling against the 2.6.18 kernel headers, during linking of
the NPTL library it runs into a "undefined reference to PRIVATE_FUTEX"
error in pthread_cond_timedwait.S. This resolves the problem by
ensuring that the definition for PRIVATE_FUTEX is made available to
pthread_cond_timedwait.S.

Signed-off-by: Dan Moulding <dan.moulding@rackwareinc.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-06-12 17:01:31 +02:00
Will Newton
2d5f1c499f arm/clone.S: Add missing IT instruction for Thumb2.
The conditional load needs to be made part of an IT block on Thumb2
cores.

Signed-off-by: Will Newton <will.newton@linaro.org>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-06-12 16:44:39 +02:00
Bernhard Reutner-Fischer
536a0e3a05 buildsys: Do not install atomic.h
Gregory Fong noted that we'd better not install atomic.h

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-06-12 16:28:33 +02:00
Michel Stam
064d18b8e5 resolv: try next server on SERVFAIL
Commit e1420eca7374cd8f583e9d774c890645a205aaee fixed a bug where a
response code should mean the next server is tried. However, it tries
only the next search domain, and never skips to the next server. This
fix makes sure we try the next server on SERVFAIL.

Signed-off-by: Michel Stam <michel@reverze.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-04-23 15:36:49 +02:00
Gregory Fong
3a3b2e42e5 test/math: Adjust arm tests for older ULPs format
The ULPs format in glibc has changed slightly and now deviates from
that in uClibc, so when using the files directly from glibc, for
certain types of tests the ULPs values were incorrectly defaulting to
0 rather than using the values provided.  This caused some tests to
fail despite the max ULPs being correctly marked.

Regenerated and updated part of the ULPs file to fix this issue.  This
also added values for exp and log.

Signed-off-by: Gregory Fong <gregory.0xf0@gmail.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-04-23 13:40:50 +02:00
Gregory Fong
161d78ab0e ldso: Add remaining relocation types to the table
The table format is thrown off a bit because some of these names are
too long to fit the previous format so they were put on their own
lines.

Signed-off-by: Gregory Fong <gregory.0xf0@gmail.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-04-23 13:40:50 +02:00
Gregory Fong
6bf9a080b0 ldso/mips: Remove redundant LD_DEBUG prints
These should have been protected by

  if (_dl_debug_reloc && _dl_debug_detail)

, but since the previous change "ldso/mips: actually print results of
each relocation" makes this redundant, just eliminate these prints
instead.  I think this is the only item that is still printing
regardless of the value of LD_DEBUG when uClibc is built with
SUPPORT_LD_DEBUG=y.

Signed-off-by: Gregory Fong <gregory.0xf0@gmail.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-04-23 13:40:50 +02:00
Gregory Fong
33a59d1c1b ldso/mips: actually print results of each relocation
The patched line was outside of the body of the loop over relocations
and so would only print the results of the last relocation, fix that.

Signed-off-by: Gregory Fong <gregory.0xf0@gmail.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-04-23 13:40:50 +02:00
Bernhard Reutner-Fischer
75cc39f89b ldso: Fix misplaced declaration
Apparently i made a typo when applying
278a06d7abcc8774ba9bb9c15779749c7e2d68cd
sorry..

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-04-23 13:33:23 +02:00
Vineet Gupta
00f425b39b weak symbols need to be "defined" weak but "declared" strong
Patch "LT.old: Make __errno_location/__h_errno_location thread safe"
uncovered yet another bug with static linking and errno (hopefully this
is last of them all).

Currently, __errno_location is declared weak but is defined strong.
While this provides with the desired weak semantics in dso, it
is subtly broken in static links.

Quoting Joern Rennecke (ARC gcc expert):

| I think the issue is that you declare the function as weak in the
| header file.  That is a rare instance where you want the reference
| use declaration that differs a bit from the definition.
| If the reference uses a weakly declared function, that creates a
| weakref, i.e. the linker won't bother to look for this symbol at
|  all - if it gets linked in for some other reason, fine,
| otherwise, it stays zero.

So the solution to declare strong, define weak.

Supporting data
-----------------
orig code: ARM mmap wrapper (LT.old build + my prev patch for errno)

_mmap:
    @ args = 8, pretend = 0, frame = 0
    @ frame_needed = 0, uses_anonymous_args = 0
    stmfd    sp!, {r4, r5, r7, lr}
    ldr    r5, [sp, #20]
    movs    ip, r5, asl #20
    beq    .L2
    bl    __errno_location(PLT)
    mov    r3, #22
    str    r3, [r0, #0]
    mvn    r0, #0
...
...
   .weak	__errno_location

A statically linked hello world program which uses mmap too.
As we can see__errno_location is completely gone - which is
semantically wrong - we need functional errno.

00008274 <__GI_mmap>:
    8274:    e92d40b0     push    {r4, r5, r7, lr}
    8278:    e59d5014     ldr    r5, [sp, #20]
    827c:    e1b0ca05     lsls    ip, r5, #20
    8280:    0a000004     beq    8298
    8284:    e320f000     nop    {0}
		          ^^^^^^^^^^
    8288:    e3a03016     mov    r3, #22
    828c:    e5803000     str    r3, [r0]
    8290:    e3e00000     mvn    r0, #0

This in turn is due to a fixup in ARM ld which transforms branch-to-null
into a nop. It is better than crashing but still wrong since errno
handling is removed.

With the patch, errno_location is restored back in test program.

00008274 <__GI_mmap>:
    8274:	e92d40b0 	push	{r4, r5, r7, lr}
    8278:	e59d5014 	ldr	r5, [sp, #20]
    827c:	e1b0ca05 	lsls	ip, r5, #20
    8280:	0a000004 	beq	8298 <__GI_mmap+0x24>
    8284:	eb000010 	bl	82cc <__errno_location>
    8288:	e3a03016 	mov	r3, #22
    828c:	e5803000 	str	r3, [r0]

Cc: Christian Ruppert <christian.ruppert@abilis.com>
CC: Francois Bedard <Francois.Bedard@synopsys.com>
Cc: Anton Kolesov <Anton.Kolesov@synopsys.com>
Cc: Joern Rennecke  <joern.rennecke@embecosm.com>
Cc: Jeremy Bennett <jeremy.bennett@embecosm.com>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Peter Korsgaard <peter@korsgaard.com>
Cc: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-04-23 13:21:23 +02:00
Vineet Gupta
8f550715c2 LT.old: Make __errno_location/__h_errno_location thread safe
WHY: errno in uClibc is not thread safe

HOW: __errno_location and it's sibling __h_errno_location need to be called
     via PLT - even from within libc. That way when linked with pthread,
     intra-uClibc callers will also use the thread safe version.

     This is achieved by removing the GI alias for these functions,
     ensuring that they get called normally (via PLT)

Verified with ARC LT.old and ARM cubieboard2 buildroot (LT.old)
NPTL is unaffected by this bug.

------------ History behind this patch ---------------------

This is a long standing bug (https://bugs.busybox.net/show_bug.cgi?id=2089)

Others have tried to fix it in past (alteast Peter Korsgaard's patch in 2010),
but somehow failed to be merged (or were backed out afterwards).
http://lists.uclibc.org/pipermail/uclibc/2010-July/044176.html

One of the causes could be side effect of atleast one more bug related to
pthreads and static link which has now been fixed.
http://lists.uclibc.org/pipermail/uclibc/2013-October/047958.html

I have solved this w/o looking at other pacthes but would like to give
credit to Peter and others for confirming that it makes sense.

Cc: Christian Ruppert <christian.ruppert@abilis.com>
CC: Francois Bedard <Francois.Bedard@synopsys.com>
Cc: Joern Rennecke  <joern.rennecke@embecosm.com>
Cc: Jeremy Bennett <jeremy.bennett@embecosm.com>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Peter Korsgaard <peter@korsgaard.com>
Cc: Khem Raj <raj.khem@gmail.com>
Cc: buildroot@busybox.net
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-04-23 13:21:03 +02:00
Bernhard Reutner-Fischer
5799194b75 ctype.h: Tweak comment
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-04-09 00:18:07 +02:00
Cédric VINCENT
278a06d7ab ldso: fix standalone execution on x86_64 architecture
If the dynamic linker is built with LDSO_STANDALONE_SUPPORT=y, it can
load then run a dynamically linked program when explicitly invoked
from the command line.  This is used for test and prelink purposes,
and also by other tools like PRoot to force the kernel to load the
right ELF interpreter.

This feature is currently broken on x86_64 since the number of command
line arguments (ie. argc) passed from the kernel is an "elf_addr_t"
(64 bit on x86_64), whereas it is read as an "unsigned int" (32 bit on
x86_64).

Ref: https://github.com/cedric-vincent/PRoot/issues/45
Signed-off-by: Cédric VINCENT <cedric.vincent@st.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-04-08 15:19:48 +02:00
Gregory Fong
9902a14bea test/math: add libm-test-ulps-{arm,mips32,mips64} files
Adds the mips and arm test ULPs from glibc.

Signed-off-by: Gregory Fong <gregory.0xf0@gmail.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-04-06 01:23:52 +02:00
Gregory Fong
b281287719 test/math: don't try to build test dep as test
libm-test.c is a generated file needed by the other math tests, but
test rules were trying to build it as a test if trying to compile the
tests a second time.

Signed-off-by: Gregory Fong <gregory.0xf0@gmail.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-04-04 16:13:16 +02:00
Gregory Fong
8589144721 test/math: Select correct ULPs for mips32/mips64
Using TARGET_ARCH isn't sufficient when ISA can differ.

Signed-off-by: Gregory Fong <gregory.0xf0@gmail.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-04-04 16:07:51 +02:00
Bernhard Reutner-Fischer
e8e3a0a833 sysinfo.h: Prevent redeclarations
Guard against duplicate inclusion.
We should go back to just including the linux/sysinfo.h ..

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-04-04 14:05:44 +02:00
Bernhard Reutner-Fischer
64a2e37a0e libc: Fix buglet around __progname
508b20ead1710e8c295630d096960e51a65b7e5d disentangled
program_invocation_name and __progname but forgot to make __progname
conditional on __UCLIBC_HAS___PROGNAME__, resulting in getconf
attempting to re-define __progname in case __UCLIBC_HAS___PROGNAME__ was
not defined.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-04-02 21:42:42 +02:00
Bernhard Reutner-Fischer
988d78ad25 test: Reuse PTINC in nptl tests
Use toplevel Rules.mak notion of PTINC as list of includes to use for
the testcases.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-04-02 15:22:43 +02:00
Steve Ellcey
ffffd5e2c2 Fix warnings in MIPS build
This patch fixes the rest of the set-but-not-used warnings in the MIPS
code by using attribute_unused and also fixes some conversion warnings
by changing __arch_compare_and_exchange_xxx_[8|16]_int.  Assigning __cmp
(int type) to __prev (pointer type) generates a warning.  Assigning zero
to each separately avoids this warning without having to add a cast.

Signed-off-by: Steve Ellcey <sellcey@mips.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-04-01 13:36:32 +02:00
Max Filippov
d4ea30a415 xtensa: add missing .literal_position directives
This addition allows building uClibc with -mtext-section-literals

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-04-01 11:59:44 +02:00
Vineet Gupta
00b07e8ca5 ARC: Make vfork weak in libc
Anton reported:

------------------->8---------------------
Package iperf cannot be built in Buildroot due to following error:

/home/akolesov/env/autobuild/tmp/host/usr/bin/arc-buildroot-linux-uclibc-g++
-Wall -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
-pipe -Os    --static -o iperf -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
-D_FILE_OFFSET_BITS=64  -pipe -Os   -pthread  -DHAVE_CONFIG_H Client.o
Extractor.o Launch.o List.o Listener.o Locale.o PerfSocket.o ReportCSV.o
ReportDefault.o Reporter.o Server.o Settings.o SocketAddr.o gnu_getopt.o
gnu_getopt_long.o main.o service.o sockets.o stdio.o tcp_window_size.o
../compat/libcompat.a
/home/akolesov/env/autobuild/tmp/host/usr/arc-buildroot-linux-uclibc/sysroot/usr/lib/libc.a(vfork.os):
In function `vfork':
(.text+0x0): multiple definition of `vfork'
/home/akolesov/env/autobuild/tmp/host/usr/arc-buildroot-linux-uclibc/sysroot/usr/lib/libpthread.a(ptfork.os):ptfork.c:(.text+0xc0):
first defined here
collect2: error: ld returned 1 exit status
------------------->8---------------------

Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Cc: Anton Kolesov <Anton.Kolesov@synopsys.com>
Cc: Francois Bedard <Francois.Bedard@synopsys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-04-01 11:36:17 +02:00
Steve Ellcey
5eddde8f09 libc: fix mips N64 pread/pwrite build
Uclibc is not building for MIPS N64 because pread is trying to use the
pread/pwrite system calls instead of pread64/pwrite64.  This patch fixes
the problem and was tested with LFS enabled and disabled.

Signed-off-by: Steve Ellcey <sellcey@mips.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-03-12 21:00:24 +01:00
Bernhard Reutner-Fischer
a20a91ad7c test: Fix math .c dependency
When explicitly running the compile target we were missing a dependency
to generate the libm-test.c.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-02-18 23:30:28 +01:00
Bernhard Reutner-Fischer
19f21a1d97 buildsys: pass correct linker to compiler driver
Testing linker features has to be done against the correct linker.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-02-15 22:39:34 +01:00
Steve Ellcey
79c0857a82 buildsys: Add MIPS64R2 support
There is support for mips64(r1) already in uclibc, this change adds mips64r2
by adding the MIPS64R2 config variable and checking it in Rules.mak.

Signed-off-by: Steve Ellcey <sellcey@mips.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-02-15 11:09:53 +01:00
Steve Ellcey
e5cde2eb0e mips: Remove duplicate macro definitions
The INLINE_SYSCALL, INTERNAL_SYSCALL*, and internal_syscall* macros
are defined for MIPS in both libc/sysdeps/linux/mips/sysdep.h and
libc/sysdeps/linux/mips/bits/syscalls.h.  The macros are the same
in both cases except that syscalls.h defines internal_syscalls[567]
the same for N32 and N64 ABIs and has a different definition for O32.
I believe that is correct.  The sysdep.h header uses the O32 versions
for N32 and has different definitions for N64.  I think that is wrong
and that N32 and N64 should share the same definition (modulo the
type 'long' vs. 'long long' for the arguments.  This setup (from
sysdep.h) now agrees with what glibc has.

I am not positive about which header (sysdep.h vs syscalls.h) is
really the right one to have these definitions in but using sysdep.h
seems to work for all my builds.

Signed-off-by: Steve Ellcey <sellcey@mips.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-02-15 11:09:26 +01:00
Steve Ellcey
4721ac5f83 libc: Fix sync_file_range.c for MIPS64 N32 ABI
The special sync_file_range handling is only needed for the O32 ABI
(regardless of whether it is on mips32 or mips64).  The N32 (and N64)
ABI's should both use the standard code.  This routine was using the
special code for the N32 ABI because that ABI has a word size of 32 bits
and that is wrong.  This patch fixes it by checking the ABI used instead
of checking the word size.

Signed-off-by: Steve Ellcey <sellcey@mips.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-02-15 11:09:00 +01:00
Vineet Gupta
7b797aa69e test/tls/tst-tls[6-8]: Fix build errors
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-02-15 11:06:57 +01:00
Bernhard Reutner-Fischer
daec167746 libc: silence warning in fts
cderrno is dead code, comment it out.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-02-15 10:32:28 +01:00
Waldemar Brodkorb
70a04a287a libc: mips: Fix setjmp/longjmp for MIPS64 N64 ABI
When booting a Linux system with qemu-system-mips64 the execution
of $(pwd) in the ash shell triggers a segmentation fault. Ash uses
setjmp/longjmp for exception handling.

After looking at the glibc implementation,
I found some differences, with this patch tries to resolve.
Now the system boots up fine and no segmentation faults occur.

The global pointer should be restored and the types for the
register values should be wide enough.

See:
http://www.cygwin.com/ml/libc-alpha/2003-03/msg00363.html

Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-02-02 21:35:50 +01:00
Steve Ellcey
d31846a1b9 mips: silence 'set but not used' warnings
This patch uses 'attribute_unused' to clean up a number of warnings
messages that are generated when doing a MIPS build.  All of the
changes are in MIPS specific files and there are no code changes
other then adding the unused attribute where needed.

Signed-off-by: Steve Ellcey <sellcey@mips.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-02-02 21:35:24 +01:00
Steve Ellcey
0f363664b5 libc: mips: Fix non-LFS build
The MIPS build is failing when UCLIBC_HAS_LFS is set to "n"
because posix_fadvise64.c is included in the build when it
should not be.

Signed-off-by: Steve Ellcey <sellcey@mips.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-02-02 21:34:57 +01:00
Bernhard Reutner-Fischer
79ce7d7f6f mips: silence _ABI* undef warnings
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-01-24 16:20:57 +01:00
Bernhard Reutner-Fischer
448909e2b0 powerpc: syscall support up to 6 arguments
As reported by Kristof Provost.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-01-22 23:10:15 +01:00
Stefan Kristiansson
f9ea885024 vfork: fix clone based version
The clone based version was introduced by commit

58570fc8e1fd601f15be5758ab95013d56771804
vfork: Use clone if arch does not have the vfork syscall

but the code was made unreachable by the previous commit

0a043c30ee71245dfe7c9d82d654312c5e1f6127
vfork: make all archs consistent

that adds a guard which require either __NR_vfork or __NR_fork
to be set.
Neither will be set on an arch that would need to use the
clone based version.

The double declaration of vfork was also introduced by
the merge of the two above mentioned patches.
The missing ; was present in the original patch.

CC: Markos Chandras <markos.chandras@imgtec.com>
CC: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
CC: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-01-22 22:55:25 +01:00
Waldemar Brodkorb
a7e8c6aa9b libc: fix MIPS N64 fork
fork() is broken for MIPS64 N64 ABI. You can check it with a simple
C program statically linked with qemu-mips64 user emulation.
Internally fork() is using the clone system call (at least with NPTL)
with 5 arguments. See ./libpthread/nptl/sysdeps/unix/sysv/linux/i386/fork.c.
The calling conventions for MIPS N32 and N64 allow to use up to 8 registers
for that. See http://en.wikipedia.org/wiki/Calling_convention#MIPS
This is correctly implemented in libc/sysdeps/linux/mips/bits/syscalls.h,
but not in libc/sysdeps/linux/mips/sysdep.h. fork.c uses the later one.
It seems that fork() works fine for MIPS64 N32 with just using the stack like
with the O32 case. There is a user of INLINE_SYSCALL with 7 arguments in
libc/sysdeps/linux/common/sync_file_range.c for MIPS64 N32, so I decided to
only use the macros for the MIPS64 N64 case. With this patch my uClibc based
Linux system boots up fine in qemu-system-mips64.

Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-01-22 21:04:39 +01:00
Bernhard Reutner-Fischer
09055cc185 nptl: Fix arm pt-vfork
We were ending up with an unrecognised CPP token (which is not diagnosed
for assembler-with-cpp, 59805)

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-01-15 10:03:53 +01:00
Bernhard Reutner-Fischer
f7db1709ab libc: add guard for arm thumb2 asm
Fixes gen_lowlevelrobustlock on thumb2

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-01-15 10:01:25 +01:00
Bernhard Reutner-Fischer
e11ff4a4a0 ldso: arm, metag: Use runtime pagesize
Use the generic runtime pagesize as per
ce54b92b046b65464e2d16b3842f3e97e3e0f27e

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-01-15 09:59:21 +01:00
Bernhard Reutner-Fischer
bc0af6cbd3 buildsys: metag: Remove inappropriate comment
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-01-14 13:42:28 +01:00
Vineet Gupta
7bf35c8b7d ARC: opencode ENTRY/END macros in crt1
crt1.S -> include sysdep.h -> include sysnum.h

In multistage gcc build, Buildroot happens to build crt1.S before
sysnum.h is generated. So break the above include chain and opencode the
ENTRY/END macros.

Reported-by: Anton Kolesov <akolesov@synopsys.com>
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-01-08 12:34:36 +01:00
Vineet Gupta
3580da1fe7 buildsys: store savedefconfig to defconfig file
It now generated a file name defconfig in current directory

Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-01-08 12:34:36 +01:00
Baruch Siach
de6561f666 xtensa: use common ptrace.h
Adds support for architecture independent actions.

Cc: Chris Zankel <chris@zankel.net>
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-01-08 12:34:31 +01:00
Baruch Siach
00571b43df libc: posix_fadvise: restore implementation for xtensa
Commit ee84b8b400 (linux: posix_fadvise: use new SYSCALL_ALIGN_64BIT)
removed posix_fadvise implementation for xtensa, since xtensa does not
define __NR_fadvise64. Reuse the ARM support code to restore xtensa support.

This commit is based Mike Frysinger's suggested patch.

Cc: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-01-08 12:34:31 +01:00
Vicente Olivert Riera
b97b4b698b siginfo.h: __SIGEV_PAD_SIZE takes __WORDSIZE into account
Make __SIGEV_PAD_SIZE to take __WORDSIZE into account for alpha, mips
and ia64 arches.

Signed-off-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-01-08 12:34:06 +01:00
Vicente Olivert Riera
b4e6e61e2f siginfo.h: add a missing function member on ia64, mips and sparc arches
Add "__pid_t _tid" member which is used for some packages, like rt-test
for instance, which fails with an error like this one:

src/cyclictest/cyclictest.c:638:9: error: 'union <anonymous>' has no
member named '_tid'

Signed-off-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-01-08 12:34:06 +01:00
Bernhard Reutner-Fischer
7feb0934e2 buildsys: update unifdef
sync up to 1542ea42da59018860a987f34f065cd120982e8c
(2.10 + cleaner exit status handling)

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-01-08 10:49:09 +01:00
Bernhard Reutner-Fischer
08e9f6f368 buildsys: fixup unifdef state in skiphash, linenum
amend to fixup line-numbering in the unifdefile

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-01-07 19:47:31 +01:00
Bernhard Reutner-Fischer
c71f8bc18e buildsys: fixup unifdef state in skiphash
attempt to fix unifdef swallowing -f defundefile lines

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-01-07 17:17:52 +01:00
Vineet Gupta
c7c5cfdbe8 elf: Add ARC Magic and Relocations
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-12-23 12:58:46 +01:00
Bernhard Reutner-Fischer
1cf1b61178 ldso: ARC: tweak whitespace some more
Use spaces instead of tabs in the table to accomodate different tab
settings.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-12-20 16:27:43 +01:00
Vineet Gupta
35556e0803 ldso: ARC whitespace tweaks
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-12-20 16:26:35 +01:00
Kenneth Soerensen
1c8d287e58 inet: Fix threaded res_init
In a multi-threaded application where res_init() was called either
directly or implicitly, getaddrinfo() and others failed to add the
DNS search domain to hostnames.

This problem made it not possible to look up a hostname without its
domain appended.

The problem is caused by res_sync_func() overwriting the configuration
read by __open_nameservers() immediately after it is read.

The suggested solutin is to disable res_sync_func() while reading name
server configuration in res_init().

Signed-off-by: Kenneth Soerensen <kenneth.sorensen@spectralink.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-12-20 15:53:01 +01:00
Baruch Siach
294079b3fd librt: fix mq_timed{send,receive} return instructions
Not all architectures use 'ret' as function return instruction. For example,
xtensa usually uses 'retw'. Use the ret_ERRVAL arch dependant macro instead.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-12-20 15:46:49 +01:00
Baruch Siach
bda630857e libc/sysdeps: commonize ret_ERRVAL
* Add a common ret_ERRVAL definition

* Remove ret_ERRVAL from architectures using the common 'ret'

* Add 'undef' to architectures that need a different return instruction

* Add '#include <common/sysdep.h>' to cris and ia64 that were missing it

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-12-20 15:46:49 +01:00
Vineet Gupta
7c1650f011 ARC defconfigs
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-12-20 14:38:23 +01:00
Vineet Gupta
917b9eebbc ARC port to uClibc
For this port, I would like to give due credit to:

- Folks from Codito technologies (Sameer, Amit, Kanika, Ramana,...)
   who did the very first port

- ARC UK from 2007-2009 (Joern, Irfan, Khurram, Phil...

- Late Brendan Kehoe (may he RIP)

Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-12-20 14:38:23 +01:00
Joern Rennecke
1ce639990b string: Add ARC support
Signed-off-by: Joern Rennecke <joern.rennecke@embecosm.com>
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-12-20 14:38:23 +01:00
Vineet Gupta
374db5d174 LT.old: Add ARC support
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-12-20 14:38:23 +01:00
Vineet Gupta
706d131f72 ldso: Add ARC support
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-12-20 14:38:23 +01:00
Vineet Gupta
4990404906 ldd: Add ARC support
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-12-20 14:38:23 +01:00
Waldemar Brodkorb
052bcf13af Fix for SIGBUS error on MIPS64 with N64 ABI
When accessing errno, a per thread variable, from _stdio_init
a SIGBUS error happens. This change fixes the wrong relocation
and debug output.

Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-12-20 14:11:36 +01:00
Bernhard Reutner-Fischer
7bec7d6325 NPTL: fork: relief register pressure on arm thumb1
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-12-20 14:08:04 +01:00
Bernhard Reutner-Fischer
f0ab57ca00 ldso: use unlikely macro
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-12-20 14:00:26 +01:00
Bernhard Reutner-Fischer
0096e0dff7 buildsys: Fix error on config clean in realclean
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-12-20 13:59:03 +01:00
Bernhard Reutner-Fischer
b45cffc3ca buildsys: add TODO reminder
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-12-20 13:21:20 +01:00
Bernhard Reutner-Fischer
2a021ae81c buildsys: update unifdef
sync up to 55501a61dd257e941d53f175350ee52fc6ff2866
(2.9 + refactor keyword and symbol matching)

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-11-19 12:43:49 +01:00
Bernhard Reutner-Fischer
32ef09dd30 buildsys: check LDFLAGS through driver
We run the linker through the compiler-driver, so we have to check
linker flags through the driver, too.
Otherwise we might check $LD's flags while we will run $CC's linker
and those might be different beasts.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-11-13 12:31:00 +01:00
Bernhard Reutner-Fischer
ea269ccbb2 ldso: silence warnings in debug code
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-11-12 17:29:48 +01:00
Kenneth Soerensen
ecc7aee9a0 Make res_init() thread safe.
res_init() was not atomic, which could give undesired behaviour. Now
res_init() is completely locked under one lock and the locking is
removed from __res_vinit().

Signed-off-by: Kenneth Soerensen <kenneth.sorensen@spectralink.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-11-12 16:12:32 +01:00
Sørensen, Kenneth
20b69920b2 Fix threaded use of res_ functions.
Commit aab4df0fb51660300559f5f29290709db2f7bfee says that the line with
after res_init() function. Commit
7f74de5d4d6d10baafab4b37bb3d472f5c5f0e8c moves the res_init()
function below the line with #undef _res.

This commit moves res_init() back above #undef _res.

Signed-off-by: Kenneth Soerensen <kenneth.sorensen@spectralink.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-11-12 15:44:08 +01:00
Bernhard Reutner-Fischer
648e744e3d buildsys: document savedefconfig in help
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-11-11 11:18:30 +01:00
Bernhard Reutner-Fischer
6967a690f9 buildsys: on realclean, rm include/{config,generated}
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-11-11 11:15:17 +01:00
Bernhard Reutner-Fischer
0e03ac5a6c buildsys: rm PT startfiles on realclean
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-11-06 22:22:00 +01:00
Bernhard Reutner-Fischer
f6f4732411 time.c: make ll_tzname* static again
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-11-06 22:22:00 +01:00
Baruch Siach
3a3ad3dfc1 prctl: fix system call wrapper
The argument names used in the prctl wrapper collide with the internal
variable names in syscall wrapper macros on some architecture. This
currently breaks xtensa. grep for '\b_a[0-9]' indicates that metag and
microblaze might also be affected.

Prefix argument names with '_prctl' to avoid collision.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-11-06 22:22:00 +01:00
Baruch Siach
931e839156 test: tls: fix build with newer binutils
Fix the following build failures:

ld: tst-tls10.o: undefined reference to symbol 'f2a'
ld: tst-tls12.o: undefined reference to symbol 'a1'

binutils ld defaults to --no-copy-dt-needed-entries since version 2.22. Add
library dependencies explicitly.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-11-06 22:22:00 +01:00
Baruch Siach
83a9e1f89b ldso: remove duplicate function declarations
Commit e3dec33ba (powerpc: Add TLS and NPTL support) introduced a duplicate of
_dl_add_to_slotinfo and _dl_initial_error_catch_tsd declarations.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-11-06 22:22:00 +01:00
Baruch Siach
f33b9d2538 test: inet: fix build when res_close support is disabled
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-11-06 22:22:00 +01:00
Baruch Siach
54979ed770 libdl: fix unused variable warning
The following warning introduced with commit 231e4a9b4 (libdl: fix dlopen
implementation from statically linked application):

ldso/libdl/libdl.c: In function 'do_dlopen':
ldso/libdl/libdl.c:311:23: warning: unused variable 'ls' [-Wunused-variable]

Cc: Filippo Arcidiacono <filippo.arcidiacono@st.com>
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-11-06 22:21:59 +01:00
Baruch Siach
ca609fafba misc: fix nm 'No such file' error
Reset CSRC-y to prevent pollution from libc/misc/glob/Makefile.in, and fix the
following error messages when UCLIBC_HAS_OBSTACK is disabled:

nm: 'libc/misc/gnu/glob-susv3.os': No such file
nm: 'libc/misc/gnu/glob64-susv3.os': No such file

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-11-06 22:21:59 +01:00
Baruch Siach
7a3d6cfb4a ldso: fix unused variable warning
This fixes the following warning when SUPPORT_LD_DEBUG_EARLY is not enabled:

ldso/ldso/ldso.c: In function '_dl_get_ready_to_run':
ldso/ldso/ldso.c:754:16: warning: unused variable 'tmp' [-Wunused-variable]

This was introduced with commit 94cc6edb (ldso: Rework global scope handling
and symbol lookup mechanism).

Cc: Filippo Arcidiacono <filippo.arcidiacono@st.com>
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-11-06 22:21:59 +01:00
Khem Raj
3475673138 add posix_fadvise() for arm
arm call to posix_fadvise simply calls posix_fadvise64

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-11-06 22:21:59 +01:00
Markos Chandras
620908d8e5 libc/metag: add __kernel_long_t and __kernel_ulong_t
Add __kernel_long_t and __kernel_ulong_t types for Meta. The rest of
the architectures have been fixed in:

6a76edddaa62ff06f178143b582167734cb55c18
"libc/sysdeps: add __kernel_long and __kernel_ulong"

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-11-06 22:21:59 +01:00
Bernhard Reutner-Fischer
e286a67441 pull kconfig from linux-3.11
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-11-06 22:21:59 +01:00
Vineet Gupta
acfc107a50 Fix weak/strong attribute of __errno_location and it's __GI alias
A simple statically linked hello world program was segfaulting for ARC
in linuxthreads.old configuration (although the root casue applies
cross-arch for NPTL as well as linuxthreads.old as described)

The crash was due to branch to NULL in _stdio_init

  0001026c <_stdio_init>:
     1026c:    push_s     blink
     1026e:    st.a       r13,[sp,-8]
     10272:    bl.d       0  --> supposed call to __errno_location

The call was NOT getting patched to libc internal only alias
__GI___errno_location, because it was weak while it's exported cousin,
__errno_location was strong/normal.

  arc-linux-uclibc-nm libc/misc/internals/__errno_location.os

  00000000 W __GI___errno_location
  00000000 T __errno_location

This is exactly opposite to what is expected.

Quoting Peter S. Mazinger, commit 87936cd013041 "errno and *_init cleanup"

 | The rule adopted:
 | for enabled threads we make in libc the __GI_x() variants strong, x() weak
 | and (should) provide another strong x() in libpthread.
 | If threads are disabled, even the __GI_x() variants are weak.

With the fix, we see the right settings as below

  00000000 T __GI___errno_location
  00000000 W __errno_location

Note that problem won't show up in a static busybox build as it references
errno and that seems to elide the issue.

I can confirm the same/more issues with latest ARM buildroot builds w/o
my fix.

(1). linuxthreads.old (broken just like ARC)

  arm-linux-nm uclibc-snapshot/libc/misc/internals/__errno_location.os

  00000000 W __GI___errno_location
  00000000 T __errno_location

  But presumably the issue there is NOT catestrophic because ARM linker is
  likely smarter and patches a NOP instead of NULL branch.

  00008388 <_stdio_init>:
      8388:	e92d4038 	push	{r3, r4, r5, lr}
      838c:	e320f000 	nop	{0}

(2) NPTL build (exported version is not weak)

  00000000 T __GI___errno_location
  00000000 T __errno_location

  This causes a static link with libpthread and test program
  referencing errno to fail to link.

  #include <errno.h>
  int main(void)
  {
      printf("%d\n", errno);
  }

  arm-linux-gcc -static -pthread -o tst tst.o

  arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/libc.a(__errno_location.os):
  In function `__errno_location':  __errno_location.c:(.text+0x0):
                           multiple definition of `__errno_location'
  arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/libpthread.a
            (errno_location.os):errno_location.c:(.text+0x0): first defined here

Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Cc: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-11-06 22:21:59 +01:00
Baruch Siach
a20d9fe539 xtensa: fix atomic_decrement_if_positive() return value
atomic_decrement_if_positive() returns the old value of &mem, not the
(sometimes undefined) value of __tmp.

Fixes the uClibc nptl/tst-sem3 test.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Chris Zankel <chris@zankel.net>
2013-11-04 15:01:39 -08:00
Baruch Siach
caee562063 xtensa: fix layout of struct sigcontext to match the kernel
Current code breaks libgcc unwind.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Chris Zankel <chris@zankel.net>
2013-11-04 15:01:11 -08:00
Denys Vlasenko
c533aca08e pmap_getport: use TCP to talk to portmapper if protocol == IPPROTO_TCP.
Before the patch, the query itself was sent via UDP
(the query contained correct protocol ID).

The fix is taken from glibc.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-10-07 16:46:11 +02:00
Anthony G. Basile
f22cca4722 libc: add isfdtype()
isfdtype(int fd, int fdtype) check whether a file descriptor fd is
of type fdtype, where the types are defined in stat(2).  It is
supported in glibc and BSD, and used by utilities such as acpid.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-08-02 14:04:17 +02:00
Baruch Siach
f2a8f24fba malloc: enable assert() when malloc debugging
UCLIBC_MALLOC_DEBUGGING is useless without assert().

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-08-02 14:04:17 +02:00
Mischa Jonker
cee1028b64 libc/sysdeps: Fix common-generic stat.h for BE part 2
Previous patch only fixed the build. This patch fixes the behavior at
run-time as well.

It fixes "Value too large for defined data type" messages caused by
fstat syscall wrapper returning -EOVERFLOW.

Signed-off-by: Mischa Jonker <Mischa.Jonker@synopsys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-07-26 09:45:34 +02:00
Gustavo Zacarias
7e509aae23 Rules.mak: Fix setting arch native bit
fix breakage from 603af30d

Removing the whitespace from findstring for 64 bit architectures has
bad consequences since powerpc would be a match in powerpc64 and sparc
would also be a match in sparc64.
That doesn't make them 64 bits in reality causing general breakage.

Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
Reviewed-by: Markos Chandras <markos.chandras@imgtec.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-07-26 09:25:33 +02:00
Bernhard Reutner-Fischer
8a3747a9d8 test commit
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-07-19 20:53:57 +02:00
Vanya Sergeev
6e16f1768d inet: fix unsafe access to _res.options in res_mkquery()
res_mkquery() takes out __resolv_lock to copy _res.options to function local
_res_options on line 4204, but later unsafely accesses _res.options without a
lock, instead of its local copy _res_options, on line 4221.  Looks like a
period / underscore typo.

Signed-off-by: Vanya Sergeev <vsergeev@gmail.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-07-19 17:35:56 +02:00
Markos Chandras
603af30d69 Rules.mak: MIPS64: Select correct interpreter
gcc (eg 4.7.3) hardcodes the MIPS64 interpreters like this:
(see gcc/config/linux.h and gcc/config/mips/linux64.h)

o32: UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
n32: UCLIBC_DYNAMIC_LINKERN32 "/lib32/ld-uClibc.so.0"
n64: UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"

The existing check for MIPS64 in uClibc is wrong because it does
not respect the selected ABI

We fix this by explicitely checking the selected ABI instead of the
selected MIPS variant.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Cc: Anthony G. Basile <blueness@gentoo.org>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-07-19 17:35:00 +02:00
Denys Vlasenko
4a96b94868 bits/waitstatus.h: correctly interpret status 0x007f on MIPS
On other architectures exit status of 0x007f is not possible,
they don't have signal 127.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-07-18 21:57:06 +02:00
Luis Machado
0551bbbbe5 C6X: Remove DSBT in favour of FDPIC
Sync up with the changes from C6X entering the kernel.

Signed-off-by: Luis Machado <lgustavo@codesourcery.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-07-04 11:52:52 +02:00
Anthony G. Basile
905775f198 libc/sysdeps/linux/common/sendfile.c: fix sendfile64 visibility
Commit a83ea57a50 introduces code for falling back on sendfile64
when the sendfile syscall is not available.  However, as written,
that code leads to sendfile64 being globally hidden in situations
where __NR_sendfile and __USE_LARGEFILE64 are defined.  In this case,
the flow executes strong_alias_untyped(sendfile,sendfile64) in
libc/sysdeps/linux/common/sendfile.c and libc_hidden_proto(sendfile64)
in include/sys/sendfile.h, but nowhere does it do libc_hidden_def(sendfile64).
This patch adds the needed libc_hidden_def(sendfile64).

This breaks, for example, xfsprogs on x86_64.  Reported by mardok4
in IRC.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-07-04 11:25:17 +02:00
Bartosz Golaszewski
f9ae36ebf1 insque: fix segfault on (prev == NULL)
Since version 2.5 glibc allows prev to be a NULL pointer in insque, whereas
uClibc segfaults in this case. This fixes the issue and makes insque
initialize q_forw and q_back with NULLs if prev == NULL.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-07-04 11:25:17 +02:00
Filippo ARCIDIACONO
23691332c8 libpthread: pthread_exit in static app. segfaults
Static applications that call pthread_exit on the main thread segfault.
This is because after a thread terminates __uClibc_main decrements
__nptl_nthreads which is only defined in pthread_create.
Therefore the right solution is to add a requirement to pthread_create
from pthread_exit.
This patch has been backported from glibc tree:
http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=e1f0b2cfa14b058ab033431b70428ccda8ec6ed0
For further detail see also glibc bug at:
http://sourceware.org/bugzilla/show_bug.cgi?id=12310

Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com>
Cc: Vladimir Nikulichev  <v.nikulichev@gmail.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-07-04 11:25:17 +02:00
Khem Raj
c2c684f881 i386/sysdep.h: Remove STABS_* macros
uclibc is compiled with elf/dwarf and secondly HAVE_CPP_ASM_DEBUGINFO
is not defined so we generate bogus .stab sections needlessly

Some of post processing tools get confused when they see both
dwarf and stab sections

Signed-off-by: Khem Raj <raj.khem@gmail.com>
2013-06-29 07:53:35 -07:00
Denys Vlasenko
2da958760f MIPS: set _NSIG to 128, not 129. This matches glibc.
Prompted by lkml discussion of a MIPS bug where sending
signal 128 was found to be able to crash the machine :/

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-06-28 21:59:54 +02:00
Bernhard Reutner-Fischer
736d9eee27 libc: Fix _obstack_newchunk public symbol vis
975bca165c3e10e74c05c0384fd58f45a7025a3c avoided relocations to
_obstack_newchunk used by obstack_vprintf but missed to enable the
corresponding public symbol which is used by the obstack macros.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-06-28 15:14:46 +02:00
Bernhard Reutner-Fischer
975bca165c libc: hide obstack relocations
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-06-14 14:27:06 +02:00
Anthony G. Basile
10d12e77d5 libc/misc/gnu/obprintf.c: implement obstack_printf and obstack_vprintf
This adds a straight forward implementation for obstack_printf and
obstack_vprintf on uClibc's already existing obstack_grow and
vasprintf.  It does not attempt to port over glibc's implementation
in terms of _IO_* structs and functions.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-06-14 10:44:08 +02:00
Anthony G. Basile
f143f92069 config: UCLIBC_HAS_OBSTACK to optionally enable obstack support
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-06-14 10:43:41 +02:00
Hiroaki KAWAI
fd355bc1db eventfd.h: Use new "bits/" scheme for arch-specific flags
As in timerfd.h, eventfd.h needs arch-specific definition files.
alpha, mips and sparc needs separate file, all the other arch
will use common definition.

This problem is already fixed in glibc.

Also sanitize and provide bits for hppa.
Make sure not to install the new bits/eventfd unless eventfd support is
enabled.

Signed-off-by: Hiroaki KAWAI <kawai@stratosphere.co.jp>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-06-07 13:53:13 +02:00
Gregory Fong
b57e9640db ldso/libdl: Also include dl-tls.h for for !SHARED.
On MIPS, several relocations that were original only resolved by the
dynamic linker were reused as static relocations.  Consequently the
macros TLS_DTPREL_VALUE and TLS_TPREL_VALUE defined in
libpthread/nptl/sysdeps/mips/dl-tls.h need to be available even for
!SHARED.

Relevant: http://www.linux-mips.org/wiki/NPTL#History

Original patch by Vincent Wen <wenvincent@gmail.com>:
http://lists.uclibc.org/pipermail/uclibc/2013-April/047707.html

When build statically linked applications for MIPS platform,
sometimes the linker fails with following errors:
undefined reference to TLS_DTPREL_VALUE
undefined reference to TLS_TPREL_VALUE
The include of dl-tls.h is only in code guarded by SHARED,
Removing the SHARED compilation option to cover static link too.

Signed-off-by: Vincent Wen <wenvincent90@gmail.com>

Signed-off-by: Gregory Fong <gregory.0xf0@gmail.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-06-07 12:44:59 +02:00
Vineet Gupta
588d35799a Reinstate hidden protos for config_{open,close,read}()
Partially reverts "parser_config.[ch]: remove duplicated hidden functions"

There's a namespace collision for config_{open,close,read} functions
between uClibc and Busybox. Callers in uClibc and busybox need to call
their local variants. In case of static linking, both the variants need
to be pulled in the final executable.

Turns out that the existing hidden attribute is not enough for static
linked Busybox where the linker treats these symbols as duplicate and
pulls in only the local (Busybox's own) variants in the final link.
This obviously causes the uClibc callers to crap out at runtime.

This can be fixed by restoring the libc_hidden_proto() annotation
which causes the libc variants to be aliased with __GI_ prefix thus
making both the symbols distinct from linker's perspective.

This issue was found with ARC gcc 4.8 + uClibc trunk.
I can confirm the same thing with ARM uClibc buildroot build (when
switching to uClibc daily snapshot).

All the credit for debugging the issue goes to Anton,Joern and Jeremy -
I simply found the cure :-)

Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Cc: Anton Kolesov <akolesov@synopsys.com>
Cc: Jeremy Bennett <jeremy.bennett@embecosm.com>
Cc: Joern Rennecke <joern.rennecke@embecosm.com>
Cc: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Cc: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-06-07 12:44:01 +02:00
Carmelo Amoroso
215c2868ac libc: elf: explicitly include uClibc_page.h to make PAGE_SIZE visible
Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2013-05-28 09:28:59 +02:00
Filippo Arcidiacono
e19afed1bd libubacktrace: fix build due to some typos
Commit 71c10c484e7dc113396cccb7e503befb759c6346 broke libubactrace build
due to some typos, so that backtrace.o[sS] were not built.
This definetively fixes this problem.

Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2013-05-28 09:26:10 +02:00
Mike Frysinger
54a97c4dc4 i386: punt all config options that just control -march
You can set these yourself in your CFLAGS, and our list is incomplete
and pointless (we agreed some time ago to stop doing this).

We keep around CONFIG_[3456]86 because it is used to select between
different optimized subdirs of handcoded assembly.

Also take this opportunity to up the default to i686.  If you're using
an older cpu, then you can handle changing this yourself.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2013-05-19 01:09:07 -04:00
Filippo Arcidiacono
71c10c484e libubacktrace: fix backtrace for statically linked application
libgcc_s.so's unwinder could not access unwind tables of statically
linked binaries, so we really want to use _Unwind_* stuff from
libgcc_eh.a.
It required to build backtrace.c differentiating between shared and
static case.

Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2013-05-13 10:11:50 +02:00
Filippo Arcidiacono
231e4a9b4b libdl: fix dlopen implementation from statically linked application
Calling dlopen from statically linked application is actually broken,
because _dl_find_hash enters into an infinite loop when trying to
resolve symbols. In this case it doesn't need to extend the global
scope, it is readyto be used as it is, because _dl_loaded_modules already points
to the dlopened library.

The patch also fixesi a typo in __LDSO_LD_LIBRARY_PATH__ macro, that was
preventing to get the actual value of the LD_LIBRARY_PATH.

Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2013-05-13 10:11:21 +02:00
Filippo ARCIDIACONO
f74663a2e6 libc: deal with aux vect inside __uClibc_main only if !SHARED
It's not safe to use the aux vect inside __uClibc_main if we are running
with shared libraries, because it could have been already modified.
For example, if some constructor plays with environment variables by
using unsetenv, the modifications done into the stack to unset an
environment variable, have impacts on the aux vect due to the extra NULL
entries added.
Due to this, __uClibc_main is not able to detect where the aux vect
starts, so all the entries that are used by __uClibc_main (AT_UID,
AT_EUID, AT_GID, AT_EGID, AT_PAGESZ and possibly other arch specific)
are impacted.

Same side effect on the aux vect is caused by the ld.so when running a
SUID program with some of the unsecure environment variables set, that
will be unset by the ld.so itself.

In order to fix this issue, it needs to handle aux vect entries into
__uClibc_main only if SHARED is not defined.
In SHARED case, libc refers to __dl_secure and _dl_pagesize as initialised
by the ld.so where the aux vext is still untouched.

Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com>
Reviewed-by: Carmelo Amoroso <carmelo.amoroso@st.com>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2013-05-13 10:08:11 +02:00
Mike Frysinger
458076d59e linux: pread/write: fix 64bit handling
The syscall on 64bit ports takes 4 args as there is no need to split
up the value into two args.  Add support for that to the common code.

Once we fix that, the mips code can now leverage it for its 64bit and
32bit needs.  However, we can't just drop it entirely yet because its
n32 ABI needs special handling to treat it like a 64bit port.  This
does change the existing behavior which treats the n32 like a 32bit
port, but we want to do this.

In the future, we'll probably have to introduce a define for this as
it currently affects x86_64/x32 and mips/n32.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2013-04-07 02:19:53 -04:00
Bernhard Reutner-Fischer
6264f45095 buildsys: fix realclean
For anything but (toplevel) clean, CLEAN_%, we need .config
Otherwise realclean would leave stuff behind that was not intended to
survive.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-04-04 00:32:46 +02:00
Bernhard Reutner-Fischer
e80657059a add UCLIBC_SUSV2_LEGACY to hide valloc
valloc was marked as LEGACY in SUSv2, removed from SUSv3 and later.
TODO: Remove this (point people to memalign and it's successors?).

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-04-04 00:25:06 +02:00
Bernhard Reutner-Fischer
5c64b9e169 relinfo.pl: use correct interpreter
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-04-04 00:12:25 +02:00
Bernhard Reutner-Fischer
17a7beda46 relinfo.pl: silence warning
$* is no longer supported at extra/scripts/relinfo.pl line 2.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-04-04 00:06:29 +02:00
Bernhard Reutner-Fischer
2be3edacc1 stdlib: avoid relocation
valloc uses memalign

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-04-03 22:54:00 +02:00
Mike Frysinger
564a95241f linux: pread/write: convert to SYSCALL_ALIGN_64BIT
The pread64/write64 syscalls have the 64bit register align issue for
all arches.  Use this new define so we can merge the powerc/xtensa
versions back into the common code.

SuperH is funky and also allows us to do this.

We should be able to merge the mips version too, but that'll require
someone to take a closer look as the current stuff doesn't look quite
right.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2013-04-01 05:58:03 -04:00
Mike Frysinger
81c9eaafec linux: readahead: convert to SYSCALL_ALIGN_64BIT
The readahead syscall has the 64bit register align issue for all
arches.  Only mips was handling this though.

Clean up the common readahead.c to use the SYSCALL_ALIGN_64BIT
define so that we can throw away the mips version and make this
work correctly on arm/ppc/xtensa.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2013-04-01 05:58:03 -04:00
Mike Frysinger
ee84b8b400 linux: posix_fadvise: use new SYSCALL_ALIGN_64BIT
Now that we have a new SYSCALL_ALIGN_64BIT define for tracking the
64bit register shift behavior, use it.  This allows us to delete
duplicated arm/xtensa files, as well as drop a few arch ifdefs from
common code.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2013-04-01 05:58:03 -04:00
Mike Frysinger
6f3f843335 linux: use OFF64_HI_LO rather than __LONG_LONG_PAIR
This macro takes care of the shift/mask split for us, so no need
to open code this ourselves and then use __LONG_LONG_PAIR.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2013-04-01 05:58:02 -04:00
Mike Frysinger
9f9d2dea17 mips: only define SYSCALL_ALIGN_64BIT for O32 ABIs
The 64bit register alignment issue only affects the O32 ABI, so wrap
the define accordingly.  We don't want this being used for N32 ABIs.

This doesn't directly affect the N64 ABI since these files wouldn't
even be compiled for those targets (no need for the 32bit/64bit shim).

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2013-04-01 04:49:24 -04:00
Mike Frysinger
e8cc14e59e libc: rename TRUNCATE64_HAS_4_ARGS to SYSCALL_ALIGN_64BIT
The reason truncate64 takes 4 args on some arches is that their ABI
requires 64bit values to be aligned on register pair boundaries.
Since this alignment affects more than just truncate64, rename the
define to properly document its purpose.  This also allows us to
expand it to the other impacted syscalls (which will be done in a
follow up commit).

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2013-04-01 04:47:08 -04:00
Bernhard Reutner-Fischer
a4c0668fa1 Revert "_scanf.c: Implement 'm' modifier for 'c' and '[' conversions."
This reverts commit e567c399ff86d007d8c4586f0dd5e0ca61e283ca.
since it breaks badly (e.g. busybox netstat)

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-03-29 13:34:54 +01:00
Mirko Vogt
d21603390f _vfprintf.c: use 'fputws_unlocked(S, F)' instead of 'fputws(S, F)'
This eliminates a source of reproduceable freezes

Signed-off-by: Mirko Vogt <dev@nanl.de>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-03-29 11:24:10 +01:00
Felix Fietkau
60e5c34fe3 inet: fix getting the nameserver from _res state after res_init.
Fixes displaying the nameserver in busybox nslookup.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-03-29 10:30:21 +01:00
Mischa Jonker
946799cd0c libc: Fix common-generic stat.h for BE
Signed-off-by: Mischa Jonker <mjonker@synopsys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-03-22 21:22:32 +01:00
Nathan Sidwell
6239e4c69d Fix some fragileness in dlopen/do_dlopen wrapper & worker pair.
do_dlopen contains __builtin_return_address to determine from
whence it was called, and uses that to determine which dynamic
object's data it should use to start the search.  (In the bug I was
tracking, this related to whether the application's RPATH was used or
not.)  For that to work, it has to have been inlined into the wrapper
function.

As it happens, it wasn't being inlined.  That's an unfortunate compiler
behaviour, but it isn't wrong and shouldn't have caused dlopen to fail.

This patch changes things so the wrapper function determines the
return address, and passes it to the worker.  If the worker's inlined,
the generated code should be exactly the same as before.

Signed-off-by: Nathan Sidwell <nathan@codesourcery.com>
Signed-off-by: Bernd Schmidt <bernds@codesourcery.com>
2013-03-22 18:01:33 +01:00
Nathan Sidwell
697427cc42 Fix a problem with scanning wide chars.
We found that the testcase

int
main (void)
{
  wchar_t s[10];
  memset (s, 0, sizeof (s));
  int r = sscanf ("s", "%ls", s);
  printf ("%d\n", r);
  printf ("%ls\n", s);
  return 0;
}

printed
0
<blankline>

rather than the expected
1
s

The problem was the enum in _scanf.c, which has had a 'CONV_m' value
inserted. The attached patch fixes the problem in __psfs_parse_spec by
not presuming a particular displacement between the two sets of
char-like conversion values. With this patch the above program produces
the expected output.

Signed-off-by: Nathan Sidwell <nathan@codesourcery.com>
Signed-off-by: Bernd Schmidt <bernds@codesourcery.com>
2013-03-22 18:00:55 +01:00
Timo Teräs
7e434242bd inet: do not filter responses in res_query
Fixes bug #5342

res_query was silently rejecting responses against T_ANY DNS
questions.

Remove the type-filtering from res_query altogether.
__dns_lookup is supposed to return the proper stuff that you asked
for (and only that).

Signed-off-by: Timo Teräs <timo.teras@iki.fi>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-03-20 11:51:08 +01:00
Bernhard Reutner-Fischer
044ac16085 inet: Fix LT{.old,} compilation due to res_iclose
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-03-20 11:08:49 +01:00
Bernhard Reutner-Fischer
479faad8a6 LT.old: add missing prototypes
to silence warning

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-03-20 10:10:17 +01:00
Bernhard Reutner-Fischer
b3a3b27c58 rpc: silence warning
Silence warning about shadowing wait

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-03-20 10:09:29 +01:00
Bernhard Reutner-Fischer
64828a12a0 test: fix non-O checking
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-03-20 10:08:15 +01:00
Bernhard Reutner-Fischer
6bfb450b58 test: add missing top_srcdir
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-03-14 22:49:25 +01:00
Bernhard Reutner-Fischer
115577807b buildsys: remove calls to mktemp
Nowadays we should not be racy in this area anymore, so simplify
generating temporary build-files.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-03-14 22:49:25 +01:00
Bernhard Reutner-Fischer
8b150a9491 test: silence warning in skeleton
Some tests use fd, rename the one in the skeleton.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-03-14 22:49:25 +01:00
Bernhard Reutner-Fischer
bad7c039de test: silence warning in testsuite.h
silence warnings about unused parameters

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-03-14 22:49:25 +01:00
Bernhard Reutner-Fischer
74dd5ff42c test: update test-skeleton.c
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-03-14 22:49:25 +01:00
Bernhard Reutner-Fischer
0007638b54 libubacktrace: use libgcc_s.h
for consistency

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-03-14 22:49:25 +01:00
Bernhard Reutner-Fischer
d1e5115772 libc: switch several users to unlikely()
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-03-14 22:49:25 +01:00
Bernhard Reutner-Fischer
950fcf0f68 inet: res_nclose: free user-buffer, not global _res
In res_iclose we were operating on the global _res even if called via
res_nclose where we are supposed to operate on the user provided
res_state.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-03-14 22:49:25 +01:00
Bernhard Reutner-Fischer
f4abc54226 test: dlopen: fix misplaced buildsys hunk
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-03-14 22:49:25 +01:00
Bernhard Reutner-Fischer
b17f1cd2b8 buildsys: remove surplus slashes from test dir paths
cosmetics

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-03-14 22:49:25 +01:00
Bernhard Reutner-Fischer
0a513103bf buildsys: tweak KCONFIG_CONFIG export
0c3eb2da578bc7ba2e74d240e3249dce62ec725e moved KCONFIG_CONFIG around and
that broke propagation of config-settings to the testsuite. Fix that.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-03-14 22:49:25 +01:00
Bernhard Reutner-Fischer
7598eeaa1d test: cater for config
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-03-14 22:49:25 +01:00
Bernhard Reutner-Fischer
36a30632a5 test: compile test{,_glibc} adjacent
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-03-14 22:49:25 +01:00
Markos Chandras
daecc9a410 metag: Add NPTL support
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-03-14 22:47:08 +01:00
Markos Chandras
20221281b3 extra/locale: Mark __codeset_8_bit_t as packed for Meta
gen_ldc writes offsets into the __locale_mmap_t structure. This
relies on the host system having the same struct offsets as the
target. On Meta, the structs are always aligned to a multiple of
4 bytes, and for these targets it is required for the struct to
be packed so that it is more likely to match the host system
(typically x86 which does not align structs).

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-03-14 22:47:08 +01:00
Markos Chandras
e3436cc40d metag: Add support for loading shared objects into core memories.
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-03-14 22:47:08 +01:00
Markos Chandras
cf349fcbb5 libm: Add support for the Meta architecture
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-03-14 22:47:04 +01:00
Markos Chandras
22686a1383 Add support for the Meta architecture
Meta cores are 32-bit, hardware multithreaded, general purpose, embedded
processors which also feature a DSP instruction set, and can be found in
many digital radios. They are capable of running different operating
systems on different hardware threads, for example a digital radio might
run RTOSes for DAB decoding and audio decoding on 3 hardware threads,
and run Linux on the 4th hardware thread to manage the user interface,
networking etc. HTPs are also capable of running SMP Linux on multiple
hardware threads.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-03-14 22:45:15 +01:00
Markos Chandras
37439e66a3 ldd: Add MATCH_MACHINE definition for Meta
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-03-14 22:41:11 +01:00
Markos Chandras
85385fe46b elf: Add ELF magic number and relocations for the Meta architecture
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-03-14 22:41:11 +01:00
Vineet Gupta
d81edb9968 ldso: Fix Build warnings with common-generic ABI build
CC ldso/ldso/ldso.oS
In file included from ./ldso/include/ldso.h:47,
                 from ldso/ldso/ldso.c:33:
./ldso/include/dl-syscall.h:35:1: warning: "S_ISUID" redefined
In file included from ./include/bits/kernel_stat.h:10,
                 from ./ldso/include/dl-syscall.h:31,
                 from ./ldso/include/ldso.h:47,
                 from ldso/ldso/ldso.c:33:
./include/sys/stat.h:163:1: warning: this is the location of the
previous definition
In file included from ./ldso/include/ldso.h:47,
                 from ldso/ldso/ldso.c:33:
./ldso/include/dl-syscall.h:36:1: warning: "S_ISGID" redefined
In file included from ./include/bits/kernel_stat.h:10,
                 from ./ldso/include/dl-syscall.h:31,
                 from ./ldso/include/ldso.h:47,
                 from ldso/ldso/ldso.c:33:
./include/sys/stat.h:164:1: warning: this is the location of the
previous definition

-----------------------------------------------------------------

Cleanly seperated the legacy ABI vs. new ABI scenario.

Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Cc: Markos Chandras <markos.chandras@imgtec.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-03-14 22:27:19 +01:00
Vineet Gupta
4798e77cdb libpthread: linuxthreads.old: Allow building for no-legacy-syscalls ABI
Since NPTL port to an ARCH can be non-trivial, we must allow the legacy
pthread lib to be built for the common-generic syscall ABI

Note that only linuxthreads.old is allowed, since "newer" linuxthreads
relies on sysctl which the ABI no longer provides.

Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Cc: Markos Chandras <markos.chandras@imgtec.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-03-14 22:27:19 +01:00
Vineet Gupta
833820e6e2 libc/ipc: Make IPC_64 0 for common-generic ABI
This avoids having to define __IPC_64 to 0 in each arch using the ABI

Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Cc: Markos Chandras <markos.chandras@imgtec.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-03-14 22:27:19 +01:00
Vineet Gupta
1b1133555e fstat64: Fix Build warnings with common-generic ABI build
CC libc/sysdeps/linux/common/fstat64.os
In file included from libc/sysdeps/linux/common/fstat64.c:16:
libc/sysdeps/linux/common/xstatconv.h:28: warning: 'struct kernel_stat'
declared inside parameter list
libc/sysdeps/linux/common/xstatconv.h:28: warning: its scope is only
this definition or declaration, which is probably not what you want
libc/sysdeps/linux/common/fstat64.c: In function 'fstat64':
libc/sysdeps/linux/common/fstat64.c:33: warning: passing argument 2 of
'__syscall_fstat64' from incompatible pointer type
libc/sysdeps/linux/common/fstat64.c:18: note: expected 'struct stat *'
but argument is of type 'struct stat64 *'
-------------------------------------------------------------------

Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Cc: Markos Chandras <markos.chandras@imgtec.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-03-14 22:27:19 +01:00
Vineet Gupta
1759f84c2a leek: if lseek syscall is not available, use lseek64 even for !LFS
With Busybox and uClibc - both built w/o LFS, this caused ash to be
completely broken, as lseek was simply returning error.

Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Cc: Markos Chandras <markos.chandras@imgtec.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-03-14 22:27:19 +01:00
Vineet Gupta
5866897566 utimes: Export utimensat based utimes
sys/time.h has libc_hidden_proto(utimes) which generates the hidden
"__GI_utimes" symbol reference, and common/utimes.c has a
libc_hidden_def(utimes) which generates the exported "utimes" alias.

As part of no-legacy-syscall kernel ABI, Commit 80dc2ed05
"utimes: Use utimensat if arch does not have the utimes syscall"
introduced a new wrapper, but missed the corresponding libc_hidden_def,
causing Busybox (1.20.0) link to fail (for ARC).

Also don't generate a STUB, in that case.
---------------->8-------------------
....
touch.c:(.text.touch_main+0xdc): undefined reference to `utimes'
touch.c:(.text.touch_main+0x114): undefined reference to `utimes'
libbb/lib.a(copy_file.o): In function `copy_file':
copy_file.c:(.text.copy_file+0x446): undefined reference to `utimes'
collect2: ld returned 1 exit status
---------------->8-------------------

Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Cc: Markos Chandras <markos.chandras@imgtec.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-03-14 22:27:19 +01:00
Vineet Gupta
f0489b5c79 LT{,.old}: include stddef.h for size_t
A user application built with -D_POSIX_C_SOURCE=200112L and
 #include signal.h, yields following compilation error:

------------------->8-----------------------------
arc-linux-uclibc-gcc -D_POSIX_C_SOURCE=200112L hello.c
In file included from
/opt/INSTALL/lib/gcc/arc-linux-uclibc/4.4.7/../../../../arc-linux-uclibc/sys-include/signal.h:429,
                 from hello.c:1:
/opt/INSTALL/lib/gcc/arc-linux-uclibc/4.4.7/../../../../arc-linux-uclibc/sys-include/bits/pthreadtypes.h:48:
error: expected specifier-qualifier-list before 'size_t'
------------------->8-----------------------------

The fix is to make sure size_t is explicitly provided to pthreadtype.h

Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-03-13 09:46:18 +01:00
Markos Chandras
f4fe313d50 buildsys: Add missing $(SYMBOL_PREFIX) to symbol names
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-03-07 18:59:35 +01:00
Markos Chandras
3c99de5c1e libpthread: Remove useless .cvsignore files
Signed-off-by: Markos Chandras <hwoarang@gentoo.org>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-03-07 18:58:14 +01:00
Markos Chandras
60c1fe7f45 nptl/allocatestack.c: Fix stack mprotect alignment for STACK_GROWS_UP
mprotect() expects the first argument to be aligned to a page boundary.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-27 22:16:20 +01:00
Markos Chandras
49d3f93362 libc/pause: Enable pause_nocancel for arches without __NR_pause
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-27 22:16:12 +01:00
Xi Wang
79cd5fb435 nice: fix overflow checking in int_add_no_wrap()
In C, signed integer overflow is undefined behavior.  Many compilers
optimize away checks like `a + b < a'.

Use safe precondition testing instead.

Signed-off-by: Xi Wang <xi@mit.edu>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20 19:12:51 +01:00
Bernhard Reutner-Fischer
3d791bda2e inet: remove noreturn attribute from res_nclose
Partially revert e9af4dfbd328e9f3bba235fdb2d1027dd2dbbcde

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20 15:20:56 +01:00
Bernhard Reutner-Fischer
62d3f7ba59 scripts: remove CVS header from getent
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20 15:20:56 +01:00
Markos Chandras
6c2fa3451f libc/ipc: Allow architectures to define their own __IPC_64 macro
New architectures don't define ARCH_WANT_IPC_PARSE_VERSION in their kernel.
This means that every cmd passed to semctl,msgctl and shmctl is IPC_64 by
default. For these architectures we need to define __IPC_64 as 0. Existing
architectures are not affected by this change.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20 13:45:13 +01:00
Markos Chandras
634e74f630 ldso: Use newer syscalls if arch does not have the deprecated syscalls
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20 13:45:13 +01:00
Markos Chandras
9f44c4ca56 open: Use openat if arch does not have the open syscall
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20 13:45:13 +01:00
Markos Chandras
faa3bc7b7c not-cancel.h: Use openat if arch does not have the open syscall
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20 13:45:13 +01:00
Markos Chandras
585ee9c4e7 open64: Use openat if arch does not have the open syscall
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20 13:45:13 +01:00
Markos Chandras
d62c716242 fcntl: Use fcntl64 is arch does not have the fcntl syscall
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20 13:45:13 +01:00
Markos Chandras
e87a63c1d8 fstatfs64: Prefer fstatfs64 system call instead of __libc_fstatfs
Using __libc_fstatfs for fstatfs64 adds a small delay as it needs to
use a 32-bit data structure to get the file info and them pass them to
the 64-bit data structure which was given as a fstatfs64 argument. Using
the system call directly should make the entire process much faster.
Also fix the arguments for fstatfs64. It takes three arguments
(see fs/fstatfs.c in Linux kernel sources) so despite what the manpage
says, the size of the buffer needs to be passed as the second argument

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20 13:45:13 +01:00
Markos Chandras
09e782b088 fstatfs: Add __libc_fstatfs wrapper
New architectures don't have fstatfs anymore, so we use a wrapper for
__libc_fstatfs which will use fstatfs64 internally. The interface however
needs to remain the same (i.e accepting a struct statfs as a second
argument) for backwards compatibility

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20 13:45:13 +01:00
Markos Chandras
13f56c443b stat: Use fstatat64 if arch does not have the stat syscall
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20 13:45:13 +01:00
Markos Chandras
aec10d8647 ustat: Add ustat stub for arches that don't have the ustat system call
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20 13:45:13 +01:00
Markos Chandras
789e2402f3 lstat64: Use fstatat64 if arch does not have the lstat64 syscall
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20 13:45:13 +01:00
Markos Chandras
677adae2b0 lstat: Use fstatat64 if arch does not have the lstat syscall
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20 13:45:13 +01:00
Markos Chandras
36b3c53f92 stat64: Use fstatat64 if arch does not have the stat64 syscall
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20 13:45:13 +01:00
Markos Chandras
82fd359bcc fstatat{64}: No conversion code is needed for new architectures
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20 13:45:12 +01:00
Markos Chandras
cb529f08cf fstatat64: Use newfstatat only for 64-bit operations
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20 13:45:12 +01:00
Markos Chandras
758a4fe9ce fstatat: Use newfstatat only for 64-bit operations
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20 13:45:12 +01:00
Markos Chandras
b34c8a4698 fstat: Use fstat64 if arch does not have the fstat syscall
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20 13:45:12 +01:00
Markos Chandras
08f8dd1e58 libc/statfs64: Skip conversion code for new architectures
Fixes the following tests in LTP

statfs02_64 ( test case #5 )

The purpose of this test is to pass an invalid pointer to the statfs64
syscall and check if the kernel returns EFAULT or not. However,
uClibc creates a new statfs struct which is then passed to the kernel.
As a result of which, the kernel returns 0 because the newly created
statfs structure is valid. But, when copying the contens of the new
pointer to the old userspace one, the uClibc segfauls because the old
pointer is invalid. Old architectures are doomed to suffer by this
problem but new architectures can use the statfs64 syscall directly
so that the userspace pointer is passed directly to the kernel and get
the correct errno at the end.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20 13:45:12 +01:00
Markos Chandras
a1a76682c4 statfs: Use statfs64 if arch does not have the statfs syscall
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20 13:45:12 +01:00
Markos Chandras
92b784d6a5 getdents: Use getdents64 if arch does not have the getdents syscall
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20 13:45:12 +01:00
Markos Chandras
524744db1f lseek: Use lseek64 is arch does not have the lseek syscall
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20 13:45:12 +01:00
Markos Chandras
a83ea57a50 sendfile: Use sendfile64 if arch does not have the sendfile syscall
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20 13:45:12 +01:00
Markos Chandras
f7bead5ada truncate: Use truncate64 if arch does not have the truncate syscall
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20 13:45:12 +01:00
Markos Chandras
bad1b218da ftruncate: Use ftruncate64 if arch does not have the ftruncate syscall
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20 13:45:12 +01:00
Markos Chandras
11372c665a fork: Use clone if arch does not have the fork syscall
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20 13:45:12 +01:00
Markos Chandras
58570fc8e1 vfork: Use clone if arch does not have the vfork syscall
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20 13:45:12 +01:00
Markos Chandras
c7d36adfc2 utime: Use utimensat if arch does not have the utime syscall
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20 13:45:12 +01:00
Markos Chandras
af63ec925e inotify_init: Use inotify_init1 if inotify_init syscall is not defined
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20 13:45:11 +01:00
Markos Chandras
3db05793b7 epoll: Use epoll_pwait if arch does not have the epoll_wait syscall
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20 13:45:11 +01:00
Markos Chandras
257323e525 epoll: Use epoll_create1 if arch does not have the epoll_create syscall
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20 13:45:11 +01:00
Markos Chandras
dde074b390 pipe: Use pipe2 if arch does not have the pipe syscall
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20 13:45:11 +01:00
Markos Chandras
80dc2ed052 utimes: Use utimensat if arch does not have the utimes syscall
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20 13:45:11 +01:00
Markos Chandras
81b480369b symlink: Use symlinkat if arch does not have the symlink syscall
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20 13:45:11 +01:00
Markos Chandras
e07db64b78 readlink: Use readlinkat if arch does not have the readlink syscall
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20 13:45:11 +01:00
Markos Chandras
3a5be53a84 rename: Use renameat if arch does not have the rename syscall
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20 13:45:11 +01:00
Markos Chandras
ecb2be2c0a mkdir: Use mkdirat if arch does not have the mkdir syscall
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20 13:45:11 +01:00
Markos Chandras
d8386ad5e7 lchown: Use fchownat if arch does not have the lchown syscall
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20 13:45:11 +01:00
Markos Chandras
98f53c5760 rmdir: Use unlinkat if arch does not have the rmdir syscall
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20 13:45:11 +01:00
Markos Chandras
c4c78fc5f3 chown: Use fchownat if arch does not have the chown syscall
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20 13:45:11 +01:00
Markos Chandras
6589e886e0 mknod: Use mknodat if arch does not have the mknod syscall
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20 13:45:11 +01:00
Markos Chandras
09a387a0fc unlink: Use unlinkat if arch does not have the unlink syscall
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20 13:45:11 +01:00
Markos Chandras
82fc713658 link: Use linkat if arch does not have the link syscall
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20 13:45:11 +01:00
Markos Chandras
695e274cf7 access: Use faccessat if arch does not have the access syscall
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20 13:45:11 +01:00
Markos Chandras
82cab37865 chmod: Use fchmodat if arch does not have the chmod syscall
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20 13:45:10 +01:00
Markos Chandras
90accddebe dup2: Use dup3 if arch does not have the dup2 syscall
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20 13:45:10 +01:00
Markos Chandras
ad68946e28 Makefile.in: Use non-legacy interfaces for new architectures
New architectures, which don't define ARCH_HAS_DEPRECATED syscalls, need
to use the new interfaces from libc/sysdeps/linux/generic-syscalls/bits/

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20 13:45:10 +01:00
Markos Chandras
bff4f0be36 Config.in: Introduce symbol for arches with deprecated syscalls
Linuxthreads(old and new) need deprecated syscalls to build. Existing
architectures support these system calls but new architectures don't.
This symbol has no functional change apart from hidding the Linuxthreads
symbols from arches that don't support them.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20 13:45:10 +01:00
Markos Chandras
6a69d7fc63 libc/sysdeps: Add new interfaces for new architectures
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20 13:45:10 +01:00
Henning Heinold
0eb30761a2 libc: add non standard execvpe function
Signed-off-by: Henning Heinold <heinold@inf.fu-berlin.de>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-18 14:40:28 +01:00
Markos Chandras
dcd8e7e8c9 libc/{arm, i386}/Makefile.arch: Don't build 64-bit code if LFS is disabled
Fixes the following compilation error:

_lfs_64.h: # error Do not include this header in files not built when LFS is disabled

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-11 10:04:06 +01:00
Bernhard Reutner-Fischer
5084cf8b6b stdlib: Fix fndecl of mkostemp, mkostemp64
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-11 09:42:16 +01:00
Bernhard Reutner-Fischer
7b6604113e test: run test{,_glibc} adjacent
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-11 09:42:15 +01:00
Bernhard Reutner-Fischer
5643900913 libc: add posix_fallocate()
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-11 09:42:15 +01:00
Bernhard Reutner-Fischer
971db25812 buildsys: switch warning into a TODO
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-07 15:31:29 +01:00
Markos Chandras
b222a04ae7 buildsys: Fix kbuild-style switch fallout
regressions introduced in 1b3025b7352f5e432ffa1c7adc57085ac9092b77
"buildsys: switch libc to kbuild-style"

unistd: Handle !UCLIBC_HAS_GET{, SUB}OPT cases

libc/libc_so.a(getsubopt-susv3.os): In function getsubopt':
getsubopt-susv3.c:(.text+0x0): multiple definition of getsubopt'
libc/libc_so.a(getsubopt.os):getsubopt.c:(.text+0x0):
first defined here.

The solution is to filter out the correct files when
UCLIBC_HAS_GETOPT and UCLIBC_HAS_GETSUBOPT are not defined.

inet: Move INET_RPC_{DIR, OUT} before CSRC_ALL

libc/libc_so.a(rpc_thread.oS): In function __rpc_thread_svc_max_pollfd':
rpc_thread.c:(.text+0x148): undefined reference to svc_max_pollfd'
libc/libc_so.a(rpc_thread.oS): In function __rpc_thread_svc_pollfd':
rpc_thread.c:(.text+0x184): undefined reference to svc_pollfd'

The CSRC_ALL variable uses the INET_RPC_DIR variable which is
initialized later on. We fix this problem by moving the
INET_RCP_{DIR,OUT} definitions before we use them in CSRC_ALL

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-07 15:31:20 +01:00
Bernhard Reutner-Fischer
868d059a14 mman: rename MAP_UNINITIALIZE to MAP_UNINITIALIZED
The name was changed to include a trailing 'D' when it went into the
kernel.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-05 19:23:37 +01:00
Bernhard Reutner-Fischer
1b3025b735 buildsys: switch libc to kbuild-style
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-05 18:55:08 +01:00
Bernhard Reutner-Fischer
aeac3e1220 libpthread: Fix handling of SUBARCH includes
TARGET_SUBARCH can only ever be set if TARGET_ARCH is set.
Only include SUBARCH includes if SUBARCH is non-empty.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-05 18:55:08 +01:00
Ronald Wahl
389cd96704 libc: atexit: reuse free slots at the end of exit functions table
Continuosly dlopen and dlclose of shared object will cause a memory leak
in atexit function. This fix reuse free slots at the end of the list.

For further detail see https://bugs.busybox.net/show_bug.cgi?id=2455

Signed-off-by: Ronald Wahl <ronald.wahl@raritan.com>
Tested-by: Filippo Arcidiacono <filippo.arcidiacono@st.com>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2013-02-05 15:59:18 +01:00
Mike Frysinger
98df9185fd libc/inet: pull in stddef.h for NULL
Fixes a build error:
In file included from libc/inet/recv.c:8:0:
libc/inet/socketcalls.c: In function '__recv_nocancel':
libc/inet/socketcalls.c:203:57: error: 'NULL' undeclared (first use in this function)

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2013-01-26 17:43:32 -05:00
Mike Frysinger
07cca0b20d libc/sysdeps: sync bits/in.h with glibc
URL: https://bugs.busybox.net/show_bug.cgi?id=5888
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2013-01-26 17:40:24 -05:00
Mike Frysinger
48d8e3721e buildsys: gen_bits_syscall_h: do not leave undefined SYS_xxx around
If we end up doing '#undef __NR_xxx', we don't want to leave the
corresponding SYS_xxx symbol defined.  So undef it too.

For example, with the ARM EABI layer, we have a bunch of legacy
syscalls that we define early on and then later undefine (such
as __NR_utime).  But we left SYS_utime defined so code that tests
for that define before using it would be broken (since it'd be
defined to a non-existent symbol).

URL: https://bugs.gentoo.org/425006
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2013-01-26 14:13:12 -05:00
Mike Frysinger
5ce6b30bd1 buildsys: gen_bits_syscall_h: clean up script
Just style changes here to make it more readable.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2013-01-26 14:05:02 -05:00
Mike Frysinger
3bbb085321 buildsys: gen_bits_syscall_h: remove top_builddir references
This script hasn't used this var in a while (it writes to stdout), so
drop all mention/usage of it.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2013-01-26 14:04:19 -05:00
Mike Frysinger
bb701610aa buildsys: allow the toolchain to search its dirs for kernel headers
Setting KERNEL_HEADERS up to the exact path all the time is a pita,
especially when the toolchain is often times already configured to
do the right thing.  So if the user has set that to "", don't force
any specific paths.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2013-01-26 13:46:55 -05:00
Mike Frysinger
406b1aba4b buildsys: clean up path scrubbing a bit
This just makes it easier to read -- no functional changes.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2013-01-26 13:43:20 -05:00
Mike Frysinger
4a8786ceef libc/sysdeps: dup3: fix typo in comment
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2013-01-26 13:18:06 -05:00
Bernhard Reutner-Fischer
9591091f15 libc: fix typo in statvfs
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-01-21 12:21:02 +01:00
Bernhard Reutner-Fischer
b03d5855fe libc: fix typo in statvfs
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-01-21 12:14:39 +01:00
Bernhard Reutner-Fischer
76ff037059 mount.h: update
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-01-18 11:12:49 +01:00
Bernhard Reutner-Fischer
a9b3c7889a statfs: towards _STATFS_F_FLAGS
preparatory work.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-01-17 22:46:24 +01:00
Bernhard Reutner-Fischer
bcf1bfabde statfs: support f_frsize
closes bugzilla #5834

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-01-17 22:44:00 +01:00
Bernhard Reutner-Fischer
1e2e4ac619 socket.h: pull socket_type.h from eglibc
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-01-17 19:31:39 +01:00
Bernhard Reutner-Fischer
7059926a34 config: improve help of UCLIBC_HAS_RESOLVER_SUPPORT
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-01-16 13:58:54 +01:00
Bernhard Reutner-Fischer
8d31a6e50d buildsys: link libgcc_eh if DODEBUG
with -O0 we (e.g. lockf) might end up with references to
_Unwind_Resume, so pull in gcc_eh in this case..

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-01-16 13:36:40 +01:00
Bernhard Reutner-Fischer
a716f8ad2c getpwnam: hide relocation
The non-reentrant version of getpwnam is used in the RPC code (for
!HAS_REENTRANT_RPC)

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-01-16 12:23:58 +01:00
Bernhard Reutner-Fischer
a586f419f5 LT.old: reinstate build
As noted by Florian Fainelli:
  LD libpthread-0.9.34-git.so
libpthread/linuxthreads.old/libpthread_so.a(wrapsyscall.oS): In function `fcntl64':
wrapsyscall.c:(.text+0xd8): undefined reference to `__libc_fcntl64'
libpthread/linuxthreads.old/libpthread_so.a(wrapsyscall.oS): In function `lseek64':
wrapsyscall.c:(.text+0x190): undefined reference to `__libc_lseek64'
libpthread/linuxthreads.old/libpthread_so.a(wrapsyscall.oS): In function `pread64':
wrapsyscall.c:(.text+0x39c): undefined reference to `__libc_pread64'

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-01-14 17:52:28 +01:00
Bernhard Reutner-Fischer
eddbf38ca4 buildsys: use kbuild style, fix omission
forgot this hunk in d0234b16d61f06b2a3fd6241eff8c81250283a60

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-01-14 14:45:13 +01:00
Bernhard Reutner-Fischer
d0234b16d6 buildsys: use kbuild style
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-01-10 17:11:48 +01:00
Bernhard Reutner-Fischer
1558b6e7b2 buildsys: remove superfluous default n
kconfig's default defaults to n so spelling out default n is redundant

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-01-10 11:04:56 +01:00
Florian Fainelli
a8dc90eaaa libc: add {get,set,swap,make}context user context manipulation functions
Add the obsolescent SUSv3 family of user context manipulating functions
for arm, i386, mips, x86_64.

Signed-off-by: Timon ter Braak <timonterbraak@gmail.com>
Signed-off-by: Florian Fainelli <florian@openwrt.org>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-01-10 10:56:19 +01:00
Timo Teräs
df3a5fcc8d dl: fix dlsym lookups with RTLD_NEXT
The current code for dlsym() when invoked with RTLD_NEXT lookup
searches for the module where it's being called from, and executes the
_dl_find_hash only for the next module in the chain. However, if the
looked symbol is not there, the rest of the modules are not checked.

Generally this is not a problem as symbols are merged for the parent
modules; so this affects only RTLD_NEXT.

This patch adds a loop iterating through all the following modules.

Signed-off-by: Timo Teräs <timo.teras@iki.fi>
Reviewed-by: Filippo ARCIDIACONO <filippo.arcidiacono@st.com>
Tested-by: Florian Fainelli <florian@openwrt.org>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-01-09 10:10:09 +01:00
Bernhard Reutner-Fischer
0c3eb2da57 buildsys: prevent make from searching for .config
Fixes:
make distclean
mkdir /.config
make -C test/API clean
Reading makefile `../../.config' (search path) (don't care) (no ~ expansion)...
make: *** ../../.config: Is a directory.  Stop.

write(1, "Reading makefile `../../.config'"..., 80) = 80
open("../../.config", O_RDONLY)         = -1 ENOENT (No such file or directory)
open("/usr/include/../../.config", O_RDONLY) = 6
fstat(6, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
read(6, 0x7f2fe3bfc000, 4096)           = -1 EISDIR (Is a directory)

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-01-08 12:07:14 +01:00
Bernhard Reutner-Fischer
7e5737f1f1 arm: workaround GCC PR target/53735 with fork()
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-01-08 09:43:01 +01:00
Bernhard Reutner-Fischer
ff6efa4488 libc: handle sync_file_range
Add cancellation and support arm, ppc64, mips32.
Compile-tested.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-01-08 09:02:36 +01:00
Filippo Arcidiacono
495c425c3b arm: clone: restore stack pointer just after return from syscall
If the syscall returns with an error the stack pointer and r4 register
are not restored because the instruction 'ldmnefd sp!, {r4}' is executed
after branching to '__error' label.
This bug has been spotted out by running './utstest clone 5' from LTP
built with -fstack-protector-all compiler flag as log below:

root@cortex-a9:/usr/tests/ltp/testcases/bin# ./utstest clone 5
stack smashing detected: ./utstest terminated()

Regression introduced by commit e58798e107d652644629a1daaa95d76430808d53

Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com>
Signed-off-by: Giuseppe Di Giore <giuseppe.di-giore@st.com>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2012-12-11 16:39:22 +01:00
Chris Zankel
f4b1b7ade7 xtensa: fix setjmp that didn't save all registers correctly
Setjmp was only saving the lower order of registers (a0-a3) correctly, but
not the higher ones (a4-a8/a12).
The change also includes additional information, and renames many of the
registers, so that setjmp and longjmp look more like the inverse of
each other.

Signed-off-by: Chris Zankel <chris@zankel.net>
2012-12-05 14:25:07 -08:00
Bernhard Reutner-Fischer
ae9e3f4652 sched.h: include stdlib.h for malloc/free
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-12-03 09:46:42 +01:00
James Hogan
ff352060fe update ptrace.h to latest from glibc
Update libc/sysdeps/linux/common/sys/ptrace.h to latest from glibc's
sysdeps/unix/sysv/linux/sys/ptrace.h.

This adds definitions for operations:
 - PTRACE_GETREGSET
 - PTRACE_SETREGSET
 - PTRACE_SEIZE
 - PTRACE_INTERRUPT
 - PTRACE_LISTEN

And adds flags:
 - PTRACE_SEIZE_DEVEL

And adds event codes:
 - PTRACE_EVENT_SECCOMP

This is to allow access to the generic interface for accessing
architecture specific regsets using the corresponding NT_* types,
required for new Linux kernel architecture ports.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-12-01 02:04:51 -05:00
Mike Frysinger
1d6f6660ff libc/stdlib: localize __unix_grantpt
When ASSUME_DEVPTS is disabled, we end up exporting __unix_grantpt and
get a reloc to it from grantpt.  Mark it static to fix all of that.

Reported-by: Michael Deutschmann <michael@talamasca.ocis.net>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-11-29 20:49:18 -05:00
Mike Frysinger
290e19f814 drop support for pre ISO-C compilers
This drops __signed, __volatile, and __const.  Only the latter was
used in the code base, and for uClibc, not consistently.  Much of
the code used plain "const" which meant "__const" was useless.

Really, the point of this is to stay in sync with what glibc did.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-11-18 06:17:03 -05:00
Mike Frysinger
266bdc1f62 Replace FSF snail mail address with URLs
This matches a similar change made to glibc.

No functional changes here.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-11-18 06:03:38 -05:00
Felix Fietkau
38cc9874d3 AVR32: declare missing result variable
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-11-18 05:09:42 -05:00
Mike Frysinger
e63f98ff27 nptl: fix gcc noreturn warning
Current builds show the warning:
  CC libpthread/nptl/pthread_create.os
libpthread/nptl/pthread_create.c: In function 'start_thread':
libpthread/nptl/pthread_create.c:418:3: warning: function declared
	'noreturn' has a 'return' statement [enabled by default]
libpthread/nptl/pthread_create.c:418:3: warning: 'noreturn' function
	does return [enabled by default]

Looking at glibc, it does not mark this function as noreturn.  Testing
code size, gcc is smart enough to detect the code never actually returns
regardless of the attribute.  So drop it to keep in sync with glibc and
to avoid the warnings.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-11-18 04:52:01 -05:00
Mike Frysinger
dd0bd6be9d nptl: fix gcc noreturn warning
Current builds show the warning:
  CC libpthread/nptl/sysdeps/unix/sysv/linux/mq_notify.os
libpthread/nptl/sysdeps/unix/sysv/linux/mq_notify.c: In function 'helper_thread':
libpthread/nptl/sysdeps/unix/sysv/linux/mq_notify.c:142:3: warning:
	function declared 'noreturn' has a 'return' statement [enabled by default]

Looking at glibc, it does not mark this function as noreturn.  Testing
code size, gcc is smart enough to detect the while(1){} never actually
returns regardless of the attribute.  So drop it to keep in sync with
glibc and to avoid the warning.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-11-18 04:49:32 -05:00
Mike Frysinger
b4725d8e2c ldso: include dlfcn.h for RTLD_NODELETE
Building with NPTL enabled and shared library support disabled we hit:
In file included from libpthread/nptl/sysdeps/generic/dl-tls.c:30:0:
./ldso/include/dl-elf.h: In function '__dl_parse_dynamic_info':
./ldso/include/dl-elf.h:173:20: error: 'RTLD_NODELETE' undeclared (first use in this function)
./ldso/include/dl-elf.h:173:20: note: each undeclared identifier is reported only once for each function it appears in
make: *** [libpthread/nptl/sysdeps/generic/dl-tls.os] Error 1

A previous commit (f26c5f6952ce9bf8edec9c1571c47addb1bcc442) touched
on a similar issue, but added the include to the incorrect location.

Reported-by: Christophe Lyon <christophe.lyon@st.com> [arm nommu]
Reported-by: Daniel Beecham <daniel@lunix.se> [static x86_64]
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-11-18 04:42:47 -05:00
Mike Frysinger
6e38a5211e string/microblaze: fix preprocessor style
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-11-17 15:45:37 -05:00
Mike Frysinger
2ff20713c6 libc/sysdeps: dup3: check for __NR_dup3 since older kernels/arches lack it
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-11-17 15:29:16 -05:00
Thomas Schwinge
48a61d889e include/elf.h: update for ELFOSABI_* changes.
ELFOSABI_GNU replaces ELFOSABI_LINUX, the latter is kept as a compatibility
alias, and ELFOSABI_HURD is removed.  See the table on
<http://www.sco.com/developers/gabi/latest/ch4.eheader.html#osabi> for
reference.

Signed-off-by: Thomas Schwinge <thomas@codesourcery.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-11-16 10:52:02 +01:00
Mike Frysinger
42d1b23fc0 libc/stdlib: add mkostemp helpers
Some projects (like udev) are starting to use this.

Imported from glibc.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-11-14 00:31:15 -05:00
Mike Frysinger
dbaa240832 libc/sysdeps: add dup3 syscall wrapper
Some projects (like udev) are starting to use this.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-11-14 00:10:32 -05:00
Mike Frysinger
92e25ae0cd include/: ignore more symlinks
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-11-14 00:07:03 -05:00
Chris Zankel
f282feaa6e test/math: add libm-test-ulps-xtensa file
Add ulps file for Xtensa for the math test.

Signed-off-by: Chris Zankel <chris@zankel.net>
2012-11-13 17:34:58 -08:00
Steve Bennett
eeff07daa6 string/microblaze: Fix for little-endian
Fix the asm-optimised memcpy and memmove so they
work for little-endian as well as big-endian.

Testing has shown no issues, but I am not a microblaze
asm expert so YMMV.

Signed-off-by: Steve Bennett <steveb@workware.net.au>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-11-12 12:43:11 +01:00
Steve Bennett
bee4e25e3d microblaze/bits/setjmp.h: Fix stray #endif
Introduced in c53099f7

Signed-off-by: Steve Bennett <steveb@workware.net.au>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-11-12 12:43:11 +01:00
Chris Zankel
e2d6bec249 xtensa: add missing atomic intrinsics
Add more atomic intrinsics. These are mostly non 32-bit versions, which
are not support by Xtensa. This file needs some more clean-up and
consolidation.

Signed-off-by: Chris Zankel <chris@zankel.net>
2012-11-03 12:57:45 -07:00
Chris Zankel
29fb29d319 xtensa: sysdep.h needs to include sys/syscall.h
The Xtensa version of sysdep.h didn't include sys/syscall.h. This header
file is, for example, needed by not-cancel.h, which uses the
INTERNAL_SYSCALL macro.

Signed-off-by: Chris Zankel <chris@zankel.net>
2012-11-03 12:57:45 -07:00
Chris Zankel
04f13f362e xtensa: add a stub user.h file
Xtensa only supports the ELF binary format, so the user.h file isn't
needed. However, it's included by other files, so provide a stub user.h.

Signed-off-by: Chris Zankel <chris@zankel.net>
2012-11-03 12:57:45 -07:00
Chris Zankel
e3913641ef ldd: ELFCLASSM was not defined for the Xtensa architecture
Signed-off-by: Chris Zankel <chris@zankel.net>
2012-11-03 12:57:45 -07:00
Chris Zankel
ed0d4c1b84 xtensa: fix a misnumbered register in sigsetjmp
Signed-off-by: Chris Zankel <chris@zankel.net>
2012-11-03 12:57:45 -07:00
Chris Zankel
cc46380d0c xtensa: add a set of atomic intrinsics
Add a new file that provides various atomic intrinsics, which use the
conditional store instruction.

Signed-off-by: Chris Zankel <chris@zankel.net>
2012-11-03 12:57:45 -07:00
Chris Zankel
5c0a3b60fb xtensa: use atomic instructions instead of a syscall
Replace system calls with atomic instructions for 'compare and swap'
in linuxthreads.old.

Signed-off-by: Chris Zankel <chris@zankel.net>
2012-11-03 12:57:45 -07:00
Chris Zankel
888b232d1e xtensa: add sigcontext.h
Signed-off-by: Chris Zankel <chris@zankel.net>
2012-11-03 12:57:45 -07:00
Will Newton
3d45b95951 _scanf.c: Implement 'm' modifier for 'c' and '[' conversions.
The current code implements the 'm' modifier only for 's'
conversions and would cause a segfault if it was used for 'c'
or '[' conversions. This patch extends the code to cover these
cases too.

Signed-off-by: Will Newton <will.newton@imgtec.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-10-31 15:22:15 +01:00
Bernhard Reutner-Fischer
1ca62f5d3c utils: Fix missing semicolon
Thanks to Manuel Rüger for spotting this one.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-10-31 15:18:58 +01:00
Bernhard Reutner-Fischer
aba9b10df9 __uclibc_main: remove stray trailing space
test post-receive hook

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-10-31 10:17:41 +01:00
Bernhard Reutner-Fischer
0f9734f891 test: Fix some warnings in inet
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-10-29 13:16:02 +01:00
Bernhard Reutner-Fischer
525a5a614d test: handle !DO_C99_MATH
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-10-29 13:08:58 +01:00
Chris Packham
6a76edddaa libc/sysdeps: add __kernel_long and __kernel_ulong
Linux 3.4 added __kernel_long_t and __kernel_ulong_t and various
exported header files were updated to use these new types. Add the
definitions for __kernel_long_t and __kernel_ulong_t to the relevant
kernel_types.h headers.

This change was automated with the following scriptlet

  git grep --name-only 'typedef.*__kernel_old_dev_t' \
    | xargs sed -i '/typedef.*__kernel_old_dev_t/ a\
  typedef long\t\t__kernel_long_t;\
  typedef unsigned long\t__kernel_ulong_t;'

Whitespace in arm, avr32, hppa, sparc was then manually fixed up.

Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
--
Here's a cleaned up patch which should get the whitespace right. I'm a
bit iffy about the sparc changes they make sense to me but it's not a
platform I have access to.

I can break this up per arch or per maintainer if requested.

 libc/sysdeps/linux/alpha/bits/kernel_types.h      |    2 ++
 libc/sysdeps/linux/arm/bits/kernel_types.h        |    2 ++
 libc/sysdeps/linux/avr32/bits/kernel_types.h      |    2 ++
 libc/sysdeps/linux/bfin/bits/kernel_types.h       |    2 ++
 libc/sysdeps/linux/c6x/bits/kernel_types.h        |    2 ++
 libc/sysdeps/linux/cris/bits/kernel_types.h       |    2 ++
 libc/sysdeps/linux/e1/bits/kernel_types.h         |    2 ++
 libc/sysdeps/linux/h8300/bits/kernel_types.h      |    2 ++
 libc/sysdeps/linux/hppa/bits/kernel_types.h       |    2 ++
 libc/sysdeps/linux/i386/bits/kernel_types.h       |    2 ++
 libc/sysdeps/linux/ia64/bits/kernel_types.h       |    2 ++
 libc/sysdeps/linux/m68k/bits/kernel_types.h       |    2 ++
 libc/sysdeps/linux/microblaze/bits/kernel_types.h |    2 ++
 libc/sysdeps/linux/mips/bits/kernel_types.h       |    4 ++++
 libc/sysdeps/linux/nios2/bits/kernel_types.h      |    2 ++
 libc/sysdeps/linux/powerpc/bits/kernel_types.h    |    4 ++++
 libc/sysdeps/linux/sh/bits/kernel_types.h         |    2 ++
 libc/sysdeps/linux/sh64/bits/kernel_types.h       |    2 ++
 libc/sysdeps/linux/sparc/bits/kernel_types.h      |    4 ++++
 libc/sysdeps/linux/v850/bits/kernel_types.h       |    2 ++
 libc/sysdeps/linux/x86_64/bits/kernel_types.h     |    2 ++
 libc/sysdeps/linux/xtensa/bits/kernel_types.h     |    2 ++
 22 files changed, 50 insertions(+)
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-10-02 10:29:32 +02:00
Filippo Arcidiacono
cb43f2afba librt: re-add SIGCANCEL to the list of blocked signal in helper thread
Indeed if the libpthread is before the libc in the library look up
the SIGCANCEL is removed from the list of the blocked signal by
sigfillset func, this can produce the handler not properly called.
This commit revert what Denys modified in commit
162cfaea20d807f0ae329efe39292a9b22593b41.

Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2012-08-29 13:11:14 +02:00
Natanael Copa
555ae2e88c i386/bits/syscalls.h: allow immediate values as 6th syscall arg
Allow use of immedate values as the 6th syscall argument. Otherwise we must
store the arg on memory. This gives gcc more options to optimize better.

This also works around an issue with posix_fallocate.

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-08-04 19:58:48 +02:00
Peter Korsgaard
3d1b82c7d9 bits/time.h: sync with glibc 2.16
CLOCK_MONOTONIC_RAW is available since 2.6.28
(2d42244ae71d: clocksource: introduce CLOCK_MONOTONIC_RAW), and
CLOCK_*_COARSE since 2.6.32 (da15cfdae033: time: Introduce
CLOCK_REALTIME_COARSE).

Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-08-04 19:50:47 +02:00
Will Newton
4237cc165c libc/inet/resolv.c: Use IE model for TLS data.
All other TLS data in uClibc is explicitly using the IE model,
so use it for __resp too. This generates smaller and faster
code.

Signed-off-by: Will Newton <will.newton@imgtec.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-08-04 19:50:12 +02:00
Will Newton
7bda8c5238 libc/inet/resolv.c: Remove obsolete comment.
The definition of __resp has been hidden for some years (commit
22de495d). Remove the comment suggesting that it is not.

Signed-off-by: Will Newton <will.newton@imgtec.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-08-04 19:49:30 +02:00
Bernd Schmidt
0e28f4b890 Accept either __NR__lseek or __NR_lseek
In llseek.c, we already allow both variants; the same needs to be done here
to avoid duplicate definitions of lseek64_nocancel.

Signed-off-by: Bernd Schmidt <bernds@codesourcery.com>
2012-07-24 15:51:38 +02:00
Bernd Schmidt
3411a732ec Remove pragma weak for undeclared symbol
pthread_initialize is a static function and should not be mentioned in a
header.  The #pragma weak for it appears to confuse gcc-4.7.

Signed-off-by: Bernd Schmidt <bernds@codesourcery.com
2012-07-24 15:51:23 +02:00
Bernd Schmidt
8345b5cfe1 Remove use of attribute_shared_hidden
This attribute is not defined anywhere. Removed its use to make the file
compile.

Signed-off-by: Bernd Schmidt <bernds@codesourcery.com>
2012-07-24 15:50:56 +02:00
Stas Sergeev
0dcc13bf7a nptl: sh: fix race condition in lll_wait_tid
Make a local copy of the tid value to avoid a race condition,
as the value could have been changed to 0, thus using a pointer
it would have been passed to the lll_futex_wait modified.

Signed-off-by: Stas Sergeev <stsp@users.sourceforge.net>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2012-06-19 09:42:31 +02:00
Kevin Cernekee
6c67ceaeed Revert: buildsys: clean up libubacktrace linker script handling
Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-18 20:52:28 +02:00
Bernhard Reutner-Fischer
1716aab0d4 libubacktrace: temporarily workaround link issue
temporarily work around circular dependency in linking that was
introduced by 01c125c3bd8f949f8e5711e09152859eecd1b004

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 16:32:58 +02:00
Peter S. Mazinger
551e6d6ac5 remove arm specific sysdep.h from linuxthreads new
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:45 +02:00
Peter S. Mazinger
428d8b2165 remove sysdep.h from arch specific string implementation
Remove hardcoded path from xtensa, we have sysdep.h in path

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:44 +02:00
Peter S. Mazinger
cd7f8b02a2 remove cris/fork.c, unused
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:44 +02:00
Peter S. Mazinger
d6f8248cc3 update arc4random from bug #885
Add config option to provide arc4random without device access.

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:44 +02:00
Peter S. Mazinger
1c17b766a9 epoll.c: add cancellation to epoll_[p]wait()
While there, fix epoll_pwait syscall, it takes 6 arguments

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:44 +02:00
Peter S. Mazinger
93002a29bc include pthreadP.h for SIGCANCEL
based on a patch from Kevin Cernekee <cernekee@gmail.com>

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:44 +02:00
Peter S. Mazinger
fe1423c4a8 linuxthreads.old: build all objects twice, once for shared lib and once for static
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:44 +02:00
Peter S. Mazinger
727aea1623 internals.h: mark __pthread_message hidden
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:44 +02:00
Peter S. Mazinger
088f450bfd linuxthreads.old: move libpthread_hidden_proto to header
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:44 +02:00
Peter S. Mazinger
40eb40a99a linuxthreads.old/internals.h: make some internal functions hidden
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:44 +02:00
Peter S. Mazinger
17e76f8070 signal.h: needs size_t
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:44 +02:00
Peter S. Mazinger
fc4fb38b29 sched.h: update header, needs size_t
While there, guard __clone[2] with _LIBC

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:44 +02:00
Peter S. Mazinger
c0a3eaf88a sigset-cvt-mask.h: add a guard to allow including it twice
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:44 +02:00
Peter S. Mazinger
5aa7aa7fa7 signal: remove sigblock, siggetmask and sigsetmask
rcmd.c uses sigblock and sigsetmask, make the function static and include them directly until
a rewrite is done.

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:44 +02:00
Peter S. Mazinger
5202922089 bits/types.h: remove thread types, users should include pthread.h
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:44 +02:00
Peter S. Mazinger
1d2dbb9eb2 linuxthreads: guard *tsd* related stuff correctly
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:44 +02:00
Peter S. Mazinger
27cfef649d error.c: no need for __error and __error_at_line
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:43 +02:00
Peter S. Mazinger
22f96153c2 linuxthreads: style update
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:43 +02:00
Peter S. Mazinger
a3516fe1a4 linuxthreads: use __UCLIBC_HAS_TLS__ consistently
replace USE_TLS, HAVE___THREAD and USE___THREAD with __UCLIBC_HAS_TLS__

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:43 +02:00
Peter S. Mazinger
4b06ff8e51 move __libc_pthread_init prototype to pthread-functions.h
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:43 +02:00
Peter S. Mazinger
eb0e749888 forward.c: no need for attribute_hidden, provided by prototype
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:43 +02:00
Peter S. Mazinger
b9e95fe38e libc_pthread_init.c: include only what is necessary
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:43 +02:00
Peter S. Mazinger
71a7acbd4e linuxthreads.old: cleanup a bit
Use __UCLIBC_HAS_TLS__ instead of USE___THREADS (although this LT implementation
will never support TLS).
Disable unused/unneeded members of the pthread_functions structure.
No redirect/forward for _pthread_cleanup_push/pop, it would have not worked anyway
due to the fact, that the structure member was not initialized. Disable it's possible
internal use in libc-lock.h.
Avoid using internals.h in libc_pthread_init.c (moving a prototype to pthread-functions.h).

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:43 +02:00
Peter S. Mazinger
d5e6e79fb9 fts.c: add a comment about wrong usage of _lfs_64.h
This file needs anyway some massage (style update), I'll leave the fix
to the committer.

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:43 +02:00
Peter S. Mazinger
9202677ac0 linuxthreads.old_db: style update
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:43 +02:00
Peter S. Mazinger
f0a3d118ea NPTL: rename __new_sem_* to sem_*
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:43 +02:00
Peter S. Mazinger
e757515091 linuxthreads.old: remove __old_sem_* and rename __new_sem_* to sem_*
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:43 +02:00
Peter S. Mazinger
d60ef5b6d8 sigqueue.c: rewrite a bit
Use sizeof(info) instead of sizeof(siginfo_t).
stubs.c: add sigqueue stub.

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:43 +02:00
Peter S. Mazinger
9d101732ad add posix_madvise.c
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:43 +02:00
Peter S. Mazinger
028183a24d change _NSIG / 8 to __SYSCALL_SIGSET_T_SIZE in common code
Since mips has different kernel sigset_t, use the new macro in common
code that is used by mips as well.

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:43 +02:00
Peter S. Mazinger
5fc5422798 make arch specific cacheflush, readahead and sysmips LINUX_SPECIFIC dependent
Remove the related headers.
Adapt sh's type to the one used everywhere and add prototype for it.

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:43 +02:00
Peter S. Mazinger
4c5395c943 shm.c: do not use __libc_X internally
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:43 +02:00
Peter S. Mazinger
b85e8c0c47 sigqueue.c: do not use __libc_X name internally
__libc_X names are intended to be used in other uClibc provided libs,
but not in libc.
Mark the syscall __always_inline.

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:42 +02:00
Peter S. Mazinger
efe9077ecf sigpause.c: provide the X/Open variant, since the BSD version is deprecated
Do not export __sigpause.
Provide __bsd_sigpause (unprototyped) if anyone may need it.
Adapt cancellation to use cancel.h.

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:42 +02:00
Peter S. Mazinger
19607f1113 socketcalls.c: rewrite to use cancel.h
__socketcall.c: remove guard, we definitely need this syscall
Re-added guard plus added comment (Bernhard)

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:42 +02:00
Peter S. Mazinger
7d0131c552 exec.c: remove duplicate attribute_hidden
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:42 +02:00
Peter S. Mazinger
80101f0d62 vax/statfs.h: common one is good for vax
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:42 +02:00
Peter S. Mazinger
62a6404ddb vax/machine-gmon.h: remove, unneeded
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:42 +02:00
Peter S. Mazinger
4393898fd3 e1/bits/unistd.h: remove unneeded bits
If an arch does not support some option, that has to be coded in Config.in

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:42 +02:00
Peter S. Mazinger
69a9120477 xstatconv: cleanup includes
xstatconv.h needs features.h to really "see" config options
xstatconv.c does not need sys/syscall.h

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:42 +02:00
Peter S. Mazinger
4258038684 use open_not_cancel_2 instead of open_not_cancel
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:42 +02:00
Peter S. Mazinger
804ab2f72f not-cancel.h: update common version and make sure we use this one
Update file (same as in NPTL).
Disable unused parts, the remaining inlines will be fixed later.
Copy it to include to be sure that we use this one independently of
chosen threads.

Provide write,close and waitpid_not_cancel for LT new.
Use wait4 syscall instead of waitpid syscall (kernel says so).
Provide open_not_cancel and close_not_cancel for librt's spawn.

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:42 +02:00
Peter S. Mazinger
62c208d68f pause.c: add back usage of pause syscall
No idea why it was removed when NPTL was added,
but glibc uses it as well.

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:42 +02:00
Peter S. Mazinger
95c40e9faf not-cancel.h: use the non-cancellable functions in libc instead of inlining code
text	   data	    bss	    dec	    hex	filename
 272224	   2298	  17576	 292098	  47502	lib/libuClibc-0.9.32-rc3-git.so.old
 271806	   2298	  17576	 291680	  47360	lib/libuClibc-0.9.32-rc3-git.so

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:42 +02:00
Peter S. Mazinger
295d4b49a6 wrapsyscall.c: add cancellable fcntl64
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:42 +02:00
Austin Foxley
9c4fce55a2 nptl: remove sigaction, sigprocmask, and sigfillset from libpthread
Having them defined in both places was causing errors with static linking

Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:42 +02:00
Peter S. Mazinger
836d74b92d pread_write.c: make all archs use common code
c6x does not need own version at all

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:42 +02:00
Peter S. Mazinger
61198b43ee add cancellation to generic pread_write
Prepare the file to be used in all arch specific files

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:42 +02:00
Peter S. Mazinger
814b0901f4 enable the common code for NPTL
the generic open, close, waitpid, read, write are good for NPTL too
no good reason to have the same sleep in both libc and libpthread (NPTL)
no good reason to add sigwaitinfo, sigtimedwait and sigwait to libpthread (NPTL)

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:41 +02:00
Peter S. Mazinger
9ac34e396b fork: do not add fork() to libpthread
No need for __libc_fork either.

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:41 +02:00
Peter S. Mazinger
050f753172 make NPTL's getpid behave similar to the common one
make __getpid static
provide getppid alias if needed
remove unneeded libc_hidden_proto

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:41 +02:00
Peter S. Mazinger
145ad1d976 poll, ppoll: use cancel.h
use __SYSCALL_SIGSET_T_SIZE
use non-cancellable select in fallback

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:41 +02:00
Peter S. Mazinger
b72b0b14d0 rework cancellation for sigwait, sigtimedwait and sigwaitinfo
sigtimedwait:
- provide __sigtimedwait_nocancel
- use __SYSCALL_SIGSET_T_SIZE instead of _NSIG / 8
- do not provide __sigtimedwait
- guard a section to avoid failure on archs if SI_TKILL/SI_USER are not defined
sigwaitinfo:
- simply use sigtimedwait since that handles cancellation already
sigwait:
- use non-cancellable functions (sigtimedwait, sigsuspend)
- get rid of code already done in __sigtimedwait_nocancel

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:41 +02:00
Peter S. Mazinger
24edbbd53a lseek, lseek64: add cancellation for all THREADS
LT_OLD provides cancellable versions, do it for all THREADS.
llseek.c: use newly added macros for offset handling.
Add a comment about endianness issue around offset.
Compile llseek.c only on 32bit archs.
Provide aliases for 64bit archs or if syscall is not available.

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:41 +02:00
Peter S. Mazinger
fae8e7e498 sigsuspend.c: add cancellation support independently of rt_sigsuspend
signal.h: add __SYSCALL_SIGSET_T_SIZE, since kernel sigset_t is different
on mips and use that instead of _NSIG / 8

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:41 +02:00
Peter S. Mazinger
551ca52892 pselect.c: avoid handling cancellation twice
Use __select_nocancel instead of select

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:41 +02:00
Peter S. Mazinger
733810682b ioctl.c: use cancel.h
Guard changed from NPTL to __NEW_THREADS to cover LT new as well.

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:41 +02:00
Peter S. Mazinger
d3b81557ec nanosleep.c: use cancel.h
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:41 +02:00
Peter S. Mazinger
613b0fabf0 wait.c: use cancel.h
Use __wait4_nocancel, since wait4 is not available all the time

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:41 +02:00
Peter S. Mazinger
f74f77b155 fcntl: add cancellation to fcntl64, use cancel.h
fcntl64 missed cancellation.
Guard fcntl64 for 32bit archs.
Reuse as much code as possible in __syscall_fcntl.c.
Provide alias fcntl64 if that syscall is not available.

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:41 +02:00
Peter S. Mazinger
4228d2f34c ptfork.c: use strong_alias for vfork
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:41 +02:00
Peter S. Mazinger
6a78127da4 waitid.c: use cancel.h
and use __waitpid_nocancel in fallback code

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:41 +02:00
Peter S. Mazinger
0500402162 readv, writev: rewrite to use cancel.h
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:41 +02:00
Peter S. Mazinger
08b258aeb9 waitpid.c: provide __waitpid_nocancel, use cancel.h
Use __wait4_nocancel since wait4 is not available all the time.
Add a comment about not using waitpid syscall.

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:41 +02:00
Peter S. Mazinger
c4b9ff234e open.c: add cancellation using cancel.h
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:40 +02:00
Peter S. Mazinger
15f25e33d9 open64.c: no need for separate cancellation, open handles it already
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:40 +02:00
Peter S. Mazinger
2c917b0305 adapt fdatasync, fsync, msync to use cancel.h
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:40 +02:00
Peter S. Mazinger
f9af28c64e creat*.c: add LIBC_CANCEL_HANDLED to know that it is cancellable (handled by open)
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:40 +02:00
Peter S. Mazinger
2d9054b39a pause.c: use cancel.h, provide __libc_pause only for LT_OLD
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:40 +02:00
Peter S. Mazinger
6c7c4fb8e1 select: adapt cancelation to use cancel.h
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:40 +02:00
Peter S. Mazinger
e4b5997fc1 fork: provide __libc_fork only if THREADS are enabled
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:40 +02:00
Peter S. Mazinger
9df9c60aa9 add cancellation for read, write, close
close.c: add function __close_nocancel_no_status to be used internally
in libc avoiding inlining it everywhere.

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:40 +02:00
Peter S. Mazinger
f6a03f19cf endian.h: add some handy macros to be used in syscalls
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:40 +02:00
Peter S. Mazinger
9f68f0cbf8 cancel.h: add generic file to ease cancellation support
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:40 +02:00
Peter S. Mazinger
a92060fe16 wait4.c: provide hidden __wait4_nocancel independent of any guards
Correct wait4 guard (it is only __USE_BSD)
wait3, system: use __wait4_nocancel

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:40 +02:00
Peter S. Mazinger
0a043c30ee vfork: make all archs consistent
__vfork is hidden.
__GI_vfork is strong (not weak as it was).
vfork is weak.
e1 can use the generic version.

Note: libc_hidden_def(x) has different meaning in .c and .S files.

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:40 +02:00
Peter S. Mazinger
917176e71e utime[s]: avoid circular dependency
utime.c: fix a cast, tv_sec is of type time_t
Add stub for utimes.

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:40 +02:00
Peter S. Mazinger
4dcfe3b269 ustat.c: always_inline syscall
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:40 +02:00
Peter S. Mazinger
b10190983a uname.c,unlink.c: whitespace only
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:39 +02:00
Peter S. Mazinger
5046a84d82 umount: make umount2 depend on UCLIBC_LINUX_SPECIFIC
Add hidden umount2 to be used in umount eventually.
Rework umount to either use directly umount2 syscall or function.

docs say, that mount and umount are also Linux specific

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:39 +02:00
Peter S. Mazinger
c6dcc660d3 mount.c: whitespace only
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:39 +02:00
Peter S. Mazinger
84dd1527aa times.c: whitespace only
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:39 +02:00
Peter S. Mazinger
1fcbd1764e umask.c: umask always succeeds, use _syscall_noerr1
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:39 +02:00
Peter S. Mazinger
78b0d99085 time.c: move included header for fallback case
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:39 +02:00
Peter S. Mazinger
34c0112854 gettimeofday.c: use the same type as in header
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:39 +02:00
Peter S. Mazinger
823b22d7c3 provide sysinfo stub
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:39 +02:00
Peter S. Mazinger
2dfcffb690 syscalls.h: remove unused headers
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:39 +02:00
Peter S. Mazinger
2668ea217f nanosleep.c, fsync.c: do not inline syscall, it is used twice
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:39 +02:00
Peter S. Mazinger
d5f8c6ddc4 brk.c: remove libc_hidden_proto, always_inline syscall
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:39 +02:00
Peter S. Mazinger
29f2e0cd6d sigsuspend.c: make build fail, if rt_sigsuspend is not available and NPTL is defined
Rework a bit for less code.
always_inline syscall used only once, do not inline syscall used twice.

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:39 +02:00
Peter S. Mazinger
c292baef29 symlink.c: Compile only if syscall is available
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:39 +02:00
Peter S. Mazinger
7dc2d2ddee update acct.h
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:39 +02:00
Peter S. Mazinger
6b1fe09331 sync.c: simplify code
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:39 +02:00
Peter S. Mazinger
1b11d19b60 provide stime and settimeofday functions if at least one of the syscalls is available
Add hidden stime for possible use in settimeofday.
Add stubs for both functions if none of the syscalls is present.
Avoid circular dependency.

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:39 +02:00
Peter S. Mazinger
a30f4f75a3 setuid.c: always_inline syscall
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:38 +02:00
Peter S. Mazinger
a55acdf73a setsid.c: whitespace only
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:38 +02:00
Peter S. Mazinger
39e02af41f setpgrp.c: remove unneeded header
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:38 +02:00
Peter S. Mazinger
0a18b6589d setgroups.c: move around some headers, always_inline syscall
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:38 +02:00
Peter S. Mazinger
4e171958a1 pause.c: no need for __UCLIBC_HIDE_DEPRECATED__, the code does not use old functions
Remove syscall.h as well, not needed anymore.

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:38 +02:00
Peter S. Mazinger
6507c3b84d correct sendfile for 32/64 bit archs
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:38 +02:00
Peter S. Mazinger
f95e1b4c61 prctl.c: no need to include stdarg.h and extern
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:38 +02:00
Peter S. Mazinger
87be6cadfc sched_getaffinity.c: mark syscall as __always_inline
Reorganize a bit.

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:38 +02:00
Peter S. Mazinger
29ba11d605 sched_setaffinity.c: make use of the syscall
Fix arg type (const missing).
Reorganize a bit.

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:38 +02:00
Peter S. Mazinger
af58093c14 rename.c: simplify code, include only necessary headers
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:38 +02:00
Peter S. Mazinger
7c966f5242 pivot_root.c: move prototype into guard
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:38 +02:00
Peter S. Mazinger
6b3453a651 poll.c: do not inline syscall
While there, remove libc_hidden_protos

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:38 +02:00
Peter S. Mazinger
06419c7f9c ppoll: no need for hidden version
Guard as GNU extension.
Reorganize a bit.

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:38 +02:00
Peter S. Mazinger
cef1f9517c no need for hidden __sigpause, use an internal static function
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:38 +02:00
Peter S. Mazinger
c28cabb179 Reorder includes and include only what is necessary
Use param.h instead of MIN.
Use stddef.h instead of offsetof.

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:38 +02:00
Peter S. Mazinger
e21479da34 *64.[cS]: use _lfs_64.h instead of features.h and remove LFS guard
_lfs_64.h makes the compile fail, if LFS is not enabled, no need for the guard.
Reorganize to include only the minimal necessary headers.

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:37 +02:00
Peter S. Mazinger
a4b93f0bef openat*: use a static function with the different type and strong_alias_untyped
No need for hidden openat64
_lfs_64.h does not allow to compile *64.c if LFS is not enabled, remove guard

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:37 +02:00
Peter S. Mazinger
67b8585dea llseek.c: use off64_t instead of loff_t as in header
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:37 +02:00
Peter S. Mazinger
f1c42c9e74 mmap64.c: use void * as in header, disable code that can't happen
Reorganize a bit.

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:37 +02:00
Peter S. Mazinger
29a778aa19 avoid circular dependency in lseek and llseek, providing a stub lseek
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:37 +02:00
Peter S. Mazinger
5415f7aa53 getopt.h: cleanup header, remove anything already in cdefs.h
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:37 +02:00
Peter S. Mazinger
28882f0645 _stdio.c: pthread.h was already included by _stdio.h
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:37 +02:00
Peter S. Mazinger
2431e3c401 handle the type mismatch of ftell[o] and fseek[o] if long int != off_t
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:37 +02:00
Peter S. Mazinger
7049cfee24 signal: cleanup, include only headers that are needed
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:37 +02:00
Peter S. Mazinger
95a2ed3551 add simplified __sigemptyset for internal use
Use __sigemptyset instead of sigemptyset.
Remove hidden sigemptyset.

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:37 +02:00
Peter S. Mazinger
d9f20698ed resolv.c: shrink code a bit in getnameinfo.
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:37 +02:00
Peter S. Mazinger
d33a8aba6a addr.c: get rid of a compiler warning
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:37 +02:00
Peter S. Mazinger
acda777b7f types.h: both icc and tendra support long long
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:37 +02:00
Peter S. Mazinger
5c7e1909e1 ssp: rework, sync messages with the ones in glibc
Touch signals only if DODEBUG is enabled.
Make the signal selection dependent on DODEBUG, as last resort use SIGKILL.
Use internal functions with less arguments, some savings.
Fix a warning about unused argument.
Do not use openlog/closelog, while there remove their hidden versions.

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:37 +02:00
Peter S. Mazinger
c9a9baab4f syslog.c: disable locking in setlogmask
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:37 +02:00
Peter S. Mazinger
631049ff3a ssp-local.c: make sure that -fstack-protector is not enabled when compiling file
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:37 +02:00
Peter S. Mazinger
daace91624 syslog.c: no need for hidden vsyslog, use a static __vsyslog instead
It is only used within the same file.
Guard the visible version according to header.

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:36 +02:00
Peter S. Mazinger
508b20ead1 make UCLIBC_HAS_PROGRAM_INVOCATION_NAME and UCLIBC_HAS___PROGNAME independent options
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:36 +02:00
Peter S. Mazinger
1350830902 tempname.c: remove unneeded attribute_hidden, change type to unsigned
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:36 +02:00
Peter S. Mazinger
a307f244bc wordexp.c: use vfork instead of fork on non-MMU archs
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:36 +02:00
Peter S. Mazinger
26284b4021 add LDSO_SAFE_RUNPATH config option
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:36 +02:00
Peter S. Mazinger
f2401c418b get_kernel_syms.c: reorganize, no need for attribute_unused in prototype
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:36 +02:00
Peter S. Mazinger
ca89d7e1fb getgroups.c: reorganize, include param.h instead of defining MIN
Include only what is necessary.
Mark __syscall_getgroups __always_inline.

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:36 +02:00
Peter S. Mazinger
11430a8e3c _exit.c: add ABORT_INSTRUCTION
Warn if the arch has no  __UCLIBC_ABORT_INSTRUCTION__.
Run only one syscall, exit_group is not an exclusivity, use it if THREADS are enabled.
Guard according header.

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:36 +02:00
Peter S. Mazinger
c311492873 stdlib.c: remove comment about _Exit, it is provided in _exit.c
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:36 +02:00
Peter S. Mazinger
e086af1dd0 hppa/bits/atomic.h: include errno.h to get EFAULT/ENOSYS
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:36 +02:00
Peter S. Mazinger
dc0a93c756 add lcong48[_r]
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:36 +02:00
Peter S. Mazinger
f503f6a970 getpt.c: no need for hidden posix_openpt
Prefer static inline instead of hidden (__bsd_getpt)

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:36 +02:00
Peter S. Mazinger
ab5add209a _exit.c: include the proper headers
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:36 +02:00
Peter S. Mazinger
a0fa1f8acf munmap.c: do not include unistd.h
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:36 +02:00
Peter S. Mazinger
37988beac7 PORTING: remove obsolete comment about readelf
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:36 +02:00
Peter S. Mazinger
810075152a dl-iterate-phdr.c: no need for visible __dl_iterate_phdr, make it static
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:36 +02:00
Peter S. Mazinger
9e74047542 posix_fadvise: make posix_fadvise[64] similar on all archs
Remove all versions, that can be covered by the common one.
Drop incorrectly implemented fallback support, if __NR_fadvise64_64 is not available.
To support 64 bit ppc, move ppc support into common.
Cleanup including headers.

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:35 +02:00
Peter S. Mazinger
dd340d59c5 i386/posix_fadvise64: remove fallback code, uClibc does not do that
Makefile.arch: include it only if ADVANCED_REALTIME is defined.

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:35 +02:00
Peter S. Mazinger
a2dc2ddbb5 splice,sync_file_range: mark them as GNU extensions
They can't be compiled if LFS is disabled, they are using off64_t.

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:35 +02:00
Peter S. Mazinger
fc4b1388b3 tee,vmsplice: mark them as GNU extensions
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:35 +02:00
Peter S. Mazinger
0265be6d43 readahead.c: add correct guards
While there, remove unneeded headers.

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:35 +02:00
Peter S. Mazinger
8f6fc2576c cacheflush.c: compile only if __NR_cacheflush is available
The header had to be removed under the guard, else asm/cachectl.h might
not be available at all.
While there, disable __cachectl prototype.
Use untyped strong_alias for cacheflush because char * != void *.

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:35 +02:00
Peter S. Mazinger
b3c8238912 dl-defs.h: avoid including dl-sysdep.h if compiling hostutils
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:35 +02:00
Peter S. Mazinger
949975862a mips/README: fix comment about file from which functions were copied
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:35 +02:00
Peter S. Mazinger
0f34bed3f4 utils: expand search path to find dl-sysdep.h
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:35 +02:00
Peter S. Mazinger
e041f4b2e2 _collate.c: avoid initialization warning
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:35 +02:00
Peter S. Mazinger
949aaf6bc9 _fpmaxtostr.c: align comments, no code change
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:35 +02:00
Peter S. Mazinger
0a718a01bd arm: avoid 2 compiler warnings
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:35 +02:00
Peter S. Mazinger
6ac83250f2 ldso: use _dl_strdup and _dl_dprintf only in ld-uClibc.so
Add support for %p to _dl_dprintf for later corrections in debug messages.
Disable _dl_debug_file if LD debugging is not enabled and change it's use to 2.

The use of dprintf in elfinterp.c will spit out warnings, will be fixed in the
reworked ldso.

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:35 +02:00
Peter S. Mazinger
41494ee200 sh: remove longjmp.c, the common is good for sh
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:35 +02:00
Peter S. Mazinger
d73b0302f3 sh: add back clone and vfork for non-NPTL
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:34 +02:00
Peter S. Mazinger
0bbae4cb66 Rules.mak: add ldso search paths independently of NPTL
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:34 +02:00
Peter S. Mazinger
d37f128c7d uClibc_pthread.h: remove __pthread_mutex_destroy, unused
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:34 +02:00
Peter S. Mazinger
41f937c846 adapt regex to new regex.h
While there, add some defines to help build, cleanup

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:34 +02:00
Peter S. Mazinger
ef304f14b3 ftw.c: errno.h has to be included before undefining _LIBC
While, cleanup a bit

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:34 +02:00
Peter S. Mazinger
f6ad32f895 regex_old.c: adapt to new regex.h
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:34 +02:00
Peter S. Mazinger
981bf0a1aa dl-string.h: include dl-defs.h instead of dl-sysdep.h
Include stddef.h instead of defining NULL
Adapt guard to file name.
Reorder includes a bit.

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:34 +02:00
Peter S. Mazinger
77de40bc26 dl-defs.h: include dl-sysdep.h before fallbacks.
dl-sysdep.h has to come before the fallbacks in dl-defs.h,
else the wrong macros are used.

While there adapt the guard to the file name.

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:34 +02:00
Peter S. Mazinger
77f287bf41 dl-elf.h: add some includes and fix comments
While there change the guard of the file

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:34 +02:00
Peter S. Mazinger
acbf938705 ldso/include: change guard of headers to reflect the file names.
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:34 +02:00
Peter S. Mazinger
1a6e3c3f8f regex.h: sync with glibc, making it more POSIX-like
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:34 +02:00
Peter S. Mazinger
73089985a9 libdl.c: disable dlinfo
dlinfo is a GNU extension, it should be of the same type
as on glibc.

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:34 +02:00
Peter S. Mazinger
d5f3b8031b dl-string.h: change IS_IN_libdl guard to IS_IN_rtld
The guard is changed to allow to be used the file in libc as well.
Include string.h (although already included by ldso.h).
Guard the rest of the file according to config options.

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:34 +02:00
Peter S. Mazinger
8eab3dcbe2 dl-string.h: use __powerpc__ guard instead of powerpc
powerpc guard depends on the compiler options, __powerpc__ should
work all the time.

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:34 +02:00
Peter S. Mazinger
36524c4c40 dl-string.h: remove mips related guard
This can't happen, __mips__ was already checked earlier

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:33 +02:00
Peter S. Mazinger
6df8eff5af remove uClibc_mutex.h on install
Add a comment to uClibc_stdio.h to keep macros in sync with uClibc_mutex.h

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:33 +02:00
Peter S. Mazinger
8808c26863 ldd.c: change syntax, no size and no functional change
Proposed-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:33 +02:00
Peter S. Mazinger
b5b89546ca _scanf.c: fix to signedness warnings
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:33 +02:00
Peter S. Mazinger
f418f52701 errno, h_errno: correct them for non-TLS
Move h_errno related stuff to separate file.
Do not hide errno and h_errno for non-TLS, else it keeps being 0.
Make __[h_]errno_location weak for non-TLS.

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:33 +02:00
Peter S. Mazinger
4341f1d523 avr32: common do_rem is good for it
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:33 +02:00
Peter S. Mazinger
406aa4df9b libdl: no need for _dl_strstr in libdl, use strstr
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:33 +02:00
Peter S. Mazinger
bfba593804 ppc/elfinterp.c: fix comment typos
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:33 +02:00
Peter S. Mazinger
1130df6d42 dl-hash.h: remove unused _dl_symbol and unneeded prototypes
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:33 +02:00
Peter S. Mazinger
6cd313691e __uClibc_main.c: do not include unused headers
Remove unneeded headers.
Guard inclusion of fcntl.h.
While there, remove an obsoleted comment.

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:33 +02:00
Peter S. Mazinger
fee4034763 getpagesize.c, unistd.h: hide __pagesize
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:33 +02:00
Peter S. Mazinger
13640c8807 malloc.h: use sysconf(_SC_PAGESIZE) instead of __pagesize
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:33 +02:00
Peter S. Mazinger
a5de87e5b5 libdl.c: hide dl_cleanup
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:33 +02:00
Peter S. Mazinger
100ad375a3 dl-elf.h: remove unused prototype
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:33 +02:00
Peter S. Mazinger
eae3172be2 jmp-unwind.c: add hidden _longjmp_unwind
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:33 +02:00
Peter S. Mazinger
bb0b54956b internals.h: use sysconf(_SC_PAGESIZE) instead of __pagesize
Rename PAGE_SIZE to __PAGE_SIZE to be sure that we do not get the
definition from uClibc_page.h.

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:33 +02:00
Peter S. Mazinger
d2e776750d libc-symbols.h: fix weak functions handling
Move weak_function and weak_const_function under HAVE_WEAK_SYMBOLS guard
and provide fallbacks.

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:32 +02:00
Peter S. Mazinger
c5cb40e9fc ldd.c: reduce size
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:32 +02:00
Peter S. Mazinger
f9946285ce libdl.c,dl-string.h: do not use inlined _dl_memset and others in libdl
Use the one from libc.
While there, remove unused _dl_strncmp() and superfluos static forward declarations.

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:32 +02:00
Peter S. Mazinger
842b502164 Makefile.commonarch: use proper CFLAGS for jmp-unwind.c
Filter out libpthread CFLAGS

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:32 +02:00
Peter S. Mazinger
f642b00b6c nios2,xtensa: common uClibc_page.h is good for them
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:32 +02:00
Peter S. Mazinger
30ca98eef1 xtensa-config.h: remove XCHAL_MMU_MIN_PTE_PAGE_SIZE used only in uClibc_page.h
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:32 +02:00
Peter S. Mazinger
47951f1e98 ldconfig.c: fix strncmp() usage
While there, remove unused __strtok.
Use err() and warn() if uClibc provides them (if ldconfig is not static).

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:32 +02:00
Peter S. Mazinger
07de755cff getconf.c: fix noreturn warnings
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:32 +02:00
Peter S. Mazinger
d46dc8bc88 iconv: Do not include __iconv_codesets into iconv utility
Host iconv needs only L_iconv_main defined and __iconv_codesets
has to included, as host system does not provide it.
Keep __iconv_codesets out of iconv linked against uClibc.

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:32 +02:00
Peter S. Mazinger
c8eb6b4c7a libnsl,libresolv: do not include unneeded features.h
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:32 +02:00
Peter S. Mazinger
9b0f7d9989 popen.c: get rid of a shadow warning
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:32 +02:00
Peter S. Mazinger
87936cd013 errno and *_init cleanup
Define a common view of __errno_location, __h_errno_location in common header
and use that everywhere, __uClibc_main.c is no special.
The rule adopted:
for enabled threads we make in libc the __GI_x() variants strong, x() weak
and (should) provide another strong x() in libpthread.
If threads are disabled, even the __GI_x() variants are weak.

_stdio_init,_stdio_term,_locale_init: make all hidden weak in common header

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:32 +02:00
Peter S. Mazinger
cfe1298282 librt: provide missing prototypes for mq_timedreceive,mq_timedsend
If ADVANCED_REALTIME is disabled, these prototypes are missing and
librt_hidden_proto() fails.
Makefile.in: added a comment, we build mq_timedreceive/mq_timedsend
on NPTL even if ADVANCED_REALTIME is disabled.

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:32 +02:00
Peter S. Mazinger
b8e6e4064c librt: get rid of visible __mq_timed(send,receive)
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:32 +02:00
Peter S. Mazinger
b6b96ed32b Config.in.arch: remove UCLIBC_FORMAT_ELF config option
Unused option (and is in !ARCH_HAS_MMU guarded section, but depends on ARCH_HAS_MMU)

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:32 +02:00
Peter S. Mazinger
39e91246bd uClibc_stdio.h: change the guard used to include stdio-lock.h
My intention was to get rid of uClibc_mutex.h completely on install, but it
introduces other dependencies. It affects anyway only the installed case.

Note: since NPTL was added, the FILE structure changes between the build
and the installed version. I wanted to fix this by the earlier commit.
Reverting the behaviour to IMHO a wrong one.

While there, remove libc-lock.h and stdio-lock.h on install (even though
glibc has them -wrongly- installed).

Reported-by: Tony Wu <tung7970@gmail.com>
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:31 +02:00
Peter S. Mazinger
8f1ba5cd4f utime.c,utimes.c: include headers only when needed
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:31 +02:00
Peter S. Mazinger
b2b5d473e0 __uClibc_main.c: make __uClibc_init hidden
The linker can cope with it if it is hidden.
No need for the __GI___uClibc_init.

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:31 +02:00
Peter S. Mazinger
95b2df38cb clock_{g,s}ettime.c,{create,delete}_module.c: cleanup
Do not include unneeded headers.
Move headers to the needed place.
Fix a comment typo.

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:31 +02:00
Peter S. Mazinger
47adeb6a1c wrapsyscall.c: include proper header for epoll
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:31 +02:00
Peter S. Mazinger
64572a51b0 add epoll_pwait()
Change const to __const while at it.

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:31 +02:00
Peter S. Mazinger
df87a0f21e sysconf.c: the clock_getres function is good for NPTL as well
Even if glibc reuses the syscall (bloat), we can reuse the function.
Make sure, that we use it only if it is provided by the syscall
and the function is really around (UCLIBC_HAS_REALTIME disables it),
else we get into a loop.

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:31 +02:00
Peter S. Mazinger
f486c8ba61 clock_getres.c: include unistd.h unless syscall is defined
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:31 +02:00
Peter S. Mazinger
8396ab5eef Config.in: NPTL does not compile with disabled UCLIBC_HAS_REALTIME
Select it.

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:31 +02:00
Peter S. Mazinger
f0e0d954f2 chdir.c: simplify code
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:31 +02:00
Peter S. Mazinger
e94b851592 memmove.c,strchrnul.c: use real name in libc_hidden_def
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:31 +02:00
Peter S. Mazinger
0f72ac224e bcopy.c,bzero.c: include string.h instead of _string.h
No need for internal _string.h.
For now include string.h, although the correct header would be strings.h.

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:31 +02:00
Peter S. Mazinger
6831040637 _vfprintf.c: use _fpmaxtostr.h
remove code already in _fpmaxtostr.h

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:31 +02:00
Peter S. Mazinger
3b2d51b4b8 _vfprintf.c: get rid of __STDIO_PRINTF_FLOAT
Rely completely on the configuration options chosen,
in this case on UCLIBC_HAS_FLOATS.

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:31 +02:00
Peter S. Mazinger
6e7b72235b old_vfprintf.c: use _fpmaxtostr.h
It shows that the internal functions differ...

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:31 +02:00
Peter S. Mazinger
59a1890c12 _fpmaxtostr.c: move common to _fpmaxtostr.h
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:31 +02:00
Peter S. Mazinger
9c373ffdda lckpwdf.c: add back lost return
2 earlier (2006 and 2009) commits killed the proper return: -1 for failure, 0 on success

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:30 +02:00
Peter S. Mazinger
da192bef87 getttyent.c: include stdio_ext.h only when needed
do not include pthread.h as the locking macro is provided by stdio.h

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:30 +02:00
Peter S. Mazinger
fb65c1db73 time.c: fix a guard to avoid a warning about unused label
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:30 +02:00
Peter S. Mazinger
e0bcc57876 dirname.c: include only what is needed
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:30 +02:00
Peter S. Mazinger
32506112b4 basename.c: define it correctly, use the proper header for each version
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:30 +02:00
Peter S. Mazinger
7431f726e2 malloc.h: hide internal functions (mainly debug related)
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:30 +02:00
Peter S. Mazinger
89b9f4592a malloc-simple: make _aligned_blocks static and __libc_free_aligned hidden
move __libc_free_aligned prototype up to a common place.

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:30 +02:00
Peter S. Mazinger
3b879e2627 malloc: use uClibc_mutex.h provided macros consequently
use the __UCLIBC_MUTEX macros
remove unused code
remove duplicated code (likely,unlikely)
hide internal __x() functions (mainly debug related)

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:30 +02:00
Peter S. Mazinger
e75dfc1f73 memalign.c: does not use MAX, do not include param.h
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:30 +02:00
Peter S. Mazinger
a80a6b505f _vfprintf.c: fix typo s/NL_MAX_ARG/NL_ARGMAX/
NL_MAX_ARG does not exist.

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:30 +02:00
Peter S. Mazinger
0aa1f968d3 _stdio.h: move _load_inttype.h and _store_inttype.h prototypes here
Use one common prototype for consistency.

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:30 +02:00
Peter S. Mazinger
7bc58308af socketcalls.c: prefer using recvfrom in recv and sendto in send
Make socketcall the last alternative.

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:30 +02:00
Peter S. Mazinger
fc352aa35c Rules.mak: include KERNEL_HEADERS last, even there it is wrong
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:30 +02:00
Peter S. Mazinger
a683d89f56 Rules.mak: change the way -include is used
Other compilers do not expect absolute path after -include,
they want to find the included file by path search (-I).
While there, prefer $(TARGET_ARCH) before common path.

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:30 +02:00
Peter S. Mazinger
eedef37b4a do not define _ISOC99_SOURCE in specific files
This should come properly from features.h or the build.

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:29 +02:00
Peter S. Mazinger
56023566de remove duplicate prototypes for _stdio_term().
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:29 +02:00
Peter S. Mazinger
1d6099a2b4 unwind-{resume,forcedunwind}.c: add missing prototypes
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:29 +02:00
Peter S. Mazinger
e9af4dfbd3 fix a bunch of build warnings
Added attribute_noreturn even if it has return at the end of function

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:29 +02:00
Peter S. Mazinger
293173f870 pthreadP.h: avoid shadow warnings
Change CANCELLATION_P macro and adapt usage.

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:29 +02:00
Peter S. Mazinger
995b4989cd disable __pthread_kill_other_threads, obsoleted
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:29 +02:00
Peter S. Mazinger
7c7dd9d00f uClibc_pthread.h: do not install on target
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:29 +02:00
Peter S. Mazinger
a9b153b6a8 resolv.c,time.c,_atexit.c: hide 3 locks
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:29 +02:00
Peter S. Mazinger
b8634d3537 uClibc_mutex.h: fix bug in conditional macros
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:29 +02:00
Peter S. Mazinger
7883b1fa2e signal.h: sync with glibc, mainly proper guards
psiginfo() is disabled for now.
Take care syncing this file, there are 3 bugs in glibc

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:29 +02:00
Peter S. Mazinger
0849f60087 uClibc_stdio.h: guard internals with _LIBC
Provide __UCLIBC_IO_MUTEX for the installed version

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:29 +02:00
Peter S. Mazinger
c206e4fc49 uClibc_stdio.h: remove consistency check
Redefining stuff is no good for consistency, anyway,
Config.in takes care of this case, it can't happen.

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:29 +02:00
Peter S. Mazinger
8f5a869f9b uClibc_stdio.h: remove parts solved in features.h
Try to have one and only view of settings, no special handling for stdio code.

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:29 +02:00
Peter S. Mazinger
d0f6eab2e9 stdio.h: move __STDIO_{GETC,PUTC}_MACRO dependent part to uClibc_stdio.h
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:29 +02:00
Peter S. Mazinger
e941c481e7 uClibc_stdio.h: move internal to _stdio.h and make them hidden
Move __stdio_mutex_init,_stdio_openlist_{use,del}_count to _stdio.h.
Make _stdio_validate_FILE hidden.
Make _stdio_openlist_{add,del}_lock hidden for non-NPTL.

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:29 +02:00
Peter S. Mazinger
75f527d9bf stdio.h: move uClibc specific parts to the common place for these changes
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:28 +02:00
Peter S. Mazinger
2b836fc1d5 mmap.c: provide a common mmap.c that is good for most of archs
Remove all others, only avr32 needs to be kept.
Define __UCLIBC_ARCH_HAS_6_ARGS__ where needed.

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:28 +02:00
Peter S. Mazinger
f8942a121c _hsearch_r.c: use stdlib.h instead of malloc.h for calloc
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:28 +02:00
Peter S. Mazinger
a5173428bb fnmatch: replace __memset and __memcmp
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:28 +02:00
Peter S. Mazinger
3d1f9dff69 pm_getport.c: s/__close/close/
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:28 +02:00
Peter S. Mazinger
3d1c785587 resolv.c: include param.h and use MIN instead of min
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:28 +02:00
Peter S. Mazinger
7c25065dc7 sa_len.c: do not include ipx.h, the IPX code is disabled
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:28 +02:00
Peter S. Mazinger
429b087a84 getaddrinfo.c: replace #if SALEN with #if 0
make it clear, that the code is disabled

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:28 +02:00
Peter S. Mazinger
934f2fc45e change __asm to __asm__ and __volatile to __volatile__
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:28 +02:00
Peter S. Mazinger
eb82a48383 pwd_grp_internal.c: do not include pthread.h
stdio.h provides __STDIO* locking related macros

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:28 +02:00
Peter S. Mazinger
71b7e3c571 iconv.c: make iconv use the XPG version of basename
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:28 +02:00
Peter S. Mazinger
1f3ca8e086 allocrtsig.c,pthread.c: disable __libc_allocate_rtsig, unused
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:28 +02:00
Peter S. Mazinger
b496187a72 setjmp.h: move __sigjmp_save prototype for consistency
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:28 +02:00
Peter S. Mazinger
f96ea618cb allocsigrt.c: provide proper crrent_rtmin for LT new
might be good for LT old as well

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:28 +02:00
Peter S. Mazinger
33d1d05a5d libc-internal.h: provide dummy attribute_tls_model_ie and __thread for non TLS builds
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:28 +02:00
Peter S. Mazinger
464ec424e6 locale.c, uClibc_locale.h: provide hidden __curlocale[_set]
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:27 +02:00
Peter S. Mazinger
938467ad2d *_strerror_r.c: keep all occurences in sync with string.h
libc-internal.h: this has to provide the reversed case of what string.h defines.
Accomodate for later possibility to compile without _GNU_SOURCE defined

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:27 +02:00
Peter S. Mazinger
145a5962d8 err.c: add attribute_noreturn to static functions
while there, remove unneeded pthread.h

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:27 +02:00
Peter S. Mazinger
23f8c147da err.c, err.h: no need for hidden functions
Since we reuse the functions in the same file, provide static __X()
and use strong_alias to provide the visible functions.

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:27 +02:00
Peter S. Mazinger
8bb1bab754 rpc: constify some more data
Comments in header were used by vda on a similar commit

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:27 +02:00
Peter S. Mazinger
3da72862b8 clnt_generic.c: whitespace only, no code change
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:27 +02:00
Peter S. Mazinger
c01fe0c4ec pm_getmaps.c: change __close to close (even though unused)
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:27 +02:00
Peter S. Mazinger
40207e12e1 ruserpass.c: needs stdio_ext.h only if threads are enabled
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:27 +02:00
Peter S. Mazinger
c968403d33 rcmd.c: no need for stdio_ext.h
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:27 +02:00
Peter S. Mazinger
c6d15bc06b xdr_intXX_t.c,xdr.h: add xdr_quad_t and xdr_u_quad_t
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:27 +02:00
Peter S. Mazinger
9449f91556 svc_auth.c: use same prototypes as in svc_authux.c
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:27 +02:00
Peter S. Mazinger
dddf830fe1 pmap_rmt.c: do not undefine _POSIX_SOURCE, it is anyway too late
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:27 +02:00
Peter S. Mazinger
09450e82e2 rpc: remove unused USE_IN_LIBIO guarded code
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:27 +02:00
Peter S. Mazinger
5e8529cbb3 arc4random.c: replace a comment
Remove pointer to a dead link.

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:27 +02:00
Peter S. Mazinger
f17de52212 stdlib.h, arc4random.c: fix arc4random return type to u_int32_t
Change uint32_t to u_int32_t and uint8_t to u_int8_t, removing
completely the dependency on stdint.h.

Based on patch by Timo Teraes <timo.teras@iki.fi>. His comment:
This also fixes a major bug that stdlib.h includes stdint.h. Things
might go very wrong because stdint.h has conditional defines and
if stdlib.h is included before #define's for stdint.h we end up
missing things and breaking builds (e.g. openjdk).

Signed-off-by: Timo Teraes <timo.teras@iki.fi>
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:27 +02:00
Peter S. Mazinger
0aa00ea102 arc4random.c: use smallint for rs_initialized
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:26 +02:00
Peter S. Mazinger
85a5d70b5f arc4random.c: move arc4_getbyte up
no need for forward declarations

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:26 +02:00
Peter S. Mazinger
b386c1a798 resolv.c: remove duplicated attribute_hidden
while there add one for future (currently in unused code)

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:26 +02:00
Peter S. Mazinger
29ad443b37 ntohl.c: simplify and shrink ntohl and friends
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:26 +02:00
Peter S. Mazinger
6d0a357bd0 geopt.c, LT new/pthread.c: s/__mempcpy/mempcpy/
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:26 +02:00
Peter S. Mazinger
903b6fc667 nios[2]/crt1.S: remove unused _stdio_init,_stdio_term and __h_errno_location
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:26 +02:00
Peter S. Mazinger
b534100aaa dl-osinfo.h: include needed headers
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:26 +02:00
Peter S. Mazinger
916229f02c __xpg_strerror_r.c, {ge,se}trlimit.c: use strong_alias_untyped
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:26 +02:00
Peter S. Mazinger
6763a89427 stdlib.c: get rid of the compiler workarounds by using strong_alias_untyped
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:26 +02:00
Peter S. Mazinger
4c2cd53a40 tsd.c: fix comment
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:26 +02:00
Peter S. Mazinger
30af95307f wait.h: resource.h is included already, rusage is defined
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:26 +02:00
Peter S. Mazinger
2f205af9bb signal.h: disable sigreturn prototype
sigreturn is an internal linux specific function and is not exported

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:26 +02:00
Peter S. Mazinger
923a7a3173 signal.h: disable ssignal and gsignal
raise.c: only LT new provided gsignal, disable it

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:26 +02:00
Peter S. Mazinger
a2fdd604df link.h: guard TLS related internals of struct link_map with _LIBC
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:26 +02:00
Peter S. Mazinger
cebc143270 alphasort*.c: use strcoll instead of strcmp to support locales
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:26 +02:00
Peter S. Mazinger
83625362e0 s_scalbn.c: since we have strong_alias_untyped now, use it
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:26 +02:00
Peter S. Mazinger
bef4efb18c scandir,readdir[_t]: use one common source for X() and X64()
Since the sources differ only minimally, use only scandir.c,readdir[_t].c
and redefine the used functions accordingly.
Use a strong_alias instead of compiling *64.c if __WORDSIZE = 64

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:25 +02:00
Peter S. Mazinger
e50a776d76 versionsort*.c, alphasort*.c: do not need *64 compiled for __WORDSIZE = 64
use a strong_alias instead

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:25 +02:00
Peter S. Mazinger
329befa261 dirent.h: use __ssize_t instead of ssize_t
getdents[64].c: forgot to include dirent.h

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:25 +02:00
Peter S. Mazinger
eb8a5ab353 move __getdents[64] prototypes to dirent.h
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:25 +02:00
Peter S. Mazinger
2e17280a39 math: avoid jump relocation in libm
add hidden significand, lgamma_r, scalb, log2, gamma

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:25 +02:00
Peter S. Mazinger
ed5c73b005 k_standard.c: guard scalb[f] related (unused) code with SUSV3_LEGACY
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:25 +02:00
Peter S. Mazinger
41ddd70e0e mathcalls.h: fix comment, MATHCALLI and MATHCALL_PRIV include libm_hidden_proto
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:25 +02:00
Peter S. Mazinger
b76e718f66 libm: remove superfluos attribute_hidden, the one in prototype is enough
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:25 +02:00
Peter S. Mazinger
c61c6d9880 libm: change j0 to _j0 and y1 to _y1 to avoid shadow warning
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:25 +02:00
Peter S. Mazinger
0769334e2e update partially string.h and strings.h
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:25 +02:00
Peter S. Mazinger
c10d0bda23 dirstream.h: remove unused constants
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:25 +02:00
Peter S. Mazinger
5f06521bf4 quota.h: update, but keep old functionality
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:25 +02:00
Peter S. Mazinger
3663803c5e stdio.h: update partially, mainly for POSIX 2008
Guard some UCLIBC specific parts.
Add comment about bits/getopt.h.
open_memstream.c: remove __restrict according to SuSv4.

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:25 +02:00
Peter S. Mazinger
c9402c70bb unistd.h: partial update, mostly related to POSIX 2008
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:25 +02:00
Peter S. Mazinger
c5bebf9403 make __uClibc_fini() hidden
No need for a visible version

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:24 +02:00
Peter S. Mazinger
30118e361f netdb.h: partial update, adding some __USE_MISC/__USE_GNU guards
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:24 +02:00
Peter S. Mazinger
02c9f0d6e8 remove libc_hidden_proto(ioperm) from all headers except arm
While there, guard everywhere ioperm and iopl prototypes with __UCLIBC_LINUX_SPECIFIC__

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:24 +02:00
Peter S. Mazinger
bcfda18ae0 no need for hidden lockf64
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:24 +02:00
Peter S. Mazinger
84135275cf utent.c, wtent.c: move functions from utxent.c
before the change (threads enabled)
   text	   data	    bss	    dec	    hex	filename
   1107	      8	    408	   1523	    5f3	libc/misc/utmp/utent.os
    152	      0	      0	    152	     98	libc/misc/utmp/wtent.os
    240	      0	      0	    240	     f0	libc/misc/utmp/utxent.os
after the change
   text	   data	    bss	    dec	    hex	filename
   1072	      8	    408	   1488	    5d0	libc/misc/utmp/utent.os
    157	      0	      0	    157	     9d	libc/misc/utmp/wtent.os
    200	      0	      0	    200	     c8	libc/misc/utmp/utxent.os

The smaller size on utent.os is unexpected, could be due to better inlining/not inlining

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:24 +02:00
Peter S. Mazinger
a1281bdca4 utent.c: go back to use static __X() functions without size increase
__X() {...} and strong_alias(__X,X) keeps size the same as X() {...}

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:24 +02:00
Peter S. Mazinger
6da1949cb5 use fputwc in putwchar()
use fputwc instead of fputc
add hidden fputwc to avoid jump relocation

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:24 +02:00
Peter S. Mazinger
0eb904a89c fputc.c, stdio.h: no need for hidden putc, putc_unlocked and fputc_unlocked
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:24 +02:00
Peter S. Mazinger
b91a7f431d cleanup fork()
Keep only fork (and it's hidden variant) and __libc_fork.
Common __libc_fork prototype in unistd.h.
Get rid of __fork, by changing HIDDEN_JUMPTARGET(__fork) to use fork
I can't see the reason to have fork() in libpthread, but kept it for now
making __fork static in these files.

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:24 +02:00
Peter S. Mazinger
741caa9982 semaphore.h, uClibc_local_lim.h: make sure SEM_VALUE_MAX is always defined
LT old and new provided SEM_VALUE_MAX in semaphore.h, NPTL in local_lim.h
Make sure to get the same definitions, independently of the fact, that
semaphore.h is included or not.

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:24 +02:00
Peter S. Mazinger
d70e284a0d semaphore.c: include limits.h before semaphore.h
else SEM_VALUE_MAX will be undefined

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:24 +02:00
Peter S. Mazinger
4424cb73da huge_val.h: add for vax
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:24 +02:00
Peter S. Mazinger
e03994a376 huge_vall.h: add for i386,ia64,m68k,sparc
relevant only for gcc < 3.3 or non-gcc compiler

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:24 +02:00
Peter S. Mazinger
fe042eb8df posix_opt.h: update to POSIX 2008
uClibc_posix_opt.h: adapt accordingly

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:24 +02:00
Peter S. Mazinger
2389017f78 posix_opt.h: update to glibc's NPTL version
add uClibc_posix_opt.h to handle uClibc specific options/features

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:23 +02:00
Peter S. Mazinger
d5332f2fdd local_lim.h: add NPTL version for alpha,ia64,powerpc,sparc, update common
avoid the possibility to use the wrong bits/local_lim.h
uClibc_local_lim.h fix it be correct for LT

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:23 +02:00
Peter S. Mazinger
d1671548b9 tgmath.h: disable builtins
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:23 +02:00
Peter S. Mazinger
13381d9c5b add jmpbuf-unwind.h and jmpbuf-offsets.h to avr32,c6x and xtensa
cleanup bits/setjmp.h and avr32's setjmp.S

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:23 +02:00
Peter S. Mazinger
8350c7e882 change __HAVE_FPU__ to __UCLIBC_HAS_FPU__
add features.h where necessary

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:23 +02:00
Peter S. Mazinger
c53099f7df cleanup bits/setjmp.h of stuff moved to jmpbuf-offsets.h and jmpbuf-unwind.h
Make sure we use the new jmpbuf-*.h headers
While there, adapt the offset on microblaze and the _JMPBUF_UNWINDS macro on bfin,
it seems, these were changed in the meantime.

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:23 +02:00
Peter S. Mazinger
14647468df make use of jmpbuf-offsets.h and jmpbuf-unwind.h
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:23 +02:00
Peter S. Mazinger
591ffe08fe jmpbuf-unwind.h: add NTPL related section
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:23 +02:00
Peter S. Mazinger
0078a92e39 add jmpbuf-offsets.h and jmpbuf-unwind.h for all archs (LT related)
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:23 +02:00
Peter S. Mazinger
8f86b8a197 move *longjmp related prototypes to setjmp.h
Provide common prototypes for __longjmp, __libc_longjmp, __libc_siglongjmp
_longjmp_unwind, __libc_unwind_longjmp in setjmp.h in preparation for use in LT new
Add __longjmp to h8300 and i960
Make common longjmp.c good for NPTL
Guard _longjmp_unwind use in sh's longjmp.c for NPTL (I think sh could use the common one)
Remove unneeded attribute_noreturn, prototype provides it already

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:23 +02:00
Peter S. Mazinger
17967fd080 libintl.h, clnt_perror.c: add fallback gettext(x) and use it for _(x)
clnt_perror.c: change _(x) to N_(x) to allow compile with the change in libintl.h

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:23 +02:00
Peter S. Mazinger
d6bc454fcb getopt[-susv3].c: use libintl's _(x)
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:23 +02:00
Peter S. Mazinger
9b7e3299c3 regex_old.c: remove unneeded guard
_LIBC is undefined here, no need to specially guard with __UCLIBC__

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:23 +02:00
Peter S. Mazinger
532c68d561 obstack.c: use libintl.h
remove gettext workarounds and use libintl.h's _(x)
use strong_alias instead of weak_alias
change how strong_alias and libc_hidden_def are disabled

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:23 +02:00
Peter S. Mazinger
ce69c1eab4 arm: consistency check OABI v. EABI
added check in toolchain and config

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:23 +02:00
Peter S. Mazinger
511f959892 wchar.h: SuSv compliance
add restrict keyword to wcsstr/wcswcs
remove restrict keyword from wmemcmp

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:23 +02:00
Peter S. Mazinger
b59d17b4c3 wchar.h: fix 2 typos in comments
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:22 +02:00
Peter S. Mazinger
8976e173e7 alpha/__syscall_rt_sigaction.S: make the function hidden on non-NPTL
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:22 +02:00
Peter S. Mazinger
3c3f899b6d remove unneeded hidden sigwaitinfo
use __sigwaitinfo in sigwait.c, since that is already hidden

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:22 +02:00
Peter S. Mazinger
5fce95b146 no need for hidden sigtimedwait
remove unneeded attribute_hidden too, as the prototype provides it

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:22 +02:00
Peter S. Mazinger
12bfecef4c setjmp.h: sync with glibc
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:22 +02:00
Peter S. Mazinger
5c151cad58 tgmath.h: sync with glibc
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:22 +02:00
Peter S. Mazinger
91450a8a3b parser_config.[ch]: remove duplicated hidden functions
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:22 +02:00
Peter S. Mazinger
27fbcf79bc signal.h: move prototypes for __syscall_[rt_]sigaction to common place
solve inconsistency between archs
NPTL should not use __syscall_rt_sigaction at all, for now it needs to be visible

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:22 +02:00
Peter S. Mazinger
ef74720709 libintl.h: add _(x) and N_(x) and use it everywhere
remove _LIBC part from rpc headers
include libintl.h to rpc_private.h and use that instead of rpc.h
include libintl.h anywhere else needed replacing _(x) and N_(x)

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:22 +02:00
Peter S. Mazinger
0dd1ccafa7 libc-internal.h: use a consistent prototype for __stack_chk_fail
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:22 +02:00
Peter S. Mazinger
db19d8d0a9 signal.h: provide prototype for __libc_sigaction and remove all others
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:22 +02:00
Peter S. Mazinger
d2b80a3996 complex.h: sync a bit glibc to guard properly
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:22 +02:00
Peter S. Mazinger
f47d6c1b28 use one common prototype for _create_xid
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:22 +02:00
Peter S. Mazinger
119f8bb12d remove subdir include/internal on install
overseen this on an earlier commit

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:22 +02:00
Peter S. Mazinger
88b7712448 rpc_private.h: change guard
need another guard, else rpc/rpc.h might not be included

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:21 +02:00
Peter S. Mazinger
1533e2876b remove __FORCE_GLIBC
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:21 +02:00
Peter S. Mazinger
caa86c6d8d getopt.c, getopt.h: avoid the need for __FORCE_GLIBC
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:21 +02:00
Peter S. Mazinger
5d39c1ed76 do not include libc-internal.h
it is already included by features.h

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:21 +02:00
Peter S. Mazinger
9414f108db locale.h, xlocale.h: guard *locale functions correctly
change the guard from LOCALE to XLOCALE for uselocale/newlocale...
move locale_t to xlocale.h

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:21 +02:00
Peter S. Mazinger
bb25127804 do not include xlocale.h, it is included by locale.h when needed
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:21 +02:00
Peter S. Mazinger
5b273df4c3 signal.h: disable sigvec() and guard related stuff with STRICT_HEADERS
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:21 +02:00
Peter S. Mazinger
095028ece7 time.h: update and guard internals
guard internal constant with _LIBC
strftime_l is SuSv4
reorder a bit to ease syncing with glibc

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:21 +02:00
Peter S. Mazinger
42c814f424 inet_addr.c, inet_makeaddr.c: used the correct section from addr.c
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:21 +02:00
Peter S. Mazinger
2e55f3df35 rpc_msg.h: move xdr_accepted_reply and xdr_received_reply from rpc.h
glibc does not provide these prototypes
libtirpc provides them in rpc_msg.h, copied comments from there

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:21 +02:00
Peter S. Mazinger
2072ce3b2e crypt.h: use __const instead of const
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:21 +02:00
Peter S. Mazinger
b9e58bace8 no need for hidden inet_ntoa_r
it is reused within the same file, solve it through a static function

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:21 +02:00
Peter S. Mazinger
5068fb4d28 remove unneeded hiddens for rtime, basename, strtof* and wcstof*
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:21 +02:00
Peter S. Mazinger
c6a755b571 dirent.h: disable getdirentries not provided by uClibc
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:21 +02:00
Peter S. Mazinger
0ad6e6a2c8 dirent.h: s:__XOPEN_2K8:__USE_XOPEN2K8:
glibc has it wrong as well

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:20 +02:00
Peter S. Mazinger
f774d42e14 wordexp.c, sysconf.c: include ctype.h for isspace
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 14:00:20 +02:00
Bernhard Reutner-Fischer
0eaaf662b7 ldso: use .arm mode for resolver unconditionally
as per comment in the file.
Fixes runtime with __THUMB_INTERWORK__ enabled.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15 13:44:35 +02:00
Filippo Arcidiacono
dc631e1281 libc: sh: fixed typo in ucontext header
Fixed typo in ucontext header, NFPREG wrongly defined twice instead of
NGREG for general registers and NFPREG for floating point register.

Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2012-06-14 00:36:03 +02:00
Bernhard Reutner-Fischer
561ce7fb9f buildsys: prune pthread bits from arch headers
Pickup the correct version of e.g. local_lim.h as seen on ppc

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-13 11:17:14 +02:00
Kevin Cernekee
01c125c3bd buildsys: clean up libubacktrace linker script handling
Currently, the installed libubacktrace linker script entry always uses
HARDWIRED_ABSPATH semantics, even if HARDWIRED_ABSPATH is disabled:

    $ grep GROUP $PREFIX/mipsel-linux-uclibc/sys-root/usr/lib/libc.so
    GROUP ( libc.so.0 uclibc_nonshared.a AS_NEEDED ( ld-uClibc.so.0 ) )
    GROUP ( AS_NEEDED ( /lib/libubacktrace.so.0 ) )

This causes problems when building a non-sysroot toolchain.

Move the AS_NEEDED insertion into libc/Makefile.in, and add a case to
the HARDWIRED_ABSPATH substitution command so libubacktrace is handled
the same way as the other libraries listed in the script.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-13 09:53:30 +02:00
Mark Salter
9af6ea0bc9 Update C6X support
This patch updates the C6X support to work with latest uClibc code and
uses reworked DSBT support to allow using kernel FDPIC loader.

Signed-off-by: Mark Salter <msalter@redhat.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-13 09:53:19 +02:00
Bernhard Reutner-Fischer
11d8a813ed libubacktrace: arm: Fix typo in assert
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-11 14:28:57 +02:00
Bernhard Reutner-Fischer
ed25cd80ed buildsys: fix typo in help
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-11 14:28:56 +02:00
Khem Raj
e118373cbb eventfd: Implement eventfd2 and fix eventfd
eventfd: evntfd assumes to take two arguments instead it
should be one evntfd expects two therefore implement both syscalls with
correct parameters

Thanks Eugene Rudoy for reporting it and also providing the patch

Signed-off-by: Khem Raj <raj.khem@gmail.com>
2012-06-10 09:36:23 -07:00
Kevin Cernekee
2952c70804 MIPS: Use $a0 instead of $v0 for __syscall_error() argument
$a0 is saved across _dl_runtime_resolve(); $v0 is not.  Unfortunately,
__syscall_error() uses $v0 for its argument, not $a0 as is the MIPS ABI
standard.  This means that if lazy binding was used for __syscall_error(),
the errno value in $v0 could get corrupted.

The problem can be easily seen in testcases where syscalls in librt fail;
when librt tries to call __syscall_error() in libc, the argument gets
lost and errno gets set to a bogus value:

    # ./tst-mqueue1 ; echo $?
    mq_receive on O_WRONLY mqd_t did not fail with EBADF: Unknown error 2004684208
    1
    # ./tst-mqueue2 ; echo $?
    mq_timedreceive with too small msg_len did not fail with EMSGSIZE: Unknown error 1997360560
    1
    # ./tst-mqueue4 ; echo $?
    mq_timedsend did not fail with ETIMEDOUT: Unknown error 2008747440
    1

When _dl_runtime_resolve() was taken out of the equation, the same test
cases passed:

    # LD_BIND_NOW=y ./tst-mqueue1 ; echo $?
    0
    # LD_BIND_NOW=y ./tst-mqueue2 ; echo $?
    0
    # LD_BIND_NOW=y ./tst-mqueue4 ; echo $?
    0

Changing __syscall_error() to look at $a0 instead of $v0 fixed the
problem.

(Note that there is also a "__syscall_error.c" file which presumably
uses the standard C calling conventions, but I do not think it is used
on MIPS.)

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-06 09:36:34 +02:00
Kevin Cernekee
3c58d95d91 MIPS: Convert __syscall_error() callers to use $a0 for argument
Some callers passed the first argument in $v0, while others used $a0.
Change the callers to use $a0 consistently.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-06 09:32:34 +02:00
Filippo Arcidiacono
da117419bd ldso: preload standard path library with setuid bit set
For set-user-ID/set-group-ID ELF binaries, only libraries in the standard
search directories that are also set-user-ID must be loaded.
This patch fixes existing logic according to the above statement.
Furthermore if either library setuid bit isn't set or it cannot be found in
the standard search path, the library won't be preloaded but execution go
ahead with default one.

Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-06 09:31:36 +02:00
Mark Salter
8554fb21bb Clean up DSBT support
The existing DSBT support relies on the kernel to provide DSBT info
as part of the load maps passed to user space. The problem with this
approach is that the DSBT info is in the dynamic section, so the
kernel must access a userspace mapping of the dynamic section (or
separately read a copy for the kernel) in order to retrieve the
information needed by userspace.

This patch reworks the DSBT support to remove the reliance on DSBT
info coming from the kernel. Instead, ldso reads the info itself from
the dynamic section. One other benefit of this is that it allows the
existing kernel FDPIC loader to also load DSBT binaries.

Signed-off-by: Mark Salter <msalter@redhat.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-06 09:06:10 +02:00
Mike Frysinger
80c9bfc466 pread/pwrite: drop fallback funcs
Linux has provided these functions since the 2.1.x era, so no need to
keep these around.  We'd rather find out when things are missing (and
fix that) than fall back to the unsafe hacks.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-05-30 01:43:32 -04:00
Mike Frysinger
52fa45da0f pread/pwrite: handle renamed syscalls in common/ppc/xtensa code
Some arches got this fix, but many did not.  So copy the ifdef logic to
the ones that missed it to fix behavior in linux-2.6+.

URL: https://bugs.busybox.net/show_bug.cgi?id=5258
Reported-by: David Laight <david.laight@aculab.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-05-30 01:16:45 -04:00
Sedat Dilek
b7792601c9 Makerules: Remove duplicated slashes in interp.c
Peter Mazinger says in [1]:
"I can revert it to the old behaviour in master (the change s://:/: should stay though)."

[1] http://lists.uclibc.org/pipermail/uclibc/2011-March/045049.html

Signed-off-by: Sedat Dilek <sedat.dilek@gmail.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-05-21 22:22:29 -04:00
Sedat Dilek
e1e7aca536 Revert "Makerules: respect HARDWIRED_ABSPATH in interp.c"
This reverts commit 5dffed7dd1a413f3965af702fa7ecd79809d1988.

This breaks ldd when HARDWIRED_ABSPATH=n.

[1] http://lists.uclibc.org/pipermail/uclibc/2011-March/045048.html

From: Timo Teräs <timo.teras@iki.fi>
Your commit 5dffed7dd1a413f3965af702fa7ecd79809d1988 removed absolute
path from the interpreter binary name embedded in ELF files.

This makes ldd seg.fault as it seems to assume absolute paths.

gdb sayeth:

(gdb) where
 #0  0x00111ae3 in find_elf_interpreter (ehdr=0xb7a74000) at
../utils/ldd.c:556
 #1  0x00111f2a in find_dependencies (filename=0x114910
"/home/fabled/aports/main/libc0.9.32/src/uClibc-0.9.32-rc3/lib/librt.so.0.9.32")
at ../utils/ldd.c:676
 #2  0x0011228e in main (argc=1, argv=0xbffff6e8) at ../utils/ldd.c:777
(gdb) p tmp
tmp = NULL
(gdb) p interp_dir
$1 = 0x116660 "ld-uClibc.so.0.9.32"

[2] http://lists.uclibc.org/pipermail/uclibc/2011-March/045054.html

From: Mike Frysinger <vapier@gentoo.org>
On Wed, Mar 23, 2011 at 7:18 AM, Peter Mazinger wrote:
>> Your commit 5dffed7dd1a413f3965af702fa7ecd79809d1988 removed absolute
>> path from the interpreter binary name embedded in ELF files.
>
> do you consider my patch wrong?

yes.  the absolute path to the ldso must be encoded in binaries.  the
point of HARDWIRED_ABSPATH is purely for sysroot/non-sysroot
toolchain, and the interp path isnt involved with that.

are you sure this even works at runtime ?  i'm pretty sure the kernel
doesnt do any path lookups on the interp string.

Signed-off-by: Sedat Dilek <sedat.dilek@gmail.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-05-21 22:22:26 -04:00
James Hogan
a8908c3517 mmap()->sys_mmap2: do unsigned shift of offset
Fix the implementation of mmap based on the mmap2 system call, to
construct pgoffset from offset with an unsigned shift rather than a
signed (off_t) shift. The mmap2 test in the testsuite catches this case
by mmap'ing with a large offset (with the sign bit set). The signed
shift repeats the sign bit making the page shift way out of range. This
is already fixed similarly in mmap64().

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-05-21 22:20:04 -04:00
Mike Frysinger
8cfb43de63 stdio: implement assignment-allocation "m" character
The latest POSIX spec introduces a "m" character to allocate buffers for
the user when using scanf type functions.  This is like the old glibc "a"
flag, but now standardized.  With packages starting to use these, we need
to implement it.

for example:
	char *s;
	sscanf("foo", "%ms", &s);
	printf("%s\n", s);
	free(s);
This will automatically allocate storage for "s", read in "foo" to it,
and then display it.

I'm not terribly familiar with the stdio layer, so this could be wrong.
But it seems to work for me.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-05-21 22:20:04 -04:00
Filippo Arcidiacono
f8111809ba ldso: sh: handle _dl_skip_args in linker startup instead of __uClibc_main
Handle _dl_skip_args in the asm part of the dynamic linker startup,
to skip the ldso arguments, so we can keep this symbol hidden as other archs do.

Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2012-05-18 09:04:11 +02:00
Bernhard Reutner-Fischer
ca2223f6b7 ldd: tweak whitespace
Tweak whitespace in preprocessor conditionals. No obj-code changes.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-05-15 09:12:07 +02:00
Bernhard Reutner-Fischer
044843f002 Revert "help: Document CROSS="
This reverts commit 5e0dbdb9e5acdcf7dea29335a5db065f48c58766.

CROSS is only a compat thing and should not be advertised

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-05-09 08:25:48 +02:00
Bernhard Reutner-Fischer
8579ca1921 ldd.host: Fix compilation for STANDALONE support
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-05-08 21:22:51 +02:00
Bernhard Reutner-Fischer
5e0dbdb9e5 help: Document CROSS=
should maybe better read "override CROSS_COMPILE from above"

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-05-08 19:53:55 +02:00
Bernhard Reutner-Fischer
f275e6c049 help: Document BUILD_CFLAGS and BUILD_LDFLAGS
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-05-08 19:49:55 +02:00
Bernhard Reutner-Fischer
f09c19c74e utils: pass in config flags for ldd
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-05-08 19:39:10 +02:00
Bernhard Reutner-Fischer
7a5c294ecf ldd: silence warning if !LDSO_LDD_SUPPORT
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-05-08 19:20:09 +02:00
Mike Frysinger
7dd2d7821e linuxthreads.old: fix build warnings with epoll enabled
Pull in the epoll header for the epoll structs.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-05-05 15:05:23 -04:00
Mark Salter
036daaa8e1 drop support for old systems lacking vfork
Only really old systems (<=linux-2.0) lack a dedicated vfork system call.
The code that is in place to support them is causing issues with newer
arches that also don't provide a vfork system call -- instead, they do
vfork by calling clone in userspace.

If anyone cares about these really old systems, they can submit a patch
to make the system work with them while not breaking newer systems.

Signed-off-by: Mark Salter <msalter@redhat.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-05-05 15:02:27 -04:00
Mike Frysinger
3457d04a3d docs: restore crt from old svn tree
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-05-05 03:48:20 -04:00
Bernhard Reutner-Fischer
81bd17ac76 config: tweak STRICT_HEADERS description
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-05-03 13:27:17 +02:00
Bernhard Reutner-Fischer
455cd6cade rpmatch: provide out-of-line implementation
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-05-03 13:04:14 +02:00
Bernhard Reutner-Fischer
8e96c897b6 rpmatch: make decl parsable
Mike, it would have been much simpler to just leave the header impl-free

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-05-03 10:58:24 +02:00
Mike Frysinger
61fec9e2b3 rpmatch: fix previous commit w/C++ compilers
The throw markings on the inline func trigger errors when building with
C++.  Since this inline version doesn't throw any exceptions, just drop
the markings completely and be done with it.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-05-02 01:14:58 -04:00
Mike Frysinger
ecc6a1d158 rpmatch: simple inline version
Since rpmatch will match ^[Yy] and ^[Nn] regardless of locale, this
lets us create a simple inline version.  Newer procps versions use
this function.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-04-30 00:42:27 -04:00
Mike Frysinger
ea4389f7c1 epoll.h: sync with glibc
Since glibc has split out arch-specific stuff to bits/epoll.h, we can
pull that sanity back into our tree and drop the arch ifdefs.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-04-28 23:52:56 -04:00
Mark Salter
7bad8cf68b llseek: support __NR_llseek syscall
Older kernels use __NR__llseek for a 64-bit lseek syscall. Newer
kernels use __NR_llseek. This patch fixes the implementation of
lseek64 to use the __NR_llseek syscall if it exists.

Signed-off-by: Mark Salter <msalter@redhat.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-04-26 23:11:02 -04:00
Mark Salter
9f096becc4 getpgrp: fix fallback handling
The test for generating a stub for getpgrp was wrong and would
result in duplicate symbols when building without __NR_getpgrp,
but with __NR_getpgid and __NR_getpid.

A closer look at the getpgrp implementation using getpgid showed
that getpid was being called to pass the current pid to getpgid.
This is unnecessary because passing 0 to getpgid returns the
pgid of the current process.

This patch cleans up the getpgrp implementation and the stub test.

Signed-off-by: Mark Salter <msalter@redhat.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-04-26 22:48:22 -04:00
Bernhard Reutner-Fischer
9756397b62 arm: use PATH_MEM in ioperm()
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-04-26 16:30:42 +02:00
Mike Frysinger
b713a0b26f mmap64: Use correct type for offset parameter
Some arches check the size in INLINE_SYSCALL() and barf if it's
too big (i.e. a 64bit value getting truncated to 32bit).
Satisfy error-check on ppc32.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-04-26 09:24:38 +02:00
Bernhard Reutner-Fischer
aa3d9c9202 atomic.h: handle new mips R10K errata
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-04-25 14:13:49 +02:00
Mike Frysinger
c51edb3fae linuxthreads.old: refactor nommu logic a little to avoid mmu warning
Should be no functional changes; just fixing:

libpthread/linuxthreads.old/manager.c: In function 'pthread_free':
libpthread/linuxthreads.old/manager.c:707:9: warning:
	variable 'h_bottom_save' set but not used [-Wunused-but-set-variable]

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-04-24 01:39:15 -04:00
Mike Frysinger
84347a3c16 linuxthreads.old: pass back up saved_errno value in manager init
This matches the newer linuxthreads code, and fixes the build warning:

libpthread/linuxthreads.old/manager.c: In function 'pthread_handle_create':
libpthread/linuxthreads.old/manager.c:487:7: warning:
	variable 'saved_errno' set but not used [-Wunused-but-set-variable]

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-04-24 01:39:15 -04:00
Mike Frysinger
22eb98f555 linuxthreads.old: fix set-but-unused warning
Move spin_count down to the code block where it's used to fix the warning:

libpthread/linuxthreads.old/spinlock.c: In function '__pthread_lock':
libpthread/linuxthreads.old/spinlock.c:70:7: warning:
	variable 'spin_count' set but not used [-Wunused-but-set-variable]

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-04-24 01:39:15 -04:00
Mike Frysinger
9c8c3a7914 linuxthreads.old: fix typo in pthread_mutex_unlock hidden prototype
Reported-by: Tony Wu <tung7970@gmail.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-04-24 01:26:09 -04:00
Mike Frysinger
6f42e7e2cf getconf: include a newline in error messages
The normal error() func implicitly appends a newline, so make sure we do
the same.  Otherwise getconf outputs an error message like so:
prompt$ getconf -h
Unrecognized variable `-h'prompt$

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-04-22 23:36:42 -04:00
Mike Frysinger
0c3247e4c1 linuxthreads.old: only declare __pthread_xxx funcs hidden inside of libpthread
These stubs get used in libc as forwarding funcs, so we don't want them
labeled as hidden.  Otherwise, attempting to use them in other libraries
(like libdl) will result in references to symbols that only libpthread
provides.  Such as:
	/usr/bin/python2.6: can't resolve symbol '__pthread_mutex_lock' in lib '/lib/libdl.so.0'.

This also brings the old code in line with the newer linuxthreads.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-04-22 18:00:45 -04:00
Bernhard Reutner-Fischer
4b24c5ad36 sysconf: use getrlimit to determine ARG_MAX
getrlimit previously was only called for NPTL (why?), fix that to be
used everywhere.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-04-18 00:31:03 +02:00
Bernhard Reutner-Fischer
1d57dcdd9b config: Fix alphabetical sort order of targets
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-04-18 00:09:02 +02:00
Bernhard Reutner-Fischer
c3db6430eb ldd: silence warnings
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-04-18 00:06:52 +02:00
Bernhard Reutner-Fischer
15d28c8ce0 locale: avoid segfault freelocale()
PR 4964

Eric Nadler writes:
It looks to me like the base structure is not fully initialized
with 0 (only a subset of the structure is initialized).
This later results in a free of base->collate.index2weight in
_locale_set_l.
This free tries to free uninitialized memory and segfaults.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-04-17 23:19:16 +02:00
Bernhard Reutner-Fischer
521d842a5e test: Ignore various test objects in locale
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-04-17 23:15:40 +02:00
Ed W
ab3c5d5b0d wchar: Fix BOM emitting in iconv_open()
Fix incorrect output of BOM when converting charactersets by name. Only
affective when iconv/locale enabled.

Signed-off-by: Ed Wildgoose <lists@wildgooses.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-04-17 22:13:34 +02:00
Bernhard Reutner-Fischer
a2cc737844 ipc: eventually use stat64 in ftok()
PR 4201
ftok() always used 32bit stat

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-04-17 22:05:07 +02:00
Bernhard Reutner-Fischer
2dab3f5ed3 resolv: tiny shrinkage in /etc/hosts handling
-4b

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-04-17 18:35:05 +02:00
Bernhard Reutner-Fischer
81545fb106 resolv: remove unused variables
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-04-17 18:31:24 +02:00
Bernhard Reutner-Fischer
dcb6ac1354 resolv: Fix /etc/hosts for more than MAXALIASES aliases
PR networking/4916

Reserve space for the terminating 0 alias and zero out the
scratch-buffer so the last entry of the alias list is empty.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-04-17 18:30:34 +02:00
Bernhard Reutner-Fischer
238d11fd33 parse_config: tweak indentation
and shuffle tokens memsetting around.
No obj-code changes.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-04-17 18:28:33 +02:00
Alexander Komyagin
777aef5097 getaddrinfo(): avoid call to __check_pf() when not needed
__check_pf() function is called from getaddrinfo() and it calls
getifaddrs(), which is too much overhead especially if RSBAC-Net
is enabled. So with this patch __check_pf() is being called only
when AI_ADDRCONFIG hint flag is specified - just when we really
need that check.

Signed-off-by: Alexander Komyagin <komyagin@altell.ru>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-04-17 12:16:46 +02:00
Ed W
97214b87d6 inet: adjust handling of cacnonname in getaddrinfo
Posix says that canonname should use the text representation of an IP address
when a numerical nodename given
See: http://pubs.opengroup.org/onlinepubs/9699919799/functions/getaddrinfo.html

Signed-off-by: Ed Wildgoose <lists@wildgooses.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-04-17 11:06:27 +02:00
Mike Frysinger
f6f98ad866 mmap64: use INLINE_SYSCALL() helper
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-04-11 16:06:29 -04:00
Mike Frysinger
47009e1e1c mmap64: include stdint.h for uint64_t
Some targets include this implicitly, but pull it in explicitly for those
which don't to fix building for them.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-04-11 16:06:29 -04:00
Mike Frysinger
3d744d6d36 mmap64: always use unsigned 64bit offsets
The current code will sometimes cast the offset to an unsigned long.
On 32bit systems, that doesn't make much sense since we always know
that the off64_t type is 64bits.  So drop the ifdef logic, cast it
to an unsigned 64bit value, and then do the shift.

If the system is 32bits, and the address is still too large, then
there's really nothing we could do about it anyways, so the extra
ifdef logic wasn't helping.

URL: https://bugs.busybox.net/show_bug.cgi?id=3853
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-04-10 12:10:01 -04:00
Kevin Cernekee
5707bfc85c test/misc: Add tst-inotify
Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-04-08 17:00:57 -04:00
Kevin Cernekee
f6944967ac test/inet: Add tst-sock-nonblock
Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-04-08 17:00:57 -04:00
Kevin Cernekee
68107fe050 test/time: Add tst-timerfd
Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-04-08 17:00:57 -04:00
Kevin Cernekee
8272dea0fe test/signal: Add tst-signalfd
Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-04-08 17:00:56 -04:00
Mike Frysinger
e35896ed37 MAKEALL: add more arch aliases
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-04-08 16:10:37 -04:00
Mike Frysinger
f80f6e457f MAKEALL: fix cross-compiler lookup breakage after CROSS cleanup
Commit ae14cd49a8da6e62e35636 broke testing of multiple arches in one go.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-04-08 16:10:37 -04:00
Mike Frysinger
d25026df29 MAKEALL: also check for gnu suffixed toolchains too
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-04-08 16:10:36 -04:00
Mike Frysinger
7a06b2f9b4 alpha: trim crt code to fix build errors
Otherwise we get:
/tmp/cc14nHjG.s: Assembler messages:
/tmp/cc14nHjG.s: Error: .size expression for _init does not evaluate to a constant
/tmp/cc14nHjG.s: Error: .size expression for _fini does not evaluate to a constant

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-04-08 16:03:27 -04:00
Kevin Cernekee
c757a64fc0 signalfd.h: Use new "bits/" scheme for arch-specific flags
glibc has split off the arch-specific flag definitions (like
SFD_NONBLOCK) into <arch>/bits/signalfd.h, so that there are no longer
multiple redundant copies of the entire header file.  We will adopt the
same scheme in uClibc.

Special cases are included for: alpha mips sparc

hppa was omitted because it has not been updated in glibc.

All others use the common definition.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-04-08 16:03:27 -04:00
Kevin Cernekee
64a410fe9a timerfd.h: Use new "bits/" scheme for arch-specific flags
glibc has split off the arch-specific flag definitions (like
TFD_NONBLOCK) into <arch>/bits/timerfd.h, so that there are no longer
multiple redundant copies of the entire header file.  We will adopt the
same scheme in uClibc.

Special cases are included for: alpha mips sparc

hppa was omitted because it has not been updated in glibc.

All others use the common definition.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-04-08 16:03:27 -04:00
Kevin Cernekee
b7eefe49d4 inotify.h: Use new "bits/" scheme for arch-specific flags
glibc has split off the arch-specific flag definitions (like
IN_NONBLOCK) into <arch>/bits/inotify.h, so that there are no longer
multiple redundant copies of the entire header file.  We will adopt the
same scheme in uClibc.

Special cases are included for: alpha mips sparc

hppa was omitted because it has not been updated in glibc.

All others use the common definition.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-04-08 16:03:27 -04:00
Kevin Cernekee
0f45e8a279 inotify_rm_watch: Change second argument to int
2009-01-30  Ulrich Drepper  <drepper@redhat.com>

        [BZ #7040]
        * sysdeps/unix/sysv/linux/sys/inotify.h: Second parameter of
        inotify_rm_watch should have type int.

This change allows us to copy inotify.h verbatim from glibc into uClibc.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-04-08 16:03:26 -04:00
Kevin Cernekee
c10a5588b3 test: Ignore various test objects
Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-04-08 01:04:17 -04:00
Mike Frysinger
83968bbe1a regex: silence set-but-unused warnings
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-04-08 00:52:50 -04:00
Filippo Arcidiacono
2e9c1dc78e ldso: fix fdpic support broken from prelink patch
The fdpic support has been broken since the prelink support was added,
because it didn't take into account DL_LOADADDR_TYPE could be a different
type of ElfW(Addr).

Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-04-08 00:49:16 -04:00
Mike Frysinger
dd109669be bfin: set an invalid insn for abort
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-04-08 00:33:08 -04:00
Mike Frysinger
9b9ee161b5 buildsys: fix building with make-3.82+
We can't merge pattern and normal rules as newer make barfs:
	*** mixed implicit and normal rules.  Stop.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-04-08 00:19:52 -04:00
Bernhard Reutner-Fischer
57f058bb34 librt: convince spawn to compile for !LFS
Great to have this valuable family of high kwalitee functions in here.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-04-04 18:08:09 +02:00
Bernhard Reutner-Fischer
d7bd4cf1a5 stubs: Disregard LFS
Fixes handling of e.g. splice

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-04-04 17:58:48 +02:00
Bernhard Reutner-Fischer
30c4dd1f3a .gitignore: Ignore dump files
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-04-04 07:54:36 +02:00
Bernhard Reutner-Fischer
5e27f2f5b4 buildsys: remove duplicate rule around defconfigs
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-04-04 07:54:35 +02:00
Mike Frysinger
577c6ee118 fchmodat: fix handling of flags
The Linux syscall takes 3 args, not 4.  We have to process flags in
userspace ourselves.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-04-02 00:37:44 -04:00
Mike Frysinger
6287cacef2 ldso: mark _start hidden
There's no need to export this symbol, so mark them all hidden.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-03-29 00:14:58 -04:00
Bernhard Reutner-Fischer
238f52fdab stdio: Fix char signedness in _load_inttype()
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-03-28 09:44:53 +02:00
Bernhard Reutner-Fischer
03a008e27f buildsys: Fix typo in check-as-var handling
Missing second expansion with _v.
This led to wrong args passed down to assembler.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-03-27 13:42:22 +02:00
Mike Frysinger
7a8e2cdaeb ldso: bfin: add alias from __start to _start
On Blackfin systems, we have underscore prefixes in our ABI.  So instead
of _start, we use __start.  However, the makefile explicitly sets _start
as the entry point to support toolchains that implicitly use other symbols
as the default entry.  It's easy enough to add a hidden alias in the
Blackfin code for free to support this.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-03-27 00:07:45 -04:00
Mike Frysinger
e2a32f7514 spawn: fix building on no-mmu systems
We don't have fork() on no-mmu, so if we're going to end up calling it,
return ENOSYS instead.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-03-26 23:42:24 -04:00
Mike Frysinger
d8b4e7a80c spawn: do not require C99 style
Simple style tweak to build with older standards.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-03-26 23:42:24 -04:00
Mike Frysinger
54935c23e9 spawn: use glibc style to keep differences down
There's no point in reformatting the code style when we're sourcing
most of it from glibc.  Further, the changed style breaks with older
compilers, and pollutes the namespace with non-double leading under-
scores.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-03-26 23:42:24 -04:00
Mike Frysinger
ead38ba03a ldso: bfin: tweak style
No functional changes here.  We don't need line continuations as gcc
is smart enough to merge the multiple strings for us.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-03-26 23:42:24 -04:00
Mike Frysinger
0dc898bd03 arm: disable ioperm/iopl stubs
ARM always provides its own userspace funcs for ioperm/iopl.
They've never had syscalls.  So disable the stubs on ARM to
avoid multiple definition errors.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-03-26 22:28:50 -04:00
Mike Frysinger
f8ad954794 Revert "Fix redefinition of ioperm and iopl in stubs.c and arm/{ioperm.c,iopl.c}"
This reverts commit 3bcd031f97d61a8f732d865a0f4248aed2d191ab.

The arm code is supposed to provide its own userspace ioperm/iopl
functions.  They've never had system calls for these funcs.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-03-26 21:54:54 -04:00
Denys Vlasenko
db45ed982f time.c: Readability improvements - no code changes
Pulled assignments out of ifs, added whitespace around operation symbols.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-03-26 16:01:51 +02:00
Bernhard Reutner-Fischer
899a273126 stubs: unified from future
Future branch extends stubs with ret_enosys_stub.
Resolve conflicts, and use superset of future and current master.
Adjust posix_fadvise* accordingly.

Upon future merge, pick this master version as the final state.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-03-26 11:25:33 +02:00
Jason Woodward
3bcd031f97 Fix redefinition of ioperm and iopl in stubs.c and arm/{ioperm.c,iopl.c}
This fixes the following link failure:

  LD libuClibc-0.9.33.so
libc/libc_so.a(stubs.os): In function `sync_file_range':
stubs.c:(.text+0x0): multiple definition of `ioperm'
libc/libc_so.a(ioperm.os):ioperm.c:(.text+0x260): first defined here
libc/libc_so.a(stubs.os): In function `sync_file_range':
stubs.c:(.text+0x0): multiple definition of `iopl'
libc/libc_so.a(iopl.os):iopl.c:(.text+0x0): first defined here
collect2: ld returned 1 exit status
make[1]: *** [lib/libc.so] Error 1

Signed-off-by: Jason Woodward <jason.woodward@timesys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-03-26 10:30:38 +02:00
Carmelo Amoroso
77937735ab nptl: fix compiler warning due to missing prototype
libpthread/nptl/sysdeps/pthread/pt-longjmp.c: In function 'longjmp':
libpthread/nptl/sysdeps/pthread/pt-longjmp.c:27:3: warning: implicit declaration of function '__libc_longjmp' [-Wimplicit-function-declaration]
libpthread/nptl/sysdeps/pthread/pt-longjmp.c:28:1: warning: 'noreturn' function does return [enabled by default]

Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2012-03-26 09:58:03 +02:00
Carmelo Amoroso
089de40d57 nptl: fix compiler warning due to unused-but-set-variable
gcc 4.6.x raises useful warnings due to unused-but-set-variable,
This patch fixes the following one by using properly preprocessor
guard

libpthread/nptl/sysdeps/pthread/pthread_cond_timedwait.c: In function '__pthread_cond_timedwait':
libpthread/nptl/sysdeps/pthread/pthread_cond_timedwait.c:103:6: warning: variable 'ret' set but not used [-Wunused-but-set-variable]

Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2012-03-26 09:57:57 +02:00
Carmelo Amoroso
21d6091b0d inet:rpc: fix build in !NPTL case
__libc_once is not available / needed when multithreading support
is not enabled, so authnone_create() calls authnone_create_once()
directly.
When LT.{old,new} is used instead of NPTL, it needs to explicitly
include <bits/libc-lock.h> to get __libc_once to be visible.

Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2012-03-26 09:54:49 +02:00
Mike Frysinger
c3393906d8 ldso: use ELF_xxx()/ElfW() helpers
They expand into the same code, but using the ELF_xxx()/ElfW() macros
makes it much easier to spot similarities between code bases.

Acked-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Acked-by: Carmelo Amoroso <carmelo.amoroso@st.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-03-25 01:55:43 -04:00
Denys Vlasenko
867bac0c75 stdio: prevent retries on fclose/fflush after write errors
Some test results:

The longer patch posted at Sun 14:46:24 +0100 made my target system
unbootable.  I did not attempt to troubleshoot it, as we are focusing
our efforts on the shorter patch now.

The shorter patch posted at Mon 01:50:27 +0100 is a good start, but it
didn't completely fix the problem for me.  I am posting an updated
version with a few changes at the end of this message; the patched
uClibc 0.9.32.1 tree passes both of my test cases.

My changes:

1) Need to break out of the loop on "hard" errors.  Otherwise the
library call never returns:

open("/dev/null", O_RDONLY)             = 4
dup2(4, 1)                              = 1
write(1, "hello world\n", 12)           = -1 EBADF (Bad file descriptor)
write(1, "hello world\n", 12)           = -1 EBADF (Bad file descriptor)
write(1, "hello world\n", 12)           = -1 EBADF (Bad file descriptor)
write(1, "hello world\n", 12)           = -1 EBADF (Bad file descriptor)
...

2) Move all of the error handling logic back into the "else" clause.  In
particular, I believe we do not want to be checking errno unless
__WRITE() had indicated a failure, since the value may be undefined:

        if (errno == EINTR
         || errno == EAGAIN
         /* do we have other "soft" errors? */
        ) {

3) Whitespace/indentation consistency.

-- 8< --

From: Denys Vlasenko <vda.linux@googlemail.com>

Currently, uclibc retains buffered data on stdio write errors,
and subsequent fclose and fflush will try to write it out again
(in most cases, in vain).

Which results in something like this:

On Wednesday 26 January 2011 13:21, Baruch Siach wrote:
> Hi busybox list,
>
> I'm running the following command under strace (thanks Rob):
>
> echo 56 > /sys/class/gpio/export
>
> and I see the following output:
>
> write(1, "56\n", 3)                     = -1 EBUSY (Device or resource busy)
> write(1, "5", 1)                        = 1
>
> The first EBUSY is OK, since GPIO 56 is already requested. But the second
> write() attempt seems strange, and leads to an unwanted outcome. GPIO 5 gets
> exported.

This patch prevents that.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-03-25 01:53:17 -04:00
Ismael Luceno
0dcf66744f librt: add posix_spawn support
Signed-off-by: Ismael Luceno <ismael.luceno@gmail.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-03-25 01:45:23 -04:00
Steve Bennett
d1bc0c9915 microblaze: add sys/user.h
A microblaze-specific sys/user.h is needed for (e.g.) strace,
so use this version from glibc.

Signed-off-by: Steve Bennett <steveb@workware.net.au>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-03-25 01:40:43 -04:00
Carmelo Amoroso
b8bf046266 ldso: remove duplicated assignment with TLS symbol
The tpnt field is already set, so not needed to assign it again.

Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2012-03-15 11:55:35 +01:00
Carmelo Amoroso
bdff674a02 ldso:sh: fix compiler warning due to unused-but-set-variable
gcc 4.6.x raises useful warnings due to unused-but-set-variable,
This patch fixes the following one by using properly preprocessor
guard

In file included from ldso/libdl/libdl.c:129:0:
./ldso/ldso/sh/elfinterp.c: In function '_dl_do_reloc':
./ldso/ldso/sh/elfinterp.c:163:22: warning: variable 'tls_tpnt' set but not used [-Wunused-but-set-variable]

Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2012-03-14 15:58:49 +01:00
Bernhard Reutner-Fischer
dd44bf9438 buildsys: do not add empty obj to archives
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-03-13 19:49:38 +01:00
Denys Vlasenko
da4ef5cf6a __stdio_WRITE: make code more readable. No code changes
Pulled assignments out of ifs.
do {...} while (1); is a weird method of writing "loop forever",
thus rewrote it.
No code changes: objdump output is the same.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-03-11 13:33:49 +01:00
Mike Frysinger
60b9866848 librt: refactor source selection
Should make adding more knob control simpler as people only need
to modify one variable now (librt_filter_SRC).

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-03-05 01:37:57 -05:00
Khem Raj
3bab4144e8 arm: Do not use 'sed -r' to calculate IS_EABI
-r is not available on BSD sed so to keep
compatibility avoid using it.

Signed-off-by: Khem Raj <raj.khem@gmail.com>
2012-02-13 11:37:26 -08:00
Filippo Arcidiacono
260260f336 libdl: fix memleak for local scope of dlopened's needed libraries
Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2012-02-09 15:27:40 +01:00
Carmelo Amoroso
cdad7776b9 tests:math: fix build of math tests for SH4
Rename libm-test-ulps-sh4 to libm-test-ulps-sh as the ULPS file
is expected to match pattern libm-test-ulps-$(TARGET_ARCH).
Indeed "sh4" is the TARGET_SUBARCH.

Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2012-02-07 17:21:41 +01:00
Filippo ARCIDIACONO
ac33828db1 tests:libdl: add a new test for symbol scope issue in dlclose
Test case to trigger an issue raised by the new symbol scope design,
that was erroneously removing local symbol scope from the global one
too early while dl-closing a shared library.
Based on original test-case by Khem Raj

Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
Reported-by: Khem Raj <raj.khem@gmail.com>
2012-02-07 17:11:47 +01:00
Carmelo Amoroso
cf068ce38b tests: fix tests build (LDFLAGS_GNUHASH not longer defined)
Since commit a899b909, variable LDFLAGS_GNUHASH has been replaced
by CFLAG_-Wl--hash-style=gnu. This change has not been reported to
the tests buildsys.

Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2012-02-07 16:06:55 +01:00
Filippo ARCIDIACONO
72215487c0 tests: add OMIT logic to remove compilation flag.
Add OMIT logic to remove compilation flags when compiling libraries,
binaries( both host and target)

Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2012-02-07 12:07:37 +01:00
Carmelo Amoroso
c697912b3a inet:rpc: fix authnone_marshal in multithreading context
This is a port of glibc's fix by Zack Weinberg as reported
in http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=142312,
and discussed in http://sourceware.org/ml/libc-alpha/2002-04/msg00069.html
and following.

Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2012-02-07 07:55:45 +01:00
Khem Raj
ae0e6225db lstat/stat/fstat: Use 64bit version of syscall if available
This is needed for stat'ing loop devices > 255
since otherwise kernel returns EOVERFLOW becasue
it needs st_rdev/st_dev to be larger than 16bits but
in kernel it uses __old_kernel_stat for stat
syscall which has st_rdev/st_dev as unsigned short

Add a testcase

Signed-off-by: Khem Raj <raj.khem@gmail.com>
2012-02-05 12:11:26 -08:00
Khem Raj
812ae602fe Declare __err and pass it to INTERNAL_SYSCALL_NCS so subsequent macros can use it
Signed-off-by: Khem Raj <raj.khem@gmail.com>
2012-02-05 12:11:10 -08:00
Bernhard Reutner-Fischer
e288fdca58 bump version to 0.9.34-git
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-02-01 23:52:39 +01:00
Bernhard Reutner-Fischer
8c0b2c2886 Release 0.9.33
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-02-01 22:21:04 +01:00
Bernhard Reutner-Fischer
7c721d31e4 tmpnam, tempnam are obsolete in SUSV4
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-01-29 18:31:16 +01:00
Bernhard Reutner-Fischer
fba639dcdc handle signal-OBXSI.SUSv4.syms
A couple of sig functions are obsolete in SUSv4.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-01-29 18:23:10 +01:00
Bernhard Reutner-Fischer
29962e14a1 nptl_db: handle SUSv4-OB
pthread_getconcurrency / pthread_setconcurrency is OBSOLETE in SUSv4
so disable pthread debug support too

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-01-29 17:51:18 +01:00
Bernhard Reutner-Fischer
46aa707fc5 test: ignore undefined symbols for API
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-01-29 15:10:01 +01:00
Bernhard Reutner-Fischer
4891374bc3 config: ftw is SUSv4-obsolete
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-01-29 15:09:34 +01:00
Bernhard Reutner-Fischer
31f48281ed *: if !HAS_THREADS strong alias sigaction
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-01-28 21:57:49 +01:00
Bernhard Reutner-Fischer
83ce0cc4d5 buildsys: fixup sigaction handling
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-01-28 21:28:27 +01:00
Carmelo Amoroso
219aa9c2dd libubacktrace:arm: libgcc_eh.a not needed
Dummy symbol is __aeabi_unwind_cpp_pr is part of uclibc_shared.a

Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2012-01-27 13:38:42 +01:00
Bernhard Reutner-Fischer
eeacc7777e ldso: fix typo in debug message
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-01-27 13:19:05 +01:00
Bernhard Reutner-Fischer
7f02033e13 buildsys: add cppcheck wrapper script (correct one)
Also incooperate vapier's suggestion on how to set REAL_CC once

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-01-27 13:12:40 +01:00
Carmelo Amoroso
b80b28ee6f libc_arm: avoid multiple version of __aeabi_unwind_cpp_pr dummy code
Do not pollute libraries with its own implementation of __aeabi_unwind_cpp_pr1 code.
Just add it to uclibc_nonshared.a archive and share it.
This fixes build issue with static linking of application due to multiple symbol
definition in libgcc_eh-a and libpthread.a or librt.a

Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2012-01-27 10:05:09 +01:00
Bernhard Reutner-Fischer
80576869e1 buildsys: use single slash version of -print-whatever
The double slash variants are not documented (doc bug?) so better use
the single slash variants like we usually do.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-01-26 17:00:05 +01:00
Bernhard Reutner-Fischer
775e77bf2c buildsys: turn off forced EXTRA_WARNINGS on i386
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-01-26 15:26:47 +01:00
Bernhard Reutner-Fischer
549fa53225 *: silence some warnings
warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-01-26 15:15:23 +01:00
Bernhard Reutner-Fischer
ba48da4e3c syscall: flag ia64 syscall error path as unlikely
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-01-26 14:46:44 +01:00
Bernhard Reutner-Fischer
c72d608a9e arm: tweak comment
harmless copy'n paste error

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-01-26 14:46:44 +01:00
Richard Braun
eb72efd81e libc: fix signal handling in system()
When built without NPTL support (or for a sparc target), the system()
function doesn't conform to its specification. Namely, it uses signal()
to install/save/restore signal handlers, which may break applications
using custom handlers installed with sigaction(). In addition, it resets
the SIGCHLD handler to SIG_DFL instead of blocking the signal, which may
result in "lost" signals if a custom handler was installed.

Fix system() by replacing uses of signal() with appropriate calls to
sigaction() and sigprocmask().

Signed-off-by: Richard Braun <rbraun@sceen.net>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-01-23 21:22:06 -05:00
Carmelo Amoroso
3837739512 ldso/mips: fix symbol lookup for JUMP_SLOT and COPY relocations
Fill properly the sym_ref fields when invoking _dl_find_hash to lookup
symbols

Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
2012-01-23 16:21:30 -08:00
Carmelo Amoroso
99d28cc086 libdl: fix dlclose handling of symbol scope
Defer removal of the local scope of a dl-opened library after
all the destructors (of itself and related dependencies) are actually
get unloaded, otherwise any function registered via atexit()
won't be resolved.

Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com>
2012-01-23 16:21:18 -08:00
Khem Raj
b18b4210a8 Rules: Check for CROSS_COMPILE to be empty
In some case where CROSS is defined to be empty
we define CROSS_COMPILE ?= CROSS so at this point
it will be defined but will be empty so check
for the same

Signed-off-by: Khem Raj <raj.khem@gmail.com>
2012-01-23 16:10:51 -08:00
Khem Raj
a0d7a45875 libubacktrace: Add arm implementation
Arm has a different mechanism of getting
_Unwind_GetIP. Therefore we provide arch
specific backtrace file.

Signed-off-by: Khem Raj <raj.khem@gmail.com>
2012-01-23 16:10:39 -08:00
Khem Raj
bee3ea0f5a mips/libdl: Apply relocations after appending the new scope
Without this the relocations for the current shared object
are not resolved since the scope is not added to map yet

Signed-off-by: Khem Raj <raj.khem@gmail.com>
2012-01-23 16:10:21 -08:00
Denys Vlasenko
c4904bd81b i386/sigaction.c: slightly more readable form of [rt_]sigreturn definitions
No code changes

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2012-01-18 14:49:11 +01:00
Bernhard Reutner-Fischer
d8d695731d stubs: mark stubs as used
Avoids warning from -Wunused-function about the alias target that is
only used at link-time.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-01-18 09:14:30 +01:00
Bernhard Reutner-Fischer
20e4af5469 stdlib: use shorhand wur for realloc prototype
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-01-18 09:09:01 +01:00
Bernhard Reutner-Fischer
9617bbc95b buildsys: add cppcheck wrapper script
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-01-18 08:44:39 +01:00
Bernhard Reutner-Fischer
de5964178b libcrypt: shrink crypt() again - unmodularise
modularisation added too much bloat for no benefit, undo.

$ ../busybox/scripts/bloat-o-meter .lib.05/libcrypt-0.9.33-rc1-git.so lib/libcrypt-0.9.33-rc1-git.so
function                                             old     new   delta
crypt                                                130      46     -84
.rodata                                             2704       -   -2704
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 0/1 up/down: 0/-2788)         Total: -2788 bytes

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-01-18 08:41:18 +01:00
Bernhard Reutner-Fischer
7d7b96a392 nptl: .gitignore generated pt-crt{i,n}.S
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-01-18 08:18:13 +01:00
Bernhard Reutner-Fischer
d69bea22a1 tests: only test crypt if we have an impl
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-01-18 08:05:52 +01:00
Bernhard Reutner-Fischer
2b25a20e49 tests: add sha356/512 tests
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-01-18 08:05:52 +01:00
Bernhard Reutner-Fischer
e55d06752f tests: silence warnings in crypt
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-01-18 08:05:52 +01:00
Mike Frysinger
a4421e6052 buildsys: use = for --sort-section linker flag
The spaces aren't handled correctly (currently) when outputting the
CFLAGS version of the linker flag.

Reported-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-01-17 01:47:23 -05:00
Mike Frysinger
bc7c171f2b tests: mark all helper scripts +x
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-01-17 01:47:07 -05:00
Mike Frysinger
c3e6556491 buildsys: handle more clean targets
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-01-16 17:24:35 -05:00
Mike Frysinger
faf51f000e buildsys: fix handling of CFLAG_-W{a,l} vars
Need a little indirection/delayed evaluation to handle variables with
equal signs and commas in them.

Reported-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-01-16 17:16:19 -05:00
Mike Frysinger
fe60f8005b tests: tst-futimens1: add missing mode args to open()
Since we use O_CREAT with open(), need to make sure to pass in mode too.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-01-16 15:55:11 -05:00
Mike Frysinger
68bfc29827 tests: test-canon: include sys/stat.h for mkdir()
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-01-16 15:55:10 -05:00
Mike Frysinger
7064156385 tests: fdopen: add missing mode args to open()
We call open() with O_CREAT, so make sure we pass in the mode else
we might get build errors with fortify source.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-01-16 15:55:10 -05:00
Mike Frysinger
cf1840ba0a tests: opendir-tst1: add header for mknod()
Include sys/stat.h for mknod() prototype.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-01-16 15:55:10 -05:00
Mike Frysinger
386a22b920 tests: mmap2: ignore permission denied errors on /dev/mem
Non-root users can't open /dev/mem, so it makes it hard to pass.
Ignore that case.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-01-16 15:55:10 -05:00
Mike Frysinger
94bf930db1 buildsys: skip compiler flag checking for clean targets
As suggested by Bernhard, there is no point in evaluating the compiler's
flag availability when cleaning, so skip things in that case.  If there
are variables that change targets based on the flags, then things are
already broken and need fixing independently.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-01-16 15:55:10 -05:00
Khem Raj
1d8d1f6b91 mips/dlfcn.h: Disable RTLD_DEEPBIND
RTLD_DEEPBIND is not supported in uclibc

Signed-off-by: Khem Raj <raj.khem@gmail.com>
2012-01-16 08:48:27 -08:00
Mike Frysinger
27fb7ccf7e buildsys: simplify include_clean greatly
Since we want to clean out all the headers we symlinked into include/,
just use `find` to locate all the symlinks for us.  This simplifies it
greatly, and actually fixes bugs where we build for one arch, switch
to another, and then do a clean but the previous arch headers are left
behind.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-01-15 13:35:33 -05:00
Mike Frysinger
26242d9e53 buildsys: fix detection of silent make
The MAKEFLAGS variable contains all the flags without the leading dash.
From the GNU make manual:
	This variable is set up automatically by make to contain the flag
	letters that make received. Thus, if you do ‘make -ks’ then MAKEFLAGS
	gets the value ‘ks’.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-01-15 13:35:33 -05:00
Mike Frysinger
fe19f3c5e3 tests: skip redundant -Wstrict-prototypes setup
We inherit the top-level Rules.mak which sets up this flag for us,
so just rely on that.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-01-15 13:11:15 -05:00
Bernhard Reutner-Fischer
4db2caac1c libc: build abort with unwind-info for backtrace
If backtrace support is turned on, build raise() and abort() with
unwind info (fixup 4c9b7f3c21ff21c199e54bfad2fdf3445fa4573d).

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-01-15 12:27:41 +01:00
Markos Chandras
2b30ab7137 linuxthreads/signals: do not restore handler for invalid signal
Invalid signals have no handlers so when trying to restore the old
handler to a bad signal a SIGSEGV occurs. This is because the library
tries to store the old handler to an invalid memory area where it things
the bad signal lives.

URL: https://bugs.busybox.net/show_bug.cgi?id=4640
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-01-14 19:36:07 -05:00
Mike Frysinger
a899b909ab buildsys: cache build flags in vars
Running `make clean` atm takes like 20 seconds because every subdir
re-evaluates all the toolchain flags.  Add some helpers to automate
the process of setting up variables to cache the result of tests,
as well as the checking of an already set flag.

Now `make clean` takes like 2 seconds on my system.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-01-14 19:32:29 -05:00
Carmelo Amoroso
93a11d8bb2 libubacktrace: use -asynchronous-funwind-tables rather than -funwind-tables
From gcc documentation, we can read:
" ...
-fasynchronous-unwind-tables
    Generate unwind table in dwarf2 format, if supported by target
    machine. The table is exact at each instruction boundary, so it can be
    used for stack unwinding from asynchronous events (such as debugger or
    garbage collector)
..."

So it seems better rather than using -funwind-tables (glibc seems to prefer
-fasynchronous-unwind-tables).

Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
2012-01-13 12:27:29 +01:00
Carmelo Amoroso
4c9b7f3c21 libc: allow to backtrace out of abort call
Build raise and abort function with dwarf2 info by using
-fasynchronous-unwind-tables to make backtrace() working across a
call to abort.

A scenario where it could be useful is within a signal handler that
wants to dump a backtrace when catching some signal (i.e SIGABRT).
Without having abort & raise built with DWARF2 information, it is not
possible for the libgcc stack unwinder to walk through the call stack
out of the abort/raise function.

Impacts in terms of size are really limited

Current
   text    data     bss     dec     hex filename
    164       0       0     164      a4 ./libpthread/nptl/sysdeps/unix/sysv/linux/raise.os
    164       0       0     164      a4 ./libpthread/nptl/sysdeps/unix/sysv/linux/raise.oS
    220      24       4     248      f8 ./libc/stdlib/abort.os

With (-fasynchronous-unwind-tables)

   text    data     bss     dec     hex filename
    216       0       0     216      d8 ./libpthread/nptl/sysdeps/unix/sysv/linux/raise.os
    216       0       0     216      d8 ./libpthread/nptl/sysdeps/unix/sysv/linux/raise.oS
    280      24       4     308     134 ./libc/stdlib/abort.os

Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
Acked-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-01-13 12:22:59 +01:00
Mike Frysinger
a7123b4744 config: remove some redundant words in the menus
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-01-02 03:02:53 -05:00
Mike Frysinger
97774e90d6 ldso: setup search path even when there are no "/"
If people use an interp path such as "ld.so", then there is no "/" found,
and we end up dereferencing a NULL pointer.  Simplify the logic by having
a relative interp path like that be the same as "" (which the code later
on interprets as $PWD).

While we're here, document some of the nuances of this code.

Reported-by: Ignacy Gawędzki <uclibc@qult.net>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-01-02 03:02:53 -05:00
Mike Frysinger
b3436addb5 ldso: simplify interp path search logic
The setup logic is duplicated, so unify it in a local func.

Mark the variable const while we're doing this, and add missing
ifdef protection to the header that declares it availability.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-01-02 03:01:41 -05:00
Denys Vlasenko
d5fd9afa76 getpass: s/sizeof(buf)-1/sizeof(buf)/ in fgets
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-01-01 17:31:40 +01:00
Bernhard Reutner-Fischer
83781e426e bump version to 0.9.33-rc1-git
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-12-30 12:40:53 +01:00
Bernhard Reutner-Fischer
8b443d4425 release 0.9.33-rc1
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-12-30 12:38:44 +01:00
Denys Vlasenko
38b3cd5f04 getpass: several fixes
fixes bogus fgets error check
fixes bogus strlen() < 0 check
switches off buffering regardless of tcgetattr() success
prints newline even on error or if there was no '\n' on input
uses sizeof(buf) instead of PWD_BUFFER_SIZE

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2011-12-23 14:24:12 +01:00
Carmelo Amoroso
8a8434b367 libubacktrace: use -funwind-tables rather than -fexecptions
For backtrace to work is enough to use -funwind-tables instead
of -fexceptions.

Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2011-12-22 15:30:20 +01:00
William Pitcock
3ac5fd7eca libcrypt: add support for SHA256-CRYPT password hashing
This is based on Ulrich Drepper's implementation in GLIBC, but hacked up to work
in uClibc.  The differences from the GLIBC version are as follows:

- b64_from_24bit() has been converted into a macro
- Usage of GLIBC-isms (such as libc_freeres_ptr) have been removed

It is enabled by the UCLIBC_HAS_SHA256_CRYPT_IMPL configuration symbol.  You must
have UCLIBC_HAS_CRYPT_IMPL enabled as well.

Signed-off-by: William Pitcock <nenolod@dereferenced.org>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-12-22 14:07:08 +01:00
William Pitcock
4c24dabb9c libcrypt: add support for SHA512-CRYPT password hashing
This is based on Ulrich Drepper's implementation in GLIBC, but hacked up to work
in uClibc.  The differences from the GLIBC version are as follows:

- b64_from_24bit() has been converted into a macro
- Usage of GLIBC-isms (such as libc_freeres_ptr) have been removed

It is enabled by the UCLIBC_HAS_SHA512_CRYPT_IMPL configuration symbol.  You must
have UCLIBC_HAS_CRYPT_IMPL enabled as well.

Signed-off-by: William Pitcock <nenolod@dereferenced.org>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-12-22 13:59:24 +01:00
William Pitcock
40c426ae8f libcrypt: make crypt() itself more modular
By using a function table, we can more cleanly support new crypt
implementations, such as SHA256 ($5$) and SHA512 ($6$).

Signed-off-by: William Pitcock <nenolod@dereferenced.org>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-12-22 11:28:05 +01:00
Timo Teräs
f69319d5a7 libdl: rudimentary locking for dlopen/dlsym/dlclose
This implements big-dlfcn lock to allow multithreaded usage of
dlopen/dlsym/dlclose. We should really clean up the dl code so
we can use more fine grained locking or even RCU where appropriate.
But at least we won't crash now.

Signed-off-by: Timo Teräs <timo.teras@iki.fi>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-12-22 10:35:35 +01:00
Natanael Copa
bc4bc07d93 sys/queue.h: update to eglibc version
Xen needs SIMPLEQ_* queue types which was not provided from the old
uclibc queue.h.

Use same implementation as eglibc.
Grabbed from: http://www.eglibc.org/svn/trunk/libc/misc/sys/queue.h

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-12-22 10:31:50 +01:00
Mike Frysinger
09dfeda9cf x86_64: add PLT bypass for __sigsetjmp
The current x86_64 setjmp helpers incur a reloc, so fix that up.

$ readelf -r lib/libc.so.0
...
Relocation section '.rela.plt' at offset 0xb058 contains 10 entries:
  Offset          Info           Type           Sym. Value    Sym. Name + Addend
000000236010  02a400000007 R_X86_64_JUMP_SLO 000000000000b3c4 __sigsetjmp + 0
...

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-12-03 12:55:45 -05:00
Mike Frysinger
46fa3f2fdc getutid: add a hidden def
The pututline func calls getutid, so add a hidden def for
it to avoid plt relocs:

$ readelf -r lib/libc.so.0
...
Relocation section '.rela.plt' at offset 0xb058 contains 11 entries:
  Offset          Info           Type           Sym. Value    Sym. Name + Addend
000000236000  01cf00000007 R_X86_64_JUMP_SLO 00000000000190ab getutid + 0
...

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-12-03 12:18:30 -05:00
Mike Frysinger
0e9ee6c27f ldso: bfin: fix sram_flags init
An earlier version had this, but was lost as code was shuffled around.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-11-27 13:04:32 -05:00
Mike Frysinger
074129d4b2 ldso: bfin: shrink sram mapping func
The L1 data and L2 code paths duplicate a lot, so unify them.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-11-27 05:01:39 -05:00
Mike Frysinger
d2dde140de ldso: fdpic: clean up style
There should (hopefully) be no functional changes here.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-11-27 05:01:39 -05:00
Mike Frysinger
0d08b44961 ldso: fdpic: unify duplicate bfin/frv logic
Much of the logic in the bfin/frv subdirs is FDPIC specific and not arch
specific.  So start a new fdpic/ subdir to keep common things.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-11-27 05:01:38 -05:00
Mike Frysinger
0405cb8f5b make ARRAY_SIZE commonly available internally
Some places have opencoded the ARRAY_SIZE macro, so move it to a global
internal location so other places can leverage it.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-11-27 04:33:03 -05:00
Mike Frysinger
9ca7a065be ldso: use __func__ rather than __FUNCTION__
The former is part of a standard (C99) while the latter is not.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-11-27 00:30:06 -05:00
Mike Frysinger
a796d26367 buildsys: drop manual TARGET_SUBARCH .config lookup
We source the .config file, so there should be no need to manually extract
it.  If the sourcing doesn't work, then a lot of things break in this file.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-11-26 22:36:49 -05:00
Mike Frysinger
1bb0e53db3 include/: ignore new sys/eventfd.h symlink
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-11-26 22:36:48 -05:00
Carmelo Amoroso
ae14cd49a8 buildsys: s/CROSS/CROSS_COMPILE/g
Use CROSS_COMPILE instead of CROSS as other projects are doing
(i.e. kernel, busybox, buildroot).
CROSS is still supported for backward compatibility only

Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2011-11-25 06:31:07 +01:00
Bernhard Reutner-Fischer
c79f09a9a3 nptl: add missing pt-tempname.c
fix bd3c1a2495cbcb51b606f8e4892fcd127f91e645 forgotten file.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-11-24 19:22:59 +01:00
Carmelo Amoroso
1b6c5c4f32 libc: do not rely upon ulimit kernel syscall.
On several architectures __NR_ulimit syscall number is currently
defined but it is remapped onto sys_ni_syscall, while on other
architectures they are not longer defined.
So use {get,set}rlimit only to implement ulimit interface.

It fixes LTP ulimit01 test case.

Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
Acked-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-11-23 17:24:54 +01:00
Filippo Arcidiacono
9b42da7d05 libdl: fix size parameter when unmap library in dlclose
Fix size parameter when unmap a library by means of dlclose, by
taking into account the p_vaddr of first PT_LOAD segment, so it works
also for prelinked shared objects.
Unmapping of dlopen shared libraries is broken since
94cc6edb78a12655c0602a246fa1cbdc8c6d0ad9

Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2011-11-23 16:12:09 +01:00
Mike Frysinger
117a32a63b stdio: add support for "e" flag with fopen()
Support this useful glibc extension for optionally setting O_CLOEXEC
on fopen streams.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-11-20 02:47:50 -05:00
Mike Frysinger
4a2b0641a3 libcrypt: do not cast away const of key/salt
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-11-20 02:35:00 -05:00
Bernhard Reutner-Fischer
69cba61dd2 libubacktrace: use .so.$(ABI_VERSION)
Thanks to William Pitcock for noticing

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-11-18 08:49:25 +01:00
Bernhard Reutner-Fischer
e548078de1 nptl: sem_open: use open64 if LFS
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-11-18 08:24:19 +01:00
Bernhard Reutner-Fischer
bd3c1a2495 misc: hide __gen_tempname
fix signed vs. unsigned comparison warnings while at it

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-11-17 14:46:07 +01:00
Bernhard Reutner-Fischer
1ea3c5e6f1 stdio: hide _stdio_validate_FILE
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-11-17 11:33:35 +01:00
Bernhard Reutner-Fischer
90d597eac8 regex_old: make some internal helpers static
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-11-17 11:25:52 +01:00
Bernhard Reutner-Fischer
fbe324024d inet: hide relocations
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-11-17 11:01:04 +01:00
Bernhard Reutner-Fischer
5a2b42a483 unistd: hide relocations
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-11-17 10:55:29 +01:00
Bernhard Reutner-Fischer
dcf56488da resolv: hide relocations
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-11-17 10:52:25 +01:00
Bernd Schmidt
eb51b7f135 Add a C6X-specific ipc.h.
Signed-off-by: Bernd Schmidt <bernds@codesourcery.com>
2011-11-14 14:46:49 +01:00
Carmelo Amoroso
632dbe851c buildsys: do not install ld.so linker script
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2011-11-08 14:36:58 +01:00
Jason Woodward
f1505e1581 libubacktrace: Conditionally link libgcc_eh
When libubacktrace is not enabled there is no need to link in libgcc_eh
Fixes bootstrap failures with (gcc-4.5.x) stage1 compilers that --disable-shared

Signed-off-by: Jason Woodward <jason.woodward@timesys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-11-08 09:16:15 +01:00
Bernhard Reutner-Fischer
5f1678b1df libm: pass CFLAGS to e500 fenv
As noted by Jason Woodward

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-11-08 09:14:43 +01:00
Jason Woodward
c894249c87 honor UCLIBC_HAS_FENV for e500
Signed-off-by: Jason Woodward <jason.woodward@timesys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-11-08 08:55:42 +01:00
Jason Woodward
beb1c62829 Fix e500 fpu libm build
Define libm_ARCH_fpu_OUT in libm/powerpc/e500/Makefile.arch as it is used
in libm/powerpc/e500/fpu/Makefile.arch

 libm_ARCH_OBJ:=$(patsubst $(libm_ARCH_fpu_DIR)/%.c,$(libm_ARCH_fpu_OUT)/%.o,$(libm_ARCH_SRC))

This appears to have been broken since cd3a494e99fa4bcad1c2a621b71361005528bead

Signed-off-by: Jason Woodward <jason.woodward@timesys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-11-08 08:54:16 +01:00
Henning Heinold
19dd090a0f libc: flesh out linux scheduler functions
Most stuff was taken from the eglibc.

Signed-off-by: Henning Heinold <heinold@inf.fu-berlin.de>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-11-07 20:57:02 +01:00
Timo Teräs
0c7690f6a5 ldso: support RTLD_NOLOAD
So application query if specified module is loaded or not with
dlopen.

Signed-off-by: Timo Teräs <timo.teras@iki.fi>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-11-07 18:10:32 +01:00
Bernhard Reutner-Fischer
515d544331 stdlib: add qsort_r
GNU extension like qsort but takes a 3 parameter comparision function.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-11-07 09:24:30 +01:00
Bernhard Reutner-Fischer
84144d142c powerpc: Fix typo in clone()
Thanks to strauman at slac stanford edu for noticing

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-11-04 13:02:09 +01:00
Jean-Christian de Rivaz
d10475f823 Add stub for eventfd.
Warn if the enventfd() function is not implemented.

Signed-off-by: Jean-Christian de Rivaz <jc@eclis.ch>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-11-04 11:44:26 +01:00
William Pitcock
7ae07d4f02 libm: implement a generic sincos().
We already provide sincos() on some archs, so we should ship a generic version.

Signed-off-by: William Pitcock <nenolod@dereferenced.org>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-11-04 10:30:19 +01:00
William Pitcock
2086015b9a libm: add cabsf() and cabsl() functions.
Signed-off-by: William Pitcock <nenolod@dereferenced.org>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-11-04 10:25:21 +01:00
William Pitcock
6471fc450b libm: implement generic cexp(), cexpf() and cexpl().
The cexp*() family of functions is defined by the C99 math standard as
implementing exponential functions for complex types.

Signed-off-by: William Pitcock <nenolod@dereferenced.org>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-11-04 10:24:57 +01:00
Bernhard Reutner-Fischer
25790afdad config: document eventfd
in LINUX_SPECIFIC

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-11-04 10:23:06 +01:00
Bernhard Reutner-Fischer
2f88f917c2 setegid: use setresgid conditionally
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-11-02 17:31:51 +01:00
Bernhard Reutner-Fischer
3dbeeb8395 stubs: remove leftover undefs
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-11-02 17:28:15 +01:00
Bernhard Reutner-Fischer
fafa38973d buildsys: eventually remove sys/eventfd.h
rm sys/eventfd.h unless linux_specific was chosen

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-11-02 17:00:52 +01:00
Bernhard Reutner-Fischer
d36bc81bb4 stubs: handle linux module functions
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-11-02 16:49:04 +01:00
Bernhard Reutner-Fischer
04df27ce98 stubs: handle linux-specific
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-11-02 16:49:04 +01:00
Bernhard Reutner-Fischer
3c331f4519 stubs: fix inverted socket logic
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-11-02 16:21:41 +01:00
Bernhard Reutner-Fischer
5724141a03 stubs: undef linux specific unless they were asked for
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-11-02 16:21:41 +01:00
Jean-Christian de Rivaz
9ed163dc0e Add eventfd support.
Hello,

I whould like to share this simple patch that add the eventfd call to
uClibc. Please review so it can be accepted to be merged.

Jean-Christian

Signed-off-by: Jean-Christian de Rivaz <jc@eclis.ch>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2011-10-31 06:54:06 +01:00
Rob Landley
015179a2c8 sparc: fix build for linuxthreads.old
sparc target has assembly implementations of clone.S that doesn't
get used, and thus the build breaks.  Also, sparc is missing a header file in
pthreads.old that exists in pthreads.new.

Signed-off-by: Rob Landley <rob@landley.net>
Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
2011-10-27 07:32:55 -07:00
Carmelo Amoroso
e0b741c2cb resolver: add a dependencies for DNS resolver feature
DNS resolver needs at least IPV4 or IPV6 support enabled
to be correctly built. Add such dependency.

Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2011-10-27 12:48:31 +02:00
Bernhard Reutner-Fischer
eb7d589d07 pthreads: fix build when DNS resolver is not enabled.
Resolver state is only available if DNS resolver is enabled.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2011-10-27 12:41:26 +02:00
Rob Landley
24a3d38605 sh: fix build for SH in !NPTL case
Signed-off-by: Rob Landley <rob@landley.net>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2011-10-27 12:32:34 +02:00
Carmelo Amoroso
abdfc79373 linuxthreads: fix typo in __UCLIBC_HAS_IPv4__ macro
IPv4 should has 'V' capital letter.

Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2011-10-27 10:00:58 +02:00
Carmelo Amoroso
e4aa966cf2 ldso: let people disable to lookup into LD_LIBRARY_PATH
On hardened system it could be useful to disable the use
of LD_LIBRARY_PATH.

Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2011-10-25 12:28:51 +02:00
Carmelo Amoroso
6d71db548d ldso: minor fixes to implicit search path
Do not defined _dl_ldsopatch if implicit search path if not enabled,
and avoid to call search_for_named_library (even if it is able to handle
NULL search path).

Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2011-10-25 11:26:50 +02:00
Carmelo Amoroso
7846b17d4c ldso: disable the implicit path search in stand-alone mode as well
Honour LDSO_SEARCH_INTERP_PATH knob option also when running in
stand-alone mode.

Signed-off-by: Rune <u-uclibc-y2lt@aetey.se>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2011-10-25 10:24:06 +02:00
Carmelo Amoroso
b9055a68dd config: add support for <custom>_defconfig
Add support for platform specific and/or custom defconfig
per arch. They have to be suffixed by '_defconfig' and are
automatically detected and displayed by issuing 'make ARCH=<arch> help'.

Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2011-10-25 06:54:34 +02:00
Carmelo Amoroso
eee423c9ed config: revise defconfigs strategy
Revise the way defconfigs are defined, by renaming them
from defconfigs/<arch> to defconfigs/<arch>/defconfig.
It allows to have multiple defconfigs per arch.

Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2011-10-25 06:44:11 +02:00
Carmelo Amoroso
4ba7f26cb9 config: tidy-up of config targets
Introduce two local variables for 'conf' and 'mconf' binaries.
Use $^ automatic variable to invoke [m]conf tool.

Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2011-10-25 06:35:10 +02:00
Bernhard Reutner-Fischer
bb8d500a75 resolv: fix memory leak
Timothy Holdener writes:
small memory leak in __dns_lookup() when the A record
in the DNS answer is preceded by one or more CNAME records.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-10-21 08:23:22 +02:00
Bernhard Reutner-Fischer
e3fea65f50 resolv: commentary typo fix
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-10-20 18:55:51 +02:00
Bernhard Reutner-Fischer
40f8f5f033 gethostbyname_r: set correct h_errno upon failure
previously gethostbyname_r(ipv6.google.com);herror("ERROR:") gave
Answer name = |ipv6.google.com|
Answer type = |5|
herrno=1
h_errno=0
ERROR:: Error 0

herrno=1
h_errno=1
ERROR:: Unknown host

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-10-20 18:55:46 +02:00
Bernhard Reutner-Fischer
984e1c1e44 resolv: fix compilation
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-10-20 18:55:37 +02:00
Carmelo Amoroso
54a1c7691b libdl: remove _dl_ldsopath from libdl.a
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2011-10-19 16:30:57 +02:00
Carmelo Amoroso
1155493454 ldd: take LD_LIBRARY_PATH into account
Extend the environment variables adding the LD_LIBRARY_PATH
if actually passed when doing shared library tracings through
the ld.so trace capability.
This is possible only using the system dynamic linker in stand-alone
mode to avoid any vulnerability.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2011-10-18 11:23:55 +02:00
Bernhard Reutner-Fischer
36ea1d442b Config.in: fix erroneously deleted line
blame e9d74358093b61e2e597fa9e066ba0468df14cba

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-10-14 14:11:01 +02:00
Bernhard Reutner-Fischer
bbf31ba768 ldso: silence harmless warning for !LDSO_PRELINK_SUPPORT
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-10-14 13:09:16 +02:00
Guillaume Bourcier
47f3da1cf4 libc: fix daylight saving time handling
The algorithm computing daylight saving time incorrectly adds a day for
each month after January for leap years. The clock shift from/to DST can
be delayed if the last Sunday of a transition month is exactly seven
days before the first of the following month.

This change adds a day for the February month only.

Signed-off-by: Guillaume Bourcier <guillaumebourcier@free.fr>
Signed-off-by: Richard Braun <rbraun@sceen.net>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2011-10-12 13:23:13 +02:00
Mike Frysinger
7eaca202b9 ldso: unify pread syscall definition
A few arches want pread() defined, so move it to common code.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-10-06 22:38:20 +02:00
Mike Frysinger
767cb4f4f5 ldso: bfin/frv: drop dead simulator code
Nowhere do we define DYNAMIC_LOADER_IN_SIMULATOR, so drop the little bit
of code that depends on it.  At least in the Blackfin case, we can run an
FDPIC ldso just fine under the simulator without hacks.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-10-06 22:37:47 +02:00
Mike Frysinger
e2f889a746 ldso: merge duplicate dl-syscalls.h code to common header
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-10-06 22:34:36 +02:00
Ryan Flux
331b437172 microblaze mmu/elf/shared lib support
microblaze can either be with mmu or without
If with, use elf rather than flat, and support shared libs

Signed-off-by: Ryan Flux <ryan.flux@emsolutions.com.au>
Signed-off-by: Steve Bennett <steveb@workware.net.au>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-10-06 22:22:25 +02:00
Steve Bennett
cc5499a6a6 microblaze linux has no SDA support
The linker does not set up the Small Data Area symbols,
_SDA_BASE_ and _SDA2_BASE_ so don't try to resolve them

Signed-off-by: Ryan Flux <ryan.flux@emsolutions.com.au>
Signed-off-by: Steve Bennett <steveb@workware.net.au>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-10-06 22:22:25 +02:00
Steve Bennett
c13e46c982 microblaze can be either big or little endian
Signed-off-by: Steve Bennett <steveb@workware.net.au>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-10-06 22:22:25 +02:00
Ryan Flux
3655ce8f05 microblaze has long double support too
Signed-off-by: Ryan Flux <ryan.flux@emsolutions.com.au>
Signed-off-by: Steve Bennett <steveb@workware.net.au>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-10-06 22:22:25 +02:00
Steve Bennett
ce01d0f059 Use the generic bits/select.h for microblaze
This avoids warnings about type-punned pointers

Signed-off-by: Steve Bennett <steveb@workware.net.au>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-10-06 22:22:25 +02:00
Mike Frysinger
01d4f7b456 tests: ignore new inet test
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-10-01 15:41:18 -04:00
Mike Frysinger
8744dc1723 tests: add fallback for mktemp()
If SuSv3 legacy support is disabled, then mktemp() isn't available, and
we end up getting a lot of build errors.  So add a fallback built on top
of tempnam() since that currently cannot be disabled.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-10-01 15:39:46 -04:00
Mike Frysinger
d174d2c465 ldso: x86_64: delete unused variable
gcc informed me:
In file included from ldso/ldso/ldso.c:46:0:
ldso/ldso/x86_64/elfinterp.c: In function '_dl_do_lazy_reloc':
ldso/ldso/x86_64/elfinterp.c:294:6: warning:
	variable 'symtab_index' set but not used [-Wunused-but-set-variable]

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-10-01 15:12:16 -04:00
Mike Frysinger
c44d37d6a2 ldso: constify reloc array itself
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-10-01 15:10:39 -04:00
Denys Vlasenko
82f8d0bce1 Defeat compiler optimization which assumes function addresses are never NULL
From email:
A warning for people who can be hit by the same or similar issue:
gcc 4.1.2 with -march=i486 here with -Os and even with -O2 or -O
is "optimizing away" the check
       if (_stdio_term)
in libc/stdlib/_atexit.c
which results in a "call 0" and a segfault at exit
if you do not happen to link in stdio.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2011-09-15 16:59:21 +02:00
Bernhard Reutner-Fischer
200895dab8 config: tweak help text
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-09-12 17:30:34 +02:00
Denys Vlasenko
021b0aa3c4 resolv: simple optimizations and style/readability fixes
text           data     bss     dec     hex filename
-   2915              0       0    2915     b63 libc/inet/ns_name_old.o
+   2656              0       0    2656     a60 libc/inet/ns_name.o
-    958              0       0     958     3be libc/inet/ns_parse_old.o
+    898              0       0     898     382 libc/inet/ns_parse.o

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-09-10 03:01:33 +02:00
Carmelo Amoroso
8ed76f5abc ldso: fix build with PRELINK enabled and !TLS
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2011-08-26 10:26:17 +02:00
Bernhard Reutner-Fischer
fdd1868050 ldso: add missing include
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-08-26 09:50:41 +02:00
Daniel Mack
120d4100b5 inet: build all res_* and ns_* functions conditionally
This patch changes the build system so that all DNS resolver related
functions (ie, those starting with dn_, ns_ and res_) are only built if
UCLIBC_HAS_RESOLVER_SUPPORT is set. This means that the libc will lack
support for things that existed in the library before unless this new
config option is set. On the other hand, if users really need support
for resolver functions, they now get a more complete set, and the
library is smaller than before it is deselected.

Signed-off-by: Daniel Mack <zonque@gmail.com>
2011-08-26 09:29:54 +02:00
Daniel Mack
77fbcc8440 include/resolv.h: provide __res_state._u even if !__UCLIBC_HAS_IPV6__
This struct is used for IPv4 as well, so only make the members
conditional that are purely used by IPv6.

Signed-off-by: Daniel Mack <zonque@gmail.com>
2011-08-26 09:29:54 +02:00
Daniel Mack
7f74de5d4d inet/resolv: add res_ninit and res_nclose
Some reordering of existing functions was necessary in order to provide
this functionality.

Signed-off-by: Daniel Mack <zonque@gmail.com>
2011-08-26 09:29:54 +02:00
Daniel Mack
a863daff68 inet/resolv: add res_mkquery
Signed-off-by: Daniel Mack <zonque@gmail.com>
2011-08-26 09:29:53 +02:00
Daniel Mack
5f6fe1fca1 inet/resolv: add ns_initparse, ns_parserr, ns_skiprr and ns_msg_getflag
There are build 'ifdef L_ns_parse'.

Signed-off-by: Daniel Mack <zonque@gmail.com>
2011-08-26 09:29:53 +02:00
Daniel Mack
95ff96497d inet/resolv: add dn_skipname and ns_name_skip
One uses the other, so add them in one go.

Signed-off-by: Daniel Mack <zonque@gmail.com>
2011-08-26 09:29:53 +02:00
Daniel Mack
05ff11da8f inet/resolv: Add dn_comp
Signed-off-by: Daniel Mack <zonque@gmail.com>
2011-08-26 09:29:53 +02:00
Daniel Mack
e5153a7778 inet/resolv: add ns_name_pton, ns_name_pack and ns_name_compress
These are built '#ifdef L_ns_name'

Signed-off-by: Daniel Mack <zonque@gmail.com>
2011-08-26 09:29:53 +02:00
Daniel Mack
466f11015f inet/resolv: add ns_{put,get}{16,32}
This patch introduces a new config directive
'UCLIBC_HAS_RESOLVER_SUPPORT' and adds the new symbols conditionally.

Signed-off-by: Daniel Mack <zonque@gmail.com>
2011-08-26 09:29:52 +02:00
Daniel Mack
6ca582ff96 libc/inet/resolv.c: comment on #endif lines
While reading this file, I found it rather confusing to relate the
"endif" lines to their opening counter-part. This patch adds comments to
most of these lines to denote what the actually do.

Signed-off-by: Daniel Mack <zonque@gmail.com>
2011-08-26 09:29:52 +02:00
Daniel Mack
e9d7435809 extra/Configs/Config.in: drop "default n" lines
"default n" is the default default. No need to mention it explicitly.

Signed-off-by: Daniel Mack <zonque@gmail.com>
2011-08-26 09:29:52 +02:00
Kevin Cernekee
966adfe8ed ldso/mips: Clean up warnings
Trivial fixes for these warnings:

  CC ldso/libdl/libdl.oS
In file included from ldso/ldso/ldso.c:46:0:
ldso/ldso/mips/elfinterp.c:88:1: warning: no previous prototype for '__dl_runtime_pltresolve'
ldso/ldso/ldso.c: In function '_dl_get_ready_to_run':
ldso/ldso/ldso.c:475:5: warning: assignment makes pointer from integer without a cast
In file included from ldso/ldso/ldso.c:1097:0:
ldso/ldso/dl-elf.c: In function '_dl_load_elf_shared_library':
ldso/ldso/dl-elf.c:811:3: warning: assignment makes pointer from integer without a cast

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2011-07-27 09:40:37 +02:00
Kevin Cernekee
a2f827c7c2 ldso/mips: dlsym() incorrectly matches undefined symbols
check_match() relies on checking for (sym->st_value == 0) to see if the
symbol is undefined.  This works reasonably well on most architectures,
such as ARM or i386:

$ readelf -s /lib32/libcap.so.2 | grep -E "\<malloc\>"
    17: 00000000     0 FUNC    GLOBAL DEFAULT  UND malloc@GLIBC_2.0 (2)

However, on MIPS, libbfd puts nonzero data in the st_value field to
facilitate resetting the symbol's GOT entry if the library that defines
the symbol gets unloaded:

$ mipsel-linux-readelf -s libfoo.so | grep -E "\<malloc\>"
    74: 00003140     0 FUNC    GLOBAL DEFAULT  UND malloc

This can cause check_match to report a false positive when examining the
external symbol reference.  Consequently dlsym() will return a bad pointer
to the caller.

Use the special MIPS logic from glibc-ports-2.13 to avoid this situation.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2011-07-27 09:40:24 +02:00
Kevin Cernekee
2d4243ce60 ldso/mips: Enable bootstrap relocations
_dl_reltypes_tab[] is an array of pointers to constant strings:

Contents of section .data:
 20000 01000000 02000000 00000000 00000000  ................
 20010 70e50000 7ce50000 88e50000 94e50000  p...|...........
       ^^^^^^^^ ^^^^^^^^ ^^^^^^^^ ^^^^^^^^

(pointers are LE)

Contents of section .rodata:
 e570 525f4d49 50535f4e 4f4e4500 525f4d49  R_MIPS_NONE.R_MI
 e580 50535f31 36000000 525f4d49 50535f33  PS_16...R_MIPS_3
 e590 32000000 525f4d49 50535f52 454c3332  2...R_MIPS_REL32

These pointers require relocation:

DYNAMIC RELOCATION RECORDS
OFFSET   TYPE              VALUE
00000000 R_MIPS_NONE       *ABS*
0001fffc R_MIPS_REL32      *ABS*
00020010 R_MIPS_REL32      *ABS*
00020014 R_MIPS_REL32      *ABS*
00020018 R_MIPS_REL32      *ABS*

On MIPS, only GOT relocations are currently handled by ldso during
startup.  The net effect is that when running with "LD_DEBUG=reloc",
ldso itself crashes before the program even starts.  This is caused
by _dl_dprintf() dereferencing an unadjusted string pointer such as
0xe570.

This patch enables the missing relocations and allows LD_DEBUG to work
as designed.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2011-07-27 09:40:10 +02:00
Richard Braun
3d5cec4ff7 libdl: add option for controlling dl_cleanup
When debugging memory leaks with Valgrind, it is required that
dynamically loaded shared objects are not unloaded when a process exits,
otherwise symbols from those files aren't correctly resolved in
allocation traces. This patch adds the LDSO_NO_CLEANUP configuration
option to control this behaviour.

Signed-off-by: Richard Braun <rbraun@sceen.net>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2011-07-25 09:09:03 +02:00
Douglas Mencken
63e61626c1 ldso: fix build error due to missing variable 'st'
Fix a build error triggered when LDSO_PRELOAD_FILE_SUPPORT is enabled
due to missing definition of 'st' variable.

Signed-off-by: Douglas Mencken <dougmencken@gmail.com>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2011-07-12 09:39:17 +02:00
Khem Raj
1537893ad3 x86_64/elfinterp.c: Protect missed debug _dl_printf with __SUPPORT_LD_DEBUG__
Signed-off-by: Khem Raj <raj.khem@gmail.com>
2011-07-07 09:50:17 -07:00
Khem Raj
f87898ca4a mips/signalfd.h: SFD_NONBLOCK for mips is 0200 unlike 04000 commonly
Exposed by udev 171 which uses signalfd

Signed-off-by: Khem Raj <raj.khem@gmail.com>
2011-07-01 14:50:15 -07:00
Khem Raj
50b6b440f9 Config.in.arch: Free UCLIBC_HAS_FPU setting from depending on UCLIBC_HAS_FLOATS
UCLIBC_HAS_FLOATS and UCLIBC_HAS_FPU are denoting two different aspects.
UCLIBC_HAS_FLOATS covers the floating point operations which has nothing
to do if you have FPU or not.

Signed-off-by: Khem Raj <raj.khem@gmail.com>
2011-07-01 14:49:55 -07:00
Carmelo Amoroso
75d95590a3 ldso: arm: fix build when prelinking is enabled.
This is a post merge fix to address build issue when PRELINK
support is enabled.

Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2011-07-01 09:49:47 +02:00
Carmelo Amoroso
1c1391e6e5 Merge remote-tracking branch 'origin/master' into prelink
* origin/master:
  libc: add missing lock initialization in vswprintf
  libubacktrace: fix makefile clean target

Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2011-07-01 09:49:08 +02:00
Maksim Rayskiy
18bf00f312 libc: add missing lock initialization in vswprintf
Unlike vsnprintf, vswprintf does not properly initialize locking
elements of FILE structure, which in some unfortunate cases can result
in lockups in _vfwprintf_internal.
Interesting, the initialization code was removed in
2a915734a32c5aec9a6a76c13bcb074d30e64171 at the same time as it was added
to vsnprintf.

Signed-off-by: Maksim Rayskiy <mrayskiy@broadcom.com>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2011-06-29 11:34:38 +02:00
Carmelo Amoroso
c61993f7e0 libubacktrace: fix makefile clean target
Fix makefile lean target removing the old reference to the non
existing libubacktrace_ARCH_OUT variable.

Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2011-06-24 16:27:36 +02:00
Carmelo Amoroso
7682323a3a Merge remote-tracking branch 'origin/master' into prelink
* origin/master: (61 commits)
  fts: fix warning due to old-style function definition
  ldso_tls: fix compiler warning due to missing cast
  resolv: fix bug in res_init with ipv6 nameservers
  config: Fix passing defconfig args
  buildsys: pt-initfini.s depends on uClibc_config.h
  libdl: search for ELF_RTYPE_CLASS_DLSYM in dlsym()
  resolv: try next server on SERVFAIL
  getaddrinfo: allow numeric service without any hints
  bump version to 0.9.33-git
  nptl/pthread: Correct path for machine specific pt-initfini.c
  ctor/dtor nptl: Fix init and fini function compilation
  Rules.mak: Rearrange appending UCLIBC_EXTRA_CFLAGS to CFLAGS
  ARM: remove EABI/OABI selection
  ARM: detect BX availibility at build time
  ARM: #include <bits/arm_asm.h> where __USE_BX__ is used
  ARM: transform the EABI/OABI choice into a boolean
  ARM: remove sub-arch/variants selection from menuconfig
  ARM: introduce blind options to select & force THUMB mode
  ARM: reorder "Use BX" option
  Fix __libc_epoll_pwait compile failure on x86
  ...

Conflicts:
	ldso/libdl/libdl.c

Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2011-06-24 16:24:25 +02:00
Carmelo Amoroso
74da7a8855 fts: fix warning due to old-style function definition
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2011-06-24 15:05:55 +02:00
Carmelo Amoroso
c2eaaf39dc ldso_tls: fix compiler warning due to missing cast
Fix compiler warning (as below) due to missign cast

In file included from ldso/ldso/ldso.c:42:0:
ldso/ldso/dl-tls.c: In function 'init_tls':
ldso/ldso/dl-tls.c:1028:24: error: initialization makes pointer from integer without a cast

Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2011-06-24 14:46:29 +02:00
Bernhard Reutner-Fischer
e8dc8eca8d resolv: fix bug in res_init with ipv6 nameservers
Thanks to Christian Krause <chkr plauener.de> for finding and fixing
this!

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-06-17 20:27:51 +02:00
Bernhard Reutner-Fischer
97c3c5f634 config: Fix passing defconfig args
Don't rely on argument-shuffling but use correct arguments in
the first place.

In bug#3589 Thomas Suckow writes:

The modified kconfig defines -D to be the same function as -d. In
addition -d does not take an argument and Config.in should be passed as
a non-option argument. The existing argument order appears to work on
distributions such as Fedora but chokes on Cygwin (newlib?).

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-06-14 18:48:19 +02:00
Bernhard Reutner-Fischer
4cf580dfcc buildsys: pt-initfini.s depends on uClibc_config.h
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-06-14 17:51:58 +02:00
Bernhard Reutner-Fischer
6b76a71299 libdl: search for ELF_RTYPE_CLASS_DLSYM in dlsym()
On FDPIC platforms, functions are passed by function descriptor, not by
pointers. If you don't specify ELF_RTYPE_CLASS_DLSYM when calling
_dl_find_hash() the return value from dlsym() will be a pointer not a
function descriptor, crashing the program.

The bug was introduced when TLS support was added in
534661b91c98492995274c364c8177c45efc63db

Closes bug#3433

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-06-14 16:48:51 +02:00
Bernhard Reutner-Fischer
0100056707 resolv: try next server on SERVFAIL
in bug 3637 Andrey Kovalev aka pxe.ru writes:
getaddrinfo does NOT add domain to query when receive SERVFAIL

RFC1035 7.2 suggests that
   - If a resolver gets a server error or other bizarre response
     from a name server, it should remove it from SLIST, and may
     wish to schedule an immediate transmission to the next
     candidate server address.

So let's try the next server upon SERVFAIL even if it's not strictly
required.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-06-14 16:31:00 +02:00
Natanael Copa
bc3be18145 getaddrinfo: allow numeric service without any hints
This appears to correspond to what glibc does and this fixes an
issue with iptables-1.4.11 with udp and raw port numbers.

(see http://bugzilla.netfilter.org/show_bug.cgi?id=721)

This fixes #3841
https://bugs.busybox.net/show_bug.cgi?id=3841

Signed-off-by: Natanael Copa <natanael.copa@gmail.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-06-14 10:46:20 +02:00
Bernhard Reutner-Fischer
2fa7315f34 bump version to 0.9.33-git
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-06-14 10:27:17 +02:00
Khem Raj
f282ca2286 nptl/pthread: Correct path for machine specific pt-initfini.c
Signed-off-by: Khem Raj <raj.khem@gmail.com>
2011-06-13 17:15:31 -07:00
Khem Raj
c97ce77636 ctor/dtor nptl: Fix init and fini function compilation
We need to define the rules for .S files so it
gets the include paths some architectures like mips
include headers

Some architectures e.g. SH have their own version
of pt-initfini.c so look for that first before resorting
to generic version of pt-initfini.c

Signed-off-by: Khem Raj <raj.khem@gmail.com>
2011-06-13 16:33:20 -07:00
Khem Raj
45046d8134 Rules.mak: Rearrange appending UCLIBC_EXTRA_CFLAGS to CFLAGS
UCLIBC_EXTRA_CFLAGS is currently added before the OPTIMIZATION flags
and OPTIMIZATION is chosen to be Os by default. But in OE we pass the optimisation
flags through UCLIBC_EXTRA_CFLAGS but they are not effective since -Os is
specified at last. So we need to change the order of these option flags

Signed-off-by: Khem Raj <raj.khem@gmail.com>
2011-06-11 00:15:02 -07:00
Yann E. MORIN
4151e14cc8 ARM: remove EABI/OABI selection
Rely on the compiler to be properly setup for the default ABI.

When installing-headers, there are two cases:
- NPTL: no issue, a cross-compiler is already expected
- LinuxThreads: no issue, EABI/OABI has no impact on installed headers.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Cc: Khem Raj <raj.khem@gmail.com>
Cc: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Cc: Carmelo AMOROSO <carmelo.amoroso@st.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
2011-06-11 00:12:34 -07:00
Yann E. MORIN
7a246fda8e ARM: detect BX availibility at build time
The "use BX" option is now a suggestion that BX be used if available.
Use a macro to detect if BX is available at build time. If so, and
the user requested it be used, then use it. Otherwise, error out.

Macro courtesy Khem RAJ:
  http://lists.uclibc.org/pipermail/uclibc/2009-April/042301.html

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Cc: Khem Raj <raj.khem@gmail.com>
Cc: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Cc: Carmelo AMOROSO <carmelo.amoroso@st.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
2011-06-11 00:12:22 -07:00
Yann E. MORIN
3862c65a05 ARM: #include <bits/arm_asm.h> where __USE_BX__ is used
The check for __USE_BX__ will be available in bits/arm_asm.h,
so the latter must be included wherever the former is used.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Cc: Khem Raj <raj.khem@gmail.com>
Cc: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Cc: Carmelo AMOROSO <carmelo.amoroso@st.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
2011-06-11 00:12:10 -07:00
Yann E. MORIN
7f40574243 ARM: transform the EABI/OABI choice into a boolean
The CONFIG_ARM_OABI option is never used.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Cc: Khem Raj <raj.khem@gmail.com>
Cc: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Cc: Carmelo AMOROSO <carmelo.amoroso@st.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
2011-06-11 00:11:53 -07:00
Yann E. MORIN
3936325282 ARM: remove sub-arch/variants selection from menuconfig
Rely on the compiler to be correctly set up to generate
appropriate code for the target variant.

This exposes the Thumb option, as it is no longer auto-selected.
The "Use BX" no longer depends on supported CPU to be selected,
so it now defaults to 'n' as it shall work by default on CPUs
that do not have BX.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Cc: Khem Raj <raj.khem@gmail.com>
Cc: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Cc: Carmelo AMOROSO <carmelo.amoroso@st.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
2011-06-11 00:11:17 -07:00
Yann E. MORIN
bda6117489 ARM: introduce blind options to select & force THUMB mode
Add three new blind options to set use of Thumb mode:
- COMPILE_IN_THUMB_MODE
  - if set, CFLAGS will contain -mthumb
  - if unset, the compiler's default is used
- HAS_THUMB
  - CPUS with Thumb instruction set can select this
  - use of BX depends on this
- FORCE_THUMB
  - CPUs that are Thumb-only must select this
  - this selects: HAS_THUMB, COMPILE_IN_THUMB_MODE and USE_BX

Also, remove leading space in Rules.mak.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Cc: Khem Raj <raj.khem@gmail.com>
Cc: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Cc: Carmelo AMOROSO <carmelo.amoroso@st.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
2011-06-11 00:06:03 -07:00
Yann E. MORIN
0e5a44e8cc ARM: reorder "Use BX" option
"Use BX" is not available on all CPUs, so the option depends on
a correct CPU to be chosen . It is weird that e BX" then appears
_above_ the CPU selection, not below.

Move the "Use BX" after the CPU selection.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Cc: Khem Raj <raj.khem@gmail.com>
Cc: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Cc: Carmelo AMOROSO <carmelo.amoroso@st.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
2011-06-11 00:05:31 -07:00
Phil Blundell
8245f3b463 Fix __libc_epoll_pwait compile failure on x86
This prevents "memory input 7 is not directly addressable" errors.

| libc/sysdeps/linux/common/epoll.c: In function '__libc_epoll_pwait':
| libc/sysdeps/linux/common/epoll.c:71:80: error: memory input 7 is not directly addressable
| libc/sysdeps/linux/common/epoll.c:75:86: error: memory input 7 is not directly addressable
| make: *** [libc/sysdeps/linux/common/epoll.o] Error 1
| make: *** Waiting for unfinished jobs....

Signed-off-by: Phil Blundell <pb@pbcl.net>
Signed-off-by: Jason Woodward <jason.woodward@timesys.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
2011-06-10 23:59:29 -07:00
Khem Raj
9a923848c4 nptl/Makefile.in: Fix the build break caused by UCLIBC_CTOR_DTOR enabling
Extra / somehow does not match the target and complains that
$(top_builddir)libpthread/nptl/sysdeps/pthread/crti.o has no rules to
build

Signed-off-by: Khem Raj <raj.khem@gmail.com>
2011-06-10 13:48:40 -07:00
Carmelo Amoroso
cf0b3a3342 buildsys: fix pregen target (!NPTL with LOCALE)
When NPTL is not enabled, and LOCALE support is used, compilation fails
with the following error:

-------------------------------------------------------------------------
  MKDIR include/bits
  GEN include/bits/sysnum.h
make[1]: *** No rule to make target `../..//include/bits/uClibc_ctype.h', needed by `../../extra/locale/gen_wc8bit.c'.  Stop.
make: *** [pregen] Error 2
-------------------------------------------------------------------------

The problem is that "headers" is not listed as prerequisite of pregen.
These have been changed multiple times recently:

	o	Austin: order headers before pregen-headers
		1f5c73c9f8a98b1d2a35cea868a585c97ab0e436
	o	Khem: pregen: Fix the parallel build problem in pregen target
		046035ecde92262d96eff2192ba3cda716f04909
	o	Khem: pregen-headers: Add new target which depends on headers.
		ef18cfe8ebab25f5ef92e81956f50e2dc57df602
	o	Carmelo: build: Fix infinite loop when no threading support is enabled
		ff5e4de7088fe8d34812c2a1e604bf04be713606
In all of these commits headers was actually as prerequisite

In commit 9381d622e2411a35a5fd73a5a573eb269e2dd9c9 [nptl: fix buildsys] by Bernhard, headers was removed,
causing the problem reported above.

Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2011-05-31 10:03:23 +02:00
Bernhard Reutner-Fischer
399ab8e650 libubacktrace: Fix ASNEEDED emission
In master the variable is called SHARED_LIBNAME and not
SHARED_MAJORNAME.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-05-31 09:47:12 +02:00
Bernhard Reutner-Fischer
5c49e11c01 NPTL: Fix CTOR_DTOR
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-05-31 09:45:44 +02:00
Filippo Arcidiacono
204c784902 libc: make common longjmp usable with NPTL
Call _longjmp_unwind conditionally under NPTL config option,
making longjmp usable with NPTL.

Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2011-05-27 17:37:09 +02:00
Filippo Arcidiacono
461c76887f sh: use the common implementation for longjmp
Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2011-05-27 17:17:51 +02:00
Filippo Arcidiacono
5e87d86ace sh: fix build in !NPTL case
Fix build issue due to missing symbols in !NPTL case:
- vfork
- _longjmp_unwind

Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2011-05-27 17:11:18 +02:00
Alan Davis
8514218c13 Correct a bug when remapping textrel segments on nommu
From: Alan Davis <adavis@ti.com>

On C6X, when trying to execute a program that has a textrel DSO, it
fails to load. The telltale line in the LD_DEBUG output is:

_dl_get_ready_to_run:779:       file='';  needed by './a.out'

The corresponding DT_NEEDED entry has 'libc.so.0', but here the
filename is empty. This is what is happening in
_dl_elf_shared_library():

First, map all segments according to their permissions. Text gets
initially mapped read-only.

Then, parse the dynamic information. The dynamic table is in RW but
some of the tags may point to RO. For example, DT_NEEDED points to a
string in .dynstr which is in RO. These pointers get computed
according to the loadmap from the original mapping.

Then, in response to a DT_TEXTREL tag, the RO segment gets remapped,
thereby invaliding anything that points to it, in particular certain
dynamic tags such as DT_NEEDED.

The following patch re-parses the dynamic info after the remapping so
as to re-compute any invalid pointers.

Signed-off-by: Alan Davis <adavis@ti.com>
Signed-off-by: Bernd Schmidt <bernds@codesourcery.com>
2011-05-27 12:46:03 +02:00
Khem Raj
71d63ed756 unwind.h: Move to libc/sysdeps from nptl sysdeps
Signed-off-by: Khem Raj <raj.khem@gmail.com>
2011-05-13 15:31:06 -07:00
Bernhard Reutner-Fischer
1bfe83b42b epoll: redo cancellation to match master
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-05-13 12:16:29 +02:00
Peter S. Mazinger
c6057584e0 epoll.c: add cancellation to epoll_[p]wait()
While there, fix epoll_pwait syscall, it takes 6 arguments

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-05-13 11:31:10 +02:00
Bernhard Reutner-Fischer
2fbbd10ac6 libm: fix building out-of-tree
Thanks to Thierry Reding for noticing!

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-05-12 12:26:41 +02:00
Bernhard Reutner-Fischer
f6e44ebb52 wordexp: fix mishandled return value of pipe call
and use pipe2 if available while at it.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-05-12 12:11:14 +02:00
Bernhard Reutner-Fischer
44100dac11 linux_specific: handle accept4 and pipe2
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-05-12 10:37:36 +02:00
Bernhard Reutner-Fischer
3fb846d24c NPTL: needs madvise internally
This fixes 8d09a50a044638fde2ed3e1a1c4d3c7c5a3cce5c since NPTL also uses
madvise internally.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-05-12 10:30:48 +02:00
Bernhard Reutner-Fischer
213709e1e1 socket: fix stubs
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-05-12 10:07:25 +02:00
Bernhard Reutner-Fischer
4eebb1ab2c commentary typo fix
s/decriptor/descriptor/

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-05-11 22:22:51 +02:00
Bernhard Reutner-Fischer
3e72d1b512 epoll: unify epoll.h 2011-05-11 22:17:23 +02:00
Bernhard Reutner-Fischer
c91c3a2b27 commentary typo fix
use cancellation (with two 'l') uniformly.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-05-11 22:03:33 +02:00
Thierry Reding
bf5dd19d97 Implement epoll_create1 and epoll_pwait system calls.
Note: TODO: This lacks cancellation support.

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-05-11 21:57:20 +02:00
Bernhard Reutner-Fischer
23b99061c8 buildsys: document UCLIBC_EXTRA_CPPFLAGS
Rename EXTRA_CPPFLAGS to UCLIBC_EXTRA_CPPFLAGS and make them override
previous flags (by appending - not prepending - them to the other flags).
2011-05-11 21:16:23 +02:00
Bernhard Reutner-Fischer
803ea5ff05 lll: avoid shadow warnings
use __ret uniformly to avoid shadow warnings as seen on x86_64.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-05-11 20:42:18 +02:00
Bernhard Reutner-Fischer
08c36f4c11 x86_64: add TODO for R_X86_64_RELATIVE
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-05-11 20:29:59 +02:00
Bernhard Reutner-Fischer
7d8c08baf4 libubacktrace: mv unwind.h to include
Fixes compilation if NPTL is off.
I hope this doesn't break ARM EABI but cannot check ATM.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-05-11 19:52:16 +02:00
Bernhard Reutner-Fischer
bbb07be585 Revert "libubacktrace: fix config-symbol handling"
This reverts commit 7a080cd149c7b25d415d76506510d55b34819fc2.

This symbol is in fact different (as it is set no 'n').
2011-05-11 19:16:17 +02:00
Bernhard Reutner-Fischer
d3ddb92ea0 add pipe2()
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-05-11 13:12:14 +02:00
Bernhard Reutner-Fischer
6af34270fa socketcalls: add stubs
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-05-11 12:05:20 +02:00
Bernhard Reutner-Fischer
74a2c71153 accept4: Implement cancellation
.. and add proper prototype, move it into it's own obj and other such
cleanups.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-05-11 11:58:07 +02:00
Thierry Reding
46e3df937b Implement accept4 system call.
Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-05-11 10:04:20 +02:00
Bernhard Reutner-Fischer
7a080cd149 libubacktrace: fix config-symbol handling
Config symbals that are not set are empty, not 'n'.
2011-05-11 09:56:55 +02:00
Bernhard Reutner-Fischer
afeef5ca39 buildsys: Turn on strict aliasing for everyone
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-05-11 09:38:56 +02:00
Bernhard Reutner-Fischer
bfbab32be6 ldso: commentary typo fix
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-05-10 21:22:25 +02:00
Bernhard Reutner-Fischer
e48bd60ce9 getcwd: Fix memory-leak in error path
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-05-10 20:19:46 +02:00
Bernhard Reutner-Fischer
025ec197fe __uc_malloc: Fix memory-leak in error path
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-05-10 20:09:36 +02:00
Filippo Arcidiacono
974d314057 libdl: fix local symbol's address handling in dladdr
Fix dladdr to correctly handle local function's address so backtrace_symbols
print only the function address for these function, instead of showing the name
of nearest one.
Indeed the dladdr walk through the hash table to find the nearest symbol, that
doesn't contain local symbols.

Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2011-05-10 11:53:41 +02:00
Bernhard Reutner-Fischer
3e68c52b94 */crtn.S: Remove .size directive for _init and _fini
These are split across objects so setting size does not (and never did)
work since the expression cannot be computed at assembly time.

This avoids errors from recent (> 2.21) gas.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-05-10 10:03:58 +02:00
Timo Teräs
074930dd7f posix_fadvise64: fix x86 implementation
Commit 73d59554144f429b1cf0d4d7fa7de42bdf59ad92 completely broke
the x86 implementation of posix_fadvise64. It moved the first
the assembly code retn instruction gets missing depending on the

Technically the file has two implementaions for posix_fadvise64,
one when __NR_fadvise64_64 is available, and second one if only
__NR_fadvise64 is there. Fix the #ifdef's to be proper for that.

Signed-off-by: Timo Teräs <timo.teras@iki.fi>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
2011-05-07 16:59:48 -07:00
Bernhard Reutner-Fischer
5cf382c0f9 i386: fix .size of _init/_fini
binutils-2.21 barf on .size that do not evaluate to const, so use
the section size and not a function that is not visible here.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-05-05 09:33:14 +02:00
Bernhard Reutner-Fischer
2297e6e1e0 x86_64: fix .size of _init/_fini
binutils-2.21 barf on .size that do not evaluate to const, so use the
section size and not a function that is not visible here.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-05-05 09:27:15 +02:00
Bernhard Reutner-Fischer
07464c3e71 Revert "*/crt?.S: remove .size directives"
Removing them generally was not a good idea

This reverts commit 233c504cd940d9802226b6a3a092368b86978f5e.
2011-05-05 09:19:16 +02:00
Bernhard Reutner-Fischer
233c504cd9 */crt?.S: remove .size directives
sed -i -e '/\.size[[:space:]]/d' $(grep -l "\.size" libc/sysdeps/linux/*/crt*.[sSc])

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-05-04 20:40:49 +02:00
Carmelo Amoroso
3004ce0c96 Merge remote-tracking branch 'origin/master' into prelink
* origin/master: (32 commits)
  libubacktrace: fix backtrace support on arm-eabi, which needs libgcc_eh linked too
  getaddrinfo.c: fix incorrect check for ERANGE from gethostbyaddr_r
  getaddrinfo.c: improve code readability. No functional changes
  string: remove unused variable
  x86_64: silence warning if !TLS
  buildsys: prettify ssp.c handling
  madvise is LINUX_SPECIFIC
  test_nptl: fix expected result for tst-cputimer[123]
  test_nptl: fix expected result for tst-clock2 test
  buildsys: make $(LOCAL_INSTALL_PATH) phony
  ether_aton: reject invalid input
  tests: disable ether tests if !HAS_SOCKET
  inet: add ether_aton testcase
  sysconf: clock_getres depends on HAS_REALTIME
  __rt_sigwaitinfo: depends on HAS_REALTIME
  buildsys: minor fixes in Makefile.arch for C6X
  buildsys: minor fixes in Makefile.arch for microblaze
  libubacktrace: enabled for all archs indeed.
  sparc: don't access fp registers when configured for no fpu
  libubacktrace: generic implementation based dwarf
  ...

Conflicts:
	ldso/ldso/dl-elf.c
	ldso/ldso/mips/elfinterp.c
	ldso/ldso/x86_64/elfinterp.c

Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2011-05-04 08:31:16 +02:00
Henning Heinold
4916fd889e libubacktrace: fix backtrace support on arm-eabi, which needs libgcc_eh linked too
Signed-off-by: Henning Heinold <heinold@inf.fu-berlin.de>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2011-05-04 06:56:14 +02:00
Denys Vlasenko
408763f326 getaddrinfo.c: fix incorrect check for ERANGE from gethostbyaddr_r
Also, freeaddrinfo(NULL) is ok, no need to check parameted for NULL
before calling it.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2011-05-03 17:29:35 +02:00
Denys Vlasenko
05238889b2 getaddrinfo.c: improve code readability. No functional changes
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2011-05-03 17:28:19 +02:00
Bernhard Reutner-Fischer
fa6546e89e string: remove unused variable
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-05-03 16:40:31 +02:00
Bernhard Reutner-Fischer
c5f87c865e x86_64: silence warning if !TLS
TODO: fix all other arches

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-05-03 16:36:15 +02:00
Bernhard Reutner-Fischer
fa08223a33 buildsys: prettify ssp.c handling
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-05-03 16:24:08 +02:00
Bernhard Reutner-Fischer
8d09a50a04 madvise is LINUX_SPECIFIC
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-05-03 16:15:30 +02:00
Filippo Arcidiacono
074c5fcc98 test_nptl: fix expected result for tst-cputimer[123]
Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2011-05-03 09:41:14 +02:00
Filippo Arcidiacono
eba2360222 test_nptl: fix expected result for tst-clock2 test
tst-clock2 should return 0 when _SC_THREAD_CPUTIME option isn't
available, instead of treating it as an error.
Further set the expected ret value as 0 avoiding to hide any real failures
in case of THREAD_CPUTIME feature available.

Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2011-05-02 17:52:50 +02:00
Bernhard Reutner-Fischer
ed9977bf65 buildsys: make $(LOCAL_INSTALL_PATH) phony
Could depend on the individual files too but this makes sure that
nothing is missed.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-05-02 10:15:41 +02:00
Bernhard Reutner-Fischer
049aebd7eb ether_aton: reject invalid input
fixes PR2227

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-05-02 10:10:47 +02:00
Bernhard Reutner-Fischer
63e3a411b1 tests: disable ether tests if !HAS_SOCKET
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-05-01 18:00:04 +02:00
David A Ramos
23135f442d inet: add ether_aton testcase
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-05-01 17:28:31 +02:00
Bernhard Reutner-Fischer
221464c9c4 sysconf: clock_getres depends on HAS_REALTIME
Bug was introduced in revision a202cf6f.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-04-29 14:19:24 +02:00
Bernhard Reutner-Fischer
3818c3a0b6 __rt_sigwaitinfo: depends on HAS_REALTIME
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-04-29 14:19:22 +02:00
Carmelo Amoroso
04dc3d1392 buildsys: minor fixes in Makefile.arch for C6X
Just a tidy-up by removing commented-out lines.

Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2011-04-27 09:29:44 +02:00
Carmelo Amoroso
4698e59ab3 buildsys: minor fixes in Makefile.arch for microblaze
Do not include Makefile.commonarch directly from within arch specific
Makefile, as it is already done in parent Maefile.in.

Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2011-04-27 09:20:48 +02:00
Carmelo Amoroso
e798b95d13 libubacktrace: enabled for all archs indeed.
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2011-04-26 14:12:55 +02:00
Austin Foxley
542c67dd8e sparc: don't access fp registers when configured for no fpu
Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
2011-04-22 16:21:30 -07:00
Carmelo Amoroso
7b5b79f09f libubacktrace: generic implementation based dwarf
Use the initial implementation for SH4 based on dwarf for all archs.
Indeed there are not obvious reason for which it should not work in general.

Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2011-04-22 12:55:43 +02:00
Salvatore Cro
a4aa01c128 Added fts support for traversing UNIX file hierarchies.
It is required by libdwfl in elfutils package.

Signed-off-by: Salvatore Cro <salvatore.cro at st.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-04-20 12:50:38 +02:00
Salvatore Cro
3a411b5d8a test: fix tst-tls13 expected result and timeout
tst-tls13 is expected to return 0 when passing.
Set higher timeout to avoid failure on slow archs.

Signed-off-by: Salvatore Cro <salvatore.cro@st.com>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2011-04-18 12:23:43 +02:00
Kevin Cernekee
4580f142b4 dl-startup: fix typos in block comment
Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2011-04-18 08:59:33 +02:00
Maksim Rayskiy
b228ddac5b MIPS LDSO: pass sym_ref parameter to _dl_find_hash() to support PROTECTED symbols
_dl_find_hash() relies on sym_ref parameter to check if the looked-up symbol
is protected. The code fixes a case when _dl_perform_mips_global_got_relocations()
was calling _dl_find_hash() without providing sym_ref parameter.
The bug was causing hangs if a library exporting non-protected symbol was earlier in
link order than library with the same symbol declared as protected.

Signed-off-by: Maksim Rayskiy <mrayskiy@broadcom.com>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2011-04-18 08:44:16 +02:00
Bernhard Reutner-Fischer
f6450b67cc buildsys: do_rm ARCH_HEADERS
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-04-14 09:59:26 +02:00
Bernhard Reutner-Fischer
d37cda884e resolv: really fix res_close not to hang with ipv6
Fix goof in previous commit.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-04-13 19:38:40 +02:00
Bernhard Reutner-Fischer
7da4d1e755 buildsys: do not use $(and)
make-3.80 does not have $(and) and $(or), so workaround for now.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-04-13 10:26:38 +02:00
Kevin Cernekee
a4a4912b18 buildsys: fix GNU make v3.80 compatibility again
GNU make 3.80 cannot handle "$(and)" or "$(or)" from commit 18e7136e
(buildsys: use kbuild style).  Replace them with ifeq/ifneq.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-04-13 10:05:18 +02:00
Bernhard Reutner-Fischer
c277cc3c99 resolv: fix res_close not to hang with ipv6
Timo Teräs writes:
The memory release loop is missing an obvious counter increment.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-04-12 09:39:59 +02:00
Bernd Schmidt
feb7ce46ef Support dynamic assignment of DSBT_INDEX
For DSBT targets (C6X only at this point), we'd like to support the case
where the user did not specify --dsbt-index at link time when building a
shared library. The dynamic linker can still assign an index at runtime
and fix up the DSBT_INDEX relocs, at the cost of startup time and memory
space.

Signed-off-by: Bernd Schmidt <bernds@codesourcery.com>
2011-04-11 13:27:03 +02:00
Bernd Schmidt
eff2d0ba58 Fix malloc alignment
In commit 3e0a1f388, Richard tried to fix malloc alignments by using
 alignof (double __attribute_aligned__(sizeof (size_t))).
This doesn't work, since attribute_aligned overrides the alignment
rather than providing a minimum. On C6X, malloc returns four-byte
aligned values rather than the necessary eight-byte alignment.

It's simpler to use a comparison and pick the bigger of the two values,
so that's what I've done.

Signed-off-by: Bernd Schmidt <bernds@codesourcery.com>
2011-04-11 13:26:56 +02:00
Bernd Schmidt
56ea76b6bf Fix nommu handling of DT_TEXTREL
We have a problem with DT_TEXTREL shared libraries on nommu machines.
The dynamic linker's strategy is to map the text segment read-only
first, then look for DT_TEXTREL, and use mprotect to change protections
if necessary. This fails on nommu, since a nommu kernel can decide to
share the memory for private read-only file mappings, and mprotect
doesn't (can't) do anything about this sharing. Existing nommu targets
apparently have no need for this, but on C6X, we may need to assign
library indices at run-time if no --dsbt-index option was passed to the
linker at build time.

Hence, the following patch, which instead of using mprotect, redoes the
mapping with PF_W set.

Signed-off-by: Bernd Schmidt <bernds@codesourcery.com>
2011-04-11 13:26:48 +02:00
Carmelo Amoroso
3b3285b1b7 Merge remote-tracking branch 'origin/master' into prelink
* origin/master: (137 commits)
  utils/ldd: Check for returned pointer from strrchr not the value it holds
  cris: add provide arch-specific vfork implementation
  lutimes.c, stubs.c: fix compiling lutimes, if __NR_utimensat is not defined
  bump version to 0.9.32-rc3-git
  release 0.9.32-rc3
  memalign: include sys/param.h for MAX
  arm/bits/atomic.h: Include common/bit/atomic.h for thumb1
  wctype.h: fix libc_hidden_proto for iswupper and add it for iswspace
  add libc_hidden_proto for wcs[n]casecmp_l
  really fix missing __libc_drand48_data
  Revert "missing prototype of __libc_drand48_data fixed"
  missing prototype of __libc_drand48_data fixed
  time.c, time.h: remove unused hidden strftime/strptime
  nanosleep.c: remove duplicated libc_hidden_proto
  ctype.c, ctype.h: remove commented parts that were banned for removal after 0.9.31
  _wctype.c, wctype.h: remove unused isw* and wctype_l hidden functions
  time.c, wchar.h: remove unused hidden wcsftime
  str[n]casecmp.c: fix hidden usage
  remove unused hidden functions
  frv/memset.S: add missing libc_hidden_def
  ...

Conflicts:
	ldso/ldso/ldso.c

Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2011-04-06 15:13:59 +02:00
Kevin Day
85f4b028d7 utils/ldd: Check for returned pointer from strrchr not the value it holds
Signed-off-by: Kevin Day <thekevinday@gmail.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
2011-03-30 04:53:36 -07:00
Thorsten Glaser
9b5df2295b cris: add provide arch-specific vfork implementation
vfork must be called with nothing at all on the stack,
so implementing it via syscall() does not work.

Signed-off-by: Thorsten Glaser <tg@mirbsd.org>
Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-03-26 23:50:49 -04:00
Peter S. Mazinger
251f2266bf lutimes.c, stubs.c: fix compiling lutimes, if __NR_utimensat is not defined
while there, provide stubs for functions depending on utimensat syscall.

Reported-by: Sedat Dilek <sedat.dilek@googlemail.com>
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
2011-03-19 11:51:25 -07:00
Bernhard Reutner-Fischer
0c18923cbc bump version to 0.9.32-rc3-git
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-03-16 20:20:32 +01:00
Carmelo Amoroso
289d19f45d ldso: use ADDR_ALIGN instead of hard-coded value
Use ADDR_ALIGN to align the minvma when loading shared libraries instead
of the hard coded 0xffffU value.
This fixes teh stand/alone support on ARM as reported in bug #3133.

Signed-off-by: Sven Ola <sven-ola@gmx.de>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
(cherry picked from commit 435471db8561e4686e5921b7f719ab6d5a0d06f7)

Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2011-03-07 18:19:32 +01:00
Carmelo Amoroso
ac5e9d08f4 Merge remote branch 'origin/master' into prelink
* origin/master:
  arm: fix the static link problem for ARM due to undefined __tls_get_addr
  nios2: Name architecture correctly in endian.h header
  nptl/mips64: Fix build when using mips64 and ABIs other than o32
  mips: avoid segmentation fault when RLD_MAP is 0
  libc: fix linker script generation for libubacktrace.so
  stdio: fix diagnostic message

Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2011-02-03 11:16:42 +01:00
Filippo Arcidiacono
fd3120fb9e ldso: fix _dl_debug_lookup to handle protected symbols
Initialize symbol_ref.sym field before calling _dl_find_hash to correctly
handle protected symbols when tracing objects in the prelink stage.

Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com>
Signed-off-by: Salvatore Cro <salvatore.cro@st.com>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2011-01-27 16:03:14 +01:00
Filippo Arcidiacono
c0e0210921 libdl: fix tls symbol lookup in dlsym
Due to merge with prelink, the sym_ref.tpnt is always set when the symbol
is found, so it needs to call the _dl_tls_symaddr only for tls symbols.

Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2011-01-25 13:31:21 +01:00
Carmelo Amoroso
2aee0efdec Merge remote branch 'origin/master' into prelink
* origin/master:
  bump version to 0.9.32-rc2-git
  release 0.9.32-rc2
  nptl: Fix __USER_LABEL_PREFIX__ concatenatio
  nptl: fix start_thread() for _STACK_GROWS_UP
  ldso: get rid of _dl_lookup_hash
  Add protected symbols support for all architectures
  Revert "ldso/arm: Correct protected symbol resolution"
  Revert "ldso_sh: add support for protected symbols to SH"
  Revert "ldso/i386: support protected symbols"
  cris: Fix build issues
  syslog: fix 'everyone logs with user facility'
  __psfs_parse_spec: always use long int for %p
  buildsys: headers target should not depend on sysnum.h
  buildsys: fix make release target
  nptl: get rid of the last preprocessor warning when __ASSUME_TGKILL is not defined
  remove uClibc_ctype.h if !LOCALE
  Revert "Makefile.in: Add header to 'all' target"
  nptl: get rid of preprocessor warning when __ASSUME_TGKILL is not defined

Conflicts:
	ldso/include/dl-hash.h
	ldso/ldso/arm/elfinterp.c
	ldso/ldso/avr32/elfinterp.c
	ldso/ldso/bfin/elfinterp.c
	ldso/ldso/cris/elfinterp.c
	ldso/ldso/dl-hash.c
	ldso/ldso/i386/elfinterp.c
	ldso/ldso/m68k/elfinterp.c
	ldso/ldso/mips/elfinterp.c
	ldso/ldso/powerpc/elfinterp.c
	ldso/ldso/sh/elfinterp.c
	ldso/ldso/sh64/elfinterp.c
	ldso/ldso/sparc/elfinterp.c
	ldso/ldso/x86_64/elfinterp.c
	ldso/ldso/xtensa/elfinterp.c
	ldso/libdl/libdl.c

Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2011-01-21 15:04:47 +01:00
Carmelo Amoroso
8100a075b7 Merge commit 'origin/master' into prelink
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2011-01-03 14:44:33 +01:00
Carmelo Amoroso
e018b8ba1a Merge commit 'origin/master' into prelink
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2010-12-14 14:54:26 +01:00
Carmelo Amoroso
d181797c70 Merge commit 'origin/master' into prelink 2010-12-06 15:37:37 +01:00
Carmelo Amoroso
57f6cce72c Merge commit 'origin/master' into prelink
Conflicts:

	ldso/include/dl-hash.h

Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2010-11-28 21:09:47 +01:00
Filippo Arcidiacono
4ec89b87bc ldso: Extend prelink support for all other achitectures
Update Arch specific part of the dynamic linker to the
latest cahnges required by prelink:

- Use _dl_loaded_modules->scope as global symbol scope
- Pass the sym argument (or NULL) to the _dl_find_hash
- Update _dl_parse, _dl_do_reloc, _dl_do_lazy_reloc and
  _dl_parse_relocation_information to reflect the change of
  the scope argument's type
- Add the call to _dl_debug_lookup used for trace prelinking.

Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2010-10-11 12:58:04 +02:00
Carmelo Amoroso
8d29ef117d Merge commit 'origin/master' into prelink
Conflicts:

	ldso/ldso/sh/elfinterp.c

Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2010-09-24 09:02:41 +02:00
Filippo Arcidiacono
b9766aa08c ldso: Fix loadaddr and mappaddr when prelink support is enabled.
Fixed loadaddr and mappaddr fields to correctly work when prelink
support is enabled.
- loadaddr is an offset relative to the first loadable segment.
- mapaddr is the address where the object has been mapped in memory.

Non PIC library detection fixed too.

Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2010-09-17 16:13:45 +02:00
Filippo Arcidiacono
a33796043b ldso: Add runtime prelink support
Added runtime prelink support to be able to run a prelinked
application; at process startup only the conflicts will be relocated.
This speed up the startup time.

Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2010-09-17 16:13:17 +02:00
Filippo Arcidiacono
02f56b3ae9 ldso: Do not add the ld.so at the end of the loaded modules list
The dynamic linker was included indifferently at the end of the
loaded modules list. In order to be used with prelink, it is required
to included the ld.so in the local scope of each shared libraries that
depends directly on it.
Also it is included in the global scope at the first occurrence.

Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2010-09-17 16:12:14 +02:00
Filippo Arcidiacono
4136ca46e3 ldso: Add support for LD_WARN and LD_TRACE_PRELINKING
Added support for the following tracing capabilities:
- LD_WARN to warn about undefined symbols during the lookup stage.
- LD_TRACE_PRELINKING to trace the needed libraries of the object
  that we are prelinking.

Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2010-09-17 16:11:27 +02:00
Filippo Arcidiacono
94cc6edb78 ldso: Rework global scope handling and symbol lookup mechanism
Global symbol scope is implemented as a linked list of
local scope, that dynamically grows and shrinks when dlopen/
dlclose are called. Each local scope is implemented as an array
of pointer to struct elf_resolve.
This will help to detect conflict when LD_TRACE_PRELINKING option
will be implemented.

Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2010-09-17 16:07:25 +02:00
Filippo Arcidiacono
637e2b2440 ldso: Add implementation of ld.so standalone execution
The dynamic linker can be run either indirectly through running some
dynamically linked program or library (in which case no command line options
to the dynamic linker can be passed and, in the ELF case, the dynamic linker
which is stored in the .interp section of the program is executed)
or directly by running:
 /lib/ld-uClibc.so.*  [OPTIONS] [PROGRAM [ARGUMENTS]]

Stand-alone execution is a prerequisite for adding prelink capabilities
to uClibc dynamic linker, as well useful for testing an updated version
of the dynamic linker without breaking the whole system.

Currently supported option:
  --library-path PATH   use given PATH instead of content of the environment
                        variable LD_LIBRARY_PATH

(Mandatory for prelinking)

Not supported options:
  --list                list all dependencies and how they are resolved
  --verify              verify that given object really is a dynamically linked
                        object we can handle
  --inhibit-rpath LIST  ignore RUNPATH and RPATH information in object names
                        in LIST

This feature can be enabled by setting LDSO_STANDALONE_SUPPORT=y

Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2010-09-17 13:06:58 +02:00
3571 changed files with 72866 additions and 32977 deletions

1
.gitignore vendored
View File

@ -25,6 +25,7 @@ cscope.*
.gdb_history
.gdbinit
core
*.c.[0-9][0-9][0-9]t.*
#
# Backups / patches

View File

@ -1,4 +1,4 @@
0.9.31 not yet released
0.9.31 2 April 2010
Upgrade notices from previous versions.
o On x86_64 the format of /var/run/utmp changed compared to previous

View File

@ -54,7 +54,7 @@ COMPILING uClibc:
to compile uClibc. or if you are cross compiling, you would
instead run something like:
make CROSS=arm-linux-
make CROSS_COMPILE=arm-linux-
INSTALLING the uClibc development environment:

View File

@ -27,7 +27,14 @@ help:
@echo ' menuconfig - interactive curses-based configurator'
@echo ' oldconfig - resolve any unresolved symbols in .config'
@echo ' silentoldconfig - resolve any unresolved symbols in .config, silently'
@echo ' savedefconfig - Save current config (minimal config)'
@echo ' randconfig - generate a random .config'
@$(if $(arch-defconfigs), \
@echo ''; \
echo 'Architecture specific configs ($(ARCH))'; \
$(foreach c, $(arch-defconfigs), \
printf " %-21s - Build for %s\\n" $(c) $(subst _defconfig,,$(c));) \
)
@echo
@echo 'Installation:'
@echo ' install - install both the runtime and the headers'
@ -46,11 +53,13 @@ help:
@echo 'Environment variables:'
@echo ' O=<abspath> - Use <abspath> as object directory'
@echo ' V="" - Quiet build (default)'
@echo ' V=1 - Brief build (show defines, ld flags)'
@echo ' V=2 - Very verbose build'
@echo ' CROSS= - Override CROSS_COMPILER_PREFIX from .config'
@echo ' V=1 - Very verbose build (show full commands)'
@echo ' V=2 - Brief build (show defines, ld flags)'
@echo ' CROSS_COMPILE= - Override CROSS_COMPILER_PREFIX from .config'
@echo ' ARCH= - Use given arch for config targets'
@echo ' SHELL= - Shell to use for make'
@echo ' BUILD_CFLAGS= - extra CFLAGS for compiling host binaries'
@echo ' BUILD_LDFLAGS= - extra LDFLAGS for linking host binaries'
@echo ' CONFIG_SHELL= - Shell to use for menuconfig'
@echo
@echo ' PREFIX= - Prepended prefix'
@ -60,4 +69,5 @@ help:
@echo ' and the include dir (usually "/usr")'
@echo ' MULTILIB_DIR= - Directory component for libraries (default "lib").'
@echo ' UCLIBC_EXTRA_CFLAGS - extra CFLAGS for compiling uClibc'
@echo ' UCLIBC_EXTRA_CPPFLAGS - extra CPPFLAGS for compiling uClibc'

View File

@ -8,22 +8,12 @@
#--------------------------------------------------------------
# You shouldn't need to mess with anything beyond this point...
#--------------------------------------------------------------
clean_targets := clean realclean distclean \
objclean-y headers_clean-y CLEAN_utils
noconfig_targets := menuconfig config oldconfig silentoldconfig randconfig \
defconfig allyesconfig allnoconfig \
release dist tags help
include $(top_srcdir)Rules.mak
sub_headers := headers
ifndef KCONFIG_CONFIG
KCONFIG_CONFIG := $(top_builddir).config
endif
export KCONFIG_CONFIG
ifeq ($(HAVE_DOT_CONFIG),y)
all: pregen libs
all: pregen libs startfiles
libs: pregen
# In this section, we need .config
@ -39,6 +29,7 @@ headers:
endif # ifeq ($(HAVE_DOT_CONFIG),y)
include $(top_srcdir)extra/locale/Makefile.in
include $(top_srcdir)ldso/Makefile.in
include $(top_srcdir)libcrypt/Makefile.in
include $(top_srcdir)libintl/Makefile.in
@ -49,22 +40,26 @@ include $(top_srcdir)libutil/Makefile.in
include $(top_srcdir)libpthread/Makefile.in
include $(top_srcdir)librt/Makefile.in
include $(top_srcdir)libubacktrace/Makefile.in
include $(top_srcdir)extra/locale/Makefile.in
# last included to catch all the objects added by others (locales/threads)
include $(top_srcdir)libc/Makefile.in
conf := $(top_builddir)extra/config/conf
mconf := $(top_builddir)extra/config/mconf
nconf := $(top_builddir)extra/config/nconf
ifeq ($(HAVE_DOT_CONFIG),y)
# If the .config changes then we have to make sure that our includes are
# updated properly. This would normally work by saying that the headers
# have uClibc_config.h as prerequisite but since we _symlink_ the headers
# and do not (?) want to rely on 'make -L' we better update them right here,
# on spot to save us from alot of hazzle.
$(top_builddir)include/bits/uClibc_config.h: $(top_builddir)extra/config/conf $(KCONFIG_CONFIG) $(top_srcdir)extra/scripts/conf-header.sh | $(top_builddir)include/bits $(top_builddir)include/config
$(top_builddir)include/bits/uClibc_config.h: $(conf) $(KCONFIG_CONFIG) $(top_srcdir)extra/scripts/conf-header.sh | $(top_builddir)include/bits
@$(disp_gen)
$(Q)@$< -s $(top_srcdir)extra/Configs/Config.in
$(Q)$(top_srcdir)extra/scripts/conf-header.sh $(KCONFIG_CONFIG) > $@
$(Q)$< -s $(Kconfig)
$(Q)$(top_srcdir)extra/scripts/conf-header.sh $(KCONFIG_CONFIG) > $@.tmp
$(Q)$(MAKE) headers-y
$(Q)mv $@.tmp $@
# The above doesn't work for threads, though. Just using check-symlinks for now.
# XXX: FIXME: this is ugly
@ -73,6 +68,10 @@ MAKEFLAGS += -L
$(top_builddir)include/config/linuxthreads/old.h $(top_builddir)include/config/linuxthreads/new.h:
@true
$(top_builddir)include/generated/unifdef_config.h: $(top_builddir)include/bits/uClibc_config.h | $(top_builddir)include/generated
@$(disp_gen)
$(Q)$(SED) -e '1,3d' $^ > $@
# For the moment, we have to keep re-running this target
# because the fix includes scripts rely on pre-processers
# in order to generate the headers correctly :(. That
@ -84,11 +83,21 @@ else
export header_extra_args = -n
endif
HEADERS_BITS_COMMON := $(notdir $(wildcard $(top_srcdir)libc/sysdeps/linux/common/bits/*.h))
ifneq ($(ARCH_HAS_DEPRECATED_SYSCALLS),y)
HEADERS_BITS_COMMON_NO_LEGACY := $(notdir $(wildcard $(top_srcdir)libc/sysdeps/linux/common-generic/bits/*.h))
HEADERS_BITS_COMMON := $(filter-out $(HEADERS_BITS_COMMON_NO_LEGACY),$(HEADERS_BITS_COMMON))
ALL_HEADERS_BITS_COMMON_NO_LEGACY := $(addprefix $(top_builddir)include/bits/,$(HEADERS_BITS_COMMON_NO_LEGACY))
endif
HEADERS_BITS_ARCH := $(notdir $(wildcard $(top_srcdir)libc/sysdeps/linux/$(TARGET_ARCH)/bits/*.h))
HEADERS_BITS_SUBARCH :=
ifneq ($(TARGET_SUBARCH),)
HEADERS_BITS_SUBARCH := $(notdir $(wildcard $(top_srcdir)libc/sysdeps/linux/$(TARGET_ARCH)/bits/$(TARGET_SUBARCH)/*.h))
endif
ifneq ($(HEADERS_BITS_PTHREAD),)
HEADERS_BITS_ARCH := $(filter-out $(HEADERS_BITS_PTHREAD),$(HEADERS_BITS_ARCH))
HEADERS_BITS_SUBARCH:= $(filter-out $(HEADERS_BITS_PTHREAD),$(HEADERS_BITS_SUBARCH))
endif
HEADERS_BITS_COMMON := $(filter-out $(HEADERS_BITS_ARCH) $(HEADERS_BITS_SUBARCH) $(HEADERS_BITS_PTHREAD),$(HEADERS_BITS_COMMON))
HEADERS_SYS_COMMON := $(notdir $(wildcard $(top_srcdir)libc/sysdeps/linux/common/sys/*.h))
@ -96,8 +105,11 @@ HEADERS_SYS_ARCH := $(notdir $(wildcard $(top_srcdir)libc/sysdeps/linux/$(TARGET
HEADERS_SYS_COMMON := $(filter-out $(HEADERS_SYS_ARCH),$(HEADERS_SYS_COMMON))
ALL_HEADERS_COMMON := $(top_builddir)include/fpu_control.h \
$(top_builddir)include/jmpbuf-offsets.h \
$(top_builddir)include/jmpbuf-unwind.h \
$(top_builddir)include/dl-osinfo.h \
$(top_builddir)include/hp-timing.h
$(top_builddir)include/hp-timing.h \
$(top_builddir)include/not-cancel.h
ALL_HEADERS_BITS_COMMON := $(addprefix $(top_builddir)include/bits/,$(HEADERS_BITS_COMMON))
ALL_HEADERS_BITS_ARCH := $(addprefix $(top_builddir)include/bits/,$(HEADERS_BITS_ARCH))
ifneq ($(TARGET_SUBARCH),)
@ -117,13 +129,17 @@ target-headers-sysdep := \
$(ALL_HEADERS_SYS_ARCH) \
$(ALL_HEADERS_BITS_PTHREAD)
$(top_builddir)include/fpu_control.h:
ifneq ($(ARCH_HAS_DEPRECATED_SYSCALLS),y)
target-headers-sysdep += $(ALL_HEADERS_BITS_COMMON_NO_LEGACY)
endif
$(top_builddir)include/fpu_control.h $(top_builddir)include/jmpbuf-offsets.h $(top_builddir)include/jmpbuf-unwind.h:
@$(disp_ln)
$(Q)[ -r $(top_srcdir)libc/sysdeps/linux/$(TARGET_ARCH)/$(@F) ] && \
$(LN) -fs $(call rel_srcdir)libc/sysdeps/linux/$(TARGET_ARCH)/$(@F) $@ || \
$(LN) -fs $(call rel_srcdir)libc/sysdeps/linux/common/$(@F) $@
$(top_builddir)include/dl-osinfo.h $(top_builddir)include/hp-timing.h:
$(top_builddir)include/dl-osinfo.h $(top_builddir)include/hp-timing.h $(top_builddir)include/not-cancel.h:
$(do_ln) $(call rel_srcdir)libc/sysdeps/linux/common/$(@F) $@
$(ALL_HEADERS_BITS_COMMON):
@ -132,6 +148,11 @@ $(ALL_HEADERS_BITS_COMMON):
$(ALL_HEADERS_BITS_ARCH):
$(do_ln) $(call rel_srcdir)libc/sysdeps/linux/$(TARGET_ARCH)/bits/$(@F) $@
ifneq ($(ARCH_HAS_DEPRECATED_SYSCALLS),y)
$(ALL_HEADERS_BITS_COMMON_NO_LEGACY):
$(do_ln) $(call rel_srcdir)libc/sysdeps/linux/common-generic/bits/$(@F) $@
endif
ifneq ($(TARGET_SUBARCH),)
$(ALL_HEADERS_BITS_SUBARCH):
$(do_ln) $(call rel_srcdir)libc/sysdeps/linux/$(TARGET_ARCH)/bits/$(TARGET_SUBARCH)/$(@F) $@
@ -152,6 +173,9 @@ $(target-headers-sysdep) $(pregen-headers-y): | $(top_builddir)include/bits $(to
HEADERCLEAN_common:
$(do_rm) $(ALL_HEADERS_COMMON)
headers_clean-y += HEADERCLEAN_common
HEADERCLEAN_config:
$(do_rm) -r $(addprefix $(top_builddir)include/,config generated)
menuconfig-clean-y: HEADERCLEAN_config
# The headers. Arch specific headers are specified via ARCH_HEADERS in
# libc/sysdeps/linux/$(TARGET_ARCH)/Makefile.arch which appends those via
@ -160,33 +184,30 @@ headers-y += $(target-headers-sysdep)
headers: $(top_builddir)include/bits/uClibc_config.h | subdirs
subdirs: $(addprefix $(top_builddir),$(subdirs))
pregen-headers: $(top_builddir)include/bits/sysnum.h $(pregen-headers-y)
pregen: pregen-headers
$(pregen-headers-y): $(headers_dep)
pregen: headers $(pregen-headers-y) $(headers_dep)
$(Q)$(if $(UCLIBC_HAS_LOCALE),$(MAKE) -C extra/locale locale_headers)
$(top_builddir)include/bits/sysnum.h: $(top_srcdir)extra/scripts/gen_bits_syscall_h.sh | $(top_builddir)include/bits
@$(disp_gen)
$(Q)set -e; \
tmp=`mktemp $(top_builddir)include/bits/sysnum.h.XXXXXX 2>/dev/null || true`; \
[ -z "$$tmp" ] && tmp='$(top_builddir)include/bits/sysnum.h.new'; \
KERNEL_HEADERS="${KERNEL_HEADERS}" top_builddir="$(top_builddir)" CC="$(CC) $(CPU_CFLAGS)" $(SHELL) $< > $$tmp; \
if cmp $(top_builddir)include/bits/sysnum.h $$tmp >/dev/null 2>&1; then \
$(RM) $$tmp; \
else \
mv -f $$tmp $(top_builddir)include/bits/sysnum.h; \
fi
KERNEL_HEADERS="${KERNEL_HEADERS}" CC="$(CC) $(CPU_CFLAGS)" $(SHELL) $< > $@.new; \
cmp -s $@ $@.new && $(RM) $@.new || mv -f $@.new $@
@# Ugly linux specific hack..
$(Q)if grep -q __NR_ $@; then true; else \
rm -f $@; \
echo "ERROR: Could not generate syscalls."; \
echo "Make sure that you have proper kernel headers."; \
echo "Your .config in KERNEL_HEADERS=\"\" was set to:"; \
echo "Make sure that you have properly installed kernel headers."; \
echo "Your .config KERNEL_HEADERS=\"\" was set to:"; \
echo "${KERNEL_HEADERS}"; \
exit 1; \
fi
.PHONY: $(LOCAL_INSTALL_PATH)
$(LOCAL_INSTALL_PATH):
$(Q)$(MAKE) PREFIX=$(shell pwd)/$(LOCAL_INSTALL_PATH) RUNTIME_PREFIX=/ \
$(Q)$(MAKE) PREFIX=$(LOCAL_INSTALL_PATH) \
RUNTIME_PREFIX=/ \
DEVEL_PREFIX=/usr/ \
HOSTCC="$(HOSTCC)" \
install
@ -196,8 +217,6 @@ install: install_runtime install_dev
RUNTIME_PREFIX_LIB_FROM_DEVEL_PREFIX_LIB=$(shell $(top_srcdir)extra/scripts/relative_path.sh $(DEVEL_PREFIX)$(MULTILIB_DIR) $(RUNTIME_PREFIX)$(MULTILIB_DIR))
startfiles: $(crt-y)
$(top_builddir)extra/scripts/unifdef: |$(top_builddir)extra/scripts
$(top_builddir)extra/scripts/unifdef: $(top_srcdir)extra/scripts/unifdef.c
$(hcompile.u)
@ -206,21 +225,34 @@ $(top_builddir)extra/scripts/unifdef: $(top_srcdir)extra/scripts/unifdef.c
# a "y" here means the feature is enabled and so we should *not* rm it.
# if the option expands to nothing though, we can punt the headers.
HEADERS_RM- := \
config \
generated \
internal \
cancel.h \
dl-osinfo.h \
jmpbuf-offsets.h \
jmpbuf-unwind.h \
hp-timing.h \
not-cancel.h \
_lfs_64.h \
bits/uClibc_arch_features.h \
bits/kernel_sigaction.h \
bits/kernel_stat.h \
bits/kernel_types.h \
bits/libc-lock.h \
bits/stdio-lock.h \
bits/syscalls.h \
bits/syscalls-common.h \
bits/uClibc_fpmax.h \
bits/uClibc_mutex.h \
bits/uClibc_pthread.h \
bits/uClibc_uintmaxtostr.h \
bits/uClibc_uwchar.h \
bits/uClibc_va_copy.h \
bits/sigcontextinfo.h \
bits/stackinfo.h \
atomic.h \
bits/atomic.h \
tls.h \
rpc/des_crypt.h \
rpc/key_prot.h \
@ -239,11 +271,12 @@ HEADERS_RM-$(UCLIBC_HAS_FLOATS) += complex.h fpu_control.h ieee754.
tgmath.h \
bits/math*.h
HEADERS_RM-$(findstring y,$(UCLIBC_HAS_FTW)$(UCLIBC_HAS_NFTW)) += ftw.h
HEADERS_RM-$(UCLIBC_HAS_FTS) += fts.h
HEADERS_RM-$(UCLIBC_HAS_GETTEXT_AWARENESS) += libintl.h
HEADERS_RM-$(UCLIBC_HAS_GLIBC_CUSTOM_PRINTF) += printf.h
HEADERS_RM-$(UCLIBC_HAS_GLOB) += glob.h
HEADERS_RM-$(UCLIBC_HAS_GNU_ERROR) += error.h
HEADERS_RM-$(UCLIBC_HAS_GNU_GETOPT)$(UCLIBC_HAS_GETOPT_LONG) += getopt.h
HEADERS_RM-$(UCLIBC_HAS_GETOPT_LONG) += getopt.h
HEADERS_RM-$(UCLIBC_HAS_IPV6) += netinet/ip6.h netinet/icmp6.h
HEADERS_RM-$(UCLIBC_HAS_BACKTRACE) += execinfo.h
HEADERS_RM-$(UCLIBC_HAS_LOCALE) += iconv.h bits/uClibc_ctype.h
@ -254,33 +287,49 @@ HEADERS_RM-$(UCLIBC_HAS_REALTIME) += mqueue.h bits/mqueue.h sched.h \
HEADERS_RM-$(UCLIBC_HAS_REGEX) += regex.h regexp.h
HEADERS_RM-$(UCLIBC_HAS_RPC) += rpc
HEADERS_RM-$(UCLIBC_HAS_SHADOW) += shadow.h
HEADERS_RM-$(UCLIBC_HAS_SOCKET) += sys/socket.h bits/socket.h sys/socketvar.h
HEADERS_RM-$(UCLIBC_HAS_SOCKET) += sys/socket.h bits/socket.h sys/socketvar.h bits/socket_type.h
HEADERS_RM-$(UCLIBC_HAS_SYSLOG) += syslog.h sys/syslog.h bits/syslog*.h
HEADERS_RM-$(UCLIBC_HAS_THREADS) += *thread*.h semaphore.h \
bits/*thread*.h \
bits/initspin.h
HEADERS_RM-$(UCLIBC_HAS_THREADS_NATIVE) += atomic.h bits/atomic.h
HEADERS_RM-$(UCLIBC_HAS_OBSTACK) += obstack.h
HEADERS_RM-$(UCLIBC_HAS_UTMP) += bits/utmp.h utmp.h
HEADERS_RM-$(UCLIBC_HAS_UTMPX) += bits/utmpx.h utmpx.h
HEADERS_RM-$(UCLIBC_HAS_WCHAR) += wchar.h wctype.h
HEADERS_RM-$(UCLIBC_HAS_WORDEXP) += wordexp.h
HEADERS_RM-$(UCLIBC_HAS_XATTR) += sys/xattr.h
HEADERS_RM-$(UCLIBC_HAS_XLOCALE) += xlocale.h
HEADERS_RM-$(UCLIBC_LINUX_SPECIFIC) += sys/fsuid.h sys/inotify.h sys/perm.h \
HEADERS_RM-$(UCLIBC_LINUX_SPECIFIC) += \
sys/cachectl.h \
bits/eventfd.h \
sys/eventfd.h \
sys/fsuid.h \
bits/inotify.h \
sys/inotify.h \
sys/kdaemon.h \
sys/perm.h \
sys/personality.h \
sys/prctl.h \
sys/random.h \
sys/reboot.h \
sys/sendfile.h \
bits/signalfd.h \
sys/signalfd.h \
bits/statfs.h \
sys/statfs.h \
sys/swap.h \
sys/sysctl.h \
sys/sysinfo.h \
bits/timerfd.h \
sys/timerfd.h \
sys/sysmips.h \
sys/vfs.h
HEADERS_RM-$(UCLIBC_SUPPORT_AI_ADDRCONFIG) += ifaddrs.h
HEADERS_RM-$(UCLIBC_SV4_DEPRECATED) += ustat.h sys/ustat.h bits/ustat.h
HEADERS_RM-$(UCLIBC_SUSV3_LEGACY) += sys/timeb.h regexp.h
HEADERS_RM-$(UCLIBC_SUSV4_LEGACY) += utime.h ucontext.h
HEADERS_RM-$(UCLIBC_HAS_ADVANCED_REALTIME) += spawn.h
ifneq ($(findstring install,$(MAKECMDGOALS)),)
$(addprefix $(PREFIX)$(DEVEL_PREFIX),include $(MULTILIB_DIR)):
@ -291,7 +340,9 @@ $(PREFIX)$(RUNTIME_PREFIX)$(MULTILIB_DIR):
$(do_mkdir)
endif
endif
install_headers: headers $(top_builddir)extra/scripts/unifdef | $(PREFIX)$(DEVEL_PREFIX)include
install_headers: headers $(top_builddir)extra/scripts/unifdef $(top_builddir)include/generated/unifdef_config.h | $(PREFIX)$(DEVEL_PREFIX)include
@$(call disp_install,"include -> $(PREFIX)$(DEVEL_PREFIX)include")
$(Q)top_builddir=$(top_builddir) \
$(top_srcdir)extra/scripts/install_headers.sh \
@ -334,12 +385,7 @@ ifeq ($(HARDWIRED_ABSPATH),y)
else
-$(INSTALL) -m 755 $(top_builddir)lib/libc.so $(PREFIX)$(DEVEL_PREFIX)$(MULTILIB_DIR)/
endif
ifeq ($(UCLIBC_HAS_BACKTRACE),y)
# Add the AS_NEEDED entry for libubacktrace.so
if [ -f $(top_builddir)lib/libc.so -a -f $(PREFIX)$(RUNTIME_PREFIX)$(MULTILIB_DIR)/$(SHARED_MAJORNAME) ] ; then \
echo "GROUP ( $(UBACKTRACE_ASNEEDED) )" >> $(PREFIX)$(DEVEL_PREFIX)$(MULTILIB_DIR)/libc.so; \
fi
endif
echo "$(UBACKTRACE_ASNEEDED)" >> $(PREFIX)$(DEVEL_PREFIX)$(MULTILIB_DIR)/libc.so
ifeq ($(UCLIBC_HAS_THREADS),y)
ifneq ($(LINUXTHREADS_OLD),y)
ifeq ($(HARDWIRED_ABSPATH),y)
@ -385,7 +431,8 @@ install_runtime: all | $(PREFIX)$(RUNTIME_PREFIX)$(MULTILIB_DIR)
ifeq ($(HAVE_SHARED),y)
$(INSTALL) -m 755 $(top_builddir)lib/lib*-$(VERSION).so \
$(PREFIX)$(RUNTIME_PREFIX)$(MULTILIB_DIR)
(cd $(top_builddir)lib && $(TAR) -cf - *.so.*) | $(TAR) -xf - -C $(PREFIX)$(RUNTIME_PREFIX)$(MULTILIB_DIR)
(cd $(top_builddir)lib && $(TAR) --exclude=$(UCLIBC_LDSO_NAME).so.lds -cf - *.so.*) \
| $(TAR) -xf - -C $(PREFIX)$(RUNTIME_PREFIX)$(MULTILIB_DIR)
@if [ -x $(top_builddir)lib/$(UCLIBC_LDSO_NAME)-$(VERSION).so ] ; then \
set -e; \
$(SHELL_SET_X); \
@ -395,88 +442,93 @@ ifeq ($(HAVE_SHARED),y)
endif
utils: | pregen
$(Q)$(MAKE) CROSS="$(CROSS)" CC="$(CC)" -C utils $@
$(Q)$(MAKE) CROSS_COMPILE="$(CROSS_COMPILE)" CC="$(CC)" -C utils $@
# Installs helper applications, such as 'ldd' and 'ldconfig'
install_utils: utils
$(Q)$(MAKE) CROSS="$(CROSS)" CC="$(CC)" -C utils utils_install
$(Q)$(MAKE) CROSS_COMPILE="$(CROSS_COMPILE)" CC="$(CC)" -C utils utils_install
endif # ifeq ($(HAVE_DOT_CONFIG),y)
hostutils: | pregen
$(Q)$(MAKE) CROSS="$(CROSS)" CC="$(CC)" HOSTCC="$(HOSTCC)" DOTHOST=.host -C utils $@
$(Q)$(MAKE) CROSS_COMPILE="$(CROSS_COMPILE)" CC="$(CC)" HOSTCC="$(HOSTCC)" DOTHOST=.host -C utils $@
install_hostutils: hostutils
$(Q)$(MAKE) CROSS="$(CROSS)" CC="$(CC)" HOSTCC="$(HOSTCC)" DOTHOST=.host -C utils utils_install
$(Q)$(MAKE) CROSS_COMPILE="$(CROSS_COMPILE)" CC="$(CC)" HOSTCC="$(HOSTCC)" DOTHOST=.host -C utils utils_install
$(addprefix $(top_builddir),include include/bits include/sys include/config lib extra/config/lxdialog extra/locale extra/scripts $(subdirs)):
$(addprefix $(top_builddir),include include/bits include/sys include/config include/generated lib extra/config/lxdialog extra/locale extra/scripts $(subdirs)):
$(do_mkdir)
# configuration
# ---------------------------------------------------------------------------
$(top_builddir)extra/config/conf $(top_builddir)extra/config/mconf: | $(top_builddir)include/config $(top_builddir)extra/config/lxdialog
$(conf) $(mconf) $(nconf): | $(top_builddir)include/config $(top_builddir)include/generated $(top_builddir)extra/config/lxdialog
$(Q)$(MAKE) -C extra/config $(@F)
menuconfig: $(top_builddir)extra/config/mconf
$(Q)$(top_builddir)extra/config/mconf extra/Configs/Config.in
arch-defconfigs := $(notdir $(wildcard $(top_srcdir)extra/Configs/defconfigs/$(ARCH)/*_defconfig))
config: $(top_builddir)extra/config/conf
$(Q)$(top_builddir)extra/config/conf extra/Configs/Config.in
menuconfig: $(mconf)
$(Q)$< $(Kconfig)
config: $(conf)
$(Q)$< $(Kconfig)
nconfig: $(nconf)
$(Q)$< $(Kconfig)
oldconfig: $(top_builddir)extra/config/conf
$(Q)$(top_builddir)extra/config/conf -o extra/Configs/Config.in
silentoldconfig: $(top_builddir)extra/config/conf
$(Q)$(top_builddir)extra/config/conf -s extra/Configs/Config.in
randconfig: $(top_builddir)extra/config/conf
$(Q)$(top_builddir)extra/config/conf -r extra/Configs/Config.in
allyesconfig: $(top_builddir)extra/config/conf
$(Q)$(top_builddir)extra/config/conf -y extra/Configs/Config.in
oldaskconfig: $(conf)
$(Q)$< -a $(Kconfig)
silentoldconfig: $(conf)
$(Q)$< -s $(Kconfig)
oldconfig: $(conf)
$(Q)$< -o $(Kconfig)
allnoconfig: $(conf)
$(Q)$< -n $(Kconfig)
allyesconfig: $(conf)
$(Q)$< -y $(Kconfig)
$(SED) -i -e "s/^DODEBUG=.*/# DODEBUG is not set/" \
-e "s/^DOASSERTS=.*/# DOASSERTS is not set/" \
-e "s/^SUPPORT_LD_DEBUG_EARLY=.*/# SUPPORT_LD_DEBUG_EARLY is not set/" \
-e "s/^SUPPORT_LD_DEBUG=.*/# SUPPORT_LD_DEBUG is not set/" \
-e "s/^UCLIBC_MJN3_ONLY=.*/# UCLIBC_MJN3_ONLY is not set/" \
$(KCONFIG_CONFIG)
$(Q)$(top_builddir)extra/config/conf -o extra/Configs/Config.in
$(Q)$< -o $(Kconfig)
alldefconfig: $(conf)
$(Q)$< -A $(Kconfig)
randconfig: $(conf)
$(Q)$< -r $(Kconfig)
allnoconfig: $(top_builddir)extra/config/conf
$(Q)$(top_builddir)extra/config/conf -n extra/Configs/Config.in
cmd_defconfig = $(Q)$< -D extra/Configs/defconfigs/$(ARCH)/$@ $(Kconfig)
defconfig: $(conf) ; $(cmd_defconfig)
%_defconfig: $(conf) ; $(cmd_defconfig)
defconfig: $(top_builddir)extra/config/conf
$(Q)$(top_builddir)extra/config/conf -d extra/Configs/Config.in \
-D extra/Configs/defconfigs/$(ARCH)
savedefconfig: $(conf)
$(Q)$< -S defconfig $(Kconfig)
listnewconfig: $(conf)
$(Q)$< -l $(Kconfig)
olddefconfig: $(conf)
$(Q)$< -d $(Kconfig)
menuconfig-clean-y:
$(Q)$(MAKE) -C extra/config CLEAN_extra/config
# The find here should continue to work as long as we are only symlinking
# headers in to include/. I don't see this changing to anything else, so
# it should be fine.
include_clean:
$(Q)$(RM) $(top_builddir)include/fpu_control.h $(top_builddir)include/dl-osinfo.h $(top_builddir)include/hp-timing.h
@set -e; \
for i in `(cd libc/sysdeps/linux/common/sys; ls *.h)` ; do \
$(RM) $(top_builddir)include/sys/$$i; \
done; \
if [ -d libc/sysdeps/linux/$(TARGET_ARCH)/sys ] ; then \
for i in `(cd libc/sysdeps/linux/$(TARGET_ARCH)/sys; ls *.h)` ; do \
$(RM) $(top_builddir)include/sys/$$i; \
done; \
fi
$(SECHO) " CLEAN include"
$(Q)$(RM) -r $(top_builddir)include/bits
$(Q)find $(top_builddir)include/ -type l -exec rm -f {} +
clean: include_clean
$(Q)$(RM) -r $(top_builddir)lib $(top_builddir)include/bits
$(Q)$(RM) -r $(top_builddir)lib
@$(MAKE) -C utils CLEAN_utils
+$(MAKE) -s -C test clean
@$(RM) $(top_builddir)include/linux $(top_builddir)include/asm*
$(Q)$(RM) $(top_builddir)extra/scripts/unifdef
$(Q)$(RM) -r $(LOCAL_INSTALL_PATH)
distclean: clean
distclean: realclean
-find . \( -name core -o -name \*.orig -o -name \*~ -o -name .\*.dep \) -exec $(RM) {} \;
$(RM) $(top_builddir).config $(top_builddir).config.old $(top_builddir).config.cmd
$(RM) $(top_builddir)extra/locale/*.tgz
$(MAKE) -C extra/config distclean
$(Q)$(RM) $(top_builddir)extra/locale/*.tgz
@$(MAKE) -C extra/config distclean
dist release:
$(RM) ../uClibc-$(VERSION).tar
@ -487,7 +539,9 @@ dist release:
du -b ../uClibc-$(VERSION).tar.{bz2,xz}
test check: test_compile
$(Q)$(MAKE) -C test
$(Q)$(MAKE) -C test \
$(if $(O),top_builddir=$(O)/)
test_compile: $(LOCAL_INSTALL_PATH)
$(Q)$(MAKE) -C test compile
$(Q)$(MAKE) -C test compile \
$(if $(O),top_builddir=$(O)/)

View File

@ -22,9 +22,32 @@ ifeq ($(UCLIBC_FORMAT_SHARED_FLAT),y)
libs: $(lib-gdb-y)
endif
libs: $(lib-a-y)
$(lib-a-y): | $(top_builddir)lib
endif
objs: all_objs
$(lib-so-y) $(lib-a-y): | $(top_builddir)lib
# apply unconditional per-directory flags
define add_IS_IN_lib
ifneq ($(strip $(2)),)
__add_IS_IN_lib := $(2)
__add_IS_IN_lib += $(2:.o=.i) $(2:.os=.i) $(2:.oS=.i)
__add_IS_IN_lib += $(2:.o=.s) $(2:.os=.s) $(2:.oS=.s)
$$(__add_IS_IN_lib): CFLAGS-for-library-members:=$(CFLAGS-$(1)) -DIN_LIB=$(word 1,$(subst /, ,$(1)))
endif
endef
$(eval $(call add_IS_IN_lib,rtld,$(ldso-y)))
$(eval $(call add_IS_IN_lib,libc,$(libc-y) $(libc-static-y) $(libc-y:.o=.os) $(libc-shared-y) $(libc-nonshared-y)))
$(eval $(call add_IS_IN_lib,libcrypt,$(libcrypt-a-y) $(libcrypt-so-y)))
$(eval $(call add_IS_IN_lib,libdl,$(libdl-a-y) $(libdl-so-y)))
$(eval $(call add_IS_IN_lib,libintl,$(libintl-a-y) $(libintl-so-y)))
$(eval $(call add_IS_IN_lib,libm,$(libm-a-y) $(libm-so-y)))
$(eval $(call add_IS_IN_lib,libnsl,$(libnsl-a-y) $(libnsl-so-y)))
$(eval $(call add_IS_IN_lib,libpthread/$(PTNAME),$(libpthread-a-y) $(libpthread-so-y) $(libpthread-nonshared-y)))
$(eval $(call add_IS_IN_lib,libpthread/$(PTNAME)_db,$(libthread_db-a-y) $(libthread_db-so-y)))
$(eval $(call add_IS_IN_lib,libresolv,$(libresolv-a-y) $(libresolv-so-y)))
$(eval $(call add_IS_IN_lib,librt,$(librt-a-y) $(librt-so-y)))
$(eval $(call add_IS_IN_lib,libutil,$(libutil-a-y) $(libutil-so-y)))
$(eval $(call add_IS_IN_lib,libubacktrace,$(libubacktrace-a-y) $(libubacktrace-so-y)))
shared_objs = $(libc-y:.o=.os) $(libc-shared-y) $(libc-nonshared-y) \
$(libcrypt-so-y) $(libdl-so-y) \
@ -50,6 +73,10 @@ all_objs: $(ar_objs)
endif
$(shared_objs) $(ar_objs): | $(sub_headers)
define objects_with_syms
$(foreach o,$(2),$(if $(shell $(NM) $(1) $(o) | grep .),$(o)))
endef
headers-y: $(headers-y)
@true
@ -58,7 +85,7 @@ SHELL_SET_X := set +x
define rel_srcdir
$(shell $(CONFIG_SHELL) $(top_srcdir)/extra/scripts/relative_path.sh $(@D) .)
endef
ifneq ($(findstring -s,$(MAKEFLAGS)),)
ifneq ($(findstring s,$(MAKEFLAGS)),)
export MAKE_IS_SILENT := y
SECHO := -@false
DISP := sil
@ -67,7 +94,7 @@ else
export MAKE_IS_SILENT := n
SECHO := @echo
ifneq ($(V)$(VERBOSE),)
ifeq ($(V),1)
ifeq ($(V),2)
DISP := bri# brief, like pur but with defines
Q := @
else
@ -224,26 +251,31 @@ maybe_exec = \
#collect_multi_flags = $(CFLAGS-$(notdir $(d))) $(CFLAGS-$(notdir $(patsubst %/,%,$(dir $(d)))))
collect_multi_flags = $(CFLAGS-$(notdir $(patsubst %/,%,$(dir $(d)))))
#sub_srcdir = $(word 1,$(filter-out lib extra locale libpthread,$(wordlist 1,2,$(subst /, ,$(subst $(top_srcdir),,$(dir $<))))))
CFLAGS_gen.dep = -MT $@ -MD -MP -MF $(dir $@).$(notdir $@).dep
cmd_compile.c = $(CC) -c $< -o $@ $(CFLAGS) \
cmd_compile.c = $(CC) -c $< -o $@ \
$(filter-out $(CFLAGS-OMIT-$(notdir $<)), \
$(CFLAGS) \
$(CFLAGS-for-library-members) \
$(CFLAGS-$(suffix $@)) \
$(filter-out $(CFLAGS-OMIT-$(notdir $<)),$(CFLAGS-$(notdir $(<D)))) \
$(CFLAGS-$(subst $(top_srcdir),,$(dir $<))) \
$(CFLAGS-y-$(subst $(top_srcdir),,$(<D))) \
$(CFLAGS-$(notdir $<)) \
$(CFLAGS-$(notdir $@)) \
) \
$(CFLAGS_gen.dep)
cmd_compile.i = $(cmd_compile.c:-c=-E -dD $(EXTRA_CPPFLAGS))
cmd_compile.i = $(cmd_compile.c:-c=-E -dD) $(UCLIBC_EXTRA_CPPFLAGS)
cmd_compile.s = $(cmd_compile.c:-c=-S)
cmd_compile.u = $(CC) $^ $(DEPS-$(notdir $@)) -o $@ $(CFLAGS) $(CFLAGS-$(notdir $(^D))) $(CFLAGS-$(notdir $@)) $(CFLAGS_gen.dep)
cmd_compile.S = $(filter-out -std=gnu99, $(cmd_compile.c)) -D__ASSEMBLER__ $(ASFLAGS) $(ARCH_ASFLAGS) $(ASFLAGS-$(suffix $@)) $(ASFLAGS-$(notdir $<)) $(ASFLAGS-$(notdir $@))
cmd_compile.S = $(filter-out -std=%, $(cmd_compile.c)) -D__ASSEMBLER__ $(ASFLAGS) $(ARCH_ASFLAGS) $(ASFLAGS-$(suffix $@)) $(ASFLAGS-$(notdir $<)) $(ASFLAGS-$(notdir $@))
cmd_compile.m = $(cmd_compile.c) -DL_$(patsubst %$(suffix $(notdir $@)),%,$(notdir $@))
cmd_compile.mi= $(cmd_compile.m:-c=-E -dD $(EXTRA_CPPFLAGS))
cmd_compile.mi= $(cmd_compile.m:-c=-E -dD) $(UCLIBC_EXTRA_CPPFLAGS)
cmd_compile-m = $(CC) $^ -c -o $@ $(CFLAGS) $(CFLAGS-$(suffix $@)) $(CFLAGS-$(notdir $(@D))) $(CFLAGS-$(notdir $@)) $(sort $(foreach d,$(^:$(top_srcdir)=),$(collect_multi_flags)))
cmd_strip = $(STRIPTOOL) $(STRIP_FLAGS) $^
cmd_t_strip = $(STRIPTOOL) $(STRIP_FLAGS) $@
cmd_ar = $(AR) $(ARFLAGS) $@ $^
cmd_ar = $(AR) $(ARFLAGS) $@ $(call objects_with_syms,,$^)
define do_ln
@$(disp_ln)
@ -299,7 +331,8 @@ define link.so
@$(disp_ld)
$(Q)$(CC) $(LDFLAGS-$(notdir $@)) $(LDFLAGS-y-$(@F)) \
-Wl,-soname=$(notdir $@).$(2) \
$(NOSTDLIB_CFLAGS) -o $(dir $@)$(1) $(START_FILE-$(notdir $@)) \
$(CFLAG_-nostdlib) $(CFLAG_-nostartfiles) \
-o $(dir $@)$(1) $(START_FILE-$(notdir $@)) \
-Wl,--whole-archive $(firstword $^) -Wl,--no-whole-archive \
$(LIBS-$(notdir $@)) $(LIBGCC) $(END_FILE-$(notdir $@))
$(Q)$(LN) -sf $(1) $@.$(2)
@ -324,7 +357,7 @@ LINK_FLAT_CRTS := $(top_builddir)lib/Scrt1.o $(top_builddir)lib/crti.o \
define link-flat.so
$(Q)$(RM) $(1) $@
@$(disp_ld)
$(Q)$(CC) $(LDFLAGS-$(notdir $@)) $(NOSTDLIB_CFLAGS) -o $(1) \
$(Q)$(CC) $(LDFLAGS-$(notdir $@)) $(CFLAG_-nostdlib) -o $(1) \
-Wl,-elf2flt -Wl,-shared-lib-id,$(2) $(top_builddir)lib/Scrt1.o \
$(top_builddir)/lib/crti.o -Wl,--whole-archive $(firstword $^) \
$(LIBGCC) -Wl,--no-whole-archive $(LIBS-$(notdir $@)) $(LIBGCC) \
@ -336,7 +369,7 @@ define linkm.so
$(do_strip)
@$(disp_ld)
$(Q)$(CC) $(LDFLAGS-$(notdir $@)) -Wl,-soname=$(notdir $@).$(2) \
$(NOSTDLIB_CFLAGS) -o $(dir $@)$(1) $(START_FILE-$(notdir $@)) \
$(CFLAG_-nostdlib) -o $(dir $@)$(1) $(START_FILE-$(notdir $@)) \
$^ \
$(LIBS-$(notdir $@)) $(LIBGCC) $(END_FILE-$(notdir $@))
$(Q)$(LN) -sf $(1) $@.$(2)
@ -364,14 +397,9 @@ $(top_builddir)%.dep:
$(top_builddir)lib/interp.c: | $(top_builddir)lib
$(Q)echo "/* Force shared libraries to know about the correct library loader */" > $@.tmp
$(Q)echo "#include <features.h>" >> $@.tmp
ifeq ($(HARDWIRED_ABSPATH),y)
$(Q)echo "const char __dl_ldso__[] attribute_hidden __attribute__ ((weak)) __attribute__ ((section " \
"(\".interp\"))) =\""$(RUNTIME_PREFIX)$(MULTILIB_DIR)/$(UCLIBC_LDSO)"\";" >> $@.tmp
$(Q)$(SED) -i -e 's://:/:g' $@.tmp
else
$(Q)echo "const char __dl_ldso__[] attribute_hidden __attribute__ ((weak)) __attribute__ ((section " \
"(\".interp\"))) =\""$(UCLIBC_LDSO)"\";" >> $@.tmp
endif
$(Q)mv $@.tmp $@
$(interp): $(top_builddir)lib/interp.c | $(sub_headers)
@ -402,6 +430,9 @@ CTOR_TARGETS=$(top_builddir)lib/crti.o $(top_builddir)lib/crtn.o
else
CTOR_TARGETS:=
endif
ifeq ($(HAS_NO_THREADS)$(UCLIBC_HAS_THREADS_NATIVE),)
$(lib-so-y): $(CTOR_TARGETS)
endif
ifeq ($(UCLIBC_FORMAT_FDPIC_ELF),y)
CRTRELOC=$(top_builddir)lib/crtreloc.o
@ -414,18 +445,18 @@ CFLAGS-initfini.s := -S -g0 $(PICFLAG) -fno-inline-functions -finhibit-size-dire
$(top_builddir)lib/initfini.s: $(top_srcdir)libc/sysdeps/linux/$(TARGET_ARCH)/initfini.c | $(top_builddir)lib
$(compile.c)
$(top_builddir)lib/defs.h: $(top_builddir)lib/initfini.s | $(top_builddir)lib
$(Q)sed -n -e '/@TESTS_BEGIN/,/@TESTS_END/p' $< | \
gawk -f $(top_srcdir)extra/scripts/defs.awk > $@.tmp
$(top_builddir)lib/defs.h: $(top_builddir)lib/initfini.s
$(do_sed) -n -e '/@TESTS_BEGIN/,/@TESTS_END/p' $< | \
$(AWK) -f $(top_srcdir)extra/scripts/defs.awk > $@.tmp
$(Q)mv $@.tmp $@
$(top_builddir)lib/crti.S: $(top_builddir)lib/initfini.s $(top_builddir)lib/defs.h
$(Q)sed -n -e '1,/@HEADER_ENDS/p' \
$(do_sed) -n -e '1,/@HEADER_ENDS/p' \
-e '/@_.*_PROLOG_BEGINS/,/@_.*_PROLOG_ENDS/p' \
-e '/@TRAILER_BEGINS/,$$p' $< > $@
$(top_builddir)lib/crtn.S: $(top_builddir)lib/initfini.s
$(Q)sed -n -e '1,/@HEADER_ENDS/p' \
$(do_sed) -n -e '1,/@HEADER_ENDS/p' \
-e '/@_.*_EPILOG_BEGINS/,/@_.*_EPILOG_ENDS/p' \
-e '/@TRAILER_BEGINS/,$$p' $< > $@
@ -445,9 +476,10 @@ CRTS_COMPAT :=
#endif
startfiles = $(CRTS) $(CTOR_TARGETS) $(CRTS_COMPAT) $(CRTRELOC)
$(crt-y): $(startfiles)
startfiles: $(startfiles)
$(CRTS) $(CTOR_TARGETS) $(CRTS_COMPAT) $(CRTRELOC): | headers
$(CRTS) $(CTOR_TARGETS) $(CRTS_COMPAT) $(CRTRELOC) $(LINK_FLAT_CRTS) $(SHARED_START_FILES) $(SHARED_END_FILES) : | $(top_builddir)lib
$(CRTS) $(CTOR_TARGETS) $(CRTS_COMPAT) $(CRTRELOC) \
$(LINK_FLAT_CRTS) $(SHARED_START_FILES) $(SHARED_END_FILES): | $(top_builddir)lib
$(top_builddir)lib/$(NONSHARED_LIBNAME): $(libc-nonshared-y)
$(Q)$(RM) $@
@ -461,6 +493,8 @@ files.dep := $(libc-a-y) $(libc-so-y) $(libc-nonshared-y) \
$(libm-a-y) $(libm-so-y) \
$(libpthread-a-y) $(libpthread-so-y) $(libpthread-nonshared-y) \
$(libthread_db-a-y) $(libthread_db-so-y) $(libpthread-generated-y) \
$(START_FILE-libpthread.so) $(END_FILE-libpthread.so) \
$(PTHREAD_INITFINI:.c=.s) \
$(librt-a-y) $(librt-so-y) $(libresolv-a-y) $(libresolv-so-y) \
$(libcrypt-a-y) $(libcrypt-so-y) $(libutil-a-y) $(libutil-so-y) \
$(libnsl-a-y) $(libnsl-so-y) $(ldso-y) $(libdl-a-y) $(libdl-so-y) \

448
Rules.mak
View File

@ -27,27 +27,36 @@ endif
# file named ".config". Don't mess with this file unless
# you know what you are doing.
clean_targets := clean realclean distclean \
objclean-y headers_clean-y CLEAN_utils
noconfig_targets := menuconfig config nconfig \
oldaskconfig silentoldconfig oldconfig allnoconfig allyesconfig \
alldefconfig randconfig defconfig savedefconfig listnewconfig \
olddefconfig \
xconfig gconfig update-po-config mconf qconf gconf nconf conf \
release dist tags help
#-----------------------------------------------------------
# If you are running a cross compiler, you will want to set
# 'CROSS' to something more interesting ... Target
# 'CROSS_COMPILE' to something more interesting ... Target
# architecture is determined by asking the CC compiler what
# arch it compiles things for, so unless your compiler is
# broken, you should not need to specify TARGET_ARCH.
#
# Most people will set this stuff on the command line, i.e.
# make CROSS=arm-linux-
# make CROSS_COMPILE=arm-linux-
# will build uClibc for 'arm'.
# CROSS is still supported for backward compatibily only
ifndef CROSS
CROSS=
endif
CC = $(CROSS)gcc
AR = $(CROSS)ar
LD = $(CROSS)ld
NM = $(CROSS)nm
OBJDUMP = $(CROSS)objdump
STRIPTOOL = $(CROSS)strip
CROSS_COMPILE ?= $(CROSS)
CC = $(CROSS_COMPILE)gcc
AR = $(CROSS_COMPILE)ar
LD = $(CROSS_COMPILE)ld
NM = $(CROSS_COMPILE)nm
OBJDUMP = $(CROSS_COMPILE)objdump
STRIPTOOL = $(CROSS_COMPILE)strip
INSTALL = install
LN = ln
@ -63,7 +72,7 @@ STRIP_FLAGS ?= -x -R .note -R .comment
# Select the compiler needed to build binaries for your development system
HOSTCC = gcc
BUILD_CFLAGS = -Os -Wall
BUILD_CFLAGS = -Os
#---------------------------------------------------------
# Nothing beyond this point should ever be touched by mere
@ -74,10 +83,25 @@ BUILD_CFLAGS = -Os -Wall
qstrip = $(strip $(subst ",,$(1)))
#"))
# kconfig stuff
KCONFIG_CONFIG ?= $(top_builddir).config
KCONFIG_CONFIG := $(abspath $(KCONFIG_CONFIG))
export KCONFIG_CONFIG
KCONFIG_AUTOCONFIG := $(dir $(KCONFIG_CONFIG))include/config/auto.conf
export KCONFIG_AUTOCONFIG
KCONFIG_TRISTATE := $(dir $(KCONFIG_CONFIG))include/config/tristate.conf
export KCONFIG_TRISTATE
srctree := $(abspath $(top_srcdir))
export srctree
KCONFIG_AUTOHEADER := $(dir $(KCONFIG_CONFIG))include/generated/autoconf.h
export KCONFIG_AUTOHEADER
Kconfig := $(abspath $(top_srcdir)extra/Configs/Config.in)
# Pull in the user's uClibc configuration
ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
-include $(top_builddir).config
ifeq ($(filter $(noconfig_targets) clean CLEAN_%,$(MAKECMDGOALS)),)
-include $(KCONFIG_CONFIG)
endif
TARGET_ARCH:=$(call qstrip,$(TARGET_ARCH))
ifeq ($(TARGET_ARCH),)
ARCH ?= $(shell uname -m | $(SED) -e s/i.86/i386/ \
@ -93,20 +117,20 @@ endif
export ARCH
# Make certain these contain a final "/", but no "//"s.
TARGET_SUBARCH:=$(call qstrip,$(shell grep -s '^TARGET_SUBARCH' $(top_builddir)/.config | $(SED) -e 's/^TARGET_SUBARCH=//'))
TARGET_SUBARCH:=$(call qstrip,$(TARGET_SUBARCH))
RUNTIME_PREFIX:=$(strip $(subst //,/, $(subst ,/, $(call qstrip,$(RUNTIME_PREFIX)))))
DEVEL_PREFIX:=$(strip $(subst //,/, $(subst ,/, $(call qstrip,$(DEVEL_PREFIX)))))
MULTILIB_DIR:=$(strip $(subst //,/, $(subst ,/, $(call qstrip,$(MULTILIB_DIR)))))
KERNEL_HEADERS:=$(strip $(subst //,/, $(subst ,/, $(call qstrip,$(KERNEL_HEADERS)))))
scrub_path = $(strip $(subst //,/, $(subst ,/, $(call qstrip,$(1)))))
TARGET_SUBARCH := $(call qstrip,$(TARGET_SUBARCH))
RUNTIME_PREFIX := $(call scrub_path,$(RUNTIME_PREFIX))
DEVEL_PREFIX := $(call scrub_path,$(DEVEL_PREFIX))
MULTILIB_DIR := $(call scrub_path,$(MULTILIB_DIR))
KERNEL_HEADERS := $(call scrub_path,$(KERNEL_HEADERS))
export RUNTIME_PREFIX DEVEL_PREFIX KERNEL_HEADERS MULTILIB_DIR
# Now config hard core
MAJOR_VERSION := 0
MINOR_VERSION := 9
SUBLEVEL := 32
EXTRAVERSION :=-rc3
SUBLEVEL := 34
EXTRAVERSION :=-git
VERSION := $(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL)
ABI_VERSION := $(MAJOR_VERSION)
ifneq ($(EXTRAVERSION),)
@ -118,14 +142,20 @@ export MAJOR_VERSION MINOR_VERSION SUBLEVEL VERSION ABI_VERSION LC_ALL
LIBC := libc
SHARED_LIBNAME := $(LIBC).so.$(ABI_VERSION)
UBACKTRACE_DSO := libubacktrace.so.$(MAJOR_VERSION)
ifneq ($(findstring $(TARGET_ARCH) , hppa64 ia64 mips64 powerpc64 s390x sparc64 x86_64 ),)
UBACKTRACE_DSO := libubacktrace.so.$(ABI_VERSION)
UCLIBC_LDSO_NAME := ld-uClibc
ARCH_NATIVE_BIT := 32
ifneq ($(findstring $(TARGET_ARCH) , hppa64 ia64 powerpc64 s390x sparc64 x86_64 ),)
UCLIBC_LDSO_NAME := ld64-uClibc
ARCH_NATIVE_BIT := 64
else
UCLIBC_LDSO_NAME := ld-uClibc
ARCH_NATIVE_BIT := 32
ifeq ($(CONFIG_MIPS_N64_ABI),y)
UCLIBC_LDSO_NAME := ld64-uClibc
ARCH_NATIVE_BIT := 64
endif
endif
UCLIBC_LDSO := $(UCLIBC_LDSO_NAME).so.$(ABI_VERSION)
NONSHARED_LIBNAME := uclibc_nonshared.a
libc := $(top_builddir)lib/$(SHARED_LIBNAME)
@ -138,7 +168,8 @@ libpthread.depend := $(top_builddir)lib/libpthread.so
endif
interp := $(top_builddir)lib/interp.os
ldso := $(top_builddir)lib/$(UCLIBC_LDSO)
headers_dep := $(top_builddir)include/bits/sysnum.h
headers_dep := $(top_builddir)include/bits/sysnum.h \
$(top_builddir)include/bits/uClibc_config.h
sub_headers := $(headers_dep)
#LIBS :=$(interp) -L$(top_builddir)lib -lc
@ -159,8 +190,8 @@ endif
comma:=,
space:= #
ifndef CROSS
CROSS=$(call qstrip,$(CROSS_COMPILER_PREFIX))
ifeq ($(CROSS_COMPILE),)
CROSS_COMPILE=$(call qstrip,$(CROSS_COMPILER_PREFIX))
endif
# A nifty macro to make testing gcc features easier
@ -171,35 +202,90 @@ check_as=$(shell \
if $(CC) -Wa,$(1) -Wa,-Z -c -o /dev/null -xassembler /dev/null > /dev/null 2>&1; \
then echo "-Wa,$(1)"; fi)
check_ld=$(shell \
if $(LD) $(1) -o /dev/null -b binary /dev/null > /dev/null 2>&1; \
if $(CC) $(LDFLAG-fuse-ld) $(CFLAG_-Wl--no-warn-mismatch) -Wl,$(1) $(CFLAG_-nostdlib) -o /dev/null -Wl,-b,binary /dev/null > /dev/null 2>&1; \
then echo "$(1)"; fi)
# Use variable indirection here so that we can have variable
# names with fun chars in them like equal signs
define check-tool-var
ifeq ($(filter $(clean_targets) CLEAN_%,$(MAKECMDGOALS)),)
_v = $(2)_$(3)
ifndef $$(_v)
$$(_v) := $$(call $(1),$(subst %, ,$(3)))
export $$(_v)
endif
endif
endef
# Usage: check-gcc-var,<flag>
# Check the C compiler to see if it supports <flag>.
# Export the variable CFLAG_<flag> if it does.
define check-gcc-var
$(call check-tool-var,check_gcc,CFLAG,$(1))
endef
# Usage: check-as-var,<flag>
# Check the assembler to see if it supports <flag>. Export the
# variable ASFLAG_<flag> if it does (for invoking the assembler),
# as well CFLAG_-Wa<flag> (for invoking the compiler driver).
define check-as-var
$(call check-tool-var,check_as,ASFLAG,$(1))
_v = CFLAG_-Wa$(1)
export $$(_v) = $$(if $$(ASFLAG_$(1)),-Wa$$(comma)$$(ASFLAG_$(1)))
endef
# Usage: check-ld-var,<flag>
# Check the linker to see if it supports <flag>. Export the
# variable LDFLAG_<flag> if it does (for invoking the linker),
# as well CFLAG_-Wl<flag> (for invoking the compiler driver).
define check-ld-var
$(call check-tool-var,check_ld,LDFLAG,$(1))
_v = CFLAG_-Wl$(1)
export $$(_v) = $$(if $$(LDFLAG_$(1)),-Wl$$(comma)$$(LDFLAG_$(1)))
endef
# Usage: cache-output-var,<variable>,<shell command>
# Execute <shell command> and cache the output in <variable>.
define cache-output-var
ifndef $(1)
$(1) := $$(shell $(2))
export $(1)
endif
endef
ARFLAGS:=cr
# Note: The check for -nostdlib has to be before all calls to check_ld
$(eval $(call check-gcc-var,-nostdlib))
$(eval $(call check-gcc-var,-nostartfiles))
# deliberately not named CFLAG-fuse-ld since unchecked and from user
LDFLAG-fuse-ld := $(filter -fuse-ld=%,$(call qstrip,$(UCLIBC_EXTRA_CFLAGS)))
# failed to merge target specific data of file /dev/null
# Could use -Wl,--script,$(top_srcdir)extra/scripts/none.lds as well.
$(eval $(call check-ld-var,--no-warn-mismatch))
$(eval $(call cache-output-var,GCC_VER,$(CC) -dumpversion))
GCC_VER := $(subst ., ,$(GCC_VER))
GCC_MAJOR_VER ?= $(word 1,$(GCC_VER))
GCC_MINOR_VER ?= $(word 2,$(GCC_VER))
# Flags in OPTIMIZATION are used only for non-debug builds
OPTIMIZATION:=
OPTIMIZATION-$(GCC_MAJOR_VER):=
OPTIMIZATION-$(GCC_MAJOR_VER).$(GCC_MINOR_VER):=
# Use '-Os' optimization if available, else use -O2, allow Config to override
OPTIMIZATION+=$(call check_gcc,-Os,-O2)
# Use the gcc 3.4 -funit-at-a-time optimization when available
OPTIMIZATION+=$(call check_gcc,-funit-at-a-time,)
# shrinks code by about 0.1%
OPTIMIZATION+=$(call check_gcc,-fmerge-all-constants)
GCC_MAJOR_VER?=$(shell $(CC) -dumpversion | cut -d . -f 1)
#GCC_MINOR_VER?=$(shell $(CC) -dumpversion | cut -d . -f 2)
ifeq ($(GCC_MAJOR_VER),4)
# shrinks code, results are from 4.0.2
# 0.36%
OPTIMIZATION+=$(call check_gcc,-fno-tree-loop-optimize,)
# 0.34%
OPTIMIZATION+=$(call check_gcc,-fno-tree-dominator-opts,)
# 0.1%
OPTIMIZATION+=$(call check_gcc,-fno-strength-reduce,)
$(eval $(call check-gcc-var,-Os))
ifneq ($(CFLAG_-Os),)
OPTIMIZATION += $(CFLAG_-Os)
else
$(eval $(call check-gcc-var,-O2))
OPTIMIZATION += $(CFLAG_-O2)
endif
# Use the gcc 3.4 -funit-at-a-time optimization when available
$(eval $(call check-gcc-var,-funit-at-a-time))
OPTIMIZATION-3.4 += $(CFLAG_-funit-at-a-time)
$(eval $(call check-gcc-var,-fstrict-aliasing))
OPTIMIZATION += $(CFLAG_-fstrict-aliasing)
# CPU_CFLAGS-y contain options which are not warnings,
# not include or library paths, and not optimizations.
@ -208,7 +294,10 @@ endif
# sign extension of 'char' type for 10 hours straight. Not fun.
CPU_CFLAGS-y := -funsigned-char -fno-builtin
CPU_CFLAGS-y += $(call check_gcc,-fno-asm,)
$(eval $(call check-gcc-var,-fno-asm))
CPU_CFLAGS-y += $(CFLAG_-fno-asm)
$(eval $(call check-gcc-var,-fmerge-all-constants))
CPU_CFLAGS-y += $(CFLAG_-fmerge-all-constants)
LDADD_LIBFLOAT=
ifeq ($(UCLIBC_HAS_SOFT_FLOAT),y)
@ -231,7 +320,8 @@ ifeq ($(TARGET_ARCH),arm)
endif
endif
CPU_CFLAGS-y += $(call check_gcc,-std=gnu99,)
$(eval $(call check-gcc-var,-std=gnu99))
CPU_CFLAGS-y += $(CFLAG_-std=gnu99)
CPU_CFLAGS-$(UCLIBC_FORMAT_SHARED_FLAT) += -mid-shared-library
CPU_CFLAGS-$(UCLIBC_FORMAT_FLAT_SEP_DATA) += -msep-data
@ -247,9 +337,12 @@ PIEFLAG_NAME:=-fPIE
# Some nice CPU specific optimizations
ifeq ($(TARGET_ARCH),i386)
OPTIMIZATION+=$(call check_gcc,-fomit-frame-pointer,)
$(eval $(call check-gcc-var,-fomit-frame-pointer))
OPTIMIZATION += $(CFLAG_-fomit-frame-pointer)
ifeq ($(CONFIG_386)$(CONFIG_486)$(CONFIG_586)$(CONFIG_586MMX),y)
ifeq ($(CONFIG_386)$(CONFIG_486)$(CONFIG_586),y)
# TODO: Change this to a gcc version check. This bug
# should be fixed with at least gcc-4.3.
# Non-SSE capable processor.
# NB: this may make SSE insns segfault!
# -O1 -march=pentium3, -Os -msse etc are known to be affected.
@ -257,7 +350,8 @@ ifeq ($(CONFIG_386)$(CONFIG_486)$(CONFIG_586)$(CONFIG_586MMX),y)
# -m32 is needed if host is 64-bit
OPTIMIZATION+=$(call check_gcc,-m32 -mpreferred-stack-boundary=2,)
else
OPTIMIZATION+=$(call check_gcc,-mpreferred-stack-boundary=4,)
$(eval $(call check-gcc-var,-mpreferred-stack-boundary=4))
OPTIMIZATION += $(CFLAG_-mpreferred-stack-boundary=4)
endif
# Choice of alignment (please document why!)
@ -267,18 +361,6 @@ endif
# -falign-jumps: reachable only by a jump
# Generic: no alignment at all (smallest code)
GCC_FALIGN=$(call check_gcc,-falign-functions=1 -falign-jumps=1 -falign-labels=1 -falign-loops=1,-malign-jumps=1 -malign-loops=1)
ifeq ($(CONFIG_K7),y)
# Align functions to four bytes, use default for jumps and loops (why?)
GCC_FALIGN=$(call check_gcc,-falign-functions=4 -falign-labels=1,-malign-functions=4)
endif
ifeq ($(CONFIG_CRUSOE),y)
# Use compiler's default for functions, jumps and loops (why?)
GCC_FALIGN=$(call check_gcc,-falign-functions=0 -falign-labels=1,-malign-functions=0)
endif
ifeq ($(CONFIG_CYRIXIII),y)
# Use compiler's default for functions, jumps and loops (why?)
GCC_FALIGN=$(call check_gcc,-falign-functions=0 -falign-labels=1,-malign-functions=0)
endif
OPTIMIZATION+=$(GCC_FALIGN)
# Putting each function and data object into its own section
@ -296,32 +378,13 @@ endif
# It specifies 4 byte align for .text even if not told to do so:
# Idx Name Size VMA LMA File off Algn
# 0 .text xxxxxxxx 00000000 00000000 xxxxxxxx 2**2 <===!
CPU_CFLAGS-y += $(call check_gcc,-ffunction-sections -fdata-sections,)
ifneq ($(call check_ld,--sort-common),)
CPU_LDFLAGS-y += -Wl,--sort-common
endif
ifneq ($(call check_ld,--sort-section alignment),)
CPU_LDFLAGS-y += -Wl,--sort-section,alignment
endif
CPU_CFLAGS-y += $(CFLAG_-ffunction-sections) $(CFLAG_-fdata-sections)
CPU_LDFLAGS-y += $(CFLAG_-Wl--sort-common)
$(eval $(call check-ld-var,--sort-section=alignment))
CPU_LDFLAGS-y += $(CFLAG_-Wl--sort-section=alignment)
CPU_LDFLAGS-y+=-m32
CPU_CFLAGS-y+=-m32
CPU_CFLAGS-$(CONFIG_386)+=-march=i386
CPU_CFLAGS-$(CONFIG_486)+=-march=i486
CPU_CFLAGS-$(CONFIG_ELAN)+=-march=i486
CPU_CFLAGS-$(CONFIG_586)+=-march=i586
CPU_CFLAGS-$(CONFIG_586MMX)+=$(call check_gcc,-march=pentium-mmx,-march=i586)
CPU_CFLAGS-$(CONFIG_686)+=-march=i686
CPU_CFLAGS-$(CONFIG_PENTIUMII)+=$(call check_gcc,-march=pentium2,-march=i686)
CPU_CFLAGS-$(CONFIG_PENTIUMIII)+=$(call check_gcc,-march=pentium3,-march=i686)
CPU_CFLAGS-$(CONFIG_PENTIUM4)+=$(call check_gcc,-march=pentium4,-march=i686)
CPU_CFLAGS-$(CONFIG_K6)+=$(call check_gcc,-march=k6,-march=i586)
CPU_CFLAGS-$(CONFIG_K7)+=$(call check_gcc,-march=athlon,-march=i686)
CPU_CFLAGS-$(CONFIG_CRUSOE)+=-march=i686
CPU_CFLAGS-$(CONFIG_WINCHIPC6)+=$(call check_gcc,-march=winchip-c6,-march=i586)
CPU_CFLAGS-$(CONFIG_WINCHIP2)+=$(call check_gcc,-march=winchip2,-march=i586)
CPU_CFLAGS-$(CONFIG_CYRIXIII)+=$(call check_gcc,-march=c3,-march=i486)
CPU_CFLAGS-$(CONFIG_NEHEMIAH)+=$(call check_gcc,-march=c3-2,-march=i686)
endif
ifeq ($(TARGET_ARCH),sparc)
@ -332,28 +395,15 @@ ifeq ($(TARGET_ARCH),sparc)
endif
ifeq ($(TARGET_ARCH),arm)
OPTIMIZATION+=-fstrict-aliasing
CPU_CFLAGS-$(ARCH_LITTLE_ENDIAN)+=-mlittle-endian
CPU_CFLAGS-$(ARCH_BIG_ENDIAN)+=-mbig-endian
CPU_CFLAGS-$(CONFIG_GENERIC_ARM)+=
CPU_CFLAGS-$(CONFIG_ARM610)+=-mtune=arm610 -march=armv3
CPU_CFLAGS-$(CONFIG_ARM710)+=-mtune=arm710 -march=armv3
CPU_CFLAGS-$(CONFIG_ARM7TDMI)+=-mtune=arm7tdmi -march=armv4t
CPU_CFLAGS-$(CONFIG_ARM720T)+=-mtune=arm7tdmi -march=armv4t
CPU_CFLAGS-$(CONFIG_ARM920T)+=-mtune=arm9tdmi -march=armv4t
CPU_CFLAGS-$(CONFIG_ARM922T)+=-mtune=arm9tdmi -march=armv4t
CPU_CFLAGS-$(CONFIG_ARM926T)+=-mtune=arm9e -march=armv5te
CPU_CFLAGS-$(CONFIG_ARM10T)+=-mtune=arm10tdmi -march=armv5t
CPU_CFLAGS-$(CONFIG_ARM1136JF_S)+=-mtune=arm1136jf-s -march=armv6
CPU_CFLAGS-$(CONFIG_ARM1176JZ_S)+=-mtune=arm1176jz-s -march=armv6
CPU_CFLAGS-$(CONFIG_ARM1176JZF_S)+=-mtune=arm1176jzf-s -march=armv6
CPU_CFLAGS-$(CONFIG_ARM_SA110)+=-mtune=strongarm110 -march=armv4
CPU_CFLAGS-$(CONFIG_ARM_SA1100)+=-mtune=strongarm1100 -march=armv4
CPU_CFLAGS-$(CONFIG_ARM_XSCALE)+=$(call check_gcc,-mtune=xscale,-mtune=strongarm110)
CPU_CFLAGS-$(CONFIG_ARM_XSCALE)+=-march=armv5te -Wa,-mcpu=xscale
CPU_CFLAGS-$(CONFIG_ARM_IWMMXT)+=-march=iwmmxt -Wa,-mcpu=iwmmxt -mabi=iwmmxt
CPU_CFLAGS-$(CONFIG_ARM_CORTEX_M3)+=-mcpu=cortex-m3 -mthumb
CPU_CFLAGS-$(CONFIG_ARM_CORTEX_M1)+=-mcpu=cortex-m1 -mthumb
CPU_CFLAGS-$(COMPILE_IN_THUMB_MODE)+=-mthumb
endif
ifeq ($(TARGET_ARCH),metag)
SYMBOL_PREFIX=_
CPU_CFLAGS-$(CONFIG_META_1_2)+=
CPU_CFLAGS-$(CONFIG_META_2_1)+=-Wa,-mcpu=metac21
endif
ifeq ($(TARGET_ARCH),mips)
@ -365,17 +415,15 @@ ifeq ($(TARGET_ARCH),mips)
CPU_CFLAGS-$(CONFIG_MIPS_ISA_MIPS32)+=-mips32 -mtune=mips32
CPU_CFLAGS-$(CONFIG_MIPS_ISA_MIPS32R2)+=-march=mips32r2 -mtune=mips32r2
CPU_CFLAGS-$(CONFIG_MIPS_ISA_MIPS64)+=-mips64 -mtune=mips32
ifeq ($(strip $(ARCH_BIG_ENDIAN)),y)
CPU_LDFLAGS-$(CONFIG_MIPS_N64_ABI)+=-Wl,-melf64btsmip
CPU_LDFLAGS-$(CONFIG_MIPS_O32_ABI)+=-Wl,-melf32btsmip
endif
ifeq ($(strip $(ARCH_LITTLE_ENDIAN)),y)
CPU_LDFLAGS-$(CONFIG_MIPS_N64_ABI)+=-Wl,-melf64ltsmip
CPU_LDFLAGS-$(CONFIG_MIPS_O32_ABI)+=-Wl,-melf32ltsmip
endif
CPU_CFLAGS-$(CONFIG_MIPS_ISA_MIPS64R2)+=-mips64r2 -mtune=mips64r2
CPU_CFLAGS-$(CONFIG_MIPS_N64_ABI)+=-mabi=64
CPU_CFLAGS-$(CONFIG_MIPS_O32_ABI)+=-mabi=32
CPU_CFLAGS-$(CONFIG_MIPS_N32_ABI)+=-mabi=n32
CPU_CFLAGS-$(CONFIG_MIPS_NAN_LEGACY)+=-mnan=legacy
CPU_CFLAGS-$(CONFIG_MIPS_NAN_2008)+=-mnan=2008
CPU_LDFLAGS-y += $(CPU_CFLAGS)
endif
ifeq ($(TARGET_ARCH),nios)
@ -385,8 +433,8 @@ ifeq ($(TARGET_ARCH),nios)
endif
ifeq ($(TARGET_ARCH),sh)
OPTIMIZATION+=-fstrict-aliasing
OPTIMIZATION+= $(call check_gcc,-mprefergot,)
$(eval $(call check-gcc-var,-mprefergot))
OPTIMIZATION += $(CFLAG_-mprefergot)
CPU_CFLAGS-$(ARCH_LITTLE_ENDIAN)+=-ml
CPU_CFLAGS-$(ARCH_BIG_ENDIAN)+=-mb
CPU_CFLAGS-$(CONFIG_SH2)+=-m2
@ -401,16 +449,14 @@ endif
endif
ifeq ($(TARGET_ARCH),sh64)
OPTIMIZATION+=-fstrict-aliasing
CPU_CFLAGS-$(ARCH_LITTLE_ENDIAN):=-ml
CPU_CFLAGS-$(ARCH_BIG_ENDIAN):=-mb
CPU_CFLAGS-$(CONFIG_SH5)+=-m5-32media
endif
ifeq ($(TARGET_ARCH),h8300)
SYMBOL_PREFIX=_
CPU_LDFLAGS-$(CONFIG_H8300H)+= -Wl,-ms8300h
CPU_LDFLAGS-$(CONFIG_H8S) += -Wl,-ms8300s
CPU_LDFLAGS-$(CONFIG_H8300H)+= -Wl,-mh8300h_linux
CPU_LDFLAGS-$(CONFIG_H8S) += -Wl,-mh8300s_linux
CPU_CFLAGS-$(CONFIG_H8300H) += -mh -mint32
CPU_CFLAGS-$(CONFIG_H8S) += -ms -mint32
endif
@ -497,21 +543,27 @@ ifeq ($(TARGET_ARCH),c6x)
CPU_LDFLAGS-y += $(CPU_CFLAGS)
endif
# Keep the check_gcc from being needlessly executed
ifndef PIEFLAG
export PIEFLAG:=$(call check_gcc,$(PIEFLAG_NAME),$(PICFLAG))
ifeq ($(TARGET_ARCH),arc)
CPU_CFLAGS-y += -mlock -mswape
CPU_CFLAGS-$(CONFIG_ARC_CPU_700) += -mA7
CPU_CFLAGS-$(CONFIG_ARC_CPU_HS) += -mcpu=archs
CPU_LDFLAGS-y += $(CPU_CFLAGS) -marclinux
endif
$(eval $(call check-gcc-var,$(PIEFLAG_NAME)))
PIEFLAG := $(CFLAG_$(PIEFLAG_NAME))
ifeq ($(PIEFLAG),)
PIEFLAG := $(PICFLAG)
endif
# We need to keep track of both the CC PIE flag (above) as
# well as the LD PIE flag (below) because we can't rely on
# gcc passing -pie if we used -fPIE. We need to directly use -pie
# instead of -Wl,-pie as gcc picks up the wrong startfile/endfile
ifndef LDPIEFLAG
export LDPIEFLAG:=$(shell $(LD) --help 2>/dev/null | grep -q -- -pie && echo "-pie")
endif
$(eval $(call cache-output-var,LDPIEFLAG,$(CC) -Wl$(comma)--help 2>/dev/null | grep -q -- -pie && echo "-pie"))
# Check for --as-needed support in linker
ifndef LD_FLAG_ASNEEDED
_LD_FLAG_ASNEEDED:=$(shell $(LD) --help 2>/dev/null | grep -- --as-needed)
_LD_FLAG_ASNEEDED:=$(shell $(CC) -Wl,--help 2>/dev/null | grep -- --as-needed)
ifneq ($(_LD_FLAG_ASNEEDED),)
export LD_FLAG_ASNEEDED:=--as-needed
endif
@ -531,28 +583,31 @@ ifdef LD_FLAG_NO_ASNEEDED
export CC_FLAG_NO_ASNEEDED:=-Wl,$(LD_FLAG_NO_ASNEEDED)
endif
endif
link.asneeded = $(if $(and $(CC_FLAG_ASNEEDED),$(CC_FLAG_NO_ASNEEDED)),$(CC_FLAG_ASNEEDED) $(1) $(CC_FLAG_NO_ASNEEDED))
link.asneeded = $(if $(findstring yy,$(CC_FLAG_ASNEEDED)$(CC_FLAG_NO_ASNEEDED)),$(CC_FLAG_ASNEEDED) $(1) $(CC_FLAG_NO_ASNEEDED))
# Check for AS_NEEDED support in linker script (binutils>=2.16.1 has it)
ifndef ASNEEDED
export ASNEEDED:=$(shell $(LD) --help 2>/dev/null | grep -q -- --as-needed && echo "AS_NEEDED ( $(UCLIBC_LDSO) )" || echo "$(UCLIBC_LDSO)")
ifeq ($(UCLIBC_HAS_BACKTRACE),y)
export ASNEEDED:=$(shell $(CC) -Wl,--help 2>/dev/null | grep -q -- --as-needed && echo "AS_NEEDED ( $(UCLIBC_LDSO) )" || echo "$(UCLIBC_LDSO)")
# Only used in installed libc.so linker script
UBACKTRACE_FULL_NAME := $(RUNTIME_PREFIX)lib/$(UBACKTRACE_DSO)
export UBACKTRACE_ASNEEDED:=$(shell $(LD) --help 2>/dev/null | grep -q -- --as-needed && echo "AS_NEEDED ( $(UBACKTRACE_FULL_NAME) )" || echo "$(UBACKTRACE_FULL_NAME)")
ifeq ($(UCLIBC_HAS_BACKTRACE),y)
ifeq ($(HARDWIRED_ABSPATH),y)
UBACKTRACE_FULL_NAME := $(subst //,/,$(RUNTIME_PREFIX)$(MULTILIB_DIR)/$(UBACKTRACE_DSO))
else
UBACKTRACE_FULL_NAME := $(UBACKTRACE_DSO)
endif
export UBACKTRACE_ASNEEDED:=$(shell $(CC) -Wl,--help 2>/dev/null | grep -q -- --as-needed && \
echo "GROUP ( AS_NEEDED ( $(UBACKTRACE_FULL_NAME) ) )" || \
echo "GROUP ( $(UBACKTRACE_FULL_NAME) )")
else
export UBACKTRACE_ASNEEDED:=""
endif
endif
# Add a bunch of extra pedantic annoyingly strict checks
XWARNINGS=$(call qstrip,$(WARNINGS))
XWARNINGS+=$(foreach w,\
-Wstrict-prototypes \
-fno-strict-aliasing \
, $(call check_gcc,$(w),))
WARNING_FLAGS = -Wstrict-prototypes -Wstrict-aliasing
ifeq ($(EXTRA_WARNINGS),y)
XWARNINGS+=$(foreach w,\
WARNING_FLAGS += \
-Wformat=2 \
-Wmissing-noreturn \
-Wmissing-format-attribute \
@ -563,46 +618,56 @@ XWARNINGS+=$(foreach w,\
-Wold-style-declaration \
-Wold-style-definition \
-Wshadow \
-Wundef \
, $(call check_gcc,$(w),))
-Wundef
# Works only w/ gcc-3.4 and up, can't be checked for gcc-3.x w/ check_gcc()
#XWARNINGS+=-Wdeclaration-after-statement
#WARNING_FLAGS-gcc-4 += -Wdeclaration-after-statement
endif
WARNING_FLAGS += $(WARNING_FLAGS-gcc-$(GCC_MAJOR_VER))
$(foreach w,$(WARNING_FLAGS),$(eval $(call check-gcc-var,$(w))))
XWARNINGS = $(call qstrip,$(WARNINGS)) $(foreach w,$(WARNING_FLAGS),$(CFLAG_$(w)))
CPU_CFLAGS=$(call qstrip,$(CPU_CFLAGS-y))
SSP_DISABLE_FLAGS ?= $(call check_gcc,-fno-stack-protector,)
# Save the tested flag in a single variable and force it to be
# evaluated just once. Then use that computed value.
$(eval $(call check-gcc-var,-fno-stack-protector))
SSP_DISABLE_FLAGS ?= $(CFLAG_-fno-stack-protector)
ifeq ($(UCLIBC_BUILD_SSP),y)
SSP_CFLAGS := $(call check_gcc,-fno-stack-protector-all,)
SSP_CFLAGS += $(call check_gcc,-fstack-protector,)
SSP_ALL_CFLAGS ?= $(call check_gcc,-fstack-protector-all,)
$(eval $(call check-gcc-var,-fno-stack-protector-all))
$(eval $(call check-gcc-var,-fstack-protector))
$(eval $(call check-gcc-var,-fstack-protector-all))
SSP_CFLAGS := $(CFLAG_-fno-stack-protector-all)
SSP_CFLAGS += $(CFLAG_-fstack-protector)
SSP_ALL_CFLAGS ?= $(CFLAG_-fstack-protector-all)
else
SSP_CFLAGS := $(SSP_DISABLE_FLAGS)
endif
NOSTDLIB_CFLAGS:=$(call check_gcc,-nostdlib,)
# Collect all CFLAGS components
CFLAGS := -include $(top_srcdir)include/libc-symbols.h \
$(XWARNINGS) $(CPU_CFLAGS) $(SSP_CFLAGS) \
-nostdinc -I$(top_builddir)include -I$(top_srcdir)include -I. \
CFLAGS := $(XWARNINGS) $(CPU_CFLAGS) $(SSP_CFLAGS) \
-nostdinc -I$(top_builddir)include \
-I$(top_srcdir)include -include libc-symbols.h \
-I$(top_srcdir)libc/sysdeps/linux/$(TARGET_ARCH) \
-I$(top_srcdir)libc/sysdeps/linux \
-I$(top_srcdir)libc/sysdeps/linux/$(TARGET_ARCH)
ifneq ($(strip $(UCLIBC_EXTRA_CFLAGS)),"")
CFLAGS += $(call qstrip,$(UCLIBC_EXTRA_CFLAGS))
endif
-I$(top_srcdir)ldso/ldso/$(TARGET_ARCH) \
-I$(top_srcdir)ldso/include -I.
# We need this to be checked within libc-symbols.h
ifneq ($(HAVE_SHARED),y)
CFLAGS += -DSTATIC
endif
LDFLAG_WARN_ONCE:=$(if $(call check_ld,--warn-once),-Wl$(comma)--warn-once)
LDFLAG_SORT_COMMON:=$(if $(call check_ld,--sort-common),-Wl$(comma)--sort-common)
LDFLAG_DISCARD_ALL:=$(if $(call check_ld,--discard-all),-Wl$(comma)--discard-all)
LDFLAGS_NOSTRIP:=$(CPU_LDFLAGS-y) -shared \
-Wl,--warn-common $(LDFLAG_WARN_ONCE) -Wl,-z,combreloc
$(eval $(call check-ld-var,--warn-once))
$(eval $(call check-ld-var,--sort-common))
$(eval $(call check-ld-var,--discard-all))
LDFLAGS_NOSTRIP:=$(LDFLAG-fuse-ld) $(CPU_LDFLAGS-y) -shared \
-Wl,--warn-common $(CFLAG_-Wl--warn-once) -Wl,-z,combreloc
# binutils-2.16.1 warns about ignored sections, 2.16.91.0.3 and newer are ok
#LDFLAGS_NOSTRIP+=$(call check_ld,--gc-sections)
#$(eval $(call check-ld-var,--gc-sections))
#LDFLAGS_NOSTRIP += $(LDFLAG_--gc-sections)
$(eval $(call check-gcc-var,-fdata-sections))
$(eval $(call check-gcc-var,-ffunction-sections))
ifeq ($(UCLIBC_BUILD_RELRO),y)
LDFLAGS_NOSTRIP+=-Wl,-z,relro
@ -614,22 +679,28 @@ endif
ifeq ($(LDSO_GNU_HASH_SUPPORT),y)
# Be sure that binutils support it
LDFLAGS_GNUHASH:=$(call check_ld,--hash-style=gnu)
ifeq ($(LDFLAGS_GNUHASH),)
ifneq ($(filter-out $(clean_targets) install_headers headers-y,$(MAKECMDGOALS)),)
$(eval $(call check-ld-var,--hash-style=gnu))
ifeq ($(LDFLAG_--hash-style=gnu),)
ifneq ($(filter-out $(clean_targets) CLEAN_% install_headers headers-y,$(MAKECMDGOALS)),)
$(error Your binutils do not support --hash-style option, while you want to use it)
endif
else
LDFLAGS_NOSTRIP += -Wl,$(LDFLAGS_GNUHASH)
LDFLAGS_NOSTRIP += $(CFLAG_-Wl--hash-style=gnu)
endif
endif
LDFLAGS:=$(LDFLAGS_NOSTRIP) -Wl,-z,defs
ifeq ($(DODEBUG),y)
CFLAGS += -O0 -g3 -DDEBUG
else
CFLAGS += $(OPTIMIZATION)
CFLAGS += $(OPTIMIZATION-$(GCC_MAJOR_VER))
CFLAGS += $(OPTIMIZATION-$(GCC_MAJOR_VER).$(GCC_MINOR_VER))
$(eval $(call check-ld-var,-O2))
LDFLAGS_NOSTRIP += $(CFLAG_-Wl-O2)
endif
LDFLAGS:=$(LDFLAGS_NOSTRIP) -Wl,-z,defs
ifeq ($(DOSTRIP),y)
LDFLAGS += -Wl,-s
else
@ -645,20 +716,28 @@ ifeq ($(DOMULTI),y)
ifeq ($(GCC_MAJOR_VER),3)
DOMULTI:=n
else
CFLAGS+=$(call check_gcc,--combine,)
$(eval $(call check-gcc-var,--combine))
CFLAGS += $(CFLAG_--combine)
endif
else
DOMULTI:=n
endif
ifneq ($(strip $(UCLIBC_EXTRA_CFLAGS)),"")
CFLAGS += $(call qstrip,$(UCLIBC_EXTRA_CFLAGS))
endif
ifneq ($(strip $(UCLIBC_EXTRA_LDFLAGS)),"")
LDFLAGS += $(call qstrip,$(UCLIBC_EXTRA_LDFLAGS))
endif
ifeq ($(UCLIBC_HAS_STDIO_FUTEXES),y)
CFLAGS += -D__USE_STDIO_FUTEXES__
endif
ifeq ($(UCLIBC_HAS_THREADS),y)
ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y)
PTNAME := nptl
CFLAGS += -DHAVE_FORCED_UNWIND
CFLAGS += -DHAVE_FORCED_UNWIND -D_LIBC_REENTRANT
else
ifeq ($(LINUXTHREADS_OLD),y)
PTNAME := linuxthreads.old
@ -671,7 +750,7 @@ PTDIR := libpthread/$(PTNAME)
ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y)
PTINC:= -I$(top_builddir)$(PTDIR) \
-I$(top_srcdir)$(PTDIR) \
$(if $(TARGET_ARCH),-I$(top_srcdir)$(PTDIR)/sysdeps/unix/sysv/linux/$(TARGET_ARCH)/$(TARGET_SUBARCH)) \
$(if $(TARGET_SUBARCH),-I$(top_srcdir)$(PTDIR)/sysdeps/unix/sysv/linux/$(TARGET_ARCH)/$(TARGET_SUBARCH)) \
-I$(top_srcdir)$(PTDIR)/sysdeps/unix/sysv/linux/$(TARGET_ARCH) \
-I$(top_builddir)$(PTDIR)/sysdeps/$(TARGET_ARCH) \
-I$(top_srcdir)$(PTDIR)/sysdeps/$(TARGET_ARCH) \
@ -679,9 +758,7 @@ PTINC:= -I$(top_builddir)$(PTDIR) \
-I$(top_srcdir)$(PTDIR)/sysdeps/unix/sysv/linux \
-I$(top_srcdir)$(PTDIR)/sysdeps/pthread \
-I$(top_srcdir)$(PTDIR)/sysdeps/pthread/bits \
-I$(top_srcdir)$(PTDIR)/sysdeps/generic \
-I$(top_srcdir)ldso/ldso/$(TARGET_ARCH) \
-I$(top_srcdir)ldso/include
-I$(top_srcdir)$(PTDIR)/sysdeps/generic
#
# Test for TLS if NPTL support was selected.
#
@ -714,13 +791,14 @@ else
PTINC :=
endif
CFLAGS += -I$(top_srcdir)libc/sysdeps/linux/common
CFLAGS += -I$(KERNEL_HEADERS)
#CFLAGS += -iwithprefix include-fixed -iwithprefix include
CC_IPREFIX := $(shell $(CC) --print-file-name=include)
$(eval $(call cache-output-var,CC_IPREFIX,$(CC) -print-file-name=include))
CC_INC := -isystem $(dir $(CC_IPREFIX))include-fixed -isystem $(CC_IPREFIX)
CFLAGS += $(CC_INC)
CFLAGS += -I$(KERNEL_HEADERS)
ifneq ($(DOASSERTS),y)
CFLAGS+=-DNDEBUG
endif
@ -730,18 +808,18 @@ CFLAGS+=-D__UCLIBC_UNDERSCORES__
endif
# Keep the check_as from being needlessly executed
ifndef ASFLAGS_NOEXEC
ifeq ($(UCLIBC_BUILD_NOEXECSTACK),y)
export ASFLAGS_NOEXEC := $(call check_as,--noexecstack)
else
export ASFLAGS_NOEXEC :=
$(eval $(call check-as-var,--noexecstack))
endif
endif
ASFLAGS = $(ASFLAGS_NOEXEC)
ASFLAGS += $(ASFLAG_--noexecstack)
LIBGCC_CFLAGS ?= $(CFLAGS) $(CPU_CFLAGS-y)
LIBGCC:=$(shell $(CC) $(LIBGCC_CFLAGS) -print-libgcc-file-name)
LIBGCC_DIR:=$(dir $(LIBGCC))
$(eval $(call cache-output-var,LIBGCC_A,$(CC) $(LIBGCC_CFLAGS) -print-libgcc-file-name))
$(eval $(call cache-output-var,LIBGCC_EH,$(CC) $(LIBGCC_CFLAGS) -print-file-name=libgcc_eh.a))
# with -O0 we (e.g. lockf) might end up with references to
# _Unwind_Resume, so pull in gcc_eh in this case..
LIBGCC_DIR := $(dir $(LIBGCC_A))
LIBGCC := $(LIBGCC_A) $(if $(DODEBUG),$(LIBGCC_EH))
# moved from libpthread/linuxthreads
ifeq ($(UCLIBC_CTOR_DTOR),y)
@ -749,4 +827,6 @@ SHARED_START_FILES:=$(top_builddir)lib/crti.o $(LIBGCC_DIR)crtbeginS.o
SHARED_END_FILES:=$(LIBGCC_DIR)crtendS.o $(top_builddir)lib/crtn.o
endif
LOCAL_INSTALL_PATH := install_dir
LOCAL_INSTALL_PATH := $(if $(O),$(O)/)install_dir
PTHREAD_GENERATE_MANGLE ?= -n "s/^.*@@@name@@@\([^@]*\)@@@value@@@[^0-9Xxa-fA-F-]*\([0-9Xxa-fA-F-][0-9Xxa-fA-F-]*\).*@@@end@@@.*\$$/\#define \1 \2/p"

8
TODO
View File

@ -88,6 +88,12 @@ TODO list for the uClibc 1.0.0 release:
*) Cleanup/scrub all the Makefile copyright junk
*) Fix dlopen, for both static and dynamic cases, and make it
fully comply with SuSv3
*) check if sched_getcpu is only pulled in where it should be
*) remove HANDLE_OLDER_RLIMIT, NEW_GETRLIMIT (conditionalize on
ugetrlimit, it seems, else use the modern variant)
*) simplify exec*() in the light of execvpe (perhaps single internal
impl); USE_GNU for execvpe (and other GNU extensions, see psm).
*) Remove unused math complex hidden protos throughout
TODO list for AFTER the uClibc 1.0.0 release:
@ -101,6 +107,7 @@ TODO list for AFTER the uClibc 1.0.0 release:
*) run 'nm -D --size-sort -t d libuClibc-0.9.26.so' and work on the
biggest things (i.e. stuff at the end of the list) to make
them smaller.
*) Fix dlopen/dlsym/dlclose locking to more fine grained or use RCU
<more wishlist items here>
@ -179,3 +186,4 @@ Manuel's todo:
b) Write a space-efficient gettext substitute, to avoid storing large amounts
of redundant data.

View File

@ -130,9 +130,6 @@ TODO: nptl / linuxthreads / linuxthreads.old
====================
=== Misc Cruft ===
====================
- utils/readelf.c - not really needed generally speaking, but might as well
add your arch to the giant EM_* list (describe_elf_hdr)
- MAINTAINERS - presumably you're going to submit this code back to mainline
and since you're the only one who cares about this arch (right now), you
should add yourself to the toplevel MAINTAINERS file. do it.

80
docs/crt.txt Normal file
View File

@ -0,0 +1,80 @@
Mini FAQ about the misc libc/gcc crt files.
Some definitions:
PIC - position independent code (-fPIC)
PIE - position independent executable (-fPIE -pie)
crt - C runtime
crt0.o crt1.o etc...
Some systems use crt0.o, while some use crt1.o (and a few even use crt2.o
or higher). Most likely due to a transitionary phase that some targets
went through. The specific number is otherwise entirely arbitrary -- look
at the internal gcc port code to figure out what your target expects. All
that matters is that whatever gcc has encoded, your C library better use
the same name.
This object is expected to contain the _start symbol which takes care of
bootstrapping the initial execution of the program. What exactly that
entails is highly libc dependent and as such, the object is provided by
the C library and cannot be mixed with other ones.
On uClibc/glibc systems, this object initializes very early ABI requirements
(like the stack or frame pointer), setting up the argc/argv/env values, and
then passing pointers to the init/fini/main funcs to the internal libc main
which in turn does more general bootstrapping before finally calling the real
main function.
glibc ports call this file 'start.S' while uClibc ports call this crt0.S or
crt1.S (depending on what their gcc expects).
crti.o
Defines the function prologs for the .init and .fini sections (with the _init
and _fini symbols respectively). This way they can be called directly. These
symbols also trigger the linker to generate DT_INIT/DT_FINI dynamic ELF tags.
These are to support the old style constructor/destructor system where all
.init/.fini sections get concatenated at link time. Not to be confused with
newer prioritized constructor/destructor .init_array/.fini_array sections and
DT_INIT_ARRAY/DT_FINI_ARRAY ELF tags.
glibc ports used to call this 'initfini.c', but now use 'crti.S'. uClibc
also uses 'crti.S'.
crtn.o
Defines the function epilogs for the .init/.fini sections. See crti.o.
glibc ports used to call this 'initfini.c', but now use 'crtn.S'. uClibc
also uses 'crtn.S'.
Scrt1.o
Used in place of crt1.o when generating PIEs.
gcrt1.o
Used in place of crt1.o when generating code with profiling information.
Compile with -pg. Produces output suitable for the gprof util.
Mcrt1.o
Like gcrt1.o, but is used with the prof utility. glibc installs this as
a dummy file as it's useless on linux systems.
crtbegin.o
GCC uses this to find the start of the constructors.
crtbeginS.o
Used in place of crtbegin.o when generating shared objects/PIEs.
crtbeginT.o
Used in place of crtbegin.o when generating static executables.
crtend.o
GCC uses this to find the start of the destructors.
crtendS.o
Used in place of crtend.o when generating shared objects/PIEs.
General linking order:
crt1.o crti.o crtbegin.o [-L paths] [user objects] [gcc libs] [C libs] [gcc libs] crtend.o crtn.o
More references:
http://gcc.gnu.org/onlinedocs/gccint/Initialization.html

110
docs/man/arc4random.3 Normal file
View File

@ -0,0 +1,110 @@
.\" $OpenBSD: arc4random.3,v 1.19 2005/07/17 08:50:55 jaredy Exp $
.\"
.\" Copyright 1997 Niels Provos <provos@physnet.uni-hamburg.de>
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by Niels Provos.
.\" 4. The name of the author may not be used to endorse or promote products
.\" derived from this software without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\" Manual page, using -mandoc macros
.\"
.Dd April 15, 1997
.Dt ARC4RANDOM 3
.Os
.Sh NAME
.Nm arc4random ,
.Nm arc4random_stir ,
.Nm arc4random_addrandom
.Nd arc4 random number generator
.Sh SYNOPSIS
.Fd #include <stdlib.h>
.Ft uint32_t
.Fn arc4random "void"
.Ft void
.Fn arc4random_stir "void"
.Ft void
.Fn arc4random_addrandom "u_char *dat" "int datlen"
.Sh DESCRIPTION
The
.Fn arc4random
function provides a high quality 32-bit pseudo-random
number very quickly.
.Fn arc4random
seeds itself on a regular basis from the kernel strong random number
subsystem described in
.Xr random 4 .
On each call, an ARC4 generator is used to generate a new result.
The
.Fn arc4random
function uses the ARC4 cipher key stream generator,
which uses 8*8 8-bit S-Boxes.
The S-Boxes can be in about (2**1700) states.
.Pp
.Fn arc4random
fits into a middle ground not covered by other subsystems such as
the strong, slow, and resource expensive random
devices described in
.Xr random 4
versus the fast but poor quality interfaces described in
.Xr rand 3 ,
.Xr random 3 ,
and
.Xr drand48 3 .
.Pp
The
.Fn arc4random_stir
function reads data from a pseudo-random device, usually
.Pa /dev/urandom,
and uses it to permute the S-Boxes via
.Fn arc4random_addrandom .
.Pp
There is no need to call
.Fn arc4random_stir
before using
.Fn arc4random ,
since
.Fn arc4random
automatically initializes itself.
.Sh SEE ALSO
.Xr rand 3 ,
.Xr rand48 3 ,
.Xr random 3
.Sh HISTORY
An algorithm called
.Pa RC4
was designed by RSA Data Security, Inc.
It was considered a trade secret.
Because it was a trade secret, it obviously could not be patented.
A clone of this was posted anonymously to USENET and confirmed to
be equivalent by several sources who had access to the original cipher.
Because of the trade secret situation, RSA Data Security, Inc. can do
nothing about the release of the ARC4 algorithm.
Since
.Pa RC4
used to be a trade secret, the cipher is now referred to as
.Pa ARC4 .
.Pp
These functions first appeared in
.Ox 2.1 .

View File

@ -13,4 +13,5 @@ config FORCE_OPTIONS_FOR_ARCH
select ARCH_LITTLE_ENDIAN
select ARCH_HAS_MMU
select ARCH_HAS_NO_LDSO
select ARCH_HAS_DEPRECATED_SYSCALLS
select UCLIBC_HAS_LFS

46
extra/Configs/Config.arc Normal file
View File

@ -0,0 +1,46 @@
#
# For a description of the syntax of this configuration file,
# see extra/config/Kconfig-language.txt
#
config TARGET_ARCH
default "arc"
config FORCE_OPTIONS_FOR_ARCH
bool
default y
select ARCH_ANY_ENDIAN
choice
prompt "Target Processor Type"
default CONFIG_ARC_CPU_700
config CONFIG_ARC_CPU_700
bool "ARC700"
select ARCH_HAS_MMU
help
ARCompact ISA based ARC CPU
config CONFIG_ARC_CPU_HS
bool "ARC-HS"
select ARCH_HAS_MMU
help
Next Generation ARCv2 ISA based Processors
endchoice
choice
prompt "MMU Page Size"
default CONFIG_ARC_PAGE_SIZE_8K
config CONFIG_ARC_PAGE_SIZE_8K
bool "8KB"
help
Choose between 4k, 8k (default) or 16k
config CONFIG_ARC_PAGE_SIZE_16K
bool "16KB"
config CONFIG_ARC_PAGE_SIZE_4K
bool "4KB"
endchoice

View File

@ -11,123 +11,30 @@ config FORCE_OPTIONS_FOR_ARCH
bool
default y
select ARCH_ANY_ENDIAN
choice
prompt "Target ABI"
default CONFIG_ARM_EABI
help
If you choose "EABI" here, functions and constants required by the
ARM EABI will be built into the library. You should choose "EABI"
if your compiler uses the ARM EABI, in which case you will also
need a kernel supporting the EABI system call interface, or "OABI"
for a compiler using the old Linux ABI.
config CONFIG_ARM_OABI
bool "OABI"
select ARCH_HAS_UCONTEXT
select ARCH_HAS_DEPRECATED_SYSCALLS
config CONFIG_ARM_EABI
bool "EABI"
bool "Build for EABI"
help
If you say 'y' here, functions and constants required by the
ARM EABI will be built into the library. You should say 'y'
if your compiler uses the ARM EABI, in which case you will also
need a kernel supporting the EABI system call interface.
endchoice
If you say 'n' here, then the library will be built for the
old Linux ABI.
config COMPILE_IN_THUMB_MODE
bool "Build using Thumb mode"
select USE_BX
help
Say 'y' here to force building uClibc in thumb mode.
Say 'n' to use your compiler's default mode.
config USE_BX
bool "Use BX in function return"
default y
depends on !CONFIG_GENERIC_ARM && !CONFIG_ARM610 && !CONFIG_ARM710
help
Use BX instruction for THUMB aware architectures.
choice
prompt "Target Processor Type"
default CONFIG_GENERIC_ARM
help
This is the processor type of your CPU. This information is used for
optimizing purposes. To build a library that will run on all ARMCPU
types (albeit not optimally fast), you can specify "Generic Arm" here.
If you pick anything other than "Generic Arm", there is no guarantee
that uClibc will even run on anything other than the selected
processor type.
Here are the settings recommended for greatest speed:
- "Generic Arm" select this if your compiler is already setup to
optimize things properly, or if you want to run on pretty much
everything, or you just don't much care.
- For anything else, pick the ARM core type that best matches the
cpu you will be using on your device.
If you don't know what to do, choose "Generic Arm".
config CONFIG_GENERIC_ARM
bool "Generic Arm"
config CONFIG_ARM610
bool "Arm 610"
select ARCH_HAS_MMU
config CONFIG_ARM710
bool "Arm 710"
select ARCH_HAS_MMU
config CONFIG_ARM7TDMI
bool "Arm 7TDMI"
select ARCH_HAS_NO_MMU
config CONFIG_ARM720T
bool "Arm 720T"
select ARCH_HAS_MMU
config CONFIG_ARM920T
bool "Arm 920T"
select ARCH_HAS_MMU
config CONFIG_ARM922T
bool "Arm 922T"
select ARCH_HAS_MMU
config CONFIG_ARM926T
bool "Arm 926T"
select ARCH_HAS_MMU
config CONFIG_ARM10T
bool "Arm 10T"
select ARCH_HAS_MMU
config CONFIG_ARM1136JF_S
bool "Arm 1136JF-S"
select ARCH_HAS_MMU
config CONFIG_ARM1176JZ_S
bool "Arm 1176JZ-S"
select ARCH_HAS_MMU
config CONFIG_ARM1176JZF_S
bool "Arm 1176JZF-S"
select ARCH_HAS_MMU
config CONFIG_ARM_CORTEX_M3
bool "Arm Cortex-M3"
select ARCH_HAS_NO_MMU
select USE_BX
config CONFIG_ARM_CORTEX_M1
bool "Arm Cortex-M1"
select ARCH_HAS_NO_MMU
select USE_BX
config CONFIG_ARM_SA110
bool "Intel StrongArm SA-110"
select ARCH_HAS_MMU
config CONFIG_ARM_SA1100
bool "Intel StrongArm SA-1100"
select ARCH_HAS_MMU
config CONFIG_ARM_XSCALE
bool "Intel Xscale"
select ARCH_HAS_MMU
config CONFIG_ARM_IWMMXT
bool "Intel Xscale With WMMX PXA27x"
select ARCH_HAS_MMU
endchoice
Say 'y' to use BX to return from functions on your thumb-aware
processor. Say 'y' if you need to use interworking. Say 'n' if not.
It is safe to say 'y' even if you're not doing interworking.

View File

@ -11,6 +11,7 @@ config FORCE_OPTIONS_FOR_ARCH
bool
default y
select ARCH_BIG_ENDIAN
select ARCH_HAS_DEPRECATED_SYSCALLS
select FORCE_SHAREABLE_TEXT_SEGMENTS
choice

View File

@ -12,3 +12,4 @@ config FORCE_OPTIONS_FOR_ARCH
default y
select ARCH_LITTLE_ENDIAN
select ARCH_HAS_NO_MMU
select ARCH_HAS_DEPRECATED_SYSCALLS

View File

@ -11,6 +11,7 @@ config FORCE_OPTIONS_FOR_ARCH
bool
default y
select ARCH_LITTLE_ENDIAN
select ARCH_HAS_DEPRECATED_SYSCALLS
choice
prompt "Target Architecture Type"

View File

@ -13,3 +13,4 @@ config FORCE_OPTIONS_FOR_ARCH
select ARCH_BIG_ENDIAN
select ARCH_HAS_NO_MMU
select ARCH_HAS_NO_SHARED
select ARCH_HAS_DEPRECATED_SYSCALLS

View File

@ -13,3 +13,4 @@ config FORCE_OPTIONS_FOR_ARCH
select ARCH_BIG_ENDIAN
select UCLIBC_HAS_FPU
select ARCH_HAS_NO_MMU
select ARCH_HAS_DEPRECATED_SYSCALLS

View File

@ -10,8 +10,10 @@ config TARGET_ARCH
config FORCE_OPTIONS_FOR_ARCH
bool
default y
select ARCH_ANY_ENDIAN
select ARCH_BIG_ENDIAN
select ARCH_HAS_NO_MMU
select ARCH_HAS_NO_LDSO
select HAVE_NO_PIC
choice
prompt "Target Processor"

View File

@ -15,3 +15,4 @@ config FORCE_OPTIONS_FOR_ARCH
select HAS_NO_THREADS
select ARCH_HAS_NO_LDSO
select HAVE_NO_SSP
select ARCH_HAS_DEPRECATED_SYSCALLS

View File

@ -12,44 +12,17 @@ config FORCE_OPTIONS_FOR_ARCH
default y
select ARCH_LITTLE_ENDIAN
select ARCH_HAS_MMU
select ARCH_HAS_UCONTEXT
select ARCH_HAS_DEPRECATED_SYSCALLS
choice
prompt "Target x86 Processor Family"
default CONFIG_486
default CONFIG_686
help
This is the processor type of your CPU. This information is used for
optimizing purposes. To build a library that will run on all x86 CPU
types (albeit not optimally fast), you can specify "386" here. If
you pick anything other than "386", there is no guarantee that uClibc
will even run on anything other than the selected processor type.
Here are the settings recommended for greatest speed:
- "Generic 386" select this if your compiler is already setup to
optimize things properly.
- "386" for the AMD/Cyrix/Intel 386DX/DXL/SL/SLC/SX, Cyrix/TI
486DLC/DLC2, UMC 486SX-S and NexGen Nx586. Only "386" kernels
will run on a 386 class machine.
- "486" for the AMD/Cyrix/IBM/Intel 486DX/DX2/DX4 or
SL/SLC/SLC2/SLC3/SX/SX2 and UMC U5D or U5S.
- "586" for Intel Pentium and other generic Pentium CPUs
- "Pentium-MMX" for the Intel Pentium MMX.
- "Pentium-Pro" for the Intel Pentium Pro/Celeron/Pentium II.
- "Pentium-III" for the Intel Pentium III
and Celerons based on the Coppermine core.
- "Pentium-4" for the Intel Pentium 4.
- "K6" for the AMD K6, K6-II and K6-III (aka K6-3D).
- "Athlon" for the AMD K7 family (Athlon/Duron/Thunderbird).
- "Elan" for the AMD Elan.
- "Crusoe" for the Transmeta Crusoe series.
- "Winchip-C6" for original IDT Winchip.
- "Winchip-2/Winchip-2A/Winchip-3" for IDT Winchip CPUs
- "CyrixIII/VIA C3" for VIA Cyrix III or VIA C3.
- "VIA C3-2 Nehemiah" model 9 and above.
If you don't know what to do, choose "386".
config CONFIG_GENERIC_386
bool "Generic 386"
selecting different handcoded optimization functions. Nowadays, most
people have an i686 CPU. If you don't, you most likely know what this
means and can pick the right one for your processor.
config CONFIG_386
bool "386"
@ -58,45 +31,9 @@ config CONFIG_486
bool "486"
config CONFIG_586
bool "Pentium/586/K5/5x86/6x86/6x86MX"
config CONFIG_586MMX
bool "Pentium-MMX"
bool "586"
config CONFIG_686
bool "Pentium-Pro"
config CONFIG_PENTIUMII
bool "Celeron/Pentium-II"
config CONFIG_PENTIUMIII
bool "Pentium-III/Celeron(Coppermine)/Pentium-III Xeon"
config CONFIG_PENTIUM4
bool "Pentium-4/Celeron(P4-based)/Xeon"
config CONFIG_K6
bool "K6/K6-II/K6-III"
config CONFIG_K7
bool "Athlon/Duron/K7"
config CONFIG_ELAN
bool "Elan"
config CONFIG_CRUSOE
bool "Crusoe"
config CONFIG_WINCHIPC6
bool "Winchip-C6"
config CONFIG_WINCHIP2
bool "Winchip-2/Winchip-2A/Winchip-3"
config CONFIG_CYRIXIII
bool "CyrixIII/VIA-C3"
config CONFIG_NEHEMIAH
bool "VIA C3-2 (Nehemiah)"
bool "686"
endchoice

View File

@ -13,3 +13,4 @@ config FORCE_OPTIONS_FOR_ARCH
select ARCH_LITTLE_ENDIAN
select ARCH_HAS_NO_MMU
select HAS_NO_THREADS
select ARCH_HAS_DEPRECATED_SYSCALLS

View File

@ -13,3 +13,4 @@ config FORCE_OPTIONS_FOR_ARCH
select ARCH_LITTLE_ENDIAN
select ARCH_HAS_MMU
select ARCH_HAS_NO_LDSO
select ARCH_HAS_DEPRECATED_SYSCALLS

File diff suppressed because it is too large Load Diff

View File

@ -10,9 +10,6 @@
if !ARCH_USE_MMU
choice
prompt "Target File Format"
config UCLIBC_FORMAT_ELF
bool "ELF"
depends on ARCH_USE_MMU
config UCLIBC_FORMAT_FDPIC_ELF
bool "FDPIC ELF"
depends on !ARCH_USE_MMU && (TARGET_bfin || TARGET_frv)
@ -42,6 +39,14 @@ if ARCH_USE_MMU
comment "Using ELF file format"
endif
config ARCH_HAS_DEPRECATED_SYSCALLS
bool
help
New architectures do not support deprecated system calls. However,
these system calls are needed to build linuxthreads (old and new) so
this symbol controls whether there is support for these threading libraries
or not.
config UCLIBC_SHARED_FLAT_ID
int "Shared library ID"
default 1
@ -133,7 +138,6 @@ config UCLIBC_HAS_FLOATS
config UCLIBC_HAS_FPU
bool "Target CPU has a floating point unit (FPU)"
depends on UCLIBC_HAS_FLOATS
default y
help
If your target CPU does not have a Floating Point Unit (FPU) or a
@ -153,7 +157,6 @@ config UCLIBC_HAS_SOFT_FLOAT
config DO_C99_MATH
bool "Enable full C99 math library support"
depends on UCLIBC_HAS_FLOATS
default n
help
If you want the uClibc math library to contain the full set C99
math library features, then answer Y. If you leave this set to
@ -167,7 +170,6 @@ config DO_C99_MATH
config DO_XSI_MATH
bool "Enable XSI math extensions to the ISO C standard (bessel)"
depends on UCLIBC_HAS_FLOATS
default n
help
X/Open System Interfaces extensions to ISO C math functions
(differential equation functions):
@ -178,7 +180,6 @@ config DO_XSI_MATH
config UCLIBC_HAS_FENV
bool "Enable C99 Floating-point environment"
depends on UCLIBC_HAS_FLOATS
default n
help
If you want the uClibc math library to contain the C99 floating
point environment, rounding and exception handling functions then
@ -190,7 +191,7 @@ config UCLIBC_HAS_FENV
config UCLIBC_HAS_LONG_DOUBLE_MATH
bool "Enable long double support"
depends on DO_C99_MATH
depends on TARGET_i386 || TARGET_m68k || TARGET_sparc || TARGET_x86_64 || TARGET_powerpc || TARGET_sh
depends on TARGET_aarch64 || TARGET_alpha || TARGET_i386 || TARGET_ia64 || TARGET_m68k || TARGET_powerpc || TARGET_s390 || TARGET_sparc || TARGET_tile || TARGET_x86_64
default y
help
If you want the uClibc math library to contain the full set of C99
@ -199,7 +200,7 @@ config UCLIBC_HAS_LONG_DOUBLE_MATH
config KERNEL_HEADERS
string "Linux kernel header location"
default "/usr/include"
default ""
help
The kernel source you use to compile with should be the same
as the Linux kernel you run your apps on. uClibc doesn't even
@ -210,6 +211,8 @@ config KERNEL_HEADERS
but then run on Linux 2.0.x, lchown will be compiled into uClibc,
but won't work at all. You have been warned.
If you don't set this, we'll assume the toolchain can find them.
config UCLIBC_UCLINUX_BROKEN_MUNMAP
bool
depends on !ARCH_USE_MMU

View File

@ -11,3 +11,4 @@ config FORCE_OPTIONS_FOR_ARCH
bool
default y
select ARCH_BIG_ENDIAN
select ARCH_HAS_DEPRECATED_SYSCALLS

View File

@ -0,0 +1,32 @@
#
# For a description of the syntax of this configuration file,
# see extra/config/Kconfig-language.txt
#
# Copyright (C) 2013, Imagination Technologies Ltd.
#
# Licensed under LGPL v2.1 or later, see the file COPYING.LIB in this tarball.
#
config TARGET_ARCH
default "metag"
config FORCE_OPTIONS_FOR_ARCH
bool
default y
select ARCH_LITTLE_ENDIAN
select ARCH_HAS_MMU
choice
prompt "Target Processor Type"
default CONFIG_META_2_1
help
This is the processor type of your CPU. This information is used for
optimizing purposes.
config CONFIG_META_1_2
bool "Meta 1.2"
config CONFIG_META_2_1
bool "Meta 2.1"
endchoice

View File

@ -10,5 +10,4 @@ config TARGET_ARCH
config FORCE_OPTIONS_FOR_ARCH
bool
default y
select ARCH_BIG_ENDIAN
select ARCH_HAS_NO_MMU
select ARCH_HAS_DEPRECATED_SYSCALLS

View File

@ -11,6 +11,8 @@ config FORCE_OPTIONS_FOR_ARCH
bool
default y
select ARCH_ANY_ENDIAN
select ARCH_HAS_UCONTEXT
select ARCH_HAS_DEPRECATED_SYSCALLS
choice
prompt "Target ABI"
@ -30,6 +32,21 @@ config CONFIG_MIPS_N64_ABI
endchoice
choice
prompt "Target NAN Encoding"
default CONFIG_MIPS_NAN_LEGACY
help
This is the NAN Encoding you want to use. Chose either Legacy
or 2008.
config CONFIG_MIPS_NAN_LEGACY
bool "LEGACY"
config CONFIG_MIPS_NAN_2008
bool "2008"
endchoice
choice
prompt "Target Processor Architecture"
default CONFIG_MIPS_ISA_1 if CONFIG_MIPS_O32_ABI
@ -70,4 +87,7 @@ config CONFIG_MIPS_ISA_MIPS32R2
config CONFIG_MIPS_ISA_MIPS64
bool "MIPS64"
config CONFIG_MIPS_ISA_MIPS64R2
bool "MIPS64r2"
endchoice

View File

@ -13,4 +13,5 @@ config FORCE_OPTIONS_FOR_ARCH
select ARCH_LITTLE_ENDIAN
select ARCH_HAS_NO_MMU
select ARCH_HAS_NO_LDSO
select ARCH_HAS_DEPRECATED_SYSCALLS
select HAVE_NO_PIC

View File

@ -13,4 +13,5 @@ config FORCE_OPTIONS_FOR_ARCH
select ARCH_LITTLE_ENDIAN
select ARCH_HAS_NO_MMU
select ARCH_HAS_NO_LDSO
select ARCH_HAS_DEPRECATED_SYSCALLS
select HAVE_NO_PIC

View File

@ -12,6 +12,7 @@ config FORCE_OPTIONS_FOR_ARCH
default y
select ARCH_BIG_ENDIAN
select ARCH_HAS_MMU
select ARCH_HAS_DEPRECATED_SYSCALLS
choice
prompt "Target Processor Type"

View File

@ -11,6 +11,7 @@ config FORCE_OPTIONS_FOR_ARCH
bool
default y
select ARCH_ANY_ENDIAN
select ARCH_HAS_DEPRECATED_SYSCALLS
choice
prompt "Target Processor Type"

View File

@ -11,6 +11,7 @@ config FORCE_OPTIONS_FOR_ARCH
bool
default y
select ARCH_ANY_ENDIAN
select ARCH_HAS_DEPRECATED_SYSCALLS
choice
prompt "Target Processor Type"

View File

@ -11,6 +11,7 @@ config FORCE_OPTIONS_FOR_ARCH
bool
default y
select ARCH_BIG_ENDIAN
select ARCH_HAS_DEPRECATED_SYSCALLS
choice
prompt "Target Processor Type"
@ -25,10 +26,4 @@ config CONFIG_SPARC_V7
config CONFIG_SPARC_V8
bool "SPARC v8"
config CONFIG_SPARC_V9
bool "SPARC v9"
config CONFIG_SPARC_V9B
bool "SPARC v9b"
endchoice

View File

@ -12,4 +12,5 @@ config FORCE_OPTIONS_FOR_ARCH
default y
select ARCH_LITTLE_ENDIAN
select ARCH_HAS_NO_MMU
select ARCH_HAS_DEPRECATED_SYSCALLS
select HAVE_NO_PIC

View File

@ -12,3 +12,4 @@ config FORCE_OPTIONS_FOR_ARCH
default y
select ARCH_LITTLE_ENDIAN
select ARCH_HAS_NO_LDSO
select ARCH_HAS_DEPRECATED_SYSCALLS

View File

@ -12,3 +12,5 @@ config FORCE_OPTIONS_FOR_ARCH
default y
select ARCH_LITTLE_ENDIAN
select ARCH_HAS_MMU
select ARCH_HAS_UCONTEXT
select ARCH_HAS_DEPRECATED_SYSCALLS

View File

@ -6,3 +6,8 @@
config TARGET_ARCH
string
default "xtensa"
config FORCE_OPTIONS_FOR_ARCH
bool
default y
select ARCH_HAS_DEPRECATED_SYSCALLS

View File

@ -0,0 +1,40 @@
CONFIG_ARC_CPU_HS=y
ARCH_WANTS_LITTLE_ENDIAN=y
# UCLIBC_HAS_FPU is not set
DO_C99_MATH=y
KERNEL_HEADERS="%KERNEL_HEADERS%"
# DOPIC is not set
# LDSO_CACHE_SUPPORT is not set
LDSO_RUNPATH=y
# LDSO_SAFE_RUNPATH is not set
UCLIBC_HAS_THREADS_NATIVE=y
PTHREADS_DEBUG_SUPPORT=y
UCLIBC_HAS_OBSTACK=y
UCLIBC_HAS_UTMPX=y
UCLIBC_HAS_UTMP=y
UCLIBC_SUSV2_LEGACY=y
UCLIBC_SUSV3_LEGACY=y
UCLIBC_SUSV4_LEGACY=y
UCLIBC_HAS_PROGRAM_INVOCATION_NAME=y
UCLIBC_HAS_LIBUTIL=y
UCLIBC_HAS_OBSOLETE_BSD_SIGNAL=y
UCLIBC_SV4_DEPRECATED=y
UCLIBC_HAS_IPV6=y
UCLIBC_HAS_RPC=y
UCLIBC_HAS_FULL_RPC=y
UCLIBC_USE_NETLINK=y
UCLIBC_SUPPORT_AI_ADDRCONFIG=y
UCLIBC_HAS_RESOLVER_SUPPORT=y
UCLIBC_HAS_LIBRESOLV_STUB=y
UCLIBC_HAS_LIBNSL_STUB=y
UCLIBC_HAS_LOCALE=y
UCLIBC_HAS_GLIBC_CUSTOM_STREAMS=y
UCLIBC_HAS_NFTW=y
UCLIBC_HAS_FTW=y
UCLIBC_HAS_GNU_GLOB=y
RUNTIME_PREFIX="%RUNTIME_PREFIX%"
DEVEL_PREFIX="%DEVEL_PREFIX%"
CROSS_COMPILER_PREFIX="arc-linux-uclibc-"
# DOSTRIP is not set
SUPPORT_LD_DEBUG=y
UCLIBC_HAS_BACKTRACE=y

View File

@ -0,0 +1,39 @@
ARCH_WANTS_LITTLE_ENDIAN=y
# UCLIBC_HAS_FPU is not set
DO_C99_MATH=y
KERNEL_HEADERS="%KERNEL_HEADERS%"
# DOPIC is not set
# LDSO_CACHE_SUPPORT is not set
LDSO_RUNPATH=y
# LDSO_SAFE_RUNPATH is not set
UCLIBC_HAS_THREADS_NATIVE=y
PTHREADS_DEBUG_SUPPORT=y
UCLIBC_HAS_OBSTACK=y
UCLIBC_HAS_UTMPX=y
UCLIBC_HAS_UTMP=y
UCLIBC_SUSV2_LEGACY=y
UCLIBC_SUSV3_LEGACY=y
UCLIBC_SUSV4_LEGACY=y
UCLIBC_HAS_PROGRAM_INVOCATION_NAME=y
UCLIBC_HAS_LIBUTIL=y
UCLIBC_HAS_OBSOLETE_BSD_SIGNAL=y
UCLIBC_SV4_DEPRECATED=y
UCLIBC_HAS_IPV6=y
UCLIBC_HAS_RPC=y
UCLIBC_HAS_FULL_RPC=y
UCLIBC_USE_NETLINK=y
UCLIBC_SUPPORT_AI_ADDRCONFIG=y
UCLIBC_HAS_RESOLVER_SUPPORT=y
UCLIBC_HAS_LIBRESOLV_STUB=y
UCLIBC_HAS_LIBNSL_STUB=y
UCLIBC_HAS_LOCALE=y
UCLIBC_HAS_GLIBC_CUSTOM_STREAMS=y
UCLIBC_HAS_NFTW=y
UCLIBC_HAS_FTW=y
UCLIBC_HAS_GNU_GLOB=y
RUNTIME_PREFIX="%RUNTIME_PREFIX%"
DEVEL_PREFIX="%DEVEL_PREFIX%"
CROSS_COMPILER_PREFIX="arc-linux-uclibc-"
# DOSTRIP is not set
SUPPORT_LD_DEBUG=y
UCLIBC_HAS_BACKTRACE=y

View File

@ -0,0 +1,38 @@
ARCH_WANTS_LITTLE_ENDIAN=y
# UCLIBC_HAS_FPU is not set
DO_C99_MATH=y
KERNEL_HEADERS="%KERNEL_HEADERS%"
# DOPIC is not set
# LDSO_CACHE_SUPPORT is not set
LDSO_RUNPATH=y
# LDSO_SAFE_RUNPATH is not set
LINUXTHREADS_OLD=y
PTHREADS_DEBUG_SUPPORT=y
MALLOC_GLIBC_COMPAT=y
UCLIBC_SUSV3_LEGACY=y
UCLIBC_SUSV4_LEGACY=y
UCLIBC_HAS_GETPT=y
UCLIBC_HAS_LIBUTIL=y
UCLIBC_HAS_OBSOLETE_BSD_SIGNAL=y
UCLIBC_SV4_DEPRECATED=y
UCLIBC_HAS_IPV6=y
UCLIBC_HAS_RPC=y
UCLIBC_HAS_FULL_RPC=y
UCLIBC_HAS_REENTRANT_RPC=y
UCLIBC_HAS_RESOLVER_SUPPORT=y
UCLIBC_HAS_LIBRESOLV_STUB=y
UCLIBC_HAS_LIBNSL_STUB=y
UCLIBC_HAS_CTYPE_CHECKED=y
UCLIBC_HAS_LOCALE=y
UCLIBC_HAS_FOPEN_EXCLUSIVE_MODE=y
UCLIBC_HAS_FOPEN_CLOSEEXEC_MODE=y
UCLIBC_HAS_GLIBC_CUSTOM_STREAMS=y
UCLIBC_HAS_PRINTF_M_SPEC=y
UCLIBC_HAS_NFTW=y
UCLIBC_HAS_FTW=y
UCLIBC_HAS_GNU_GLOB=y
RUNTIME_PREFIX="%RUNTIME_PREFIX%"
DEVEL_PREFIX="%DEVEL_PREFIX%"
CROSS_COMPILER_PREFIX="arc-linux-uclibc-"
# DOSTRIP is not set
SUPPORT_LD_DEBUG=y

View File

@ -0,0 +1 @@
TARGET_metag=y

View File

@ -2,18 +2,21 @@
# Generated files
#
config*
lex.*.c
*.lex.c
*.tab.c
*.tab.h
zconf.hash.c
*.moc
lkc_defs.h
gconf.glade.h
*.pot
*.mo
#
# configuration programs
#
conf
mconf
nconf
qconf
gconf
kxgettext

View File

@ -1,16 +1,17 @@
top_srcdir ?= ../../
ifdef O
top_builddir ?= ../../
else
top_builddir = ../../
endif
include $(top_srcdir)Rules.mak
include $(top_srcdir)Makerules
# ugh
top_srcdir:=$(shell cd $(top_srcdir) && pwd)/
ifdef O
top_builddir ?= ../../
else
top_builddir = ../../
endif
srctree := $(top_srcdir)
src := extra/config
obj := $(top_builddir)$(src)
@ -18,29 +19,23 @@ generated := $(patsubst %_shipped,%,$(wildcard *_shipped))
generated := $(addprefix $(obj)/,$(generated:.c=.o))
include $(top_srcdir)extra/config/Makefile.kconfig
PHONY += $(always)
chk-lxdialog := $(top_srcdir)$(src)/lxdialog/check-lxdialog.sh
check-lxdialog := cd $(obj) && $(CONFIG_SHELL) $(chk-lxdialog)
HOST_EXTRACFLAGS = $(shell $(CONFIG_SHELL) -c '$(check-lxdialog) -ccflags')
HOST_LOADLIBES = $(shell $(CONFIG_SHELL) -c '$(check-lxdialog) -ldflags $(HOSTCC)')
HOST_EXTRACFLAGS += -DLOCALE
HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) -c '$(srctree)/$(src)/check.sh $(HOSTCC) $(HOSTCFLAGS)')
HOST_EXTRACFLAGS += -DCONFIG_='""'
# do not create temporary object in the readonly srctree
$(obj)/dochecklxdialog:
$(Q)cd $(obj) && $(CONFIG_SHELL) $(chk-lxdialog) -check $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOST_LOADLIBES)
HOSTCFLAGS_lex.zconf.o := -I$(top_srcdir)$(src)
$(obj)/dochecklxdialog: CONFIG_SHELL:=cd $(obj) && $(CONFIG_SHELL)
HOSTCFLAGS_zconf.lex.o := -I$(top_srcdir)$(src)
HOSTCFLAGS_zconf.tab.o := -I$(top_srcdir)$(src)
conf-objs := $(addprefix $(obj)/,$(conf-objs))
mconf-objs := $(addprefix $(obj)/,$(mconf-objs))
nconf-objs := $(addprefix $(obj)/,$(nconf-objs))
kxgettext-objs := $(addprefix $(obj)/,$(kxgettext-objs))
ifeq ($(findstring mconf,$(MAKECMDGOALS)),mconf)
hostprogs-y += mconf
endif
#BUILD_CFLAGS-config = -W -Wall -pedantic
#BUILD_CFLAGS-lxdialog = -W -Wall -pedantic
ifeq ($(findstring nconf,$(MAKECMDGOALS)),nconf)
hostprogs-y += nconf
endif
__hostprogs := $(sort $(hostprogs-y) $(hostprogs-m))
host-csingle:= $(foreach m,$(__hostprogs),$(if $($(m)-objs),,$(m)))
@ -48,16 +43,18 @@ host-cmulti := $(foreach m,$(__hostprogs),\
$(if $($(m)-cxxobjs),,$(if $($(m)-objs),$(m))))
host-cobjs := $(sort $(foreach m,$(__hostprogs),$($(m)-objs)))
conf mconf kxgettext: %: $(obj)/%
$(obj)/conf $(obj)/mconf $(obj)/kxgettext: BUILD_LDFLAGS=$(HOST_LOADLIBES)
conf mconf nconf kxgettext: %: $(obj)/%
$(obj)/conf $(obj)/mconf $(obj)/nconf $(obj)/kxgettext: BUILD_LDFLAGS=$(HOSTLOADLIBES_$(@F))
$(obj)/conf: $(conf-objs)
$(hcompile.u)
$(obj)/mconf: $(mconf-objs)
$(hcompile.u)
$(obj)/nconf: $(nconf-objs)
$(hcompile.u)
$(obj)/kxgettext: $(kxgettext-objs)
$(hcompile.u)
$(host-csingle) $(host-cmulti) $(host-cobjs): BUILD_CFLAGS=$(HOST_EXTRACFLAGS) \
$(host-csingle) $(host-cmulti) $(host-cobjs): BUILD_CFLAGS+=$(HOST_EXTRACFLAGS) \
$(HOSTCFLAGS) $(HOSTCFLAGS_$(@F))
host-cobjs.nogen := $(filter-out $(generated),$(host-cobjs))
@ -68,19 +65,18 @@ $(host-cobjs.nogen): $(obj)/%.o: $(top_srcdir)$(src)/%.c
$(host-cobjs.generated): $(obj)/%.o: $(obj)/%.c
$(hcompile.o)
ifndef LKC_GENPARSER
# we use the pre-generated always
$(obj)/%:: $(top_srcdir)$(src)/%_shipped
@$(disp_gen)
$(Q)cat $< > $@
endif
CLEAN_extra/config menuconfig_clean:
$(do_rm) $(clean-files) $(lxdialog) conf $(wildcard *.o)
distclean: clean
$(do_rm) $(lxdialog) $(conf-objs) $(mconf-objs) \
distclean: CLEAN_extra/config
$(Q)$(RM) -r $(lxdialog) $(conf-objs) $(mconf-objs) $(nconf-objs) \
$(kxgettext-objs) \
$(hostprogs-y) $(qconf-cxxobjs) $(qconf-objs) $(gconf-objs) \
.depend
$(do_rm) -r $(top_builddir)include/config
.depend \
$(top_builddir)include/config $(top_builddir)include/generated
FORCE:
.PHONY: FORCE clean distclean $(always)
.PHONY: clean distclean $(PHONY)

View File

@ -2,14 +2,18 @@
# Kernel configuration targets
# These targets are used from top-level makefile
PHONY += oldconfig xconfig gconfig menuconfig config silentoldconfig update-po-config
PHONY += oldconfig xconfig gconfig menuconfig config silentoldconfig update-po-config \
localmodconfig localyesconfig
ifdef KBUILD_KCONFIG
Kconfig := $(KBUILD_KCONFIG)
else
Kconfig := arch/$(SRCARCH)/Kconfig
Kconfig := Kconfig
endif
# We need this, in case the user has it in its environment
unexport CONFIG_
xconfig: $(obj)/qconf
$< $(Kconfig)
@ -20,91 +24,121 @@ menuconfig: $(obj)/mconf
$< $(Kconfig)
config: $(obj)/conf
$< --oldaskconfig $(Kconfig)
nconfig: $(obj)/nconf
$< $(Kconfig)
oldconfig: $(obj)/conf
$< -o $(Kconfig)
$< --$@ $(Kconfig)
silentoldconfig: $(obj)/conf
$< -s $(Kconfig)
$(Q)mkdir -p include/generated
$< --$@ $(Kconfig)
localyesconfig localmodconfig: $(obj)/streamline_config.pl $(obj)/conf
$(Q)mkdir -p include/generated
$(Q)perl $< --$@ $(srctree) $(Kconfig) > .tmp.config
$(Q)if [ -f .config ]; then \
cmp -s .tmp.config .config || \
(mv -f .config .config.old.1; \
mv -f .tmp.config .config; \
$(obj)/conf --silentoldconfig $(Kconfig); \
mv -f .config.old.1 .config.old) \
else \
mv -f .tmp.config .config; \
$(obj)/conf --silentoldconfig $(Kconfig); \
fi
$(Q)rm -f .tmp.config
# Create new linux.pot file
# Adjust charset to UTF-8 in .po file to accept UTF-8 in Kconfig files
# The symlink is used to repair a deficiency in arch/um
update-po-config: $(obj)/kxgettext $(obj)/gconf.glade.h
$(Q)echo " GEN config"
$(Q)xgettext --default-domain=linux \
--add-comments --keyword=_ --keyword=N_ \
--from-code=UTF-8 \
--files-from=scripts/kconfig/POTFILES.in \
$(Q)echo " GEN config.pot"
$(Q)xgettext --default-domain=linux \
--add-comments --keyword=_ --keyword=N_ \
--from-code=UTF-8 \
--files-from=$(srctree)/scripts/kconfig/POTFILES.in \
--directory=$(srctree) --directory=$(objtree) \
--output $(obj)/config.pot
$(Q)sed -i s/CHARSET/UTF-8/ $(obj)/config.pot
$(Q)ln -fs Kconfig.i386 arch/um/Kconfig.arch
$(Q)(for i in `ls arch/*/Kconfig`; \
$(Q)(for i in `ls $(srctree)/arch/*/Kconfig \
$(srctree)/arch/*/um/Kconfig`; \
do \
echo " GEN $$i"; \
echo " GEN $$i"; \
$(obj)/kxgettext $$i \
>> $(obj)/config.pot; \
done )
$(Q)echo " GEN linux.pot"
$(Q)msguniq --sort-by-file --to-code=UTF-8 $(obj)/config.pot \
--output $(obj)/linux.pot
$(Q)rm -f arch/um/Kconfig.arch
$(Q)rm -f $(obj)/config.pot
PHONY += randconfig allyesconfig allnoconfig allmodconfig defconfig
PHONY += allnoconfig allyesconfig allmodconfig alldefconfig randconfig
randconfig: $(obj)/conf
$< -r $(Kconfig)
allnoconfig allyesconfig allmodconfig alldefconfig randconfig: $(obj)/conf
$< --$@ $(Kconfig)
allyesconfig: $(obj)/conf
$< -y $(Kconfig)
PHONY += listnewconfig olddefconfig oldnoconfig savedefconfig defconfig
allnoconfig: $(obj)/conf
$< -n $(Kconfig)
listnewconfig olddefconfig: $(obj)/conf
$< --$@ $(Kconfig)
allmodconfig: $(obj)/conf
$< -m $(Kconfig)
# oldnoconfig is an alias of olddefconfig, because people already are dependent
# on its behavior(sets new symbols to their default value but not 'n') with the
# counter-intuitive name.
oldnoconfig: $(obj)/conf
$< --olddefconfig $(Kconfig)
savedefconfig: $(obj)/conf
$< --$@=defconfig $(Kconfig)
defconfig: $(obj)/conf
ifeq ($(KBUILD_DEFCONFIG),)
$< -d $(Kconfig)
$< --defconfig $(Kconfig)
else
@echo "*** Default configuration is based on '$(KBUILD_DEFCONFIG)'"
$(Q)$< -D arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG) $(Kconfig)
$(Q)$< --defconfig=arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG) $(Kconfig)
endif
%_defconfig: $(obj)/conf
$(Q)$< -D arch/$(SRCARCH)/configs/$@ $(Kconfig)
$(Q)$< --defconfig=arch/$(SRCARCH)/configs/$@ $(Kconfig)
# Help text used by make help
help:
@echo ' config - Update current config utilising a line-oriented program'
@echo ' nconfig - Update current config utilising a ncurses menu based program'
@echo ' menuconfig - Update current config utilising a menu based program'
@echo ' xconfig - Update current config utilising a QT based front-end'
@echo ' gconfig - Update current config utilising a GTK based front-end'
@echo ' oldconfig - Update current config utilising a provided .config as base'
@echo ' silentoldconfig - Same as oldconfig, but quietly'
@echo ' randconfig - New config with random answer to all options'
@echo ' defconfig - New config with default answer to all options'
@echo ' allmodconfig - New config selecting modules when possible'
@echo ' allyesconfig - New config where all options are accepted with yes'
@echo ' localmodconfig - Update current config disabling modules not loaded'
@echo ' localyesconfig - Update current config converting local mods to core'
@echo ' silentoldconfig - Same as oldconfig, but quietly, additionally update deps'
@echo ' defconfig - New config with default from ARCH supplied defconfig'
@echo ' savedefconfig - Save current config as ./defconfig (minimal config)'
@echo ' allnoconfig - New config where all options are answered with no'
@echo ' allyesconfig - New config where all options are accepted with yes'
@echo ' allmodconfig - New config selecting modules when possible'
@echo ' alldefconfig - New config with all symbols set to default'
@echo ' randconfig - New config with random answer to all options'
@echo ' listnewconfig - List new options'
@echo ' olddefconfig - Same as silentoldconfig but sets new symbols to their default value'
# lxdialog stuff
check-lxdialog := $(srctree)/$(src)/lxdialog/check-lxdialog.sh
# Use recursively expanded variables so we do not call gcc unless
# we really need to do so. (Do not call gcc as part of make mrproper)
HOST_EXTRACFLAGS = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags)
HOST_LOADLIBES = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC))
HOST_EXTRACFLAGS += -DLOCALE
HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags) \
-DLOCALE
# ===========================================================================
# Shared Makefile for the various kconfig executables:
# conf: Used for defconfig, oldconfig and related targets
# mconf: Used for the mconfig target.
# nconf: Used for the nconfig target.
# Utilizes ncurses
# mconf: Used for the menuconfig target
# Utilizes the lxdialog package
# qconf: Used for the xconfig target
# Based on QT which needs to be installed to compile it
@ -116,15 +150,27 @@ lxdialog := lxdialog/checklist.o lxdialog/util.o lxdialog/inputbox.o
lxdialog += lxdialog/textbox.o lxdialog/yesno.o lxdialog/menubox.o
conf-objs := conf.o zconf.tab.o
mconf-objs := mconf.o zconf.tab.o $(lxdialog)
mconf-objs := mconf.o zconf.tab.o $(lxdialog)
nconf-objs := nconf.o zconf.tab.o nconf.gui.o
kxgettext-objs := kxgettext.o zconf.tab.o
qconf-cxxobjs := qconf.o
qconf-objs := zconf.tab.o
gconf-objs := gconf.o zconf.tab.o
hostprogs-y := conf qconf gconf kxgettext
hostprogs-y := conf
ifeq ($(MAKECMDGOALS),nconfig)
hostprogs-y += nconf
endif
ifeq ($(MAKECMDGOALS),menuconfig)
hostprogs-y += mconf
endif
ifeq ($(MAKECMDGOALS),update-po-config)
hostprogs-y += kxgettext
endif
ifeq ($(MAKECMDGOALS),xconfig)
qconf-target := 1
endif
@ -134,24 +180,23 @@ endif
ifeq ($(qconf-target),1)
qconf-cxxobjs := qconf.o
qconf-objs := kconfig_load.o zconf.tab.o
hostprogs-y += qconf
endif
ifeq ($(gconf-target),1)
gconf-objs := gconf.o kconfig_load.o zconf.tab.o
hostprogs-y += gconf
endif
clean-files := lkc_defs.h qconf.moc .tmp_qtcheck \
.tmp_gtkcheck zconf.tab.c lex.zconf.c zconf.hash.c gconf.glade.h
clean-files += mconf qconf gconf
clean-files := qconf.moc .tmp_qtcheck .tmp_gtkcheck
clean-files += zconf.tab.c zconf.lex.c zconf.hash.c gconf.glade.h
clean-files += mconf qconf gconf nconf
clean-files += config.pot linux.pot
# Check that we have the required ncurses stuff installed for lxdialog (menuconfig)
PHONY += $(obj)/dochecklxdialog
$(addprefix $(obj)/,$(lxdialog)): $(obj)/dochecklxdialog
#$(obj)/dochecklxdialog:
# $(Q)$(CONFIG_SHELL) $(check-lxdialog) -check $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOST_LOADLIBES)
$(obj)/dochecklxdialog:
$(Q)$(CONFIG_SHELL) $(check-lxdialog) -check $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTLOADLIBES_mconf)
always := dochecklxdialog
@ -159,16 +204,24 @@ always := dochecklxdialog
HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) $(srctree)/$(src)/check.sh $(HOSTCC) $(HOSTCFLAGS))
# generated files seem to need this to find local include files
HOSTCFLAGS_lex.zconf.o := -I$(src)
HOSTCFLAGS_zconf.lex.o := -I$(src)
HOSTCFLAGS_zconf.tab.o := -I$(src)
HOSTLOADLIBES_qconf = $(KC_QT_LIBS) -ldl
HOSTCXXFLAGS_qconf.o = $(KC_QT_CFLAGS) -D LKC_DIRECT_LINK
LEX_PREFIX_zconf := zconf
YACC_PREFIX_zconf := zconf
HOSTLOADLIBES_qconf = $(KC_QT_LIBS)
HOSTCXXFLAGS_qconf.o = $(KC_QT_CFLAGS)
HOSTLOADLIBES_gconf = `pkg-config --libs gtk+-2.0 gmodule-2.0 libglade-2.0`
HOSTCFLAGS_gconf.o = `pkg-config --cflags gtk+-2.0 gmodule-2.0 libglade-2.0` \
-D LKC_DIRECT_LINK
-Wno-missing-prototypes
HOSTLOADLIBES_mconf = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC))
HOSTLOADLIBES_nconf = $(shell \
pkg-config --libs menu panel ncurses 2>/dev/null \
|| echo "-lmenu -lpanel -lncurses" )
$(obj)/qconf.o: $(obj)/.tmp_qtcheck
ifeq ($(qconf-target),1)
@ -178,40 +231,48 @@ $(obj)/.tmp_qtcheck: $(src)/Makefile
# QT needs some extra effort...
$(obj)/.tmp_qtcheck:
@set -e; echo " CHECK qt"; dir=""; pkg=""; \
pkg-config --exists qt 2> /dev/null && pkg=qt; \
pkg-config --exists qt-mt 2> /dev/null && pkg=qt-mt; \
if [ -n "$$pkg" ]; then \
cflags="\$$(shell pkg-config $$pkg --cflags)"; \
libs="\$$(shell pkg-config $$pkg --libs)"; \
moc="\$$(shell pkg-config $$pkg --variable=prefix)/bin/moc"; \
dir="$$(pkg-config $$pkg --variable=prefix)"; \
if ! pkg-config --exists QtCore 2> /dev/null; then \
echo "* Unable to find the QT4 tool qmake. Trying to use QT3"; \
pkg-config --exists qt 2> /dev/null && pkg=qt; \
pkg-config --exists qt-mt 2> /dev/null && pkg=qt-mt; \
if [ -n "$$pkg" ]; then \
cflags="\$$(shell pkg-config $$pkg --cflags)"; \
libs="\$$(shell pkg-config $$pkg --libs)"; \
moc="\$$(shell pkg-config $$pkg --variable=prefix)/bin/moc"; \
dir="$$(pkg-config $$pkg --variable=prefix)"; \
else \
for d in $$QTDIR /usr/share/qt* /usr/lib/qt*; do \
if [ -f $$d/include/qconfig.h ]; then dir=$$d; break; fi; \
done; \
if [ -z "$$dir" ]; then \
echo >&2 "*"; \
echo >&2 "* Unable to find any QT installation. Please make sure that"; \
echo >&2 "* the QT4 or QT3 development package is correctly installed and"; \
echo >&2 "* either qmake can be found or install pkg-config or set"; \
echo >&2 "* the QTDIR environment variable to the correct location."; \
echo >&2 "*"; \
false; \
fi; \
libpath=$$dir/lib; lib=qt; osdir=""; \
$(HOSTCXX) -print-multi-os-directory > /dev/null 2>&1 && \
osdir=x$$($(HOSTCXX) -print-multi-os-directory); \
test -d $$libpath/$$osdir && libpath=$$libpath/$$osdir; \
test -f $$libpath/libqt-mt.so && lib=qt-mt; \
cflags="-I$$dir/include"; \
libs="-L$$libpath -Wl,-rpath,$$libpath -l$$lib"; \
moc="$$dir/bin/moc"; \
fi; \
if [ ! -x $$dir/bin/moc -a -x /usr/bin/moc ]; then \
echo "*"; \
echo "* Unable to find $$dir/bin/moc, using /usr/bin/moc instead."; \
echo "*"; \
moc="/usr/bin/moc"; \
fi; \
else \
for d in $$QTDIR /usr/share/qt* /usr/lib/qt*; do \
if [ -f $$d/include/qconfig.h ]; then dir=$$d; break; fi; \
done; \
if [ -z "$$dir" ]; then \
echo "*"; \
echo "* Unable to find the QT3 installation. Please make sure that"; \
echo "* the QT3 development package is correctly installed and"; \
echo "* either install pkg-config or set the QTDIR environment"; \
echo "* variable to the correct location."; \
echo "*"; \
false; \
fi; \
libpath=$$dir/lib; lib=qt; osdir=""; \
$(HOSTCXX) -print-multi-os-directory > /dev/null 2>&1 && \
osdir=x$$($(HOSTCXX) -print-multi-os-directory); \
test -d $$libpath/$$osdir && libpath=$$libpath/$$osdir; \
test -f $$libpath/libqt-mt.so && lib=qt-mt; \
cflags="-I$$dir/include"; \
libs="-L$$libpath -Wl,-rpath,$$libpath -l$$lib"; \
moc="$$dir/bin/moc"; \
fi; \
if [ ! -x $$dir/bin/moc -a -x /usr/bin/moc ]; then \
echo "*"; \
echo "* Unable to find $$dir/bin/moc, using /usr/bin/moc instead."; \
echo "*"; \
moc="/usr/bin/moc"; \
cflags="\$$(shell pkg-config QtCore QtGui Qt3Support --cflags)"; \
libs="\$$(shell pkg-config QtCore QtGui Qt3Support --libs)"; \
moc="\$$(shell pkg-config QtCore --variable=moc_location)"; \
[ -n "$$moc" ] || moc="\$$(shell pkg-config QtCore --variable=prefix)/bin/moc"; \
fi; \
echo "KC_QT_CFLAGS=$$cflags" > $@; \
echo "KC_QT_LIBS=$$libs" >> $@; \
@ -229,61 +290,33 @@ $(obj)/.tmp_gtkcheck:
if `pkg-config --atleast-version=2.0.0 gtk+-2.0`; then \
touch $@; \
else \
echo "*"; \
echo "* GTK+ is present but version >= 2.0.0 is required."; \
echo "*"; \
echo >&2 "*"; \
echo >&2 "* GTK+ is present but version >= 2.0.0 is required."; \
echo >&2 "*"; \
false; \
fi \
else \
echo "*"; \
echo "* Unable to find the GTK+ installation. Please make sure that"; \
echo "* the GTK+ 2.0 development package is correctly installed..."; \
echo "* You need gtk+-2.0, glib-2.0 and libglade-2.0."; \
echo "*"; \
echo >&2 "*"; \
echo >&2 "* Unable to find the GTK+ installation. Please make sure that"; \
echo >&2 "* the GTK+ 2.0 development package is correctly installed..."; \
echo >&2 "* You need gtk+-2.0, glib-2.0 and libglade-2.0."; \
echo >&2 "*"; \
false; \
fi
endif
$(obj)/zconf.tab.o: $(obj)/lex.zconf.c $(obj)/zconf.hash.c
$(obj)/zconf.tab.o: $(obj)/zconf.lex.c $(obj)/zconf.hash.c
$(obj)/kconfig_load.o: $(obj)/lkc_defs.h
$(obj)/qconf.o: $(obj)/qconf.moc
$(obj)/qconf.o: $(obj)/qconf.moc $(obj)/lkc_defs.h
quiet_cmd_moc = MOC $@
cmd_moc = $(KC_QT_MOC) -i $< -o $@
$(obj)/gconf.o: $(obj)/lkc_defs.h
$(obj)/%.moc: $(src)/%.h
$(KC_QT_MOC) -i $< -o $@
$(obj)/lkc_defs.h: $(src)/lkc_proto.h
sed < $< > $@ 's/P(\([^,]*\),.*/#define \1 (\*\1_p)/'
$(obj)/%.moc: $(src)/%.h $(obj)/.tmp_qtcheck
$(call cmd,moc)
# Extract gconf menu items for I18N support
$(obj)/gconf.glade.h: $(obj)/gconf.glade
intltool-extract --type=gettext/glade $(obj)/gconf.glade
$(Q)intltool-extract --type=gettext/glade --srcdir=$(srctree) \
$(obj)/gconf.glade
###
# The following requires flex/bison/gperf
# By default we use the _shipped versions, uncomment the following line if
# you are modifying the flex/bison src.
# LKC_GENPARSER := 1
ifdef LKC_GENPARSER
$(obj)/zconf.tab.c: $(src)/zconf.y
$(obj)/lex.zconf.c: $(src)/zconf.l
$(obj)/zconf.hash.c: $(src)/zconf.gperf
%.tab.c: %.y
bison -l -b $* -p $(notdir $*) $<
cp $@ $@_shipped
lex.%.c: %.l
flex -L -P$(notdir $*) -o$@ $<
cp $@ $@_shipped
%.hash.c: %.gperf
gperf < $< > $@
cp $@ $@_shipped
endif

View File

@ -5,7 +5,7 @@ To update:
cd extra/config.new
cp /usr/src/linux/Documentation/kbuild/kconfig-language.txt .
mv Makefile Makefile.kconfig
zcat ../config/kconfig-to-uclibc.patch.gz | patch -p1
tar -O -xzf ../config/kconfig-to-uclibc.tar.gz | patch -p3
cp ../config/README.uClibc .
cp ../config/Makefile .
cd ..

View File

@ -1,6 +1,6 @@
#!/bin/sh
# Needed for systems without gettext
$* -xc -o /dev/null - > /dev/null 2>&1 << EOF
$* -x c -o /dev/null - > /dev/null 2>&1 << EOF
#include <libintl.h>
int main()
{

View File

@ -12,40 +12,45 @@
#include <unistd.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <errno.h>
#define LKC_DIRECT_LINK
#include "lkc.h"
static void conf(struct menu *menu);
static void check_conf(struct menu *menu);
static void xfgets(char *str, int size, FILE *in);
enum {
ask_all,
ask_new,
ask_silent,
set_default,
set_yes,
set_mod,
set_no,
set_random
} input_mode = ask_all;
char *defconfig_file;
enum input_mode {
oldaskconfig,
silentoldconfig,
oldconfig,
allnoconfig,
allyesconfig,
allmodconfig,
alldefconfig,
randconfig,
defconfig,
savedefconfig,
listnewconfig,
olddefconfig,
} input_mode = oldaskconfig;
static int indent = 1;
static int tty_stdio;
static int valid_stdin = 1;
static int sync_kconfig;
static int conf_cnt;
static char line[128];
static struct menu *rootEntry;
static char nohelp_text[] = N_("Sorry, no help available for this option yet.\n");
static const char *get_help(struct menu *menu)
static void print_help(struct menu *menu)
{
if (menu_has_help(menu))
return _(menu_get_help(menu));
else
return nohelp_text;
struct gstr help = str_new();
menu_get_ext_help(menu, &help);
printf("\n%s\n", str_get(&help));
str_free(&help);
}
static void strip(char *str)
@ -93,16 +98,19 @@ static int conf_askvalue(struct symbol *sym, const char *def)
}
switch (input_mode) {
case ask_new:
case ask_silent:
case oldconfig:
case silentoldconfig:
if (sym_has_value(sym)) {
printf("%s\n", def);
return 0;
}
check_stdin();
case ask_all:
/* fall through */
case oldaskconfig:
fflush(stdout);
fgets(line, 128, stdin);
xfgets(line, 128, stdin);
if (!tty_stdio)
printf("\n");
return 1;
default:
break;
@ -121,7 +129,7 @@ static int conf_askvalue(struct symbol *sym, const char *def)
return 1;
}
int conf_string(struct menu *menu)
static int conf_string(struct menu *menu)
{
struct symbol *sym = menu->sym;
const char *def;
@ -140,10 +148,11 @@ int conf_string(struct menu *menu)
case '?':
/* print help */
if (line[1] == '\n') {
printf("\n%s\n", get_help(menu));
print_help(menu);
def = NULL;
break;
}
/* fall through */
default:
line[strlen(line)-1] = 0;
def = line;
@ -156,14 +165,12 @@ int conf_string(struct menu *menu)
static int conf_sym(struct menu *menu)
{
struct symbol *sym = menu->sym;
int type;
tristate oldval, newval;
while (1) {
printf("%*s%s ", indent - 1, "", _(menu->prompt->text));
if (sym->name)
printf("(%s) ", sym->name);
type = sym_get_type(sym);
putchar('[');
oldval = sym_get_tristate_value(sym);
switch (oldval) {
@ -220,7 +227,7 @@ static int conf_sym(struct menu *menu)
if (sym_set_tristate_value(sym, newval))
return 0;
help:
printf("\n%s\n", get_help(menu));
print_help(menu);
}
}
@ -228,11 +235,9 @@ static int conf_choice(struct menu *menu)
{
struct symbol *sym, *def_sym;
struct menu *child;
int type;
bool is_new;
sym = menu->sym;
type = sym_get_type(sym);
is_new = !sym_has_value(sym);
if (sym_is_changable(sym)) {
conf_sym(menu);
@ -294,20 +299,21 @@ static int conf_choice(struct menu *menu)
printf("?");
printf("]: ");
switch (input_mode) {
case ask_new:
case ask_silent:
case oldconfig:
case silentoldconfig:
if (!is_new) {
cnt = def;
printf("%d\n", cnt);
break;
}
check_stdin();
case ask_all:
/* fall through */
case oldaskconfig:
fflush(stdout);
fgets(line, 128, stdin);
xfgets(line, 128, stdin);
strip(line);
if (line[0] == '?') {
printf("\n%s\n", get_help(menu));
print_help(menu);
continue;
}
if (!line[0])
@ -330,8 +336,8 @@ static int conf_choice(struct menu *menu)
}
if (!child)
continue;
if (line[strlen(line) - 1] == '?') {
printf("\n%s\n", get_help(child));
if (line[0] && line[strlen(line) - 1] == '?') {
print_help(child);
continue;
}
sym_set_choice_value(sym, child->sym);
@ -360,10 +366,14 @@ static void conf(struct menu *menu)
switch (prop->type) {
case P_MENU:
if (input_mode == ask_silent && rootEntry != menu) {
if ((input_mode == silentoldconfig ||
input_mode == listnewconfig ||
input_mode == olddefconfig) &&
rootEntry != menu) {
check_conf(menu);
return;
}
/* fall through */
case P_COMMENT:
prompt = menu_get_prompt(menu);
if (prompt)
@ -418,10 +428,16 @@ static void check_conf(struct menu *menu)
if (sym && !sym_has_value(sym)) {
if (sym_is_changable(sym) ||
(sym_is_choice(sym) && sym_get_tristate_value(sym) == yes)) {
if (!conf_cnt++)
printf(_("*\n* Restart config...\n*\n"));
rootEntry = menu_get_parent_menu(menu);
conf(rootEntry);
if (input_mode == listnewconfig) {
if (sym->name && !sym_is_choice_value(sym)) {
printf("%s%s\n", CONFIG_, sym->name);
}
} else if (input_mode != olddefconfig) {
if (!conf_cnt++)
printf(_("*\n* Restart config...\n*\n"));
rootEntry = menu_get_parent_menu(menu);
conf(rootEntry);
}
}
}
@ -429,90 +445,170 @@ static void check_conf(struct menu *menu)
check_conf(child);
}
#if 00 // || !defined __UCLIBC__ || \
defined __UCLIBC_HAS_GETOPT_LONG__
static struct option long_opts[] = {
{"oldaskconfig", no_argument, NULL, oldaskconfig},
{"oldconfig", no_argument, NULL, oldconfig},
{"silentoldconfig", no_argument, NULL, silentoldconfig},
{"defconfig", optional_argument, NULL, defconfig},
{"savedefconfig", required_argument, NULL, savedefconfig},
{"allnoconfig", no_argument, NULL, allnoconfig},
{"allyesconfig", no_argument, NULL, allyesconfig},
{"allmodconfig", no_argument, NULL, allmodconfig},
{"alldefconfig", no_argument, NULL, alldefconfig},
{"randconfig", no_argument, NULL, randconfig},
{"listnewconfig", no_argument, NULL, listnewconfig},
{"olddefconfig", no_argument, NULL, olddefconfig},
/*
* oldnoconfig is an alias of olddefconfig, because people already
* are dependent on its behavior(sets new symbols to their default
* value but not 'n') with the counter-intuitive name.
*/
{"oldnoconfig", no_argument, NULL, olddefconfig},
{NULL, 0, NULL, 0}
};
static void conf_usage(const char *progname)
{
printf("Usage: %s [option] <kconfig-file>\n", progname);
printf("[option] is _one_ of the following:\n");
printf(" --listnewconfig List new options\n");
printf(" --oldaskconfig Start a new configuration using a line-oriented program\n");
printf(" --oldconfig Update a configuration using a provided .config as base\n");
printf(" --silentoldconfig Same as oldconfig, but quietly, additionally update deps\n");
printf(" --olddefconfig Same as silentoldconfig but sets new symbols to their default value\n");
printf(" --oldnoconfig An alias of olddefconfig\n");
printf(" --defconfig <file> New config with default defined in <file>\n");
printf(" --savedefconfig <file> Save the minimal current configuration to <file>\n");
printf(" --allnoconfig New config where all options are answered with no\n");
printf(" --allyesconfig New config where all options are answered with yes\n");
printf(" --allmodconfig New config where all options are answered with mod\n");
printf(" --alldefconfig New config with all symbols set to default\n");
printf(" --randconfig New config with random answer to all options\n");
}
#else
static void conf_usage(const char *progname)
{
printf("Usage: %s [option] <kconfig-file>\n", progname);
printf("[option] is _one_ of the following:\n");
printf(" -a, --oldaskconfig Start a new configuration using a line-oriented program\n");
printf(" -s, --silentoldconfig Same as oldconfig, but quietly, additionally update deps\n");
printf(" -o, --oldconfig Update a configuration using a provided .config as base\n");
printf(" -n, --allnoconfig New config where all options are answered with no\n");
printf(" -y, --allyesconfig New config where all options are answered with yes\n");
printf(" -m, --allmodconfig New config where all options are answered with mod\n");
printf(" -A, --alldefconfig New config with all symbols set to default\n");
printf(" -r, --randconfig New config with random answer to all options\n");
printf(" -D, --defconfig <file> New config with default defined in <file>\n");
printf(" -S, --savedefconfig <file> Save the minimal current configuration to <file>\n");
printf(" -l, --listnewconfig List new options\n");
printf(" -d, --olddefconfig Same as silentoldconfig but sets new symbols to their default value\n");
printf(" --oldnoconfig An alias of olddefconfig\n");
}
#endif
int main(int ac, char **av)
{
const char *progname = av[0];
int opt;
const char *name;
const char *configname = conf_get_configname();
const char *name, *defconfig_file = NULL /* gcc uninit */;
struct stat tmpstat;
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
while ((opt = getopt(ac, av, "osdD:nmyrh")) != -1) {
tty_stdio = isatty(0) && isatty(1) && isatty(2);
#if 00// !defined __UCLIBC__ || \
defined __UCLIBC_HAS_GETOPT_LONG__
while ((opt = getopt_long(ac, av, "", long_opts, NULL)) != -1)
#else
char *gch = "asonymArDSld";
while ((opt = getopt(ac, av, "asonymArD:S:ldh")) != -1)
#endif
{
char *x = memchr(gch, opt, strlen(gch));
if (x == NULL)
opt = '?';
else
opt = x - gch;
input_mode = (enum input_mode)opt;
switch (opt) {
case 'o':
input_mode = ask_silent;
break;
case 's':
input_mode = ask_silent;
case silentoldconfig:
sync_kconfig = 1;
break;
case 'd':
input_mode = set_default;
break;
case 'D':
input_mode = set_default;
case defconfig:
case savedefconfig:
defconfig_file = optarg;
break;
case 'n':
input_mode = set_no;
break;
case 'm':
input_mode = set_mod;
break;
case 'y':
input_mode = set_yes;
break;
case 'r':
case randconfig:
{
struct timeval now;
unsigned int seed;
char *seed_env;
/*
* Use microseconds derived seed,
* compensate for systems where it may be zero
*/
gettimeofday(&now, NULL);
seed = (unsigned int)((now.tv_sec + 1) * (now.tv_usec + 1));
srand(seed);
input_mode = set_random;
seed_env = getenv("KCONFIG_SEED");
if( seed_env && *seed_env ) {
char *endp;
int tmp = (int)strtol(seed_env, &endp, 0);
if (*endp == '\0') {
seed = tmp;
}
}
fprintf( stderr, "KCONFIG_SEED=0x%X\n", seed );
srand(seed);
break;
}
case 'h':
printf(_("See README for usage info\n"));
exit(0);
case oldaskconfig:
case oldconfig:
case allnoconfig:
case allyesconfig:
case allmodconfig:
case alldefconfig:
case listnewconfig:
case olddefconfig:
break;
default:
fprintf(stderr, _("See README for usage info\n"));
case '?':
conf_usage(progname);
exit(1);
break;
}
}
if (ac == optind) {
printf(_("%s: Kconfig file missing\n"), av[0]);
conf_usage(progname);
exit(1);
}
name = av[optind];
conf_parse(name);
//zconfdump(stdout);
if (sync_kconfig) {
if (stat(configname, &tmpstat)) {
name = conf_get_configname();
if (stat(name, &tmpstat)) {
fprintf(stderr, _("***\n"
"*** You have not yet configured!\n"
"*** (missing .config file)\n"
"*** Configuration file \"%s\" not found!\n"
"***\n"
"*** Please run some configurator (e.g. \"make oldconfig\" or\n"
"*** \"make menuconfig\" or \"make xconfig\").\n"
"***\n"));
"***\n"), name);
exit(1);
}
}
switch (input_mode) {
case set_default:
case defconfig:
if (!defconfig_file)
defconfig_file = conf_get_default_confname();
if (conf_read(defconfig_file)) {
@ -522,31 +618,46 @@ int main(int ac, char **av)
exit(1);
}
break;
case ask_silent:
case ask_all:
case ask_new:
case savedefconfig:
case silentoldconfig:
case oldaskconfig:
case oldconfig:
case listnewconfig:
case olddefconfig:
conf_read(NULL);
break;
case set_no:
case set_mod:
case set_yes:
case set_random:
case allnoconfig:
case allyesconfig:
case allmodconfig:
case alldefconfig:
case randconfig:
name = getenv("KCONFIG_ALLCONFIG");
if (name && !stat(name, &tmpstat)) {
conf_read_simple(name, S_DEF_USER);
if (!name)
break;
if ((strcmp(name, "") != 0) && (strcmp(name, "1") != 0)) {
if (conf_read_simple(name, S_DEF_USER)) {
fprintf(stderr,
_("*** Can't read seed configuration \"%s\"!\n"),
name);
exit(1);
}
break;
}
switch (input_mode) {
case set_no: name = "allno.config"; break;
case set_mod: name = "allmod.config"; break;
case set_yes: name = "allyes.config"; break;
case set_random: name = "allrandom.config"; break;
case allnoconfig: name = "allno.config"; break;
case allyesconfig: name = "allyes.config"; break;
case allmodconfig: name = "allmod.config"; break;
case alldefconfig: name = "alldef.config"; break;
case randconfig: name = "allrandom.config"; break;
default: break;
}
if (!stat(name, &tmpstat))
conf_read_simple(name, S_DEF_USER);
else if (!stat("all.config", &tmpstat))
conf_read_simple("all.config", S_DEF_USER);
if (conf_read_simple(name, S_DEF_USER) &&
conf_read_simple("all.config", S_DEF_USER)) {
fprintf(stderr,
_("*** KCONFIG_ALLCONFIG set, but no \"%s\" or \"all.config\" file found\n"),
name);
exit(1);
}
break;
default:
break;
@ -557,41 +668,51 @@ int main(int ac, char **av)
name = getenv("KCONFIG_NOSILENTUPDATE");
if (name && *name) {
fprintf(stderr,
_("\n*** configuration requires explicit update.\n\n"));
_("\n*** The configuration requires explicit update.\n\n"));
return 1;
}
}
valid_stdin = isatty(0) && isatty(1) && isatty(2);
valid_stdin = tty_stdio;
}
switch (input_mode) {
case set_no:
case allnoconfig:
conf_set_all_new_symbols(def_no);
break;
case set_yes:
case allyesconfig:
conf_set_all_new_symbols(def_yes);
break;
case set_mod:
case allmodconfig:
conf_set_all_new_symbols(def_mod);
break;
case set_random:
conf_set_all_new_symbols(def_random);
break;
case set_default:
case alldefconfig:
conf_set_all_new_symbols(def_default);
break;
case ask_new:
case ask_all:
case randconfig:
/* Really nothing to do in this loop */
while (conf_set_all_new_symbols(def_random)) ;
break;
case defconfig:
conf_set_all_new_symbols(def_default);
break;
case savedefconfig:
break;
case oldaskconfig:
rootEntry = &rootmenu;
conf(&rootmenu);
input_mode = ask_silent;
input_mode = silentoldconfig;
/* fall through */
case ask_silent:
case oldconfig:
case listnewconfig:
case olddefconfig:
case silentoldconfig:
/* Update until a loop caused no more changes */
do {
conf_cnt = 0;
check_conf(&rootmenu);
} while (conf_cnt);
} while (conf_cnt &&
(input_mode != listnewconfig &&
input_mode != olddefconfig));
break;
}
@ -607,7 +728,13 @@ int main(int ac, char **av)
fprintf(stderr, _("\n*** Error during update of the configuration.\n\n"));
return 1;
}
} else {
} else if (input_mode == savedefconfig) {
if (conf_write_defconfig(defconfig_file)) {
fprintf(stderr, _("n*** Error while saving defconfig to: %s\n\n"),
defconfig_file);
return 1;
}
} else if (input_mode != listnewconfig) {
if (conf_write(NULL)) {
fprintf(stderr, _("\n*** Error during writing of the configuration.\n\n"));
exit(1);
@ -615,3 +742,12 @@ int main(int ac, char **av)
}
return 0;
}
/*
* Helper function to facilitate fgets() by Jean Sacren.
*/
void xfgets(char *str, int size, FILE *in)
{
if (fgets(str, size, in) == NULL)
fprintf(stderr, "\nError in reading or end of file.\n");
}

File diff suppressed because it is too large Load Diff

View File

@ -7,15 +7,13 @@
#include <stdlib.h>
#include <string.h>
#define LKC_DIRECT_LINK
#include "lkc.h"
#define DEBUG_EXPR 0
struct expr *expr_alloc_symbol(struct symbol *sym)
{
struct expr *e = malloc(sizeof(*e));
memset(e, 0, sizeof(*e));
struct expr *e = xcalloc(1, sizeof(*e));
e->type = E_SYMBOL;
e->left.sym = sym;
return e;
@ -23,8 +21,7 @@ struct expr *expr_alloc_symbol(struct symbol *sym)
struct expr *expr_alloc_one(enum expr_type type, struct expr *ce)
{
struct expr *e = malloc(sizeof(*e));
memset(e, 0, sizeof(*e));
struct expr *e = xcalloc(1, sizeof(*e));
e->type = type;
e->left.expr = ce;
return e;
@ -32,8 +29,7 @@ struct expr *expr_alloc_one(enum expr_type type, struct expr *ce)
struct expr *expr_alloc_two(enum expr_type type, struct expr *e1, struct expr *e2)
{
struct expr *e = malloc(sizeof(*e));
memset(e, 0, sizeof(*e));
struct expr *e = xcalloc(1, sizeof(*e));
e->type = type;
e->left.expr = e1;
e->right.expr = e2;
@ -42,8 +38,7 @@ struct expr *expr_alloc_two(enum expr_type type, struct expr *e1, struct expr *e
struct expr *expr_alloc_comp(enum expr_type type, struct symbol *s1, struct symbol *s2)
{
struct expr *e = malloc(sizeof(*e));
memset(e, 0, sizeof(*e));
struct expr *e = xcalloc(1, sizeof(*e));
e->type = type;
e->left.sym = s1;
e->right.sym = s2;
@ -64,14 +59,14 @@ struct expr *expr_alloc_or(struct expr *e1, struct expr *e2)
return e2 ? expr_alloc_two(E_OR, e1, e2) : e1;
}
struct expr *expr_copy(struct expr *org)
struct expr *expr_copy(const struct expr *org)
{
struct expr *e;
if (!org)
return NULL;
e = malloc(sizeof(*org));
e = xmalloc(sizeof(*org));
memcpy(e, org, sizeof(*org));
switch (org->type) {
case E_SYMBOL:
@ -348,7 +343,7 @@ struct expr *expr_trans_bool(struct expr *e)
/*
* e1 || e2 -> ?
*/
struct expr *expr_join_or(struct expr *e1, struct expr *e2)
static struct expr *expr_join_or(struct expr *e1, struct expr *e2)
{
struct expr *tmp;
struct symbol *sym1, *sym2;
@ -412,7 +407,7 @@ struct expr *expr_join_or(struct expr *e1, struct expr *e2)
return NULL;
}
struct expr *expr_join_and(struct expr *e1, struct expr *e2)
static struct expr *expr_join_and(struct expr *e1, struct expr *e2)
{
struct expr *tmp;
struct symbol *sym1, *sym2;
@ -1013,6 +1008,48 @@ int expr_compare_type(enum expr_type t1, enum expr_type t2)
#endif
}
static inline struct expr *
expr_get_leftmost_symbol(const struct expr *e)
{
if (e == NULL)
return NULL;
while (e->type != E_SYMBOL)
e = e->left.expr;
return expr_copy(e);
}
/*
* Given expression `e1' and `e2', returns the leaf of the longest
* sub-expression of `e1' not containing 'e2.
*/
struct expr *expr_simplify_unmet_dep(struct expr *e1, struct expr *e2)
{
struct expr *ret;
switch (e1->type) {
case E_OR:
return expr_alloc_and(
expr_simplify_unmet_dep(e1->left.expr, e2),
expr_simplify_unmet_dep(e1->right.expr, e2));
case E_AND: {
struct expr *e;
e = expr_alloc_and(expr_copy(e1), expr_copy(e2));
e = expr_eliminate_dups(e);
ret = (!expr_eq(e, e1)) ? e1 : NULL;
expr_free(e);
break;
}
default:
ret = e1;
break;
}
return expr_get_leftmost_symbol(ret);
}
void expr_print(struct expr *e, void (*fn)(void *, struct symbol *, const char *), void *data, int prevtoken)
{
if (!e) {
@ -1087,7 +1124,7 @@ void expr_print(struct expr *e, void (*fn)(void *, struct symbol *, const char *
static void expr_print_file_helper(void *data, struct symbol *sym, const char *str)
{
fwrite(str, strlen(str), 1, data);
xfwrite(str, strlen(str), 1, data);
}
void expr_fprint(struct expr *e, FILE *out)
@ -1097,7 +1134,32 @@ void expr_fprint(struct expr *e, FILE *out)
static void expr_print_gstr_helper(void *data, struct symbol *sym, const char *str)
{
str_append((struct gstr*)data, str);
struct gstr *gs = (struct gstr*)data;
const char *sym_str = NULL;
if (sym)
sym_str = sym_get_string_value(sym);
if (gs->max_width) {
unsigned extra_length = strlen(str);
const char *last_cr = strrchr(gs->s, '\n');
unsigned last_line_length;
if (sym_str)
extra_length += 4 + strlen(sym_str);
if (!last_cr)
last_cr = gs->s;
last_line_length = strlen(gs->s) - (last_cr - gs->s);
if ((last_line_length + extra_length) > gs->max_width)
str_append(gs, "\\\n");
}
str_append(gs, str);
if (sym && sym->type != S_UNKNOWN)
str_printf(gs, " [=%s]", sym_str);
}
void expr_gstr_print(struct expr *e, struct gstr *gs)

View File

@ -10,7 +10,9 @@
extern "C" {
#endif
#include <assert.h>
#include <stdio.h>
#include "list.h"
#ifndef __cplusplus
#include <stdbool.h>
#endif
@ -18,14 +20,10 @@ extern "C" {
struct file {
struct file *next;
struct file *parent;
char *name;
const char *name;
int lineno;
int flags;
};
#define FILE_BUSY 0x0001
#define FILE_SCANNED 0x0002
typedef enum tristate {
no, mod, yes
} tristate;
@ -83,10 +81,11 @@ struct symbol {
tristate visible;
int flags;
struct property *prop;
struct expr_value dir_dep;
struct expr_value rev_dep;
};
#define for_all_symbols(i, sym) for (i = 0; i < 257; i++) for (sym = symbol_hash[i]; sym; sym = sym->next) if (sym->type != S_OTHER)
#define for_all_symbols(i, sym) for (i = 0; i < SYMBOL_HASHSIZE; i++) for (sym = symbol_hash[i]; sym; sym = sym->next) if (sym->type != S_OTHER)
#define SYMBOL_CONST 0x0001 /* symbol is const */
#define SYMBOL_CHECK 0x0008 /* used during dependency checking */
@ -107,9 +106,11 @@ struct symbol {
#define SYMBOL_DEF3 0x40000 /* symbol.def[S_DEF_3] is valid */
#define SYMBOL_DEF4 0x80000 /* symbol.def[S_DEF_4] is valid */
/* choice values need to be set before calculating this symbol value */
#define SYMBOL_NEED_SET_CHOICE_VALUES 0x100000
#define SYMBOL_MAXLENGTH 256
#define SYMBOL_HASHSIZE 257
#define SYMBOL_HASHMASK 0xff
#define SYMBOL_HASHSIZE 9973
/* A property represent the config options that can be associated
* with a config "symbol".
@ -132,6 +133,7 @@ enum prop_type {
P_SELECT, /* select BAR */
P_RANGE, /* range 7..100 (for a symbol) */
P_ENV, /* value from environment variable */
P_SYMBOL, /* where a symbol is defined */
};
struct property {
@ -163,6 +165,7 @@ struct menu {
struct menu *list;
struct symbol *sym;
struct property *prompt;
struct expr *visibility;
struct expr *dep;
unsigned int flags;
char *help;
@ -174,7 +177,14 @@ struct menu {
#define MENU_CHANGED 0x0001
#define MENU_ROOT 0x0002
#ifndef SWIG
struct jump_key {
struct list_head entries;
size_t offset;
struct menu *target;
int index;
};
#define JUMP_NB 9
extern struct file *file_list;
extern struct file *current_file;
@ -190,7 +200,7 @@ struct expr *expr_alloc_two(enum expr_type type, struct expr *e1, struct expr *e
struct expr *expr_alloc_comp(enum expr_type type, struct symbol *s1, struct symbol *s2);
struct expr *expr_alloc_and(struct expr *e1, struct expr *e2);
struct expr *expr_alloc_or(struct expr *e1, struct expr *e2);
struct expr *expr_copy(struct expr *org);
struct expr *expr_copy(const struct expr *org);
void expr_free(struct expr *e);
int expr_eq(struct expr *e1, struct expr *e2);
void expr_eliminate_eq(struct expr **ep1, struct expr **ep2);
@ -205,6 +215,7 @@ struct expr *expr_extract_eq_and(struct expr **ep1, struct expr **ep2);
struct expr *expr_extract_eq_or(struct expr **ep1, struct expr **ep2);
void expr_extract_eq(enum expr_type type, struct expr **ep, struct expr **ep1, struct expr **ep2);
struct expr *expr_trans_compare(struct expr *e, enum expr_type type, struct symbol *sym);
struct expr *expr_simplify_unmet_dep(struct expr *e1, struct expr *e2);
void expr_fprint(struct expr *e, FILE *out);
struct gstr; /* forward */
@ -219,7 +230,6 @@ static inline int expr_is_no(struct expr *e)
{
return e && (e->type == E_SYMBOL && e->left.sym == &symbol_no);
}
#endif
#ifdef __cplusplus
}

View File

@ -10,6 +10,7 @@
# include <config.h>
#endif
#include <stdlib.h>
#include "lkc.h"
#include "images.c"
@ -22,7 +23,6 @@
#include <string.h>
#include <unistd.h>
#include <time.h>
#include <stdlib.h>
//#define DEBUG
@ -30,13 +30,16 @@ enum {
SINGLE_VIEW, SPLIT_VIEW, FULL_VIEW
};
enum {
OPT_NORMAL, OPT_ALL, OPT_PROMPT
};
static gint view_mode = FULL_VIEW;
static gboolean show_name = TRUE;
static gboolean show_range = TRUE;
static gboolean show_value = TRUE;
static gboolean show_all = FALSE;
static gboolean show_debug = FALSE;
static gboolean resizeable = FALSE;
static int opt_mode = OPT_NORMAL;
GtkWidget *main_wnd = NULL;
GtkWidget *tree1_w = NULL; // left frame
@ -76,36 +79,7 @@ static void conf_changed(void);
/* Helping/Debugging Functions */
const char *dbg_print_stype(int val)
{
static char buf[256];
bzero(buf, 256);
if (val == S_UNKNOWN)
strcpy(buf, "unknown");
if (val == S_BOOLEAN)
strcpy(buf, "boolean");
if (val == S_TRISTATE)
strcpy(buf, "tristate");
if (val == S_INT)
strcpy(buf, "int");
if (val == S_HEX)
strcpy(buf, "hex");
if (val == S_STRING)
strcpy(buf, "string");
if (val == S_OTHER)
strcpy(buf, "other");
#ifdef DEBUG
printf("%s", buf);
#endif
return buf;
}
const char *dbg_print_flags(int val)
const char *dbg_sym_flags(int val)
{
static char buf[256];
@ -131,40 +105,10 @@ const char *dbg_print_flags(int val)
strcat(buf, "auto/");
buf[strlen(buf) - 1] = '\0';
#ifdef DEBUG
printf("%s", buf);
#endif
return buf;
}
const char *dbg_print_ptype(int val)
{
static char buf[256];
bzero(buf, 256);
if (val == P_UNKNOWN)
strcpy(buf, "unknown");
if (val == P_PROMPT)
strcpy(buf, "prompt");
if (val == P_COMMENT)
strcpy(buf, "comment");
if (val == P_MENU)
strcpy(buf, "menu");
if (val == P_DEFAULT)
strcpy(buf, "default");
if (val == P_CHOICE)
strcpy(buf, "choice");
#ifdef DEBUG
printf("%s", buf);
#endif
return buf;
}
void replace_button_icon(GladeXML * xml, GdkDrawable * window,
GtkStyle * style, gchar * btn_name, gchar ** xpm)
{
@ -189,7 +133,6 @@ void init_main_window(const gchar * glade_file)
GladeXML *xml;
GtkWidget *widget;
GtkTextBuffer *txtbuf;
char title[256];
GtkStyle *style;
xml = glade_xml_new(glade_file, "window1", NULL);
@ -266,9 +209,7 @@ void init_main_window(const gchar * glade_file)
/*"style", PANGO_STYLE_OBLIQUE, */
NULL);
sprintf(title, _("uClibc v%s Configuration"),
getenv("VERSION"));
gtk_window_set_title(GTK_WINDOW(main_wnd), title);
gtk_window_set_title(GTK_WINDOW(main_wnd), rootmenu.prompt->text);
gtk_widget_show(main_wnd);
}
@ -312,7 +253,7 @@ void init_left_tree(void)
gtk_tree_view_set_model(view, model1);
gtk_tree_view_set_headers_visible(view, TRUE);
gtk_tree_view_set_rules_hint(view, FALSE);
gtk_tree_view_set_rules_hint(view, TRUE);
column = gtk_tree_view_column_new();
gtk_tree_view_append_column(view, column);
@ -344,8 +285,6 @@ void init_left_tree(void)
static void renderer_edited(GtkCellRendererText * cell,
const gchar * path_string,
const gchar * new_text, gpointer user_data);
static void renderer_toggled(GtkCellRendererToggle * cellrenderertoggle,
gchar * arg1, gpointer user_data);
void init_right_tree(void)
{
@ -357,7 +296,7 @@ void init_right_tree(void)
gtk_tree_view_set_model(view, model2);
gtk_tree_view_set_headers_visible(view, TRUE);
gtk_tree_view_set_rules_hint(view, FALSE);
gtk_tree_view_set_rules_hint(view, TRUE);
column = gtk_tree_view_column_new();
gtk_tree_view_append_column(view, column);
@ -379,8 +318,6 @@ void init_right_tree(void)
"inconsistent", COL_BTNINC,
"visible", COL_BTNVIS,
"radio", COL_BTNRAD, NULL);
/*g_signal_connect(G_OBJECT(renderer), "toggled",
G_CALLBACK(renderer_toggled), NULL); */
renderer = gtk_cell_renderer_text_new();
gtk_tree_view_column_pack_start(GTK_TREE_VIEW_COLUMN(column),
renderer, FALSE);
@ -456,19 +393,9 @@ static void text_insert_help(struct menu *menu)
GtkTextBuffer *buffer;
GtkTextIter start, end;
const char *prompt = _(menu_get_prompt(menu));
gchar *name;
const char *help;
struct gstr help = str_new();
help = menu_get_help(menu);
/* Gettextize if the help text not empty */
if ((help != 0) && (help[0] != 0))
help = _(help);
if (menu->sym && menu->sym->name)
name = g_strdup_printf(menu->sym->name);
else
name = g_strdup("");
menu_get_ext_help(menu, &help);
buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text_w));
gtk_text_buffer_get_bounds(buffer, &start, &end);
@ -478,14 +405,11 @@ static void text_insert_help(struct menu *menu)
gtk_text_buffer_get_end_iter(buffer, &end);
gtk_text_buffer_insert_with_tags(buffer, &end, prompt, -1, tag1,
NULL);
gtk_text_buffer_insert_at_cursor(buffer, " ", 1);
gtk_text_buffer_get_end_iter(buffer, &end);
gtk_text_buffer_insert_with_tags(buffer, &end, name, -1, tag1,
NULL);
gtk_text_buffer_insert_at_cursor(buffer, "\n\n", 2);
gtk_text_buffer_get_end_iter(buffer, &end);
gtk_text_buffer_insert_with_tags(buffer, &end, help, -1, tag2,
gtk_text_buffer_insert_with_tags(buffer, &end, str_get(&help), -1, tag2,
NULL);
str_free(&help);
}
@ -710,20 +634,29 @@ void on_show_data1_activate(GtkMenuItem * menuitem, gpointer user_data)
void
on_show_all_options1_activate(GtkMenuItem * menuitem, gpointer user_data)
on_set_option_mode1_activate(GtkMenuItem *menuitem, gpointer user_data)
{
show_all = GTK_CHECK_MENU_ITEM(menuitem)->active;
opt_mode = OPT_NORMAL;
gtk_tree_store_clear(tree2);
display_tree(&rootmenu); // instead of update_tree to speed-up
display_tree(&rootmenu); /* instead of update_tree to speed-up */
}
void
on_show_debug_info1_activate(GtkMenuItem * menuitem, gpointer user_data)
on_set_option_mode2_activate(GtkMenuItem *menuitem, gpointer user_data)
{
show_debug = GTK_CHECK_MENU_ITEM(menuitem)->active;
update_tree(&rootmenu, NULL);
opt_mode = OPT_ALL;
gtk_tree_store_clear(tree2);
display_tree(&rootmenu); /* instead of update_tree to speed-up */
}
void
on_set_option_mode3_activate(GtkMenuItem *menuitem, gpointer user_data)
{
opt_mode = OPT_PROMPT;
gtk_tree_store_clear(tree2);
display_tree(&rootmenu); /* instead of update_tree to speed-up */
}
@ -732,7 +665,6 @@ void on_introduction1_activate(GtkMenuItem * menuitem, gpointer user_data)
GtkWidget *dialog;
const gchar *intro_text = _(
"Welcome to gkc, the GTK+ graphical configuration tool\n"
"for uClibc.\n"
"For each option, a blank box indicates the feature is disabled, a\n"
"check indicates it is enabled, and a dot indicates that it is to\n"
"be compiled as a module. Clicking on the box will cycle through the three states.\n"
@ -751,7 +683,7 @@ void on_introduction1_activate(GtkMenuItem * menuitem, gpointer user_data)
dialog = gtk_message_dialog_new(GTK_WINDOW(main_wnd),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_INFO,
GTK_BUTTONS_CLOSE, intro_text);
GTK_BUTTONS_CLOSE, "%s", intro_text);
g_signal_connect_swapped(GTK_OBJECT(dialog), "response",
G_CALLBACK(gtk_widget_destroy),
GTK_OBJECT(dialog));
@ -769,7 +701,7 @@ void on_about1_activate(GtkMenuItem * menuitem, gpointer user_data)
dialog = gtk_message_dialog_new(GTK_WINDOW(main_wnd),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_INFO,
GTK_BUTTONS_CLOSE, about_text);
GTK_BUTTONS_CLOSE, "%s", about_text);
g_signal_connect_swapped(GTK_OBJECT(dialog), "response",
G_CALLBACK(gtk_widget_destroy),
GTK_OBJECT(dialog));
@ -788,7 +720,7 @@ void on_license1_activate(GtkMenuItem * menuitem, gpointer user_data)
dialog = gtk_message_dialog_new(GTK_WINDOW(main_wnd),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_INFO,
GTK_BUTTONS_CLOSE, license_text);
GTK_BUTTONS_CLOSE, "%s", license_text);
g_signal_connect_swapped(GTK_OBJECT(dialog), "response",
G_CALLBACK(gtk_widget_destroy),
GTK_OBJECT(dialog));
@ -820,7 +752,6 @@ void on_load_clicked(GtkButton * button, gpointer user_data)
void on_single_clicked(GtkButton * button, gpointer user_data)
{
view_mode = SINGLE_VIEW;
gtk_paned_set_position(GTK_PANED(hpaned), 0);
gtk_widget_hide(tree1_w);
current = &rootmenu;
display_tree_part();
@ -846,7 +777,6 @@ void on_split_clicked(GtkButton * button, gpointer user_data)
void on_full_clicked(GtkButton * button, gpointer user_data)
{
view_mode = FULL_VIEW;
gtk_paned_set_position(GTK_PANED(hpaned), 0);
gtk_widget_hide(tree1_w);
if (tree2)
gtk_tree_store_clear(tree2);
@ -900,7 +830,7 @@ static void renderer_edited(GtkCellRendererText * cell,
static void change_sym_value(struct menu *menu, gint col)
{
struct symbol *sym = menu->sym;
tristate oldval, newval;
tristate newval;
if (!sym)
return;
@ -917,7 +847,6 @@ static void change_sym_value(struct menu *menu, gint col)
switch (sym_get_type(sym)) {
case S_BOOLEAN:
case S_TRISTATE:
oldval = sym_get_tristate_value(sym);
if (!sym_tristate_within_range(sym, newval))
newval = yes;
sym_set_tristate_value(sym, newval);
@ -954,35 +883,6 @@ static void toggle_sym_value(struct menu *menu)
display_tree_part(); //fixme: keep exp/coll
}
static void renderer_toggled(GtkCellRendererToggle * cell,
gchar * path_string, gpointer user_data)
{
GtkTreePath *path, *sel_path = NULL;
GtkTreeIter iter, sel_iter;
GtkTreeSelection *sel;
struct menu *menu;
path = gtk_tree_path_new_from_string(path_string);
if (!gtk_tree_model_get_iter(model2, &iter, path))
return;
sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree2_w));
if (gtk_tree_selection_get_selected(sel, NULL, &sel_iter))
sel_path = gtk_tree_model_get_path(model2, &sel_iter);
if (!sel_path)
goto out1;
if (gtk_tree_path_compare(path, sel_path))
goto out2;
gtk_tree_model_get(model2, &iter, COL_MENU, &menu, -1);
toggle_sym_value(menu);
out2:
gtk_tree_path_free(sel_path);
out1:
gtk_tree_path_free(path);
}
static gint column2index(GtkTreeViewColumn * column)
{
gint i;
@ -1174,9 +1074,12 @@ static gchar **fill_row(struct menu *menu)
row[COL_OPTION] =
g_strdup_printf("%s %s", _(menu_get_prompt(menu)),
sym && sym_has_value(sym) ? "(NEW)" : "");
sym && !sym_has_value(sym) ? "(NEW)" : "");
if (show_all && !menu_is_visible(menu))
if (opt_mode == OPT_ALL && !menu_is_visible(menu))
row[COL_COLOR] = g_strdup("DarkGray");
else if (opt_mode == OPT_PROMPT &&
menu_has_prompt(menu) && !menu_is_visible(menu))
row[COL_COLOR] = g_strdup("DarkGray");
else
row[COL_COLOR] = g_strdup("Black");
@ -1235,6 +1138,7 @@ static gchar **fill_row(struct menu *menu)
row[COL_BTNVIS] = GINT_TO_POINTER(TRUE);
if (sym_is_choice(sym))
break;
/* fall through */
case S_TRISTATE:
val = sym_get_tristate_value(sym);
switch (val) {
@ -1373,7 +1277,6 @@ static void update_tree(struct menu *src, GtkTreeIter * dst)
gboolean valid;
GtkTreeIter *sibling;
struct symbol *sym;
struct property *prop;
struct menu *menu1, *menu2;
if (src == &rootmenu)
@ -1382,7 +1285,6 @@ static void update_tree(struct menu *src, GtkTreeIter * dst)
valid = gtk_tree_model_iter_children(model2, child2, dst);
for (child1 = src->list; child1; child1 = child1->next) {
prop = child1->prompt;
sym = child1->sym;
reparse:
@ -1399,16 +1301,20 @@ static void update_tree(struct menu *src, GtkTreeIter * dst)
menu2 ? menu_get_prompt(menu2) : "nil");
#endif
if (!menu_is_visible(child1) && !show_all) { // remove node
if ((opt_mode == OPT_NORMAL && !menu_is_visible(child1)) ||
(opt_mode == OPT_PROMPT && !menu_has_prompt(child1)) ||
(opt_mode == OPT_ALL && !menu_get_prompt(child1))) {
/* remove node */
if (gtktree_iter_find_node(dst, menu1) != NULL) {
memcpy(&tmp, child2, sizeof(GtkTreeIter));
valid = gtk_tree_model_iter_next(model2,
child2);
gtk_tree_store_remove(tree2, &tmp);
if (!valid)
return; // next parent
return; /* next parent */
else
goto reparse; // next child
goto reparse; /* next child */
} else
continue;
}
@ -1477,17 +1383,19 @@ static void display_tree(struct menu *menu)
&& (tree == tree2))
continue;
if (menu_is_visible(child) || show_all)
if ((opt_mode == OPT_NORMAL && menu_is_visible(child)) ||
(opt_mode == OPT_PROMPT && menu_has_prompt(child)) ||
(opt_mode == OPT_ALL && menu_get_prompt(child)))
place_node(child, fill_row(child));
#ifdef DEBUG
printf("%*c%s: ", indent, ' ', menu_get_prompt(child));
printf("%s", child->flags & MENU_ROOT ? "rootmenu | " : "");
dbg_print_ptype(ptype);
printf("%s", prop_get_type_name(ptype));
printf(" | ");
if (sym) {
dbg_print_stype(sym->type);
printf("%s", sym_type_name(sym->type));
printf(" | ");
dbg_print_flags(sym->flags);
printf("%s", dbg_sym_flags(sym->flags));
printf("\n");
} else
printf("\n");
@ -1499,6 +1407,12 @@ static void display_tree(struct menu *menu)
if (((menu != &rootmenu) && !(menu->flags & MENU_ROOT))
|| (view_mode == FULL_VIEW)
|| (view_mode == SPLIT_VIEW))*/
/* Change paned position if the view is not in 'split mode' */
if (view_mode == SINGLE_VIEW || view_mode == FULL_VIEW) {
gtk_paned_set_position(GTK_PANED(hpaned), 0);
}
if (((view_mode == SINGLE_VIEW) && (menu->flags & MENU_ROOT))
|| (view_mode == FULL_VIEW)
|| (view_mode == SPLIT_VIEW)) {
@ -1557,10 +1471,6 @@ int main(int ac, char *av[])
char *env;
gchar *glade_file;
#ifndef LKC_DIRECT_LINK
kconfig_load();
#endif
bindtextdomain(PACKAGE, LOCALEDIR);
bind_textdomain_codeset(PACKAGE, "UTF-8");
textdomain(PACKAGE);
@ -1582,12 +1492,6 @@ int main(int ac, char *av[])
else
glade_file = g_strconcat(g_get_current_dir(), "/", av[0], ".glade", NULL);
/* Load the interface and connect signals */
init_main_window(glade_file);
init_tree_model();
init_left_tree();
init_right_tree();
/* Conf stuffs */
if (ac > 1 && av[1][0] == '-') {
switch (av[1][1]) {
@ -1607,6 +1511,12 @@ int main(int ac, char *av[])
fixup_rootmenu(&rootmenu);
conf_read(NULL);
/* Load the interface and connect signals */
init_main_window(glade_file);
init_tree_model();
init_left_tree();
init_right_tree();
switch (view_mode) {
case SINGLE_VIEW:
display_tree_part();

View File

@ -1,11 +1,10 @@
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
<glade-interface>
<widget class="GtkWindow" id="window1">
<property name="visible">True</property>
<property name="title" translatable="yes">Gtk uClibc Configurator</property>
<property name="title" translatable="yes">Gtk uCLibc Configurator</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">False</property>
@ -190,26 +189,40 @@
</child>
<child>
<widget class="GtkCheckMenuItem" id="show_all_options1">
<widget class="GtkRadioMenuItem" id="set_option_mode1">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Show normal options</property>
<property name="label" translatable="yes">Show normal options</property>
<property name="use_underline">True</property>
<property name="active">True</property>
<signal name="activate" handler="on_set_option_mode1_activate"/>
</widget>
</child>
<child>
<widget class="GtkRadioMenuItem" id="set_option_mode2">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Show all options</property>
<property name="label" translatable="yes">Show all _options</property>
<property name="use_underline">True</property>
<property name="active">False</property>
<signal name="activate" handler="on_show_all_options1_activate"/>
<property name="group">set_option_mode1</property>
<signal name="activate" handler="on_set_option_mode2_activate"/>
</widget>
</child>
<child>
<widget class="GtkCheckMenuItem" id="show_debug_info1">
<widget class="GtkRadioMenuItem" id="set_option_mode3">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Show masked options</property>
<property name="label" translatable="yes">Show _debug info</property>
<property name="tooltip" translatable="yes">Show all options with prompts</property>
<property name="label" translatable="yes">Show all prompt options</property>
<property name="use_underline">True</property>
<property name="active">False</property>
<signal name="activate" handler="on_show_debug_info1_activate"/>
<property name="group">set_option_mode1</property>
<signal name="activate" handler="on_set_option_mode3_activate"/>
</widget>
</child>
</widget>
</child>
</widget>
@ -547,7 +560,7 @@
<property name="headers_visible">True</property>
<property name="rules_hint">False</property>
<property name="reorderable">False</property>
<property name="enable_search">True</property>
<property name="enable_search">False</property>
<signal name="cursor_changed" handler="on_treeview2_cursor_changed" last_modification_time="Sun, 12 Jan 2003 15:58:22 GMT"/>
<signal name="button_press_event" handler="on_treeview1_button_press_event" last_modification_time="Sun, 12 Jan 2003 16:03:52 GMT"/>
<signal name="key_press_event" handler="on_treeview2_key_press_event" last_modification_time="Sun, 12 Jan 2003 16:11:44 GMT"/>
@ -582,7 +595,7 @@
<property name="headers_visible">True</property>
<property name="rules_hint">False</property>
<property name="reorderable">False</property>
<property name="enable_search">True</property>
<property name="enable_search">False</property>
<signal name="cursor_changed" handler="on_treeview2_cursor_changed" last_modification_time="Sun, 12 Jan 2003 15:57:55 GMT"/>
<signal name="button_press_event" handler="on_treeview2_button_press_event" last_modification_time="Sun, 12 Jan 2003 15:57:58 GMT"/>
<signal name="key_press_event" handler="on_treeview2_key_press_event" last_modification_time="Sun, 12 Jan 2003 15:58:01 GMT"/>

View File

@ -112,7 +112,13 @@ applicable everywhere (see syntax).
(no prompts anywhere) and for symbols with no dependencies.
That will limit the usefulness but on the other hand avoid
the illegal configurations all over.
kconfig should one day warn about such things.
- limiting menu display: "visible if" <expr>
This attribute is only applicable to menu blocks, if the condition is
false, the menu block is not displayed to the user (the symbols
contained there can still be selected by other symbols, though). It is
similar to a conditional "prompt" attribute for individual menu
entries. Default value of "visible" is true.
- numerical ranges: "range" <symbol> <symbol> ["if" <expr>]
This allows to limit the range of possible input values for int
@ -181,7 +187,7 @@ Expressions are listed in decreasing order of precedence.
(7) Returns the result of max(/expr/, /expr/).
An expression can have a value of 'n', 'm' or 'y' (or 0, 1, 2
respectively for calculations). A menu entry becomes visible when it's
respectively for calculations). A menu entry becomes visible when its
expression evaluates to 'm' or 'y'.
There are two types of symbols: constant and non-constant symbols.
@ -268,7 +274,7 @@ separate list of options.
choices:
"choice"
"choice" [symbol]
<choice options>
<choice block>
"endchoice"
@ -282,6 +288,10 @@ single driver can be compiled/loaded into the kernel, but all drivers
can be compiled as modules.
A choice accepts another option "optional", which allows to set the
choice to 'n' and no entry needs to be selected.
If no [symbol] is associated with a choice, then you can not have multiple
definitions of that choice. If a [symbol] is associated to the choice,
then you may define the same choice (ie. with the same entries) in another
place.
comment:
@ -300,7 +310,8 @@ menu:
"endmenu"
This defines a menu block, see "Menu structure" above for more
information. The only possible options are dependencies.
information. The only possible options are dependencies and "visible"
attributes.
if:
@ -322,7 +333,8 @@ mainmenu:
"mainmenu" <prompt>
This sets the config program's title bar if the config program chooses
to use it.
to use it. It should be placed at the top of the configuration, before any
other statement.
Kconfig hints
@ -376,4 +388,3 @@ config FOO
depends on BAR && m
limits FOO to module (=m) or disabled (=n).

Binary file not shown.

View File

@ -1,35 +0,0 @@
#include <dlfcn.h>
#include <stdio.h>
#include <stdlib.h>
#include "lkc.h"
#define P(name,type,arg) type (*name ## _p) arg
#include "lkc_proto.h"
#undef P
void kconfig_load(void)
{
void *handle;
char *error;
handle = dlopen("./libkconfig.so", RTLD_LAZY);
if (!handle) {
handle = dlopen("./scripts/kconfig/libkconfig.so", RTLD_LAZY);
if (!handle) {
fprintf(stderr, "%s\n", dlerror());
exit(1);
}
}
#define P(name,type,arg) \
{ \
name ## _p = dlsym(handle, #name); \
if ((error = dlerror())) { \
fprintf(stderr, "%s\n", error); \
exit(1); \
} \
}
#include "lkc_proto.h"
#undef P
}

View File

@ -7,7 +7,6 @@
#include <stdlib.h>
#include <string.h>
#define LKC_DIRECT_LINK
#include "lkc.h"
static char *escape(const char* text, char *bf, int len)
@ -43,6 +42,10 @@ static char *escape(const char* text, char *bf, int len)
++text;
goto next;
}
else if (*text == '\\') {
*bfp++ = '\\';
len--;
}
*bfp++ = *text++;
next:
--len;
@ -59,11 +62,11 @@ next:
struct file_line {
struct file_line *next;
char* file;
int lineno;
const char *file;
int lineno;
};
static struct file_line *file_line__new(char *file, int lineno)
static struct file_line *file_line__new(const char *file, int lineno)
{
struct file_line *self = malloc(sizeof(*self));
@ -86,7 +89,8 @@ struct message {
static struct message *message__list;
static struct message *message__new(const char *msg, char *option, char *file, int lineno)
static struct message *message__new(const char *msg, char *option,
const char *file, int lineno)
{
struct message *self = malloc(sizeof(*self));
@ -126,7 +130,8 @@ static struct message *mesage__find(const char *msg)
return m;
}
static int message__add_file_line(struct message *self, char *file, int lineno)
static int message__add_file_line(struct message *self, const char *file,
int lineno)
{
int rc = -1;
struct file_line *fl = file_line__new(file, lineno);
@ -141,7 +146,8 @@ out:
return rc;
}
static int message__add(const char *msg, char *option, char *file, int lineno)
static int message__add(const char *msg, char *option, const char *file,
int lineno)
{
int rc = 0;
char bf[16384];
@ -162,7 +168,7 @@ static int message__add(const char *msg, char *option, char *file, int lineno)
return rc;
}
void menu_build_message_list(struct menu *menu)
static void menu_build_message_list(struct menu *menu)
{
struct menu *child;
@ -207,7 +213,7 @@ static void message__print_gettext_msgid_msgstr(struct message *self)
"msgstr \"\"\n", self->msg);
}
void menu__xgettext(void)
static void menu__xgettext(void)
{
struct message *m = message__list;

131
extra/config/list.h Normal file
View File

@ -0,0 +1,131 @@
#ifndef LIST_H
#define LIST_H
/*
* Copied from include/linux/...
*/
#undef offsetof
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
/**
* container_of - cast a member of a structure out to the containing structure
* @ptr: the pointer to the member.
* @type: the type of the container struct this is embedded in.
* @member: the name of the member within the struct.
*
*/
#define container_of(ptr, type, member) ({ \
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
(type *)( (char *)__mptr - offsetof(type,member) );})
struct list_head {
struct list_head *next, *prev;
};
#define LIST_HEAD_INIT(name) { &(name), &(name) }
#define LIST_HEAD(name) \
struct list_head name = LIST_HEAD_INIT(name)
/**
* list_entry - get the struct for this entry
* @ptr: the &struct list_head pointer.
* @type: the type of the struct this is embedded in.
* @member: the name of the list_struct within the struct.
*/
#define list_entry(ptr, type, member) \
container_of(ptr, type, member)
/**
* list_for_each_entry - iterate over list of given type
* @pos: the type * to use as a loop cursor.
* @head: the head for your list.
* @member: the name of the list_struct within the struct.
*/
#define list_for_each_entry(pos, head, member) \
for (pos = list_entry((head)->next, typeof(*pos), member); \
&pos->member != (head); \
pos = list_entry(pos->member.next, typeof(*pos), member))
/**
* list_for_each_entry_safe - iterate over list of given type safe against removal of list entry
* @pos: the type * to use as a loop cursor.
* @n: another type * to use as temporary storage
* @head: the head for your list.
* @member: the name of the list_struct within the struct.
*/
#define list_for_each_entry_safe(pos, n, head, member) \
for (pos = list_entry((head)->next, typeof(*pos), member), \
n = list_entry(pos->member.next, typeof(*pos), member); \
&pos->member != (head); \
pos = n, n = list_entry(n->member.next, typeof(*n), member))
/**
* list_empty - tests whether a list is empty
* @head: the list to test.
*/
static inline int list_empty(const struct list_head *head)
{
return head->next == head;
}
/*
* Insert a new entry between two known consecutive entries.
*
* This is only for internal list manipulation where we know
* the prev/next entries already!
*/
static inline void __list_add(struct list_head *_new,
struct list_head *prev,
struct list_head *next)
{
next->prev = _new;
_new->next = next;
_new->prev = prev;
prev->next = _new;
}
/**
* list_add_tail - add a new entry
* @new: new entry to be added
* @head: list head to add it before
*
* Insert a new entry before the specified head.
* This is useful for implementing queues.
*/
static inline void list_add_tail(struct list_head *_new, struct list_head *head)
{
__list_add(_new, head->prev, head);
}
/*
* Delete a list entry by making the prev/next entries
* point to each other.
*
* This is only for internal list manipulation where we know
* the prev/next entries already!
*/
static inline void __list_del(struct list_head *prev, struct list_head *next)
{
next->prev = prev;
prev->next = next;
}
#define LIST_POISON1 ((void *) 0x00100100)
#define LIST_POISON2 ((void *) 0x00200200)
/**
* list_del - deletes entry from list.
* @entry: the element to delete from the list.
* Note: list_empty() on entry does not return true after this, the entry is
* in an undefined state.
*/
static inline void list_del(struct list_head *entry)
{
__list_del(entry->prev, entry->next);
entry->next = (struct list_head*)LIST_POISON1;
entry->prev = (struct list_head*)LIST_POISON2;
}
#endif

View File

@ -14,29 +14,37 @@
static inline const char *gettext(const char *txt) { return txt; }
static inline void textdomain(const char *domainname) {}
static inline void bindtextdomain(const char *name, const char *dir) {}
static inline char *bind_textdomain_codeset(const char *dn, char *c) { return c; }
#endif
#ifdef __cplusplus
extern "C" {
#endif
#ifdef LKC_DIRECT_LINK
#define P(name,type,arg) extern type name arg
#else
#include "lkc_defs.h"
#define P(name,type,arg) extern type (*name ## _p) arg
#endif
#include "lkc_proto.h"
#undef P
#define SRCTREE "srctree"
#ifndef PACKAGE
#define PACKAGE "linux"
#endif
#define LOCALEDIR "/usr/share/locale"
#define _(text) gettext(text)
#define N_(text) (text)
#ifndef CONFIG_
#define CONFIG_ "CONFIG_"
#endif
static inline const char *CONFIG_prefix(void)
{
return getenv( "CONFIG_" ) ?: CONFIG_;
}
#undef CONFIG_
#define CONFIG_ CONFIG_prefix()
#define TF_COMMAND 0x0001
#define TF_PARAM 0x0002
@ -61,35 +69,49 @@ struct kconf_id {
enum symbol_type stype;
};
extern int zconfdebug;
int zconfparse(void);
void zconfdump(FILE *out);
extern int zconfdebug;
void zconf_starthelp(void);
FILE *zconf_fopen(const char *name);
void zconf_initscan(const char *name);
void zconf_nextfile(const char *name);
int zconf_lineno(void);
char *zconf_curname(void);
const char *zconf_curname(void);
/* confdata.c */
const char *conf_get_configname(void);
const char *conf_get_autoconfig_name(void);
char *conf_get_default_confname(void);
void sym_set_change_count(int count);
void sym_add_change_count(int count);
void conf_set_all_new_symbols(enum conf_def_mode mode);
bool conf_set_all_new_symbols(enum conf_def_mode mode);
void set_all_choice_values(struct symbol *csym);
/* kconfig_load.c */
void kconfig_load(void);
struct conf_printer {
void (*print_symbol)(FILE *, struct symbol *, const char *, void *);
void (*print_comment)(FILE *, const char *, void *);
};
/* confdata.c and expr.c */
static inline void xfwrite(const void *str, size_t len, size_t count, FILE *out)
{
assert(len != 0);
if (fwrite(str, len, count, out) != count)
fprintf(stderr, "Error in writing or end of file.\n");
}
/* menu.c */
void menu_init(void);
void _menu_init(void);
void menu_warn(struct menu *menu, const char *fmt, ...);
struct menu *menu_add_menu(void);
void menu_end_menu(void);
void menu_add_entry(struct symbol *sym);
void menu_end_entry(void);
void menu_add_dep(struct expr *dep);
void menu_add_visibility(struct expr *dep);
struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *expr, struct expr *dep);
struct property *menu_add_prompt(enum prop_type type, char *prompt, struct expr *dep);
void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *dep);
@ -101,10 +123,19 @@ void menu_set_type(int type);
/* util.c */
struct file *file_lookup(const char *name);
int file_write_dep(const char *name);
void *xmalloc(size_t size);
void *xcalloc(size_t nmemb, size_t size);
char *dir_name(char *path);
char *base_name(char *path);
struct gstr {
size_t len;
char *s;
/*
* when max_width is not zero long lines in string s (if any) get
* wrapped not to exceed the max_width value
*/
int max_width;
};
struct gstr str_new(void);
struct gstr str_assign(const char *s);
@ -120,6 +151,8 @@ void sym_init(void);
void sym_clear_all_valid(void);
void sym_set_all_changed(void);
void sym_set_changed(struct symbol *sym);
struct symbol *sym_choice_default(struct symbol *sym);
const char *sym_get_string_default(struct symbol *sym);
struct symbol *sym_check_deps(struct symbol *sym);
struct property *prop_alloc(enum prop_type type, struct symbol *sym);
struct symbol *prop_get_symbol(struct property *prop);

View File

@ -1,28 +1,40 @@
#include <stdarg.h>
/* confdata.c */
P(conf_parse,void,(const char *name));
P(conf_read,int,(const char *name));
P(conf_read_simple,int,(const char *name, int));
P(conf_write_defconfig,int,(const char *name));
P(conf_write,int,(const char *name));
P(conf_write_autoconf,int,(void));
P(conf_get_changed,bool,(void));
P(conf_set_changed_callback, void,(void (*fn)(void)));
P(conf_set_message_callback, void,(void (*fn)(const char *fmt, va_list ap)));
/* menu.c */
P(rootmenu,struct menu,);
P(menu_is_visible,bool,(struct menu *menu));
P(menu_is_empty, bool, (struct menu *menu));
P(menu_is_visible, bool, (struct menu *menu));
P(menu_has_prompt, bool, (struct menu *menu));
P(menu_get_prompt,const char *,(struct menu *menu));
P(menu_get_root_menu,struct menu *,(struct menu *menu));
P(menu_get_parent_menu,struct menu *,(struct menu *menu));
P(menu_has_help,bool,(struct menu *menu));
P(menu_get_help,const char *,(struct menu *menu));
P(get_symbol_str, void, (struct gstr *r, struct symbol *sym, struct list_head
*head));
P(get_relations_str, struct gstr, (struct symbol **sym_arr, struct list_head
*head));
P(menu_get_ext_help,void,(struct menu *menu, struct gstr *help));
/* symbol.c */
P(symbol_hash,struct symbol *,[SYMBOL_HASHSIZE]);
P(sym_lookup,struct symbol *,(const char *name, int flags));
P(sym_find,struct symbol *,(const char *name));
P(sym_expand_string_value,const char *,(const char *in));
P(sym_escape_string_value, const char *,(const char *in));
P(sym_re_search,struct symbol **,(const char *pattern));
P(sym_type_name,const char *,(enum symbol_type type));
P(sym_calc_value,void,(struct symbol *sym));

View File

@ -4,7 +4,9 @@
# What library to link
ldflags()
{
for ext in so a dylib ; do
pkg-config --libs ncursesw 2>/dev/null && exit
pkg-config --libs ncurses 2>/dev/null && exit
for ext in so a dll.a dylib ; do
for lib in ncursesw ncurses curses ; do
$cc -print-file-name=lib${lib}.${ext} | grep -q /
if [ $? -eq 0 ]; then
@ -19,14 +21,13 @@ ldflags()
# Where is ncurses.h?
ccflags()
{
if [ -f /usr/include/ncursesw/ncurses.h ]; then
echo '-I/usr/include/ncursesw -DCURSES_LOC="<ncurses.h>"'
elif [ -f /usr/include/ncursesw/curses.h ]; then
echo '-I/usr/include/ncursesw -DCURSES_LOC="<ncursesw/curses.h>"'
if [ -f /usr/include/ncursesw/curses.h ]; then
echo '-I/usr/include/ncursesw -DCURSES_LOC="<curses.h>"'
echo ' -DNCURSES_WIDECHAR=1'
elif [ -f /usr/include/ncurses/ncurses.h ]; then
echo '-I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>"'
elif [ -f /usr/include/ncurses/curses.h ]; then
echo '-I/usr/include/ncurses -DCURSES_LOC="<ncurses/curses.h>"'
echo '-I/usr/include/ncurses -DCURSES_LOC="<curses.h>"'
elif [ -f /usr/include/ncurses.h ]; then
echo '-DCURSES_LOC="<ncurses.h>"'
else
@ -40,7 +41,7 @@ trap "rm -f $tmp" 0 1 2 3 15
# Check if we can link to ncurses
check() {
$cc -xc - -o $tmp 2>/dev/null <<'EOF'
$cc -x c - -o $tmp 2>/dev/null <<'EOF'
#include CURSES_LOC
main() {}
EOF

View File

@ -31,6 +31,10 @@ static int list_width, check_x, item_x;
static void print_item(WINDOW * win, int choice, int selected)
{
int i;
char *list_item = malloc(list_width + 1);
strncpy(list_item, item_str(), list_width - item_x);
list_item[list_width - item_x] = '\0';
/* Clear 'residue' of last item */
wattrset(win, dlg.menubox.atr);
@ -41,16 +45,18 @@ static void print_item(WINDOW * win, int choice, int selected)
wmove(win, choice, check_x);
wattrset(win, selected ? dlg.check_selected.atr
: dlg.check.atr);
wprintw(win, "(%c)", item_is_tag('X') ? 'X' : ' ');
if (!item_is_tag(':'))
wprintw(win, "(%c)", item_is_tag('X') ? 'X' : ' ');
wattrset(win, selected ? dlg.tag_selected.atr : dlg.tag.atr);
mvwaddch(win, choice, item_x, item_str()[0]);
mvwaddch(win, choice, item_x, list_item[0]);
wattrset(win, selected ? dlg.item_selected.atr : dlg.item.atr);
waddstr(win, (char *)item_str() + 1);
waddstr(win, list_item + 1);
if (selected) {
wmove(win, choice, check_x + 1);
wrefresh(win);
}
free(list_item);
}
/*
@ -126,16 +132,16 @@ int dialog_checklist(const char *title, const char *prompt, int height,
}
do_resize:
if (getmaxy(stdscr) < (height + 6))
if (getmaxy(stdscr) < (height + CHECKLIST_HEIGTH_MIN))
return -ERRDISPLAYTOOSMALL;
if (getmaxx(stdscr) < (width + 6))
if (getmaxx(stdscr) < (width + CHECKLIST_WIDTH_MIN))
return -ERRDISPLAYTOOSMALL;
max_choice = MIN(list_height, item_count());
/* center dialog box on screen */
x = (COLS - width) / 2;
y = (LINES - height) / 2;
x = (getmaxx(stdscr) - width) / 2;
y = (getmaxy(stdscr) - height) / 2;
draw_shadow(stdscr, y, x, height, width);
@ -174,6 +180,7 @@ do_resize:
check_x = 0;
item_foreach()
check_x = MAX(check_x, strlen(item_str()) + 4);
check_x = MIN(check_x, list_width);
check_x = (list_width - check_x) / 2;
item_x = check_x + 4;

View File

@ -106,8 +106,14 @@ struct dialog_color {
int hl; /* highlight this item */
};
struct subtitle_list {
struct subtitle_list *next;
const char *text;
};
struct dialog_info {
const char *backtitle;
struct subtitle_list *subtitles;
struct dialog_color screen;
struct dialog_color shadow;
struct dialog_color dialog;
@ -144,6 +150,7 @@ struct dialog_info {
*/
extern struct dialog_info dlg;
extern char dialog_input_result[];
extern int saved_x, saved_y; /* Needed in signal handler in mconf.c */
/*
* Function prototypes
@ -193,8 +200,23 @@ int item_is_tag(char tag);
int on_key_esc(WINDOW *win);
int on_key_resize(void);
/* minimum (re)size values */
#define CHECKLIST_HEIGTH_MIN 6 /* For dialog_checklist() */
#define CHECKLIST_WIDTH_MIN 6
#define INPUTBOX_HEIGTH_MIN 2 /* For dialog_inputbox() */
#define INPUTBOX_WIDTH_MIN 2
#define MENUBOX_HEIGTH_MIN 15 /* For dialog_menu() */
#define MENUBOX_WIDTH_MIN 65
#define TEXTBOX_HEIGTH_MIN 8 /* For dialog_textbox() */
#define TEXTBOX_WIDTH_MIN 8
#define YESNO_HEIGTH_MIN 4 /* For dialog_yesno() */
#define YESNO_WIDTH_MIN 4
#define WINDOW_HEIGTH_MIN 19 /* For init_dialog() */
#define WINDOW_WIDTH_MIN 80
int init_dialog(const char *backtitle);
void set_dialog_backtitle(const char *backtitle);
void set_dialog_subtitles(struct subtitle_list *subtitles);
void end_dialog(int x, int y);
void attr_clear(WINDOW * win, int height, int width, chtype attr);
void dialog_clear(void);
@ -209,12 +231,17 @@ int first_alpha(const char *string, const char *exempt);
int dialog_yesno(const char *title, const char *prompt, int height, int width);
int dialog_msgbox(const char *title, const char *prompt, int height,
int width, int pause);
int dialog_textbox(const char *title, const char *file, int height, int width);
typedef void (*update_text_fn)(char *buf, size_t start, size_t end, void
*_data);
int dialog_textbox(const char *title, char *tbuf, int initial_height,
int initial_width, int *keys, int *_vscroll, int *_hscroll,
update_text_fn update_text, void *data);
int dialog_menu(const char *title, const char *prompt,
const void *selected, int *s_scroll);
int dialog_checklist(const char *title, const char *prompt, int height,
int width, int list_height);
extern char dialog_input_result[];
int dialog_inputbox(const char *title, const char *prompt, int height,
int width, const char *init);

View File

@ -45,7 +45,8 @@ int dialog_inputbox(const char *title, const char *prompt, int height, int width
const char *init)
{
int i, x, y, box_y, box_x, box_width;
int input_x = 0, scroll = 0, key = 0, button = -1;
int input_x = 0, key = 0, button = -1;
int show_x, len, pos;
char *instr = dialog_input_result;
WINDOW *dialog;
@ -55,14 +56,14 @@ int dialog_inputbox(const char *title, const char *prompt, int height, int width
strcpy(instr, init);
do_resize:
if (getmaxy(stdscr) <= (height - 2))
if (getmaxy(stdscr) <= (height - INPUTBOX_HEIGTH_MIN))
return -ERRDISPLAYTOOSMALL;
if (getmaxx(stdscr) <= (width - 2))
if (getmaxx(stdscr) <= (width - INPUTBOX_WIDTH_MIN))
return -ERRDISPLAYTOOSMALL;
/* center dialog box on screen */
x = (COLS - width) / 2;
y = (LINES - height) / 2;
x = (getmaxx(stdscr) - width) / 2;
y = (getmaxy(stdscr) - height) / 2;
draw_shadow(stdscr, y, x, height, width);
@ -97,14 +98,17 @@ do_resize:
wmove(dialog, box_y, box_x);
wattrset(dialog, dlg.inputbox.atr);
input_x = strlen(instr);
len = strlen(instr);
pos = len;
if (input_x >= box_width) {
scroll = input_x - box_width + 1;
if (len >= box_width) {
show_x = len - box_width + 1;
input_x = box_width - 1;
for (i = 0; i < box_width - 1; i++)
waddch(dialog, instr[scroll + i]);
waddch(dialog, instr[show_x + i]);
} else {
show_x = 0;
input_x = len;
waddstr(dialog, instr);
}
@ -121,45 +125,104 @@ do_resize:
case KEY_UP:
case KEY_DOWN:
break;
case KEY_LEFT:
continue;
case KEY_RIGHT:
continue;
case KEY_BACKSPACE:
case 127:
if (input_x || scroll) {
if (pos) {
wattrset(dialog, dlg.inputbox.atr);
if (!input_x) {
scroll = scroll < box_width - 1 ? 0 : scroll - (box_width - 1);
wmove(dialog, box_y, box_x);
for (i = 0; i < box_width; i++)
waddch(dialog,
instr[scroll + input_x + i] ?
instr[scroll + input_x + i] : ' ');
input_x = strlen(instr) - scroll;
if (input_x == 0) {
show_x--;
} else
input_x--;
instr[scroll + input_x] = '\0';
mvwaddch(dialog, box_y, input_x + box_x, ' ');
if (pos < len) {
for (i = pos - 1; i < len; i++) {
instr[i] = instr[i+1];
}
}
pos--;
len--;
instr[len] = '\0';
wmove(dialog, box_y, box_x);
for (i = 0; i < box_width; i++) {
if (!instr[show_x + i]) {
waddch(dialog, ' ');
break;
}
waddch(dialog, instr[show_x + i]);
}
wmove(dialog, box_y, input_x + box_x);
wrefresh(dialog);
}
continue;
case KEY_LEFT:
if (pos > 0) {
if (input_x > 0) {
wmove(dialog, box_y, --input_x + box_x);
} else if (input_x == 0) {
show_x--;
wmove(dialog, box_y, box_x);
for (i = 0; i < box_width; i++) {
if (!instr[show_x + i]) {
waddch(dialog, ' ');
break;
}
waddch(dialog, instr[show_x + i]);
}
wmove(dialog, box_y, box_x);
}
pos--;
}
continue;
case KEY_RIGHT:
if (pos < len) {
if (input_x < box_width - 1) {
wmove(dialog, box_y, ++input_x + box_x);
} else if (input_x == box_width - 1) {
show_x++;
wmove(dialog, box_y, box_x);
for (i = 0; i < box_width; i++) {
if (!instr[show_x + i]) {
waddch(dialog, ' ');
break;
}
waddch(dialog, instr[show_x + i]);
}
wmove(dialog, box_y, input_x + box_x);
}
pos++;
}
continue;
default:
if (key < 0x100 && isprint(key)) {
if (scroll + input_x < MAX_LEN) {
if (len < MAX_LEN) {
wattrset(dialog, dlg.inputbox.atr);
instr[scroll + input_x] = key;
instr[scroll + input_x + 1] = '\0';
if (input_x == box_width - 1) {
scroll++;
wmove(dialog, box_y, box_x);
for (i = 0; i < box_width - 1; i++)
waddch(dialog, instr [scroll + i]);
if (pos < len) {
for (i = len; i > pos; i--)
instr[i] = instr[i-1];
instr[pos] = key;
} else {
wmove(dialog, box_y, input_x++ + box_x);
waddch(dialog, key);
instr[len] = key;
}
pos++;
len++;
instr[len] = '\0';
if (input_x == box_width - 1) {
show_x++;
} else {
input_x++;
}
wmove(dialog, box_y, box_x);
for (i = 0; i < box_width; i++) {
if (!instr[show_x + i]) {
waddch(dialog, ' ');
break;
}
waddch(dialog, instr[show_x + i]);
}
wmove(dialog, box_y, input_x + box_x);
wrefresh(dialog);
} else
flash(); /* Alarm user about overflow */
@ -180,7 +243,7 @@ do_resize:
case KEY_LEFT:
switch (button) {
case -1:
button = 1; /* Indicates "Cancel" button is selected */
button = 1; /* Indicates "Help" button is selected */
print_buttons(dialog, height, width, 1);
break;
case 0:
@ -204,7 +267,7 @@ do_resize:
print_buttons(dialog, height, width, 0);
break;
case 0:
button = 1; /* Indicates "Cancel" button is selected */
button = 1; /* Indicates "Help" button is selected */
print_buttons(dialog, height, width, 1);
break;
case 1:

View File

@ -154,12 +154,14 @@ static void print_arrows(WINDOW * win, int item_no, int scroll, int y, int x,
*/
static void print_buttons(WINDOW * win, int height, int width, int selected)
{
int x = width / 2 - 16;
int x = width / 2 - 28;
int y = height - 2;
print_button(win, gettext("Select"), y, x, selected == 0);
print_button(win, gettext(" Exit "), y, x + 12, selected == 1);
print_button(win, gettext(" Help "), y, x + 24, selected == 2);
print_button(win, gettext(" Save "), y, x + 36, selected == 3);
print_button(win, gettext(" Load "), y, x + 48, selected == 4);
wmove(win, y, x + 1 + 12 * selected);
wrefresh(win);
@ -191,7 +193,7 @@ int dialog_menu(const char *title, const char *prompt,
do_resize:
height = getmaxy(stdscr);
width = getmaxx(stdscr);
if (height < 15 || width < 65)
if (height < MENUBOX_HEIGTH_MIN || width < MENUBOX_WIDTH_MIN)
return -ERRDISPLAYTOOSMALL;
height -= 4;
@ -201,8 +203,8 @@ do_resize:
max_choice = MIN(menu_height, item_count());
/* center dialog box on screen */
x = (COLS - width) / 2;
y = (LINES - height) / 2;
x = (getmaxx(stdscr) - width) / 2;
y = (getmaxy(stdscr) - height) / 2;
draw_shadow(stdscr, y, x, height, width);
@ -301,10 +303,11 @@ do_resize:
}
}
if (i < max_choice ||
key == KEY_UP || key == KEY_DOWN ||
key == '-' || key == '+' ||
key == KEY_PPAGE || key == KEY_NPAGE) {
if (item_count() != 0 &&
(i < max_choice ||
key == KEY_UP || key == KEY_DOWN ||
key == '-' || key == '+' ||
key == KEY_PPAGE || key == KEY_NPAGE)) {
/* Remove highligt of current item */
print_item(scroll + choice, choice, FALSE);
@ -372,7 +375,7 @@ do_resize:
case TAB:
case KEY_RIGHT:
button = ((key == KEY_LEFT ? --button : ++button) < 0)
? 2 : (button > 2 ? 0 : button);
? 4 : (button > 4 ? 0 : button);
print_buttons(dialog, height, width, button);
wrefresh(menu);
@ -383,6 +386,10 @@ do_resize:
case 'n':
case 'm':
case '/':
case 'h':
case '?':
case 'z':
case '\n':
/* save scroll info */
*s_scroll = scroll;
delwin(menu);
@ -390,30 +397,26 @@ do_resize:
item_set(scroll + choice);
item_set_selected(1);
switch (key) {
case 'h':
case '?':
return 2;
case 's':
return 3;
case 'y':
return 3;
case 'n':
return 4;
case 'm':
return 5;
case ' ':
case 'n':
return 6;
case '/':
case 'm':
return 7;
case ' ':
return 8;
case '/':
return 9;
case 'z':
return 10;
case '\n':
return button;
}
return 0;
case 'h':
case '?':
button = 2;
case '\n':
*s_scroll = scroll;
delwin(menu);
delwin(dialog);
item_set(scroll + choice);
item_set_selected(1);
return button;
case 'e':
case 'x':
key = KEY_ESC;

View File

@ -22,23 +22,25 @@
#include "dialog.h"
static void back_lines(int n);
static void print_page(WINDOW * win, int height, int width);
static void print_line(WINDOW * win, int row, int width);
static void print_page(WINDOW *win, int height, int width, update_text_fn
update_text, void *data);
static void print_line(WINDOW *win, int row, int width);
static char *get_line(void);
static void print_position(WINDOW * win);
static int hscroll;
static int begin_reached, end_reached, page_length;
static const char *buf;
static const char *page;
static char *buf;
static char *page;
/*
* refresh window content
*/
static void refresh_text_box(WINDOW *dialog, WINDOW *box, int boxh, int boxw,
int cur_y, int cur_x)
int cur_y, int cur_x, update_text_fn update_text,
void *data)
{
print_page(box, boxh, boxw);
print_page(box, boxh, boxw, update_text, data);
print_position(dialog);
wmove(dialog, cur_y, cur_x); /* Restore cursor position */
wrefresh(dialog);
@ -47,14 +49,18 @@ static void refresh_text_box(WINDOW *dialog, WINDOW *box, int boxh, int boxw,
/*
* Display text from a file in a dialog box.
*
* keys is a null-terminated array
* update_text() may not add or remove any '\n' or '\0' in tbuf
*/
int dialog_textbox(const char *title, const char *tbuf,
int initial_height, int initial_width)
int dialog_textbox(const char *title, char *tbuf, int initial_height,
int initial_width, int *keys, int *_vscroll, int *_hscroll,
update_text_fn update_text, void *data)
{
int i, x, y, cur_x, cur_y, key = 0;
int height, width, boxh, boxw;
int passed_end;
WINDOW *dialog, *box;
bool done = false;
begin_reached = 1;
end_reached = 0;
@ -63,9 +69,18 @@ int dialog_textbox(const char *title, const char *tbuf,
buf = tbuf;
page = buf; /* page is pointer to start of page to be displayed */
if (_vscroll && *_vscroll) {
begin_reached = 0;
for (i = 0; i < *_vscroll; i++)
get_line();
}
if (_hscroll)
hscroll = *_hscroll;
do_resize:
getmaxyx(stdscr, height, width);
if (height < 8 || width < 8)
if (height < TEXTBOX_HEIGTH_MIN || width < TEXTBOX_WIDTH_MIN)
return -ERRDISPLAYTOOSMALL;
if (initial_height != 0)
height = initial_height;
@ -83,8 +98,8 @@ do_resize:
width = 0;
/* center dialog box on screen */
x = (COLS - width) / 2;
y = (LINES - height) / 2;
x = (getmaxx(stdscr) - width) / 2;
y = (getmaxy(stdscr) - height) / 2;
draw_shadow(stdscr, y, x, height, width);
@ -120,25 +135,28 @@ do_resize:
/* Print first page of text */
attr_clear(box, boxh, boxw, dlg.dialog.atr);
refresh_text_box(dialog, box, boxh, boxw, cur_y, cur_x);
refresh_text_box(dialog, box, boxh, boxw, cur_y, cur_x, update_text,
data);
while ((key != KEY_ESC) && (key != '\n')) {
while (!done) {
key = wgetch(dialog);
switch (key) {
case 'E': /* Exit */
case 'e':
case 'X':
case 'x':
delwin(box);
delwin(dialog);
return 0;
case 'q':
case '\n':
done = true;
break;
case 'g': /* First page */
case KEY_HOME:
if (!begin_reached) {
begin_reached = 1;
page = buf;
refresh_text_box(dialog, box, boxh, boxw,
cur_y, cur_x);
cur_y, cur_x, update_text,
data);
}
break;
case 'G': /* Last page */
@ -148,78 +166,48 @@ do_resize:
/* point to last char in buf */
page = buf + strlen(buf);
back_lines(boxh);
refresh_text_box(dialog, box, boxh, boxw,
cur_y, cur_x);
refresh_text_box(dialog, box, boxh, boxw, cur_y,
cur_x, update_text, data);
break;
case 'K': /* Previous line */
case 'k':
case KEY_UP:
if (!begin_reached) {
back_lines(page_length + 1);
if (begin_reached)
break;
/* We don't call print_page() here but use
* scrolling to ensure faster screen update.
* However, 'end_reached' and 'page_length'
* should still be updated, and 'page' should
* point to start of next page. This is done
* by calling get_line() in the following
* 'for' loop. */
scrollok(box, TRUE);
wscrl(box, -1); /* Scroll box region down one line */
scrollok(box, FALSE);
page_length = 0;
passed_end = 0;
for (i = 0; i < boxh; i++) {
if (!i) {
/* print first line of page */
print_line(box, 0, boxw);
wnoutrefresh(box);
} else
/* Called to update 'end_reached' and 'page' */
get_line();
if (!passed_end)
page_length++;
if (end_reached && !passed_end)
passed_end = 1;
}
print_position(dialog);
wmove(dialog, cur_y, cur_x); /* Restore cursor position */
wrefresh(dialog);
}
back_lines(page_length + 1);
refresh_text_box(dialog, box, boxh, boxw, cur_y,
cur_x, update_text, data);
break;
case 'B': /* Previous page */
case 'b':
case 'u':
case KEY_PPAGE:
if (begin_reached)
break;
back_lines(page_length + boxh);
refresh_text_box(dialog, box, boxh, boxw,
cur_y, cur_x);
refresh_text_box(dialog, box, boxh, boxw, cur_y,
cur_x, update_text, data);
break;
case 'J': /* Next line */
case 'j':
case KEY_DOWN:
if (!end_reached) {
begin_reached = 0;
scrollok(box, TRUE);
scroll(box); /* Scroll box region up one line */
scrollok(box, FALSE);
print_line(box, boxh - 1, boxw);
wnoutrefresh(box);
print_position(dialog);
wmove(dialog, cur_y, cur_x); /* Restore cursor position */
wrefresh(dialog);
}
if (end_reached)
break;
back_lines(page_length - 1);
refresh_text_box(dialog, box, boxh, boxw, cur_y,
cur_x, update_text, data);
break;
case KEY_NPAGE: /* Next page */
case ' ':
case 'd':
if (end_reached)
break;
begin_reached = 0;
refresh_text_box(dialog, box, boxh, boxw,
cur_y, cur_x);
refresh_text_box(dialog, box, boxh, boxw, cur_y,
cur_x, update_text, data);
break;
case '0': /* Beginning of line */
case 'H': /* Scroll left */
@ -234,8 +222,8 @@ do_resize:
hscroll--;
/* Reprint current page to scroll horizontally */
back_lines(page_length);
refresh_text_box(dialog, box, boxh, boxw,
cur_y, cur_x);
refresh_text_box(dialog, box, boxh, boxw, cur_y,
cur_x, update_text, data);
break;
case 'L': /* Scroll right */
case 'l':
@ -245,11 +233,12 @@ do_resize:
hscroll++;
/* Reprint current page to scroll horizontally */
back_lines(page_length);
refresh_text_box(dialog, box, boxh, boxw,
cur_y, cur_x);
refresh_text_box(dialog, box, boxh, boxw, cur_y,
cur_x, update_text, data);
break;
case KEY_ESC:
key = on_key_esc(dialog);
if (on_key_esc(dialog) == KEY_ESC)
done = true;
break;
case KEY_RESIZE:
back_lines(height);
@ -257,11 +246,31 @@ do_resize:
delwin(dialog);
on_key_resize();
goto do_resize;
default:
for (i = 0; keys[i]; i++) {
if (key == keys[i]) {
done = true;
break;
}
}
}
}
delwin(box);
delwin(dialog);
return key; /* ESC pressed */
if (_vscroll) {
const char *s;
s = buf;
*_vscroll = 0;
back_lines(page_length);
while (s < page && (s = strchr(s, '\n'))) {
(*_vscroll)++;
s++;
}
}
if (_hscroll)
*_hscroll = hscroll;
return key;
}
/*
@ -298,12 +307,23 @@ static void back_lines(int n)
}
/*
* Print a new page of text. Called by dialog_textbox().
* Print a new page of text.
*/
static void print_page(WINDOW * win, int height, int width)
static void print_page(WINDOW *win, int height, int width, update_text_fn
update_text, void *data)
{
int i, passed_end = 0;
if (update_text) {
char *end;
for (i = 0; i < height; i++)
get_line();
end = page;
back_lines(height);
update_text(buf, page - buf, end - buf, data);
}
page_length = 0;
for (i = 0; i < height; i++) {
print_line(win, i, width);
@ -316,11 +336,10 @@ static void print_page(WINDOW * win, int height, int width)
}
/*
* Print a new line of text. Called by dialog_textbox() and print_page().
* Print a new line of text.
*/
static void print_line(WINDOW * win, int row, int width)
{
int y, x;
char *line;
line = get_line();
@ -329,10 +348,10 @@ static void print_line(WINDOW * win, int row, int width)
waddch(win, ' ');
waddnstr(win, line, MIN(strlen(line), width - 2));
getyx(win, y, x);
/* Clear 'residue' of previous line */
#if OLD_NCURSES
{
int x = getcurx(win);
int i;
for (i = 0; i < width - x; i++)
waddch(win, ' ');
@ -355,10 +374,8 @@ static char *get_line(void)
end_reached = 0;
while (*page != '\n') {
if (*page == '\0') {
if (!end_reached) {
end_reached = 1;
break;
}
end_reached = 1;
break;
} else if (i < MAX_LEN)
line[i++] = *(page++);
else {
@ -371,7 +388,7 @@ static char *get_line(void)
if (i <= MAX_LEN)
line[i] = '\0';
if (!end_reached)
page++; /* move pass '\n' */
page++; /* move past '\n' */
return line;
}

View File

@ -19,8 +19,13 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <stdarg.h>
#include "dialog.h"
/* Needed in signal handler in mconf.c */
int saved_x, saved_y;
struct dialog_info dlg;
static void set_mono_theme(void)
@ -249,15 +254,56 @@ void attr_clear(WINDOW * win, int height, int width, chtype attr)
void dialog_clear(void)
{
attr_clear(stdscr, LINES, COLS, dlg.screen.atr);
int lines, columns;
lines = getmaxy(stdscr);
columns = getmaxx(stdscr);
attr_clear(stdscr, lines, columns, dlg.screen.atr);
/* Display background title if it exists ... - SLH */
if (dlg.backtitle != NULL) {
int i;
int i, len = 0, skip = 0;
struct subtitle_list *pos;
wattrset(stdscr, dlg.screen.atr);
mvwaddstr(stdscr, 0, 1, (char *)dlg.backtitle);
for (pos = dlg.subtitles; pos != NULL; pos = pos->next) {
/* 3 is for the arrow and spaces */
len += strlen(pos->text) + 3;
}
wmove(stdscr, 1, 1);
for (i = 1; i < COLS - 1; i++)
if (len > columns - 2) {
const char *ellipsis = "[...] ";
waddstr(stdscr, ellipsis);
skip = len - (columns - 2 - strlen(ellipsis));
}
for (pos = dlg.subtitles; pos != NULL; pos = pos->next) {
if (skip == 0)
waddch(stdscr, ACS_RARROW);
else
skip--;
if (skip == 0)
waddch(stdscr, ' ');
else
skip--;
if (skip < strlen(pos->text)) {
waddstr(stdscr, pos->text + skip);
skip = 0;
} else
skip -= strlen(pos->text);
if (skip == 0)
waddch(stdscr, ' ');
else
skip--;
}
for (i = len + 1; i < columns - 1; i++)
waddch(stdscr, ACS_HLINE);
}
wnoutrefresh(stdscr);
@ -271,8 +317,12 @@ int init_dialog(const char *backtitle)
int height, width;
initscr(); /* Init curses */
/* Get current cursor position for signal handler in mconf.c */
getyx(stdscr, saved_y, saved_x);
getmaxyx(stdscr, height, width);
if (height < 19 || width < 80) {
if (height < WINDOW_HEIGTH_MIN || width < WINDOW_WIDTH_MIN) {
endwin();
return -ERRDISPLAYTOOSMALL;
}
@ -293,6 +343,11 @@ void set_dialog_backtitle(const char *backtitle)
dlg.backtitle = backtitle;
}
void set_dialog_subtitles(struct subtitle_list *subtitles)
{
dlg.subtitles = subtitles;
}
/*
* End using dialog functions.
*/
@ -321,27 +376,19 @@ void print_title(WINDOW *dialog, const char *title, int width)
/*
* Print a string of text in a window, automatically wrap around to the
* next line if the string is too long to fit on one line. Newline
* characters '\n' are replaced by spaces. We start on a new line
* characters '\n' are propperly processed. We start on a new line
* if there is no room for at least 4 nonblanks following a double-space.
*/
void print_autowrap(WINDOW * win, const char *prompt, int width, int y, int x)
{
int newl, cur_x, cur_y;
int i, prompt_len, room, wlen;
char tempstr[MAX_LEN + 1], *word, *sp, *sp2;
int prompt_len, room, wlen;
char tempstr[MAX_LEN + 1], *word, *sp, *sp2, *newline_separator = 0;
strcpy(tempstr, prompt);
prompt_len = strlen(tempstr);
/*
* Remove newlines
*/
for (i = 0; i < prompt_len; i++) {
if (tempstr[i] == '\n')
tempstr[i] = ' ';
}
if (prompt_len <= width - x * 2) { /* If prompt is short */
wmove(win, y, (width - prompt_len) / 2);
waddstr(win, tempstr);
@ -351,7 +398,10 @@ void print_autowrap(WINDOW * win, const char *prompt, int width, int y, int x)
newl = 1;
word = tempstr;
while (word && *word) {
sp = strchr(word, ' ');
sp = strpbrk(word, "\n ");
if (sp && *sp == '\n')
newline_separator = sp;
if (sp)
*sp++ = 0;
@ -363,7 +413,7 @@ void print_autowrap(WINDOW * win, const char *prompt, int width, int y, int x)
if (wlen > room ||
(newl && wlen < 4 && sp
&& wlen + 1 + strlen(sp) > room
&& (!(sp2 = strchr(sp, ' '))
&& (!(sp2 = strpbrk(sp, "\n "))
|| wlen + 1 + (sp2 - sp) > room))) {
cur_y++;
cur_x = x;
@ -371,7 +421,15 @@ void print_autowrap(WINDOW * win, const char *prompt, int width, int y, int x)
wmove(win, cur_y, cur_x);
waddstr(win, word);
getyx(win, cur_y, cur_x);
cur_x++;
/* Move to the next line if the word separator was a newline */
if (newline_separator) {
cur_y++;
cur_x = x;
newline_separator = 0;
} else
cur_x++;
if (sp && *sp == ' ') {
cur_x++; /* double space */
while (*++sp == ' ') ;

View File

@ -45,14 +45,14 @@ int dialog_yesno(const char *title, const char *prompt, int height, int width)
WINDOW *dialog;
do_resize:
if (getmaxy(stdscr) < (height + 4))
if (getmaxy(stdscr) < (height + YESNO_HEIGTH_MIN))
return -ERRDISPLAYTOOSMALL;
if (getmaxx(stdscr) < (width + 4))
if (getmaxx(stdscr) < (width + YESNO_WIDTH_MIN))
return -ERRDISPLAYTOOSMALL;
/* center dialog box on screen */
x = (COLS - width) / 2;
y = (LINES - height) / 2;
x = (getmaxx(stdscr) - width) / 2;
y = (getmaxy(stdscr) - height) / 2;
draw_shadow(stdscr, y, x, height, width);

View File

@ -15,20 +15,19 @@
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include <unistd.h>
#include <locale.h>
#define LKC_DIRECT_LINK
#include "lkc.h"
#include "lxdialog/dialog.h"
static const char mconf_readme[] = N_(
"Overview\n"
"--------\n"
"Some features may be built directly into uClibc. Some features\n"
"may be completely removed altogether. There are also certain\n"
"parameters which are not really features, but must be\n"
"entered in as decimal or hexadecimal numbers or possibly text.\n"
"This interface let you select features and parameters for the build.\n"
"Features can either be built-in, modularized, or ignored. Parameters\n"
"must be entered in as decimal or hexadecimal numbers or text.\n"
"\n"
"Menu items beginning with following braces represent features that\n"
" [ ] can be built in or removed\n"
@ -49,7 +48,7 @@ static const char mconf_readme[] = N_(
"----------\n"
"o Use the Up/Down arrow keys (cursor keys) to highlight the item\n"
" you wish to change or submenu wish to select and press <Enter>.\n"
" Submenus are designated by \"--->\".\n"
" Submenus are designated by \"--->\", empty ones by \"----\".\n"
"\n"
" Shortcut: Press the option's highlighted letter (hotkey).\n"
" Pressing a hotkey more than once will sequence\n"
@ -66,13 +65,15 @@ static const char mconf_readme[] = N_(
" there is a delayed response which you may find annoying.\n"
"\n"
" Also, the <TAB> and cursor keys will cycle between <Select>,\n"
" <Exit> and <Help>\n"
" <Exit> and <Help>.\n"
"\n"
"o To get help with an item, use the cursor keys to highlight <Help>\n"
" and Press <ENTER>.\n"
" and press <ENTER>.\n"
"\n"
" Shortcut: Press <H> or <?>.\n"
"\n"
"o To toggle the display of hidden options, press <Z>.\n"
"\n"
"\n"
"Radiolists (Choice lists)\n"
"-----------\n"
@ -104,10 +105,10 @@ static const char mconf_readme[] = N_(
"Text Box (Help Window)\n"
"--------\n"
"o Use the cursor keys to scroll up/down/left/right. The VI editor\n"
" keys h,j,k,l function here as do <SPACE BAR> and <B> for those\n"
" who are familiar with less and lynx.\n"
" keys h,j,k,l function here as do <u>, <d>, <SPACE BAR> and <B> for \n"
" those who are familiar with less and lynx.\n"
"\n"
"o Press <E>, <X>, <Enter> or <Esc><Esc> to exit.\n"
"o Press <E>, <X>, <q>, <Enter> or <Esc><Esc> to exit.\n"
"\n"
"\n"
"Alternate Configuration Files\n"
@ -147,9 +148,9 @@ static const char mconf_readme[] = N_(
"\n"
"Optional personality available\n"
"------------------------------\n"
"If you prefer to have all of the options listed in a single\n"
"menu, rather than the default multimenu hierarchy, run the menuconfig\n"
"with MENUCONFIG_MODE environment variable set to single_menu. Example:\n"
"If you prefer to have all of the options listed in a single menu, rather\n"
"than the default multimenu hierarchy, run the menuconfig with\n"
"MENUCONFIG_MODE environment variable set to single_menu. Example:\n"
"\n"
"make MENUCONFIG_MODE=single_menu menuconfig\n"
"\n"
@ -175,11 +176,11 @@ static const char mconf_readme[] = N_(
"\n"),
menu_instructions[] = N_(
"Arrow keys navigate the menu. "
"<Enter> selects submenus --->. "
"<Enter> selects submenus ---> (or empty submenus ----). "
"Highlighted letters are hotkeys. "
"Pressing <Y> selectes a feature, while <N> will exclude a feature. "
"Pressing <Y> includes, <N> excludes, <M> modularizes features. "
"Press <Esc><Esc> to exit, <?> for Help, </> for Search. "
"Legend: [*] feature is selected [ ] feature is excluded"),
"Legend: [*] built-in [ ] excluded <M> module < > module capable"),
radiolist_instructions[] = N_(
"Use the arrow keys to navigate this window or "
"press the hotkey of the item you wish to select "
@ -198,8 +199,6 @@ inputbox_instructions_string[] = N_(
setmod_text[] = N_(
"This feature depends on another which has been configured as a module.\n"
"As a result, this feature will be built as a module."),
nohelp_text[] = N_(
"There is no help available for this option.\n"),
load_config_text[] = N_(
"Enter the name of the configuration file you wish to load. "
"Accept the name shown to restore the configuration you "
@ -210,18 +209,18 @@ load_config_help[] = N_(
"configurations available on a single machine.\n"
"\n"
"If you have saved a previous configuration in a file other than the\n"
"default, entering the name of the file here will allow you\n"
"to modify that configuration.\n"
"default one, entering its name here will allow you to modify that\n"
"configuration.\n"
"\n"
"If you are uncertain, then you have probably never used alternate\n"
"configuration files. You should therefor leave this blank to abort.\n"),
"configuration files. You should therefore leave this blank to abort.\n"),
save_config_text[] = N_(
"Enter a filename to which this configuration should be saved "
"as an alternate. Leave blank to abort."),
save_config_help[] = N_(
"\n"
"For various reasons, one may wish to keep different\n"
"configurations available on a single machine.\n"
"For various reasons, one may wish to keep different configurations\n"
"available on a single machine.\n"
"\n"
"Entering a file name here will allow you to later retrieve, modify\n"
"and use the current configuration as an alternate to whatever\n"
@ -231,32 +230,39 @@ save_config_help[] = N_(
"leave this blank.\n"),
search_help[] = N_(
"\n"
"Search for CONFIG_ symbols and display their relations.\n"
"Search for symbols and display their relations.\n"
"Regular expressions are allowed.\n"
"Example: search for \"^FOO\"\n"
"Result:\n"
"-----------------------------------------------------------------\n"
"Symbol: FOO [=m]\n"
"Type : tristate\n"
"Prompt: Foo bus is used to drive the bar HW\n"
"Defined at drivers/pci/Kconfig:47\n"
"Depends on: X86_LOCAL_APIC && X86_IO_APIC || IA64\n"
"Location:\n"
" -> Bus options (PCI, PCMCIA, EISA, MCA, ISA)\n"
" -> PCI support (PCI [=y])\n"
" -> PCI access mode (<choice> [=y])\n"
"Selects: LIBCRC32\n"
"Selected by: BAR\n"
" Defined at drivers/pci/Kconfig:47\n"
" Depends on: X86_LOCAL_APIC && X86_IO_APIC || IA64\n"
" Location:\n"
" -> Bus options (PCI, PCMCIA, EISA, ISA)\n"
" -> PCI support (PCI [=y])\n"
"(1) -> PCI access mode (<choice> [=y])\n"
" Selects: LIBCRC32\n"
" Selected by: BAR\n"
"-----------------------------------------------------------------\n"
"o The line 'Type:' shows the type of the configuration option for\n"
" this symbol (boolean, tristate, string, ...)\n"
"o The line 'Prompt:' shows the text used in the menu structure for\n"
" this CONFIG_ symbol\n"
" this symbol\n"
"o The 'Defined at' line tell at what file / line number the symbol\n"
" is defined\n"
"o The 'Depends on:' line tell what symbols needs to be defined for\n"
" this symbol to be visible in the menu (selectable)\n"
"o The 'Location:' lines tell where in the menu structure this symbol\n"
" is located\n"
" A location followed by a [=y] indicate that this is a selectable\n"
" menu item - and current value is displayed inside brackets.\n"
" A location followed by a [=y] indicates that this is a\n"
" selectable menu item - and the current value is displayed inside\n"
" brackets.\n"
" Press the key in the (#) prefix to jump directly to that\n"
" location. You will be returned to the current search results\n"
" after exiting this new menu.\n"
"o The 'Selects:' line tell what symbol will be automatically\n"
" selected if this symbol is selected (y or m)\n"
"o The 'Selected by' line tell what symbol has selected this symbol\n"
@ -264,110 +270,38 @@ search_help[] = N_(
"Only relevant lines are shown.\n"
"\n\n"
"Search examples:\n"
"Examples: USB => find all CONFIG_ symbols containing USB\n"
" ^USB => find all CONFIG_ symbols starting with USB\n"
" USB$ => find all CONFIG_ symbols ending with USB\n"
"Examples: USB => find all symbols containing USB\n"
" ^USB => find all symbols starting with USB\n"
" USB$ => find all symbols ending with USB\n"
"\n");
static int indent;
static struct menu *current_menu;
static int child_count;
static int single_menu_mode;
static int show_all_options;
static int save_and_exit;
static void conf(struct menu *menu);
static void conf(struct menu *menu, struct menu *active_menu);
static void conf_choice(struct menu *menu);
static void conf_string(struct menu *menu);
static void conf_load(void);
static void conf_save(void);
static int show_textbox_ext(const char *title, char *text, int r, int c,
int *keys, int *vscroll, int *hscroll,
update_text_fn update_text, void *data);
static void show_textbox(const char *title, const char *text, int r, int c);
static void show_helptext(const char *title, const char *text);
static void show_help(struct menu *menu);
static void get_prompt_str(struct gstr *r, struct property *prop)
{
int i, j;
struct menu *submenu[8], *menu;
str_printf(r, _("Prompt: %s\n"), _(prop->text));
str_printf(r, _(" Defined at %s:%d\n"), prop->menu->file->name,
prop->menu->lineno);
if (!expr_is_yes(prop->visible.expr)) {
str_append(r, _(" Depends on: "));
expr_gstr_print(prop->visible.expr, r);
str_append(r, "\n");
}
menu = prop->menu->parent;
for (i = 0; menu != &rootmenu && i < 8; menu = menu->parent)
submenu[i++] = menu;
if (i > 0) {
str_printf(r, _(" Location:\n"));
for (j = 4; --i >= 0; j += 2) {
menu = submenu[i];
str_printf(r, "%*c-> %s", j, ' ', _(menu_get_prompt(menu)));
if (menu->sym) {
str_printf(r, " (%s [=%s])", menu->sym->name ?
menu->sym->name : _("<choice>"),
sym_get_string_value(menu->sym));
}
str_append(r, "\n");
}
}
}
static void get_symbol_str(struct gstr *r, struct symbol *sym)
{
bool hit;
struct property *prop;
if (sym && sym->name)
str_printf(r, "Symbol: %s [=%s]\n", sym->name,
sym_get_string_value(sym));
for_all_prompts(sym, prop)
get_prompt_str(r, prop);
hit = false;
for_all_properties(sym, prop, P_SELECT) {
if (!hit) {
str_append(r, " Selects: ");
hit = true;
} else
str_printf(r, " && ");
expr_gstr_print(prop->expr, r);
}
if (hit)
str_append(r, "\n");
if (sym->rev_dep.expr) {
str_append(r, _(" Selected by: "));
expr_gstr_print(sym->rev_dep.expr, r);
str_append(r, "\n");
}
str_append(r, "\n\n");
}
static struct gstr get_relations_str(struct symbol **sym_arr)
{
struct symbol *sym;
struct gstr res = str_new();
int i;
for (i = 0; sym_arr && (sym = sym_arr[i]); i++)
get_symbol_str(&res, sym);
if (!i)
str_append(&res, _("No matches found.\n"));
return res;
}
static char filename[PATH_MAX+1];
static void set_config_filename(const char *config_filename)
{
static char menu_backtitle[PATH_MAX+128];
int size;
struct symbol *sym;
sym = sym_lookup("VERSION", 0);
sym_calc_value(sym);
size = snprintf(menu_backtitle, sizeof(menu_backtitle),
_("%s - uClibc v%s Configuration"),
config_filename, sym_get_string_value(sym));
"%s - %s", config_filename, rootmenu.prompt->text);
if (size >= sizeof(menu_backtitle))
menu_backtitle[sizeof(menu_backtitle)-1] = '\0';
set_dialog_backtitle(menu_backtitle);
@ -377,18 +311,103 @@ static void set_config_filename(const char *config_filename)
filename[sizeof(filename)-1] = '\0';
}
struct subtitle_part {
struct list_head entries;
const char *text;
};
static LIST_HEAD(trail);
static struct subtitle_list *subtitles;
static void set_subtitle(void)
{
struct subtitle_part *sp;
struct subtitle_list *pos, *tmp;
for (pos = subtitles; pos != NULL; pos = tmp) {
tmp = pos->next;
free(pos);
}
subtitles = NULL;
list_for_each_entry(sp, &trail, entries) {
if (sp->text) {
if (pos) {
pos->next = xcalloc(sizeof(*pos), 1);
pos = pos->next;
} else {
subtitles = pos = xcalloc(sizeof(*pos), 1);
}
pos->text = sp->text;
}
}
set_dialog_subtitles(subtitles);
}
static void reset_subtitle(void)
{
struct subtitle_list *pos, *tmp;
for (pos = subtitles; pos != NULL; pos = tmp) {
tmp = pos->next;
free(pos);
}
subtitles = NULL;
set_dialog_subtitles(subtitles);
}
struct search_data {
struct list_head *head;
struct menu **targets;
int *keys;
};
static void update_text(char *buf, size_t start, size_t end, void *_data)
{
struct search_data *data = _data;
struct jump_key *pos;
int k = 0;
list_for_each_entry(pos, data->head, entries) {
if (pos->offset >= start && pos->offset < end) {
char header[4];
if (k < JUMP_NB) {
int key = '0' + (pos->index % JUMP_NB) + 1;
sprintf(header, "(%c)", key);
data->keys[k] = key;
data->targets[k] = pos->target;
k++;
} else {
sprintf(header, " ");
}
memcpy(buf + pos->offset, header, sizeof(header) - 1);
}
}
data->keys[k] = 0;
}
static void search_conf(void)
{
struct symbol **sym_arr;
struct gstr res;
struct gstr title;
char *dialog_input;
int dres;
int dres, vscroll = 0, hscroll = 0;
bool again;
struct gstr sttext;
struct subtitle_part stpart;
title = str_new();
str_printf( &title, _("Enter %s (sub)string or regexp to search for "
"(with or without \"%s\")"), CONFIG_, CONFIG_);
again:
dialog_clear();
dres = dialog_inputbox(_("Search Configuration Parameter"),
_("Enter CONFIG_ (sub)string to search for "
"(with or without \"CONFIG\")"),
str_get(&title),
10, 75, "");
switch (dres) {
case 0:
@ -397,19 +416,52 @@ again:
show_helptext(_("Search Configuration"), search_help);
goto again;
default:
str_free(&title);
return;
}
/* strip CONFIG_ if necessary */
/* strip the prefix if necessary */
dialog_input = dialog_input_result;
if (strncasecmp(dialog_input_result, "CONFIG_", 7) == 0)
dialog_input += 7;
if (strncasecmp(dialog_input_result, CONFIG_, strlen(CONFIG_)) == 0)
dialog_input += strlen(CONFIG_);
sttext = str_new();
str_printf(&sttext, "Search (%s)", dialog_input_result);
stpart.text = str_get(&sttext);
list_add_tail(&stpart.entries, &trail);
sym_arr = sym_re_search(dialog_input);
res = get_relations_str(sym_arr);
do {
LIST_HEAD(head);
struct menu *targets[JUMP_NB];
int keys[JUMP_NB + 1], i;
struct search_data data = {
.head = &head,
.targets = targets,
.keys = keys,
};
struct jump_key *pos, *tmp;
res = get_relations_str(sym_arr, &head);
set_subtitle();
dres = show_textbox_ext(_("Search Results"), (char *)
str_get(&res), 0, 0, keys, &vscroll,
&hscroll, &update_text, (void *)
&data);
again = false;
for (i = 0; i < JUMP_NB && keys[i]; i++)
if (dres == keys[i]) {
conf(targets[i]->parent, targets[i]);
again = true;
}
str_free(&res);
list_for_each_entry_safe(pos, tmp, &head, entries)
free(pos);
} while (again);
free(sym_arr);
show_textbox(_("Search Results"), str_get(&res), 0, 0);
str_free(&res);
str_free(&title);
list_del(trail.prev);
str_free(&sttext);
}
static void build_conf(struct menu *menu)
@ -420,8 +472,16 @@ static void build_conf(struct menu *menu)
int type, tmp, doint = 2;
tristate val;
char ch;
bool visible;
if (!menu_is_visible(menu))
/*
* note: menu_is_visible() has side effect that it will
* recalc the value of the symbol.
*/
visible = menu_is_visible(menu);
if (show_all_options && !menu_has_prompt(menu))
return;
else if (!show_all_options && !visible)
return;
sym = menu->sym;
@ -438,8 +498,9 @@ static void build_conf(struct menu *menu)
menu->data ? "-->" : "++>",
indent + 1, ' ', prompt);
} else
item_make(" %*c%s --->", indent + 1, ' ', prompt);
item_make(" %*c%s %s",
indent + 1, ' ', prompt,
menu_is_empty(menu) ? "----" : "--->");
item_set_tag('m');
item_set_data(menu);
if (single_menu_mode && menu->data)
@ -570,7 +631,7 @@ static void build_conf(struct menu *menu)
(sym_has_value(sym) || !sym_is_changable(sym)) ?
"" : _(" (NEW)"));
if (menu->prompt->type == P_MENU) {
item_add_str(" --->");
item_add_str(" %s", menu_is_empty(menu) ? "----" : "--->");
return;
}
}
@ -582,40 +643,40 @@ conf_childs:
indent -= doint;
}
static void conf(struct menu *menu)
static void conf(struct menu *menu, struct menu *active_menu)
{
struct menu *submenu;
const char *prompt = menu_get_prompt(menu);
struct subtitle_part stpart;
struct symbol *sym;
struct menu *active_menu = NULL;
int res;
int s_scroll = 0;
if (menu != &rootmenu)
stpart.text = menu_get_prompt(menu);
else
stpart.text = NULL;
list_add_tail(&stpart.entries, &trail);
while (1) {
item_reset();
current_menu = menu;
build_conf(menu);
if (!child_count)
break;
if (menu == &rootmenu) {
item_make("--- ");
item_set_tag(':');
item_make(_(" Load an Alternate Configuration File"));
item_set_tag('L');
item_make(_(" Save an Alternate Configuration File"));
item_set_tag('S');
}
set_subtitle();
dialog_clear();
res = dialog_menu(prompt ? _(prompt) : _("Main Menu"),
_(menu_instructions),
active_menu, &s_scroll);
if (res == 1 || res == KEY_ESC || res == -ERRDISPLAYTOOSMALL)
break;
if (!item_activate_selected())
continue;
if (!item_tag())
continue;
if (item_count() != 0) {
if (!item_activate_selected())
continue;
if (!item_tag())
continue;
}
submenu = item_data();
active_menu = item_data();
if (submenu)
@ -630,32 +691,36 @@ static void conf(struct menu *menu)
if (single_menu_mode)
submenu->data = (void *) (long) !submenu->data;
else
conf(submenu);
conf(submenu, NULL);
break;
case 't':
if (sym_is_choice(sym) && sym_get_tristate_value(sym) == yes)
conf_choice(submenu);
else if (submenu->prompt->type == P_MENU)
conf(submenu);
conf(submenu, NULL);
break;
case 's':
conf_string(submenu);
break;
case 'L':
conf_load();
break;
case 'S':
conf_save();
break;
}
break;
case 2:
if (sym)
show_help(submenu);
else
else {
reset_subtitle();
show_helptext(_("README"), _(mconf_readme));
}
break;
case 3:
reset_subtitle();
conf_save();
break;
case 4:
reset_subtitle();
conf_load();
break;
case 5:
if (item_is_tag('t')) {
if (sym_set_tristate_value(sym, yes))
break;
@ -663,31 +728,45 @@ static void conf(struct menu *menu)
show_textbox(NULL, setmod_text, 6, 74);
}
break;
case 4:
case 6:
if (item_is_tag('t'))
sym_set_tristate_value(sym, no);
break;
case 5:
case 7:
if (item_is_tag('t'))
sym_set_tristate_value(sym, mod);
break;
case 6:
case 8:
if (item_is_tag('t'))
sym_toggle_tristate_value(sym);
else if (item_is_tag('m'))
conf(submenu);
conf(submenu, NULL);
break;
case 7:
case 9:
search_conf();
break;
case 10:
show_all_options = !show_all_options;
break;
}
}
list_del(trail.prev);
}
static int show_textbox_ext(const char *title, char *text, int r, int c, int
*keys, int *vscroll, int *hscroll, update_text_fn
update_text, void *data)
{
dialog_clear();
return dialog_textbox(title, text, r, c, keys, vscroll, hscroll,
update_text, data);
}
static void show_textbox(const char *title, const char *text, int r, int c)
{
dialog_clear();
dialog_textbox(title, text, r, c);
show_textbox_ext(title, (char *) text, r, c, (int []) {0}, NULL, NULL,
NULL, NULL);
}
static void show_helptext(const char *title, const char *text)
@ -695,25 +774,24 @@ static void show_helptext(const char *title, const char *text)
show_textbox(title, text, 0, 0);
}
static void conf_message_callback(const char *fmt, va_list ap)
{
char buf[PATH_MAX+1];
vsnprintf(buf, sizeof(buf), fmt, ap);
if (save_and_exit)
printf("%s", buf);
else
show_textbox(NULL, buf, 6, 60);
}
static void show_help(struct menu *menu)
{
struct gstr help = str_new();
struct symbol *sym = menu->sym;
if (menu_has_help(menu))
{
if (sym->name) {
str_printf(&help, "%s:\n\n", sym->name);
}
str_append(&help, _(menu_get_help(menu)));
str_append(&help, "\n");
} else if (menu_has_help(sym->prop->menu->parent)) {
str_append(&help, _(menu_get_help(sym->prop->menu->parent)));
str_append(&help, "\n");
} else {
str_append(&help, nohelp_text);
}
get_symbol_str(&help, sym);
help.max_width = getmaxx(stdscr) - 10;
menu_get_ext_help(menu, &help);
show_helptext(_(menu_get_prompt(menu)), str_get(&help));
str_free(&help);
}
@ -734,7 +812,12 @@ static void conf_choice(struct menu *menu)
for (child = menu->list; child; child = child->next) {
if (!menu_is_visible(child))
continue;
item_make("%s", _(menu_get_prompt(child)));
if (child->sym)
item_make("%s", _(menu_get_prompt(child)));
else {
item_make("*** %s ***", _(menu_get_prompt(child)));
item_set_tag(':');
}
item_set_data(child);
if (child->sym == active)
item_set_selected(1);
@ -744,12 +827,17 @@ static void conf_choice(struct menu *menu)
dialog_clear();
res = dialog_checklist(prompt ? _(prompt) : _("Main Menu"),
_(radiolist_instructions),
15, 70, 6);
MENUBOX_HEIGTH_MIN,
MENUBOX_WIDTH_MIN,
CHECKLIST_HEIGTH_MIN);
selected = item_activate_selected();
switch (res) {
case 0:
if (selected) {
child = item_data();
if (!child->sym)
break;
sym_set_tristate_value(child->sym, yes);
}
return;
@ -863,9 +951,58 @@ static void conf_save(void)
}
}
static int handle_exit(void)
{
int res;
save_and_exit = 1;
reset_subtitle();
dialog_clear();
if (conf_get_changed())
res = dialog_yesno(NULL,
_("Do you wish to save your new configuration?\n"
"(Press <ESC><ESC> to continue configuration.)"),
6, 60);
else
res = -1;
end_dialog(saved_x, saved_y);
switch (res) {
case 0:
if (conf_write(filename)) {
fprintf(stderr, _("\n\n"
"Error while writing of the configuration.\n"
"Your configuration changes were NOT saved."
"\n\n"));
return 1;
}
/* fall through */
case -1:
printf(_("\n\n"
"*** End of the configuration.\n"
"*** Execute 'make' to start the build or try 'make help'."
"\n\n"));
res = 0;
break;
default:
fprintf(stderr, _("\n\n"
"Your configuration changes were NOT saved."
"\n\n"));
if (res != KEY_ESC)
res = 0;
}
return res;
}
static void sig_handler(int signo)
{
exit(handle_exit());
}
int main(int ac, char **av)
{
int saved_x, saved_y;
char *mode;
int res;
@ -873,6 +1010,8 @@ int main(int ac, char **av)
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
signal(SIGINT, sig_handler);
conf_parse(av[1]);
conf_read(NULL);
@ -882,7 +1021,6 @@ int main(int ac, char **av)
single_menu_mode = 1;
}
getyx(stdscr, saved_y, saved_x);
if (init_dialog(NULL)) {
fprintf(stderr, N_("Your display is too small to run Menuconfig!\n"));
fprintf(stderr, N_("It must be at least 19 lines by 80 columns.\n"));
@ -890,41 +1028,12 @@ int main(int ac, char **av)
}
set_config_filename(conf_get_configname());
conf_set_message_callback(conf_message_callback);
do {
conf(&rootmenu);
dialog_clear();
if (conf_get_changed())
res = dialog_yesno(NULL,
_("Do you wish to save your "
"new configuration?\n"
"<ESC><ESC> to continue."),
6, 60);
else
res = -1;
conf(&rootmenu, NULL);
res = handle_exit();
} while (res == KEY_ESC);
end_dialog(saved_x, saved_y);
switch (res) {
case 0:
if (conf_write(filename)) {
fprintf(stderr, _("\n\n"
"Error during writing of the configuration.\n"
"Your configuration changes were NOT saved."
"\n\n"));
return 1;
}
case -1:
printf(_("\n\n"
"*** End of configuration.\n"
"*** Execute 'make' to build or try 'make help'."
"\n\n"));
break;
default:
fprintf(stderr, _("\n\n"
"Your configuration changes were NOT saved."
"\n\n"));
}
return conf_write_autoconf();
return res;
}

View File

@ -3,12 +3,15 @@
* Released under the terms of the GNU GPL v2.0.
*/
#include <ctype.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#define LKC_DIRECT_LINK
#include "lkc.h"
static const char nohelp_text[] = "There is no help available for this option.";
struct menu rootmenu;
static struct menu **last_entry_ptr;
@ -35,7 +38,7 @@ static void prop_warn(struct property *prop, const char *fmt, ...)
va_end(ap);
}
void menu_init(void)
void _menu_init(void)
{
current_entry = current_menu = &rootmenu;
last_entry_ptr = &rootmenu.list;
@ -45,7 +48,7 @@ void menu_add_entry(struct symbol *sym)
{
struct menu *menu;
menu = malloc(sizeof(*menu));
menu = xmalloc(sizeof(*menu));
memset(menu, 0, sizeof(*menu));
menu->sym = sym;
menu->parent = current_menu;
@ -55,6 +58,8 @@ void menu_add_entry(struct symbol *sym)
*last_entry_ptr = menu;
last_entry_ptr = &menu->next;
current_entry = menu;
if (sym)
menu_add_symbol(P_SYMBOL, sym, NULL);
}
void menu_end_entry(void)
@ -74,7 +79,7 @@ void menu_end_menu(void)
current_menu = current_menu->parent;
}
struct expr *menu_check_dep(struct expr *e)
static struct expr *menu_check_dep(struct expr *e)
{
if (!e)
return e;
@ -133,8 +138,35 @@ struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *e
while (isspace(*prompt))
prompt++;
}
if (current_entry->prompt)
if (current_entry->prompt && current_entry != &rootmenu)
prop_warn(prop, "prompt redefined");
/* Apply all upper menus' visibilities to actual prompts. */
if(type == P_PROMPT) {
struct menu *menu = current_entry;
while ((menu = menu->parent) != NULL) {
struct expr *dup_expr;
if (!menu->visibility)
continue;
/*
* Do not add a reference to the
* menu's visibility expression but
* use a copy of it. Otherwise the
* expression reduction functions
* will modify expressions that have
* multiple references which can
* cause unwanted side effects.
*/
dup_expr = expr_copy(menu->visibility);
prop->visible.expr
= expr_alloc_and(prop->visible.expr,
dup_expr);
}
}
current_entry->prompt = prop;
}
prop->text = prompt;
@ -147,6 +179,12 @@ struct property *menu_add_prompt(enum prop_type type, char *prompt, struct expr
return menu_add_prop(type, prompt, NULL, dep);
}
void menu_add_visibility(struct expr *expr)
{
current_entry->visibility = expr_alloc_and(current_entry->visibility,
expr);
}
void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *dep)
{
menu_add_prop(type, NULL, expr, dep);
@ -178,13 +216,13 @@ void menu_add_option(int token, char *arg)
}
}
static int menu_range_valid_sym(struct symbol *sym, struct symbol *sym2)
static int menu_validate_number(struct symbol *sym, struct symbol *sym2)
{
return sym2->type == S_INT || sym2->type == S_HEX ||
(sym2->type == S_UNKNOWN && sym_string_valid(sym, sym2->name));
}
void sym_check_prop(struct symbol *sym)
static void sym_check_prop(struct symbol *sym)
{
struct property *prop;
struct symbol *sym2;
@ -194,8 +232,17 @@ void sym_check_prop(struct symbol *sym)
if ((sym->type == S_STRING || sym->type == S_INT || sym->type == S_HEX) &&
prop->expr->type != E_SYMBOL)
prop_warn(prop,
"default for config symbol '%'"
"default for config symbol '%s'"
" must be a single symbol", sym->name);
if (prop->expr->type != E_SYMBOL)
break;
sym2 = prop_get_symbol(prop);
if (sym->type == S_HEX || sym->type == S_INT) {
if (!menu_validate_number(sym, sym2))
prop_warn(prop,
"'%s': number is invalid",
sym->name);
}
break;
case P_SELECT:
sym2 = prop_get_symbol(prop);
@ -215,8 +262,8 @@ void sym_check_prop(struct symbol *sym)
if (sym->type != S_INT && sym->type != S_HEX)
prop_warn(prop, "range is only allowed "
"for int or hex symbols");
if (!menu_range_valid_sym(sym, prop->expr->left.sym) ||
!menu_range_valid_sym(sym, prop->expr->right.sym))
if (!menu_validate_number(sym, prop->expr->left.sym) ||
!menu_validate_number(sym, prop->expr->right.sym))
prop_warn(prop, "range is invalid");
break;
default:
@ -315,6 +362,8 @@ void menu_finalize(struct menu *parent)
parent->next = last_menu->next;
last_menu->next = NULL;
}
sym->dir_dep.expr = expr_alloc_or(sym->dir_dep.expr, parent->dep);
}
for (menu = parent->list; menu; menu = menu->next) {
if (sym && sym_is_choice(sym) &&
@ -387,6 +436,29 @@ void menu_finalize(struct menu *parent)
}
}
bool menu_has_prompt(struct menu *menu)
{
if (!menu->prompt)
return false;
return true;
}
/*
* Determine if a menu is empty.
* A menu is considered empty if it contains no or only
* invisible entries.
*/
bool menu_is_empty(struct menu *menu)
{
struct menu *child;
for (child = menu->list; child; child = child->next) {
if (menu_is_visible(child))
return(false);
}
return(true);
}
bool menu_is_visible(struct menu *menu)
{
struct menu *child;
@ -395,6 +467,12 @@ bool menu_is_visible(struct menu *menu)
if (!menu->prompt)
return false;
if (menu->visibility) {
if (expr_calc_value(menu->visibility) == no)
return no;
}
sym = menu->sym;
if (sym) {
sym_calc_value(sym);
@ -404,12 +482,18 @@ bool menu_is_visible(struct menu *menu)
if (visible != no)
return true;
if (!sym || sym_get_tristate_value(menu->sym) == no)
return false;
for (child = menu->list; child; child = child->next)
if (menu_is_visible(child))
for (child = menu->list; child; child = child->next) {
if (menu_is_visible(child)) {
if (sym)
sym->flags |= SYMBOL_DEF_USER;
return true;
}
}
return false;
}
@ -451,3 +535,156 @@ const char *menu_get_help(struct menu *menu)
else
return "";
}
static void get_prompt_str(struct gstr *r, struct property *prop,
struct list_head *head)
{
int i, j;
struct menu *submenu[8], *menu, *location = NULL;
struct jump_key *jump;
str_printf(r, _("Prompt: %s\n"), _(prop->text));
menu = prop->menu->parent;
for (i = 0; menu != &rootmenu && i < 8; menu = menu->parent) {
bool accessible = menu_is_visible(menu);
submenu[i++] = menu;
if (location == NULL && accessible)
location = menu;
}
if (head && location) {
jump = xmalloc(sizeof(struct jump_key));
if (menu_is_visible(prop->menu)) {
/*
* There is not enough room to put the hint at the
* beginning of the "Prompt" line. Put the hint on the
* last "Location" line even when it would belong on
* the former.
*/
jump->target = prop->menu;
} else
jump->target = location;
if (list_empty(head))
jump->index = 0;
else
jump->index = list_entry(head->prev, struct jump_key,
entries)->index + 1;
list_add_tail(&jump->entries, head);
}
if (i > 0) {
str_printf(r, _(" Location:\n"));
for (j = 4; --i >= 0; j += 2) {
menu = submenu[i];
if (head && location && menu == location)
jump->offset = r->len - 1;
str_printf(r, "%*c-> %s", j, ' ',
_(menu_get_prompt(menu)));
if (menu->sym) {
str_printf(r, " (%s [=%s])", menu->sym->name ?
menu->sym->name : _("<choice>"),
sym_get_string_value(menu->sym));
}
str_append(r, "\n");
}
}
}
/*
* get peoperty of type P_SYMBOL
*/
static struct property *get_symbol_prop(struct symbol *sym)
{
struct property *prop = NULL;
for_all_properties(sym, prop, P_SYMBOL)
break;
return prop;
}
/*
* head is optional and may be NULL
*/
void get_symbol_str(struct gstr *r, struct symbol *sym,
struct list_head *head)
{
bool hit;
struct property *prop;
if (sym && sym->name) {
str_printf(r, "Symbol: %s [=%s]\n", sym->name,
sym_get_string_value(sym));
str_printf(r, "Type : %s\n", sym_type_name(sym->type));
if (sym->type == S_INT || sym->type == S_HEX) {
prop = sym_get_range_prop(sym);
if (prop) {
str_printf(r, "Range : ");
expr_gstr_print(prop->expr, r);
str_append(r, "\n");
}
}
}
for_all_prompts(sym, prop)
get_prompt_str(r, prop, head);
prop = get_symbol_prop(sym);
if (prop) {
str_printf(r, _(" Defined at %s:%d\n"), prop->menu->file->name,
prop->menu->lineno);
if (!expr_is_yes(prop->visible.expr)) {
str_append(r, _(" Depends on: "));
expr_gstr_print(prop->visible.expr, r);
str_append(r, "\n");
}
}
hit = false;
for_all_properties(sym, prop, P_SELECT) {
if (!hit) {
str_append(r, " Selects: ");
hit = true;
} else
str_printf(r, " && ");
expr_gstr_print(prop->expr, r);
}
if (hit)
str_append(r, "\n");
if (sym->rev_dep.expr) {
str_append(r, _(" Selected by: "));
expr_gstr_print(sym->rev_dep.expr, r);
str_append(r, "\n");
}
str_append(r, "\n\n");
}
struct gstr get_relations_str(struct symbol **sym_arr, struct list_head *head)
{
struct symbol *sym;
struct gstr res = str_new();
int i;
for (i = 0; sym_arr && (sym = sym_arr[i]); i++)
get_symbol_str(&res, sym, head);
if (!i)
str_append(&res, _("No matches found.\n"));
return res;
}
void menu_get_ext_help(struct menu *menu, struct gstr *help)
{
struct symbol *sym = menu->sym;
const char *help_text = nohelp_text;
if (menu_has_help(menu)) {
if (sym->name)
str_printf(help, "%s%s:\n\n", CONFIG_, sym->name);
help_text = menu_get_help(menu);
}
str_printf(help, "%s\n", _(help_text));
if (sym)
get_symbol_str(help, sym, NULL);
}

150
extra/config/merge_config.sh Executable file
View File

@ -0,0 +1,150 @@
#!/bin/sh
# merge_config.sh - Takes a list of config fragment values, and merges
# them one by one. Provides warnings on overridden values, and specified
# values that did not make it to the resulting .config file (due to missed
# dependencies or config symbol removal).
#
# Portions reused from kconf_check and generate_cfg:
# http://git.yoctoproject.org/cgit/cgit.cgi/yocto-kernel-tools/tree/tools/kconf_check
# http://git.yoctoproject.org/cgit/cgit.cgi/yocto-kernel-tools/tree/tools/generate_cfg
#
# Copyright (c) 2009-2010 Wind River Systems, Inc.
# Copyright 2011 Linaro
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# This program 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 General Public License for more details.
clean_up() {
rm -f $TMP_FILE
exit
}
trap clean_up HUP INT TERM
usage() {
echo "Usage: $0 [OPTIONS] [CONFIG [...]]"
echo " -h display this help text"
echo " -m only merge the fragments, do not execute the make command"
echo " -n use allnoconfig instead of alldefconfig"
echo " -r list redundant entries when merging fragments"
echo " -O dir to put generated output files"
}
MAKE=true
ALLTARGET=alldefconfig
WARNREDUN=false
OUTPUT=.
while true; do
case $1 in
"-n")
ALLTARGET=allnoconfig
shift
continue
;;
"-m")
MAKE=false
shift
continue
;;
"-h")
usage
exit
;;
"-r")
WARNREDUN=true
shift
continue
;;
"-O")
if [ -d $2 ];then
OUTPUT=$(echo $2 | sed 's/\/*$//')
else
echo "output directory $2 does not exist" 1>&2
exit 1
fi
shift 2
continue
;;
*)
break
;;
esac
done
INITFILE=$1
shift;
MERGE_LIST=$*
SED_CONFIG_EXP="s/^\(# \)\{0,1\}\(CONFIG_[a-zA-Z0-9_]*\)[= ].*/\2/p"
TMP_FILE=$(mktemp ./.tmp.config.XXXXXXXXXX)
echo "Using $INITFILE as base"
cat $INITFILE > $TMP_FILE
# Merge files, printing warnings on overrided values
for MERGE_FILE in $MERGE_LIST ; do
echo "Merging $MERGE_FILE"
CFG_LIST=$(sed -n "$SED_CONFIG_EXP" $MERGE_FILE)
for CFG in $CFG_LIST ; do
grep -q -w $CFG $TMP_FILE
if [ $? -eq 0 ] ; then
PREV_VAL=$(grep -w $CFG $TMP_FILE)
NEW_VAL=$(grep -w $CFG $MERGE_FILE)
if [ "x$PREV_VAL" != "x$NEW_VAL" ] ; then
echo Value of $CFG is redefined by fragment $MERGE_FILE:
echo Previous value: $PREV_VAL
echo New value: $NEW_VAL
echo
elif [ "$WARNREDUN" = "true" ]; then
echo Value of $CFG is redundant by fragment $MERGE_FILE:
fi
sed -i "/$CFG[ =]/d" $TMP_FILE
fi
done
cat $MERGE_FILE >> $TMP_FILE
done
if [ "$MAKE" = "false" ]; then
cp $TMP_FILE $OUTPUT/.config
echo "#"
echo "# merged configuration written to $OUTPUT/.config (needs make)"
echo "#"
clean_up
exit
fi
# If we have an output dir, setup the O= argument, otherwise leave
# it blank, since O=. will create an unnecessary ./source softlink
OUTPUT_ARG=""
if [ "$OUTPUT" != "." ] ; then
OUTPUT_ARG="O=$OUTPUT"
fi
# Use the merged file as the starting point for:
# alldefconfig: Fills in any missing symbols with Kconfig default
# allnoconfig: Fills in any missing symbols with # CONFIG_* is not set
make KCONFIG_ALLCONFIG=$TMP_FILE $OUTPUT_ARG $ALLTARGET
# Check all specified config values took (might have missed-dependency issues)
for CFG in $(sed -n "$SED_CONFIG_EXP" $TMP_FILE); do
REQUESTED_VAL=$(grep -w -e "$CFG" $TMP_FILE)
ACTUAL_VAL=$(grep -w -e "$CFG" $OUTPUT/.config)
if [ "x$REQUESTED_VAL" != "x$ACTUAL_VAL" ] ; then
echo "Value requested for $CFG not in final .config"
echo "Requested value: $REQUESTED_VAL"
echo "Actual value: $ACTUAL_VAL"
echo ""
fi
done
clean_up

1557
extra/config/nconf.c Normal file

File diff suppressed because it is too large Load Diff

656
extra/config/nconf.gui.c Normal file
View File

@ -0,0 +1,656 @@
/*
* Copyright (C) 2008 Nir Tzachar <nir.tzachar@gmail.com?
* Released under the terms of the GNU GPL v2.0.
*
* Derived from menuconfig.
*
*/
#include "nconf.h"
/* a list of all the different widgets we use */
attributes_t attributes[ATTR_MAX+1] = {0};
/* available colors:
COLOR_BLACK 0
COLOR_RED 1
COLOR_GREEN 2
COLOR_YELLOW 3
COLOR_BLUE 4
COLOR_MAGENTA 5
COLOR_CYAN 6
COLOR_WHITE 7
*/
static void set_normal_colors(void)
{
init_pair(NORMAL, -1, -1);
init_pair(MAIN_HEADING, COLOR_MAGENTA, -1);
/* FORE is for the selected item */
init_pair(MAIN_MENU_FORE, -1, -1);
/* BACK for all the rest */
init_pair(MAIN_MENU_BACK, -1, -1);
init_pair(MAIN_MENU_GREY, -1, -1);
init_pair(MAIN_MENU_HEADING, COLOR_GREEN, -1);
init_pair(MAIN_MENU_BOX, COLOR_YELLOW, -1);
init_pair(SCROLLWIN_TEXT, -1, -1);
init_pair(SCROLLWIN_HEADING, COLOR_GREEN, -1);
init_pair(SCROLLWIN_BOX, COLOR_YELLOW, -1);
init_pair(DIALOG_TEXT, -1, -1);
init_pair(DIALOG_BOX, COLOR_YELLOW, -1);
init_pair(DIALOG_MENU_BACK, COLOR_YELLOW, -1);
init_pair(DIALOG_MENU_FORE, COLOR_RED, -1);
init_pair(INPUT_BOX, COLOR_YELLOW, -1);
init_pair(INPUT_HEADING, COLOR_GREEN, -1);
init_pair(INPUT_TEXT, -1, -1);
init_pair(INPUT_FIELD, -1, -1);
init_pair(FUNCTION_HIGHLIGHT, -1, -1);
init_pair(FUNCTION_TEXT, COLOR_YELLOW, -1);
}
/* available attributes:
A_NORMAL Normal display (no highlight)
A_STANDOUT Best highlighting mode of the terminal.
A_UNDERLINE Underlining
A_REVERSE Reverse video
A_BLINK Blinking
A_DIM Half bright
A_BOLD Extra bright or bold
A_PROTECT Protected mode
A_INVIS Invisible or blank mode
A_ALTCHARSET Alternate character set
A_CHARTEXT Bit-mask to extract a character
COLOR_PAIR(n) Color-pair number n
*/
static void normal_color_theme(void)
{
/* automatically add color... */
#define mkattr(name, attr) do { \
attributes[name] = attr | COLOR_PAIR(name); } while (0)
mkattr(NORMAL, NORMAL);
mkattr(MAIN_HEADING, A_BOLD | A_UNDERLINE);
mkattr(MAIN_MENU_FORE, A_REVERSE);
mkattr(MAIN_MENU_BACK, A_NORMAL);
mkattr(MAIN_MENU_GREY, A_NORMAL);
mkattr(MAIN_MENU_HEADING, A_BOLD);
mkattr(MAIN_MENU_BOX, A_NORMAL);
mkattr(SCROLLWIN_TEXT, A_NORMAL);
mkattr(SCROLLWIN_HEADING, A_BOLD);
mkattr(SCROLLWIN_BOX, A_BOLD);
mkattr(DIALOG_TEXT, A_BOLD);
mkattr(DIALOG_BOX, A_BOLD);
mkattr(DIALOG_MENU_FORE, A_STANDOUT);
mkattr(DIALOG_MENU_BACK, A_NORMAL);
mkattr(INPUT_BOX, A_NORMAL);
mkattr(INPUT_HEADING, A_BOLD);
mkattr(INPUT_TEXT, A_NORMAL);
mkattr(INPUT_FIELD, A_UNDERLINE);
mkattr(FUNCTION_HIGHLIGHT, A_BOLD);
mkattr(FUNCTION_TEXT, A_REVERSE);
}
static void no_colors_theme(void)
{
/* automatically add highlight, no color */
#define mkattrn(name, attr) { attributes[name] = attr; }
mkattrn(NORMAL, NORMAL);
mkattrn(MAIN_HEADING, A_BOLD | A_UNDERLINE);
mkattrn(MAIN_MENU_FORE, A_STANDOUT);
mkattrn(MAIN_MENU_BACK, A_NORMAL);
mkattrn(MAIN_MENU_GREY, A_NORMAL);
mkattrn(MAIN_MENU_HEADING, A_BOLD);
mkattrn(MAIN_MENU_BOX, A_NORMAL);
mkattrn(SCROLLWIN_TEXT, A_NORMAL);
mkattrn(SCROLLWIN_HEADING, A_BOLD);
mkattrn(SCROLLWIN_BOX, A_BOLD);
mkattrn(DIALOG_TEXT, A_NORMAL);
mkattrn(DIALOG_BOX, A_BOLD);
mkattrn(DIALOG_MENU_FORE, A_STANDOUT);
mkattrn(DIALOG_MENU_BACK, A_NORMAL);
mkattrn(INPUT_BOX, A_BOLD);
mkattrn(INPUT_HEADING, A_BOLD);
mkattrn(INPUT_TEXT, A_NORMAL);
mkattrn(INPUT_FIELD, A_UNDERLINE);
mkattrn(FUNCTION_HIGHLIGHT, A_BOLD);
mkattrn(FUNCTION_TEXT, A_REVERSE);
}
void set_colors()
{
start_color();
use_default_colors();
set_normal_colors();
if (has_colors()) {
normal_color_theme();
} else {
/* give defaults */
no_colors_theme();
}
}
/* this changes the windows attributes !!! */
void print_in_middle(WINDOW *win,
int starty,
int startx,
int width,
const char *string,
chtype color)
{ int length, x, y;
float temp;
if (win == NULL)
win = stdscr;
getyx(win, y, x);
if (startx != 0)
x = startx;
if (starty != 0)
y = starty;
if (width == 0)
width = 80;
length = strlen(string);
temp = (width - length) / 2;
x = startx + (int)temp;
(void) wattrset(win, color);
mvwprintw(win, y, x, "%s", string);
refresh();
}
int get_line_no(const char *text)
{
int i;
int total = 1;
if (!text)
return 0;
for (i = 0; text[i] != '\0'; i++)
if (text[i] == '\n')
total++;
return total;
}
const char *get_line(const char *text, int line_no)
{
int i;
int lines = 0;
if (!text)
return 0;
for (i = 0; text[i] != '\0' && lines < line_no; i++)
if (text[i] == '\n')
lines++;
return text+i;
}
int get_line_length(const char *line)
{
int res = 0;
while (*line != '\0' && *line != '\n') {
line++;
res++;
}
return res;
}
/* print all lines to the window. */
void fill_window(WINDOW *win, const char *text)
{
int x, y;
int total_lines = get_line_no(text);
int i;
getmaxyx(win, y, x);
/* do not go over end of line */
total_lines = min(total_lines, y);
for (i = 0; i < total_lines; i++) {
char tmp[x+10];
const char *line = get_line(text, i);
int len = get_line_length(line);
strncpy(tmp, line, min(len, x));
tmp[len] = '\0';
mvwprintw(win, i, 0, "%s", tmp);
}
}
/* get the message, and buttons.
* each button must be a char*
* return the selected button
*
* this dialog is used for 2 different things:
* 1) show a text box, no buttons.
* 2) show a dialog, with horizontal buttons
*/
int btn_dialog(WINDOW *main_window, const char *msg, int btn_num, ...)
{
va_list ap;
char *btn;
int btns_width = 0;
int msg_lines = 0;
int msg_width = 0;
int total_width;
int win_rows = 0;
WINDOW *win;
WINDOW *msg_win;
WINDOW *menu_win;
MENU *menu;
ITEM *btns[btn_num+1];
int i, x, y;
int res = -1;
va_start(ap, btn_num);
for (i = 0; i < btn_num; i++) {
btn = va_arg(ap, char *);
btns[i] = new_item(btn, "");
btns_width += strlen(btn)+1;
}
va_end(ap);
btns[btn_num] = NULL;
/* find the widest line of msg: */
msg_lines = get_line_no(msg);
for (i = 0; i < msg_lines; i++) {
const char *line = get_line(msg, i);
int len = get_line_length(line);
if (msg_width < len)
msg_width = len;
}
total_width = max(msg_width, btns_width);
/* place dialog in middle of screen */
y = (getmaxy(stdscr)-(msg_lines+4))/2;
x = (getmaxx(stdscr)-(total_width+4))/2;
/* create the windows */
if (btn_num > 0)
win_rows = msg_lines+4;
else
win_rows = msg_lines+2;
win = newwin(win_rows, total_width+4, y, x);
keypad(win, TRUE);
menu_win = derwin(win, 1, btns_width, win_rows-2,
1+(total_width+2-btns_width)/2);
menu = new_menu(btns);
msg_win = derwin(win, win_rows-2, msg_width, 1,
1+(total_width+2-msg_width)/2);
set_menu_fore(menu, attributes[DIALOG_MENU_FORE]);
set_menu_back(menu, attributes[DIALOG_MENU_BACK]);
(void) wattrset(win, attributes[DIALOG_BOX]);
box(win, 0, 0);
/* print message */
(void) wattrset(msg_win, attributes[DIALOG_TEXT]);
fill_window(msg_win, msg);
set_menu_win(menu, win);
set_menu_sub(menu, menu_win);
set_menu_format(menu, 1, btn_num);
menu_opts_off(menu, O_SHOWDESC);
menu_opts_off(menu, O_SHOWMATCH);
menu_opts_on(menu, O_ONEVALUE);
menu_opts_on(menu, O_NONCYCLIC);
set_menu_mark(menu, "");
post_menu(menu);
touchwin(win);
refresh_all_windows(main_window);
while ((res = wgetch(win))) {
switch (res) {
case KEY_LEFT:
menu_driver(menu, REQ_LEFT_ITEM);
break;
case KEY_RIGHT:
menu_driver(menu, REQ_RIGHT_ITEM);
break;
case 10: /* ENTER */
case 27: /* ESCAPE */
case ' ':
case KEY_F(F_BACK):
case KEY_F(F_EXIT):
break;
}
touchwin(win);
refresh_all_windows(main_window);
if (res == 10 || res == ' ') {
res = item_index(current_item(menu));
break;
} else if (res == 27 || res == KEY_F(F_BACK) ||
res == KEY_F(F_EXIT)) {
res = KEY_EXIT;
break;
}
}
unpost_menu(menu);
free_menu(menu);
for (i = 0; i < btn_num; i++)
free_item(btns[i]);
delwin(win);
return res;
}
int dialog_inputbox(WINDOW *main_window,
const char *title, const char *prompt,
const char *init, char **resultp, int *result_len)
{
int prompt_lines = 0;
int prompt_width = 0;
WINDOW *win;
WINDOW *prompt_win;
WINDOW *form_win;
PANEL *panel;
int i, x, y;
int res = -1;
int cursor_position = strlen(init);
int cursor_form_win;
char *result = *resultp;
if (strlen(init)+1 > *result_len) {
*result_len = strlen(init)+1;
*resultp = result = realloc(result, *result_len);
}
/* find the widest line of msg: */
prompt_lines = get_line_no(prompt);
for (i = 0; i < prompt_lines; i++) {
const char *line = get_line(prompt, i);
int len = get_line_length(line);
prompt_width = max(prompt_width, len);
}
if (title)
prompt_width = max(prompt_width, strlen(title));
/* place dialog in middle of screen */
y = (getmaxy(stdscr)-(prompt_lines+4))/2;
x = (getmaxx(stdscr)-(prompt_width+4))/2;
strncpy(result, init, *result_len);
/* create the windows */
win = newwin(prompt_lines+6, prompt_width+7, y, x);
prompt_win = derwin(win, prompt_lines+1, prompt_width, 2, 2);
form_win = derwin(win, 1, prompt_width, prompt_lines+3, 2);
keypad(form_win, TRUE);
(void) wattrset(form_win, attributes[INPUT_FIELD]);
(void) wattrset(win, attributes[INPUT_BOX]);
box(win, 0, 0);
(void) wattrset(win, attributes[INPUT_HEADING]);
if (title)
mvwprintw(win, 0, 3, "%s", title);
/* print message */
(void) wattrset(prompt_win, attributes[INPUT_TEXT]);
fill_window(prompt_win, prompt);
mvwprintw(form_win, 0, 0, "%*s", prompt_width, " ");
cursor_form_win = min(cursor_position, prompt_width-1);
mvwprintw(form_win, 0, 0, "%s",
result + cursor_position-cursor_form_win);
/* create panels */
panel = new_panel(win);
/* show the cursor */
curs_set(1);
touchwin(win);
refresh_all_windows(main_window);
while ((res = wgetch(form_win))) {
int len = strlen(result);
switch (res) {
case 10: /* ENTER */
case 27: /* ESCAPE */
case KEY_F(F_HELP):
case KEY_F(F_EXIT):
case KEY_F(F_BACK):
break;
case 127:
case KEY_BACKSPACE:
if (cursor_position > 0) {
memmove(&result[cursor_position-1],
&result[cursor_position],
len-cursor_position+1);
cursor_position--;
cursor_form_win--;
len--;
}
break;
case KEY_DC:
if (cursor_position >= 0 && cursor_position < len) {
memmove(&result[cursor_position],
&result[cursor_position+1],
len-cursor_position+1);
len--;
}
break;
case KEY_UP:
case KEY_RIGHT:
if (cursor_position < len) {
cursor_position++;
cursor_form_win++;
}
break;
case KEY_DOWN:
case KEY_LEFT:
if (cursor_position > 0) {
cursor_position--;
cursor_form_win--;
}
break;
case KEY_HOME:
cursor_position = 0;
cursor_form_win = 0;
break;
case KEY_END:
cursor_position = len;
cursor_form_win = min(cursor_position, prompt_width-1);
break;
default:
if ((isgraph(res) || isspace(res))) {
/* one for new char, one for '\0' */
if (len+2 > *result_len) {
*result_len = len+2;
*resultp = result = realloc(result,
*result_len);
}
/* insert the char at the proper position */
memmove(&result[cursor_position+1],
&result[cursor_position],
len-cursor_position+1);
result[cursor_position] = res;
cursor_position++;
cursor_form_win++;
len++;
} else {
mvprintw(0, 0, "unknown key: %d\n", res);
}
break;
}
if (cursor_form_win < 0)
cursor_form_win = 0;
else if (cursor_form_win > prompt_width-1)
cursor_form_win = prompt_width-1;
wmove(form_win, 0, 0);
wclrtoeol(form_win);
mvwprintw(form_win, 0, 0, "%*s", prompt_width, " ");
mvwprintw(form_win, 0, 0, "%s",
result + cursor_position-cursor_form_win);
wmove(form_win, 0, cursor_form_win);
touchwin(win);
refresh_all_windows(main_window);
if (res == 10) {
res = 0;
break;
} else if (res == 27 || res == KEY_F(F_BACK) ||
res == KEY_F(F_EXIT)) {
res = KEY_EXIT;
break;
} else if (res == KEY_F(F_HELP)) {
res = 1;
break;
}
}
/* hide the cursor */
curs_set(0);
del_panel(panel);
delwin(prompt_win);
delwin(form_win);
delwin(win);
return res;
}
/* refresh all windows in the correct order */
void refresh_all_windows(WINDOW *main_window)
{
update_panels();
touchwin(main_window);
refresh();
}
/* layman's scrollable window... */
void show_scroll_win(WINDOW *main_window,
const char *title,
const char *text)
{
int res;
int total_lines = get_line_no(text);
int x, y, lines, columns;
int start_x = 0, start_y = 0;
int text_lines = 0, text_cols = 0;
int total_cols = 0;
int win_cols = 0;
int win_lines = 0;
int i = 0;
WINDOW *win;
WINDOW *pad;
PANEL *panel;
getmaxyx(stdscr, lines, columns);
/* find the widest line of msg: */
total_lines = get_line_no(text);
for (i = 0; i < total_lines; i++) {
const char *line = get_line(text, i);
int len = get_line_length(line);
total_cols = max(total_cols, len+2);
}
/* create the pad */
pad = newpad(total_lines+10, total_cols+10);
(void) wattrset(pad, attributes[SCROLLWIN_TEXT]);
fill_window(pad, text);
win_lines = min(total_lines+4, lines-2);
win_cols = min(total_cols+2, columns-2);
text_lines = max(win_lines-4, 0);
text_cols = max(win_cols-2, 0);
/* place window in middle of screen */
y = (lines-win_lines)/2;
x = (columns-win_cols)/2;
win = newwin(win_lines, win_cols, y, x);
keypad(win, TRUE);
/* show the help in the help window, and show the help panel */
(void) wattrset(win, attributes[SCROLLWIN_BOX]);
box(win, 0, 0);
(void) wattrset(win, attributes[SCROLLWIN_HEADING]);
mvwprintw(win, 0, 3, " %s ", title);
panel = new_panel(win);
/* handle scrolling */
do {
copywin(pad, win, start_y, start_x, 2, 2, text_lines,
text_cols, 0);
print_in_middle(win,
text_lines+2,
0,
text_cols,
"<OK>",
attributes[DIALOG_MENU_FORE]);
wrefresh(win);
res = wgetch(win);
switch (res) {
case KEY_NPAGE:
case ' ':
case 'd':
start_y += text_lines-2;
break;
case KEY_PPAGE:
case 'u':
start_y -= text_lines+2;
break;
case KEY_HOME:
start_y = 0;
break;
case KEY_END:
start_y = total_lines-text_lines;
break;
case KEY_DOWN:
case 'j':
start_y++;
break;
case KEY_UP:
case 'k':
start_y--;
break;
case KEY_LEFT:
case 'h':
start_x--;
break;
case KEY_RIGHT:
case 'l':
start_x++;
break;
}
if (res == 10 || res == 27 || res == 'q' ||
res == KEY_F(F_HELP) || res == KEY_F(F_BACK) ||
res == KEY_F(F_EXIT))
break;
if (start_y < 0)
start_y = 0;
if (start_y >= total_lines-text_lines)
start_y = total_lines-text_lines;
if (start_x < 0)
start_x = 0;
if (start_x >= total_cols-text_cols)
start_x = total_cols-text_cols;
} while (res);
del_panel(panel);
delwin(win);
refresh_all_windows(main_window);
}

Some files were not shown because too many files have changed in this diff Show More