Commit Graph

75 Commits

Author SHA1 Message Date
Elliott Hughes
cbe970b82a Fix build by removing libportable from the default build.
Easier than working out how to fix the fenv stuf...

Change-Id: Id457d4fcd790b1fc13047cba29c7d47118196a87
2014-06-09 14:51:24 -07:00
Elliott Hughes
fc9ac9f173 Fix libportable build breakage.
Change-Id: Ic85e36cf55b7486b50fc9f1513f10a8ade5e86e9
2014-06-07 22:24:44 -07:00
Elliott Hughes
caebfa9b50 Fix MIPS build.
We really ought to remove libportable.

Bug: 14903517
Change-Id: Id96b24bfe329096adffd94d452f440295d8aa83a
2014-05-23 14:24:15 -07:00
Andrew Hsieh
67dc50cbbb Merge changes Ie67acf11,Ia9c03558
* changes:
  Remove non-existanec functions/variables from libc.so
  Restore stdint.h for android-3..19 to the original headers
2014-05-16 03:17:19 +00:00
David 'Digit' Turner
e398009921 libportable: Add dependency on libdl.
The patch at [1] was reverted because ndk/sources/android/cpu-features
is now part of the platform build (as a dependency of libportable), and
now requires dlopen()/dlsym()/dlclose().

Because the platform build system doesn't support LOCAL_EXPORT_LDLIBS,
add the dependency to libportable's own module definition instead.
After this patch is submitted, it's possible to re-apply the original
patch and get a working build.

[1] https://android-review.googlesource.com/#/c/91380/

BUG=13679666

Change-Id: I54b4376a562242d21631eaf13090650decfe791d
2014-05-12 15:10:01 +02:00
Andrew Hsieh
154e19fda6 Restore stdint.h for android-3..19 to the original headers
$NDK/tests/standalone/run.sh fail to run with last update on stdint.h
to android-20 level.  Restore stdint.h for fear of the new one breaking
the existing apps

Also fix signal_portable.h to use SIGRTMIN/MAX in old headers
(which got renamed to __SIGRTMIN in new header)

Also change _JBLEN to 1024 which shall be large enough to store CPU
states for forseable future.

Change-Id: Ia9c03558a258c10434eb8e6985adc122532feaa3
2014-05-12 12:14:33 +08:00
Pavel Chupin
4120ceca07 Update signal.h from bionic with transition from SIGRTMIN to __SIGRTMIN
Update signal.c for build with old platforms

Change-Id: Ica87465a73004c0885d51e384acd4f42947cc19b
Signed-off-by: Pavel Chupin <pavel.v.chupin@intel.com>
2014-05-08 15:34:45 +04:00
Brian Carlstrom
fb9c4e0c9f Track transition from SIGRTMIN to __SIGRTMIN
Change-Id: I69064edf1a7e95c91f90d9b05c1cf3f9c8c46747
2014-04-30 17:58:41 -07:00
WenHan Gu
70174f1084 Update libportable to catch up bionic changes.
Note __open should not be used anymore.
Also, fix a x86 fenv bug.

Change-Id: I8430ccfdb7d7685e1ee6e71333d65590c09e3d6c
2014-04-23 21:47:49 +08:00
WenHan Gu
a8ba6f6147 Remove $(info...) accidentally committed in Makefile.
Change-Id: Ifc043619bccf7e208b6a971987fcc78f0e763a93
2014-04-11 19:14:40 +08:00
WenHan Gu
859559268d Implement libportable for unknown arch 64bit.
Change-Id: I1e1fd8714b907bfccd5fa8df12a94697886e59cb
2014-04-08 16:28:22 +08:00
Elliott Hughes
72af45c116 Insulate libportable from bionic changes.
Really libportable should take its own copy of BSD's <machine/asm.h>,
rather than relying on bionic's hacked-about copies.

Change-Id: I02248045a903dc4ca0d6ed1054ecb1cd54da335e
2014-02-20 11:19:32 -08:00
Elliott Hughes
dfb6545c6b MIPS hasn't supported SA_RESTORER since 2.5 kernels.
Change-Id: Ia3500168ab5ba5ba381d0195e9ecc26a618bf505
2013-11-20 11:34:53 -08:00
Andrew Hsieh
4abacac32d Merge "Fix prototype of poll" 2013-11-04 00:30:46 +00:00
Elliott Hughes
0d86e637f6 Fix build.
Change-Id: If09775ab21fef5b1df0222f07443a55190ae7a1c
2013-10-31 18:41:52 -07:00
Andrew Hsieh
61097c7e51 Fix prototype of poll
from poll(struct pollfd *, nfds_t, long) to
poll(struct pollfd *, nfds_t, int)

See 11952073af22568bba0b661f7a9d4402c443a888
and ebfbb367fb

Change-Id: Idba600d4b172404f0a1d5d715febcba8a495a770
2013-11-01 08:33:08 +08:00
Elliott Hughes
ebfbb367fb Fix incorrect extern declaration of poll(2).
Change-Id: I9ed5136a6b7d20fd0520e09d455a0447ea73e122
2013-10-25 09:07:42 -07:00
Andrew Hsieh
16af6afb9a Refresh include/sys/vfs.h
1. Sync bionic's, remove mips-specific one
2. Fix statfs.c to transfer the new f_flags too
3. Revise comment about --wrap=symbol

Change-Id: If68818e3dcb2a4056cd0b2e100fcfb8b2156c33a
2013-10-07 15:39:47 +08:00
Brian Carlstrom
22c1fdc8f3 Fix MIPS build
(cherry picked from commit f9695cbd669fd024d805319a279c7c93db7263dc)

Change-Id: Ife90c3c5094b5b429f81cf0168a2d0c550aae02f
2013-10-02 17:11:57 -07:00
Andrew Hsieh
85f9f76450 Merge "Workaround for libportable wait4 implementation." 2013-07-22 19:11:18 +00:00
Lai Wei-Chih
db279bedd6 [MIPS] Add missing REAL macros.
Change-Id: If396e16a759d90f94213deb536f3d1c9dcb6c132
2013-07-15 10:09:06 +08:00
WenHan Gu
3d4172fa77 Workaround for libportable wait4 implementation.
Follow https://android-review.googlesource.com/#/c/55573 and
this should be revert once being solved.

Change-Id: Ib9dabc1effaf59d541bc80bfce3f250a3d5fc8b2
2013-06-20 12:15:40 +08:00
Lai Wei-Chih
7e7f8b295f Implement optimized __swap16md and __swap32md. 2013-05-15 21:04:52 +08:00
Andrew Hsieh
13dfb24d10 Merge "[MIPS] Cleaned up sig_0 error messages and added a few more checks." 2013-04-07 01:07:31 +00:00
Pete Delaney
b294db4498 [MIPS] Cleaned up sig_0 error messages and added a few more checks.
Change-Id: I316e60d891af99c18fc4b838b35a6d8977d0e7c8
Signed-off-by: Pete Delaney <piet.delaney@imgtec.com>
2013-04-05 16:00:35 -07:00
Chris Dearman
8663dd74ad [MIPS] Add portable versions of wait(), wait3() and wait4()
Added logging and refactored the code

Change-Id: Idcd2a9e8fbe933d410e9d67f0789fa074e89baef
2013-04-05 15:19:30 -07:00
Lai Wei-Chih
521bcfb17a [libportable] Add fenv support.
Fix ndk/tests/device/fenv.

Change-Id: I46e1b47c3bec5213e827fabe311ef9e29a28195b
2013-03-26 22:09:17 +08:00
Andrew Hsieh
2f6ae26a67 Fix build >= JB
File arch-mips/sigsetjmp.S includes <asm-generic/portability.h>
already defined in LOCAL_CFLAGS, and build system prior JB
passes LOCAL_CFLAGS for building *.S as well, but no more >=JB.

Use LOCAL_C_INCLUDES instead (pass for *.S too)

Change-Id: I7e6d6e838d632f980aa6c9b6b2b2862bd7de11b1
2013-03-20 11:35:43 -07:00
Andrew Hsieh
fa33fb1132 Merge "Clean up unnecessary wrap functions." 2013-03-20 14:43:48 +00:00
Lai Wei-Chih
3917ab0c97 Clean up unnecessary wrap functions.
For wrap functions that call real function directly, it could be removed.

Change-Id: I261aa6639349da776e835b9eb74f00b246d4e3c1
2013-03-20 14:30:13 +08:00
Andrew Hsieh
78175cbcc5 Don't use errno directly
errno in MIPS is macro for "*__errno)()".  Use of errno inside
WRAP(__errno)() cause infinite loop.  This may happen in other
wrapper functions which access errno.

Change all error to *REAL(__error)()

Change-Id: I1c09d84a58855bd7896fcd4e70f740b8a0f0b386
2013-03-19 18:06:30 -07:00
Andrew Hsieh
6433ec22b1 Use linker -Wl,--wrap=symbol
Linker --wrap option resolves to __wrap_symbol for undefined symbol.
During the compilation of host libportable.a, __HOST__ is defined
to rename all portable functions to  __wrap_symbol, and the
real function to __real_symbol.  This way libportable.a can be
validated at host w/o changes of user's source code.

See http://sourceware.org/binutils/docs/ld/Options.html

Change-Id: Idcbe53dd642536f3dc2be85a875f95535b9dc0b1
2013-03-18 21:55:39 -07:00
Andrew Hsieh
8052dc36d9 Make libportable.a compile on host
where cutils/log.h doesn't exit

Change-Id: I0ed6389a28f419f90ccbc6719b72895b366bb611
2013-03-12 22:48:28 -07:00
WenHan Gu
55128d1aca [ARM] Add unwind portable header adaptor.
ARM expanse some functions to others. For example,
_Unwind_GetIP will be inlined to _Unwind_GetGR, which
will be inlined to _Unwind_VRS_Get. This happens at
header-included level.

However, we use Itanium _Unwind_* header as portable one.
We do the inlining in ARM libportable to prevent
undefined reference to these functions.

Change-Id: Iad94c4a92531cdcfbcf535443fb257d02cb24c43
Signed-off-by: WenHan Gu <Wenhan.gu@mediatek.com>
2013-03-06 10:25:32 +08:00
Andrew Hsieh
27bd326dc3 Merge "[MIPS] Allow errno safe logging" 2013-02-26 11:55:15 +00:00
Pete Delaney
7ddc46bf9f [MIPS] Allow errno safe logging
Change-Id: I35b4a9007572bec15ab7ba81aad3756fa96c5eb2
Signed-off-by: Chris Dearman <chris.dearman@imgtec.com>
Signed-off-by: Pete Delaney <piet.delaney@imgtec.com>
2013-02-25 22:52:02 -08:00
Pete Delaney
858086ef5f [MIPS] Fixed mmap_portable()
mmap_portable() was calling madvise() and disrupting errno.
The call to madvise() has been dropped in bionic's version of
mmap() and now we just call that.

Updated helper functions to use the newer <class>_pton() style.

Added logging calls; like the rest of Lib-Portable,
it frequently helps save time.


Change-Id: I39f77899f0808e3af5fd2f6610355d2e33c09d85
Signed-off-by: Pete Delaney <piet.delaney@imgtec.com>
Signed-off-by: Chris Dearman <chris.dearman@imgtec.com>
2013-02-25 21:45:47 -08:00
Pete Delaney
183963db80 [MIPS] Portable versions of setjmp, sigsetjmp, ...
The portable (ARM) jmp_buf and sigjmp_buf structures are smaller than the native
(MIPS) structures so it is not safe to simply call the standard bionic routines.

Luckily there is a lot of redundant space in the standard MIPS structures
and it is possible to save all of the needed registers in the area provided by the
ARM application.

Change-Id: I694a90516cdf96d581863e833776092830afe3cc
Signed-off-by: Chris Dearman <chris.dearman@imgtec.com>
Signed-off-by: Pete Delaney <piet.delaney@imgtec.com>
Signed-off-by: Paul Lind <paul.lind@imgtec.com>
2013-02-20 20:07:33 -08:00
Pete Delaney
860342e989 [MIPS] Added support for STDIO sflags().
sflags() returns open() flags via a pointer passed to sflags().

Change-Id: I854dc4302bf09318e97eb3129a8debf98dbe8735
Signed-off-by: Chris Dearman <chris.dearman@imgtec.com>
Signed-off-by: Pete Delaney <piet.delaney@imgtec.com>
Signed-off-by: Paul Lind <paul.lind@imgtec.com>
2013-02-20 20:06:46 -08:00
Pete Delaney
998548881e [MIPS] Fixed a bug and improved fcntl_portable.
Improved Logging, tweaked func names, fixed double mappings
of mips_command.

While debugging the LTP fcntl07* set of failures I modified
a few ALOGV() calls to make logging more helpful in
fcntl_cmd_pton().

Change-Id: Idc9a7c8dd27883dff1e555769d6a8e331f4fdeb9
Signed-off-by: Pete Delaney <piet.delaney@imgtec.com>
Signed-off-by: Chris Dearman <chris.dearman@imgtec.com>
Signed-off-by: Paul Lind <paul.lind@imgtec.com>
2013-02-20 20:06:13 -08:00
Pete Delaney
b7b5e9d3fb [MIPS] Extend Signal Mapping to include RT Signals.
Both MIPS and ARM use signals 32 to 64 for real-time signals.
ARM signals 32 to 64 can't be masked due to the signal
mask being limited to 32 bits. MIPS signals 32 to 64 can be
masked, and Lib-Portable correctly supports this feature.

Fixes LTP tests rt_sigaction01 and ptrace05.

Fixed a few signal problems; Ex last Real Time Signal

1.  The signal handler for signal number 64, the last real
    time signal, wasn't being intercepted. Now catching
    signal number 64.

2.  sigaction() to only change *oldact when return
    value is zero.

3.  Fixed rt_sigqueue_portable() to set errno when
    returning a -1.

4.  Fixed a few cases where signal 0 was being added
    to the table of signal handlers for signal remapping.
    Harmless but a bit silly.

Change-Id: I1a71113d7ce4b60f3a587dae4e243dc88dd6d6bc
Signed-off-by: Pete Delaney <piet.delaney@imgtec.com>
Signed-off-by: Chris Dearman <chris.dearman@imgtec.com>
Signed-off-by: Paul Lind <paul.lind@imgtec.com>
2013-02-20 20:05:46 -08:00
Pete Delaney
c684613e19 [MIPS] Added support for file descriptor related system calls.
Specifically these functions are now supported:
    signalfd4(), eventfd(), timerfd_create(),
    pipe(), and inotify_init1()

Modified syscall_portable() to call signalfd4_portable(),
eventfd_portable(), eventfd2_portable(), and timerfd_create().
These system calls enable the read system calls to access
kernel data structures.

The signalfd4() enables read to return a signalfd_siginfo structure
which have the signal number and errno mapped until an execve().
This is similar to the maintaining a table of signal handlers to
map the signal numbers done earlier. This mapping is extended to
the process after an execve() by passing the final set of mapped
file descriptors via a pair of environment variables.

Disabling signal and file descriptor read mapping in parent
if the child would break the mapping algorithms.

This code passes at least all of the non-POSIX LTP tests,
including an updated LTP signalfd4 test that posts SIGNALS
and uses this read() mechanism to get signal info.

inotify_init1 is similar to signalfd(), timerfd() and other
filefd functions which map read() calls. Unlike signalfd(), and
similar to timerfd(), the reads don't appear to need to be mapped.

The members of the inotify_event structure appear to be generic.
The mask bits like IN_MOVE_FROM and IN_MOVE_TO are defined in
generic files. The LTP test in testcases/kernel/syscalls/inotify
test for the inotify_event structure being inotify_event structure
being read and does seem to check it contents being correct.

Change-Id: I3f2dcd4e33437ac953cd9f67f56dccc6ec6e5e6f
Signed-off-by: Pete Delaney <piet.delaney@imgtec.com>
Signed-off-by: Chris Dearman <chris.dearman@imgtec.com>
Signed-off-by: Paul Lind <paul.lind@imgtec.com>
2013-02-20 20:05:19 -08:00
Pete Delaney
dbbf0045b6 [MIPS] Fixed LTP Tests 9 and 20 of getaddrinfo_01.
Just mapping struct addrinfo socktype member; everything else is
identical in ARM vs MIPS cpp comparison.

Lots of tests in getaddrinfo_01 fail on Android, but test 9 and 20
were breaking with lib-portable only. This fix corrects that
difference in the test results.

Change-Id: I93c7948cc206ec60b867844857e3e19350c5f5e9
Signed-off-by: Pete Delaney <piet.delaney@imgtec.com>
Signed-off-by: Chris Dearman <chris.dearman@imgtec.com>
Signed-off-by: Paul Lind <paul.lind@imgtec.com>
2013-02-20 20:04:01 -08:00
Pete Delaney
a89a549987 [MIPS] Added missing _NR_* system call support and cleaned up.
Change-Id: I18499a73ad3732a16edb941c4db9fc2811dfe5d5
Signed-off-by: Pete Delaney <piet.delaney@imgtec.com>
Signed-off-by: Chris Dearman <chris.dearman@imgtec.com>
Signed-off-by: Paul Lind <paul.lind@imgtec.com>
2013-02-20 20:03:24 -08:00
Pete Delaney
6732a917fd [MIPS] Add Real Time Signal Functions and minor bug fixes.
1. Added:
        rt_sigaction(),
        rt_sigprocmask(), and
        rt_sigtimedwait portable syscalls.

    2. Fixed a bug in signal.c.

    3. Added a new pair of functions to map siginfo_t
       between portable and native formats.

    4. Fixed LTP rt_siqqueueinfo01 and siqqueue() test failures.

    5. Using these new siginfo_t mapping functions in functions
       that were previously doing this functionality internally:
          a. mips_sigaction_handler()
          b. __rt_sigtimedwait_portable()

    6. Modified rt_sigqueueinfo_portable():
      a. Added a call to this new siginfo_pton() function.
      b. Fixed native_sig calculation; it was converting
         with the wrong function (ntop instead of pton).

    7. Added the Thread Group Flavor of Real Time version of
       sigqueueinfo().

    8. Added and tested the sigqueue() implementation thought it's
       not supported by Android yet. Using a LTP library function
       to implement it via syscall for now.  Android has a
       sysconf() regression that will be addressed in a separate
       commit.

    9. Modified some of the variable names in:

          __rt_sigtimedwait_portable()

       to make it easier/faster to read.

    10. Fixed a SIGTERM --> SIGTERM_PORTABLE mapping bug.

Most LTP Posix sigqueue() tests and the rt_sigqueueinfo01() test
now pass with this commit.

Change-Id: I5a2c28c4f5863cc013fe0c7fce819fa5b7a6dcc7
Signed-off-by: Pete Delaney <piet.delaney@imgtec.com>
Signed-off-by: Douglas Leung <douglas.leung@imgtec.com>
Signed-off-by: Chris Dearman <chris.dearman@imgtec.com>
Signed-off-by: Paul Lind <paul.lind@imgtec.com>
2013-02-20 20:02:52 -08:00
Pete Delaney
4977f77e79 [MIPS] Unify around a consistent *_ntop/*_pton style.
Unifying around the <class>_ntop() style;
changing ntop_*() and pton_* to *_ntop() and *_pton().

Also added portable versions of strerror() and strerror_r()
while updating the errno.c file.

Change-Id: I2a0f40963f293ef9387b0dbcb3426276d301a17c
Signed-off-by: Pete Delaney <piet.delaney@imgtec.com>
Signed-off-by: Chris Dearman <chris.dearman@imgtec.com>
Signed-off-by: Paul Lind <paul.lind@imgtec.com>
2013-02-20 20:02:09 -08:00
Pete Delaney
2928edfab9 [MIPS] Tighten up code to fit within 100 characters lines.
File poll.c had a wide line and the reason for the asymmetric
mapping of the event flags wasn't obvious on my reviewing
this code. Seemed to justify adding some clarification.

Both signal.c and socket.c were using lengthy function names
for Portable <--> Native mappings. Switch to the newer *_ntop()
style in wide files and made the ALOGV() messages more useful.

Also changed mapping of portable SIGSTKFLT to native SIGEMT
while editing a wide line in the signal.c file.  MIPS has no
SIGSTKFLT signal, nor ARM a signal SIGEMT. Using SIGEMT as a
proxy for SIGSTKFLT_PORTABLE for Lib-Portable applications.
This makes the signal mapping reversible during signal handling.

Fixed ALOGV() Entry/Exit brackets to match.

Change-Id: I9a91992e67ab24322db608424bf69c47fad8e18d
Signed-off-by: Pete Delaney <piet.delaney@imgtec.com>
Signed-off-by: Chris Dearman <chris.dearman@imgtec.com>
Signed-off-by: Paul Lind <paul.lind@imgtec.com>
2013-02-20 20:01:15 -08:00
Pete Delaney
8930ac5534 [MIPS] Expand TABS and remove redundant return parenthesis.
Also fixed syscall.c to use curly brackets in case
statements to be more like bionic.

Change-Id: I20ffab9a474a2132b47fb4e765966c956aab2aff
Signed-off-by: Pete Delaney <piet.delaney@imgtec.com>
Signed-off-by: Chris Dearman <chris.dearman@imgtec.com>
Signed-off-by: Paul Lind <paul.lind@imgtec.com>
2013-02-20 20:00:23 -08:00
Lai Wei-Chih
2c9e934fc5 Let users could query cpu features on device.
Change-Id: I9f5d7c66fb4248f5f8cbbf4c350b82a5b8c3aee9
2012-10-23 10:05:22 +08:00
Pete Delaney
bf03a1b304 [MIPS] Add support for waitpid.
Change-Id: I7b3b90f9a64d40c5aa72c74cac6881f1189c1462
Signed-off-by: Chris Dearman <chris@mips.com>
Signed-off-by: Pete Delaney  <piet@mips.com>
2012-10-05 02:18:27 -07:00