Commit graph

254 commits

Author SHA1 Message Date
Jun Nakajima
5288fee835 x86 libc: Fix the range to check the error
The spec says "A value in the range between -4095 to -1 indicates an error" (not -129).
This was pointed out in the comment in 22039.

Change-Id: I11b7c45015a9e4ccf09aed5364a889437eab6ab8
Signed-off-by: Jun Nakajima <jun.nakajima@intel.com>
2011-06-17 14:37:50 -07:00
David Turner
204d1f65db am b2c7e0c1: Merge "x86: Enable -fstack-protector"
* commit 'b2c7e0c18b7ab04cfe306277c79165de0612a2d1':
  x86: Enable -fstack-protector
2011-06-06 11:32:49 -07:00
David Turner
a57270b6ab am 56baceca: Merge "Update X86 Bionic CRT files for unwind/exceptions"
* commit '56baceca024f1cc2a5e8ef8c5e7ba7ea463d1ae2':
  Update X86 Bionic CRT files for unwind/exceptions
2011-06-06 11:32:38 -07:00
Bruce Beare
e0b4844a20 x86: Enable -fstack-protector
Change-Id: Ib69514c3afcb4c1f5e5f3f8cd91acfd145a0866c
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
2011-05-24 13:32:14 -07:00
Mark D Horn
dc3bc87b43 Update X86 Bionic CRT files for unwind/exceptions
Several updates to Bionic crt*.o files to implement Linux/x86
stack unwind/exception handling.
Mark __dso_handle as hidden.
Note: Requires complete rebuild due to CRT changes. Google will
need to regenerate and check-in all the prebuilt x86 CRT object
files and libraries which link to them.

Change-Id: I191ce1afb0dee7bbc28dcd9694e5919226dbd070
Signed-off-by: Bruce J Beare <bruce.j.beare@intel.com>
Signed-off-by: Mark D Horn <mark.d.horn@intel.com>
Author: Lu, Hongjiu <hongjiu.lu@intel.com>
2011-05-24 13:31:50 -07:00
David Turner
2b434862fd am 2b10d912: am fcee105b: Merge "x86 libc: fix the wrong return value of syscall"
* commit '2b10d912cc5a566818ff68f9af192033d8f8b2a9':
  x86 libc: fix the wrong return value of syscall
2011-04-11 14:46:44 -07:00
Kan-Ru Chen
8488efaa09 x86 libc: fix the wrong return value of syscall
According to Intel ABI spec, there is no need to save %eax, %ecx, %edx
on the stack. Worse, popping %eax will wipe out the return value.

Change-Id: Ida536c3b98174b8deef88f8f3b9352eaaeb7c0c0
2011-03-29 13:16:42 +08:00
Ken Sumrall
b130f00493 am ae2d5ba3: Add support for the utimensat(2) syscall to bionic.
* commit 'ae2d5ba31412c4f382ef405000baa866f35dd736':
  Add support for the utimensat(2) syscall to bionic.
2011-03-24 22:31:40 -07:00
Ken Sumrall
ae2d5ba314 Add support for the utimensat(2) syscall to bionic.
The kernel has supported this syscall for quite some time now,
but bionic did not.  Now that there is a need for it, let's
add it to bionic.

Change-Id: Ifcef3e46f1438d79435b600c4e6063857ab16903
2011-03-24 18:18:48 -07:00
Bruce Beare
48e1feaa9d Updated gcc 4.4.3 IA toolchain doesn't require the .ctors list
Change-Id: Ia840a19a45257128eccdcf25d105f500f2d90741
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
2011-02-16 17:50:23 -08:00
Bruce Beare
f4680b57ed Remove an extra register move.
Change-Id: I63c217b73203b44b1a2e74950b58f2ec12989cab
Author: H.J. Lu <hjl.tools@gmail.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
2011-02-03 12:21:04 -08:00
Bruce Beare
0f2001b147 Replace __atomic_XXX with GCC __sync_XXX intrinsics.
Change-Id: I14f275392fcd70cc15e307470e0a099777c7c09e
Author: H.J. Lu <hjl.tools@gmail.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
2011-02-03 12:21:03 -08:00
Bruce Beare
3c56ce497d use consistent guards for off_t and size_t defines for IA
Change-Id: Ie92b7597883c99e7f4101f4cf5e0ad267b4ee706
2011-01-07 11:42:54 -08:00
Bruce Beare
ce6c1d6184 Simplify variable typing for IA builds
Change-Id: I065e5176b3a15bd74ba832f8827b4a4e4837b0f7
2011-01-07 11:40:42 -08:00
Jean-Baptiste Queru
53c3e86fae am 3d302be4: Merge "android-x86: add sigsetjmp.S"
* commit '3d302be485bc2f62a889fac85e386c9b8775eb59':
  android-x86: add sigsetjmp.S
2010-12-29 11:29:33 -08:00
Chih-Wei Huang
18635d9c17 android-x86: add sigsetjmp.S
It adds two functions sigsetjmp and siglongjmp
that fix compiling errors in bluetooth and mksh.

Copy directly from sigsetjmp.S of OpenBSD.

Change-Id: I4696f82ee6f85d1c93cbdd3c9e40f4917d50f3a6
2010-12-26 09:22:13 -08:00
David 'Digit' Turner
95d751feac libc: Add ftruncate64 and improve 64-bit parameter syscall handling.
This patch improves the handling of 64-bit parameters in syscalls on ARM.
The ARM EABI mandates that 64-bit quantities be passed in even/odd register
pairs, which requires special treatment.

This allows us to simplify our implementations of pread() and pwrite()
and remove the C stubs for pread64() and pwrite64().

Also add ftruncate64() to <unistd.h>

Change-Id: I407e2fd223ba0093dd2d0b04c6152fadfc9ce3ef

Bug 3107933
2010-12-16 17:04:41 +01:00
David 'Digit' Turner
72e6fd4242 <sched.h>: Add sched_getcpu() and cpu_set_t
This adds the cpu_set_t type definition and related functions
and macros used to handle CPU thread affinity.

  sched_getcpu()
  sched_setaffinity()
  sched_getaffinity()

Change-Id: If382ecafde8926341a88478062b275553645065b
2010-12-06 13:42:54 +01:00
Jean-Baptiste Queru
82775ae0ac resolved conflicts for merge of 347db52a to gingerbread-plus-aosp
Change-Id: I706a5158e781cbbc00344a72badca1543bcbca15
2010-10-15 12:52:21 -07:00
Bruce Beare
124a542aa4 Update ATOM string routines to latest
Change-Id: I22a600e7f172681cfd38ff73a64e3fd07b284959
Signed-off-by: Lu, Hongjiu <hongjiu.lu@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
2010-10-11 12:33:58 -07:00
repo sync
686af0b3a5 resolved conflicts for merge of defd1622 to gingerbread-plus-aosp
Conflicts:
	libc/arch-arm/syscalls/eventfd.S
	libc/include/sys/eventfd.h
	libc/include/sys/linux-syscalls.h

Change-Id: I02f6e9536aa5478322240c199ff4c2f4367922d0
2010-09-28 12:23:55 +02:00
David 'Digit' Turner
a511f24561 am 9973a564: libc: Add missing waitid() implementation.
Merge commit '9973a564222b842eb7497fd6e659fe8c8c49e2b3' into gingerbread-plus-aosp

* commit '9973a564222b842eb7497fd6e659fe8c8c49e2b3':
  libc: Add missing waitid() implementation.
2010-09-28 00:22:25 -07:00
David 'Digit' Turner
defd162212 libc: add <sys/eventfd.h> and corresponding implementations.
Change-Id: Ide040884c456190226e580513099fdb8377e015b
2010-09-28 09:20:37 +02:00
David 'Digit' Turner
052fbd8808 am a3ae60d3: libc: Add missing fdatasync() implementation
Merge commit 'a3ae60d343661784e3f6f4566b276d8e6b8a06a7' into gingerbread-plus-aosp

* commit 'a3ae60d343661784e3f6f4566b276d8e6b8a06a7':
  libc: Add missing fdatasync() implementation
2010-09-28 00:19:31 -07:00
David 'Digit' Turner
9973a56422 libc: Add missing waitid() implementation.
Change-Id: I312ee608dbf9249e4886a10d45d13e3cda8a9042
2010-09-28 09:18:26 +02:00
David 'Digit' Turner
a3ae60d343 libc: Add missing fdatasync() implementation
Change-Id: I04bb655d77e414021e1f2a973329167ad76ca1c4
2010-09-28 09:17:17 +02:00
David 'Digit' Turner
914528cdc9 am 223ddfcf: Merge "libc: Add missing pipe2() declaration and implementation." into gingerbread
Merge commit '223ddfcfc4cb354641e70da31a60556248db5036' into gingerbread-plus-aosp

* commit '223ddfcfc4cb354641e70da31a60556248db5036':
  libc: Add missing pipe2() declaration and implementation.
2010-09-28 00:13:48 -07:00
David 'Digit' Turner
275cd48511 libc: Add missing pipe2() declaration and implementation.
Change-Id: Iacb914bd6ac5adc60c5671e6fef680ede21f9b0c
2010-09-27 17:33:08 +02:00
The Android Open Source Project
611793d6ab merge from open-source master
Change-Id: Ia22080192681c2ac596582d6cfdac732b1ff4c9f
2010-07-09 10:47:23 -07:00
David 'Digit' Turner
ab8b54101e libc: fix fstatfs() implementation.
The syscall expects the size of the buffer as the second argument.

Change-Id: I99ede2fec7fcd385ca03ff022c2cffa4297bea8d
2010-07-08 16:52:27 -07:00
Bruce Beare
16984423bc Fix missing NL
Change-Id: Ic210fe9f740b9a8235a66d479ad4eddc869998bb
Signed-off-by: Bruce Beare <brucex.j.beare@intel.com>
2010-07-08 11:12:36 -07:00
David 'Digit' Turner
3b43f87d29 Allow dlclose() to properly call static C++ destructors.
With this patch _and_ an upcoming build/ patch, the destruction
of static C++ objects contained in shared libraries will happen
properly when dlclose() is called.

Note that this change introduces crtbegin_so.S and crtend_so.S which
are currently ignored by the build system.

+ move definition of __dso_handle to the right place
(before that, all shared libraries used the __dso_handle
global variable from the C library).

Note that we keep a 'weak' __dso_handle in aeabi.c to avoid
breaking the build until the next patch to build/core/combo/
appears. We will be able to remove that later.

+ move bionic/aeabi.c to arch-arm/bionic/ (its proper location)

NOTE: The NDK will need to be modified to enable this feature in
         the shared libraries that are generated through it.

Change-Id: I99cd801375bbaef0581175893d1aa0943211b9bc
2010-07-01 23:09:28 -07:00
David 'Digit' Turner
6a9b888d7c Allow static C++ destructors to be properly called on dlclose().
With this patch, _and_ an upcoming build/ patch, the destruction
of static C++ objects contained in shared libraries will happen
properly when dlclose() is called.

Note that this change introduces crtbegin_so.S and crtend_so.S which
are currently ignored by the build system.

+ move definition of __dso_handle to the right place
  (before that, all shared libraries used the __dso_handle
   global variable from the C library).

  Note that we keep a 'weak' __dso_handle in aeabi.c to avoid
  breaking the build until the next patch to build/core/combo/
  appears. We will be able to remove that later.

+ move bionic/aeabi.c to arch-arm/bionic/ (its proper location)

Change-Id: Ie771aa204e3acbdf02fd30ebd4150373a1398f39
NOTE: The NDK will need to be modified to enable this feature in
      the shared libraries that are generated through it.
2010-06-18 16:07:10 -07:00
David 'Digit' Turner
aa4b1d0429 Add missing sysinfo() implementation (already declared in <sys/sysinfo.h>) - DO NOT MERGE
Change-Id: Iac4eb5911ffe4a7ab72b84df44e907685ac816af
2010-06-09 13:12:15 -07:00
The Android Open Source Project
5ffedb22c8 merge from open-source master
Change-Id: I076e0df8656fdf58c229cc9a168cd6d8e16b6d8e
2010-03-31 14:15:30 -07:00
David Turner
87ae0da817 Merge "Atom optimized string and memory routines" 2010-03-29 14:40:05 -07:00
The Android Open Source Project
62ac0dc457 merge from open-source master
Change-Id: I96d2cd063f084fd17116bf7ee08fa7109a3c1ceb
2010-03-29 11:01:59 -07:00
Bruce Beare
8ff1a2759a Atom optimized string and memory routines
Change-Id: I27b68bb28551c75c9ac84bb9730e2cd8254d8991
2010-03-26 10:54:07 -07:00
Bruce Beare
58f0326362 Android hack for size_t
Change-Id: I3c967fca60f542459dc17be84da47b3b6a26242b
2010-03-26 09:36:01 -07:00
The Android Open Source Project
377d4c979d merge from open-source master
Change-Id: I70266ee8c520b216773f267e46c8273d2334c31d
2010-03-22 15:55:09 -07:00
David 'Digit' Turner
88f06cd84a Use private futexes for pthread_mutex_t.
This does not change the implementation of conditional variables
since we're waiting for other system components to properly use
pthread_condattr_init/setpshared before that.

Also remove an obsolete x86 source file.

Change-Id: Ia3e3fbac35b87a534fb04d4381c3c66b975bc8f7
2010-03-18 17:13:41 -07:00
Fabrice Di Meglio
8641833b62 Revert "bionic: pthread: use private futexes by default for mutexes and condvars"
This reverts commit ba9c6f0989.
2010-03-11 14:47:47 -08:00
David 'Digit' Turner
ba9c6f0989 bionic: pthread: use private futexes by default for mutexes and condvars
Private futexes are a recent kernel addition: faster futexes that cannot be
shared between processes. This patch uses them by default, unless the PROCESS_SHARED
attribute flag is used when creating a mutex and/or conditional variable.

Also introduces pthread_condattr_init/destroy/setpshared/getpshared.

Change-Id: I3a0e2116f467072b046524cb5babc00e41057a53
2010-03-11 11:48:38 -08:00
Bruce Beare
3c543e1da9 x86 syscall system call implementation 2010-03-04 10:29:38 -08:00
Mike Chan
9f6915631b bonic: libc: cpuacct support for setuid functions
Any of the setuid functions now updates /acct/uid/ with its own tid
before changing users. This is so we can properly account for cpu time
per uid.

Change-Id: I34186cf4d5228cac8439e582a9e26c01ef3011e4
Signed-off-by: Mike Chan <mike@android.com>
2010-03-02 18:18:04 -08:00
Andrei Popescu
eb9d5ed347 add sigaltstack syscall 2010-03-02 11:43:24 +00:00
San Mehat
75c5e25ae3 bionic: syscalls: Add ioprio_set/ioprio_get syscall wrappers
Signed-off-by: San Mehat <san@google.com>
2010-02-23 15:55:29 -08:00
David 'Digit' Turner
97cf7f3394 Implement clone() C library function properly.
Only provide an implementation for ARM at the moment, since
it requires specific assembly fragments (the standard syscall
stubs cannot be used because the child returns in a different
stack).
2010-01-25 11:18:30 -08:00
David 'Digit' Turner
3a654b1e04 Revert "Fix the C library initialization to avoid calling static C++ constructors twice."
This reverts commit 03eabfe65e.
2009-06-03 19:32:37 +02:00
David 'Digit' Turner
03eabfe65e Fix the C library initialization to avoid calling static C++ constructors twice.
The problem was due to the fact that, in the case of dynamic executables,
the dynamic linker calls the DT_PREINIT_ARRAY, DT_INIT and DT_INIT_ARRAY
constructors when loading shared libraries and dynamic executables,
*before* calling the executable's entry point (i.e. arch-$ARCH/bionic/crtbegin_dynamic.c)
which in turns call __libc_init() in libc.so, as defined by bionic/libc_init_dynamic.c

The latter did call these constructors array again, mistakenly.

The patch also updates the documentation of many related functions.

Also adds a new section to linker/README.TXT explaining restrictions on
C library usage.

The patch has been tested on a Dream for stability issues with
proprietary blobs:

- H264 decoding works
- Camera + Video recording works
- GPS works
- Sensors work

The tests in system/extra/tests/bionic/libc/common/test_static_cpp_mutex.cpp has been
run and shows the static C++ constructor being called only once.
2009-06-02 23:27:44 +02:00
The Android Open Source Project
1dc9e472e1 auto import from //depot/cupcake/@135843 2009-03-03 19:28:35 -08:00
The Android Open Source Project
1767f908af auto import from //depot/cupcake/@135843 2009-03-03 18:28:13 -08:00
The Android Open Source Project
4e468ed2eb Code drop from //branches/cupcake/...@124589 2008-12-17 18:03:48 -08:00
The Android Open Source Project
a27d2baa0c Initial Contribution 2008-10-21 07:00:00 -07:00