native_client/nacl-glibc.git
2 weeks agoWhitespace change to bump glibc rev for nacl-gcc va_list ABI change. master
Jan Voung [Wed, 8 Oct 2014 00:00:54 +0000 (17:00 -0700)]
Whitespace change to bump glibc rev for nacl-gcc va_list ABI change.

See: https://codereview.chromium.org/614683004/

I don't always do whitespace changes, but when I do, I pick
whitespace-sensitive files.

http://build.chromium.org/p/tryserver.nacl/builders/nacl-toolchain-precise64-glibc/builds/85
http://build.chromium.org/p/tryserver.nacl/builders/nacl-toolchain-win7-glibc/builds/279

BUG= https://code.google.com/p/nativeclient/issues/detail?id=3650
R=mseaborn@chromium.org

Review URL: https://codereview.chromium.org/605943003

2 months agoAdd truncate.c to list of nacl files overrides.
Sam Clegg [Wed, 20 Aug 2014 13:14:30 +0000 (14:14 +0100)]
Add truncate.c to list of nacl files overrides.

As far as I can tell without this change this
file is ignored.

BUG= https://code.google.com/p/nativeclient/issues/detail?id=3583
R=bradnelson@google.com

Review URL: https://codereview.chromium.org/439003002

4 months agoUse stub implementations for get{e,}[ug]id
Roland McGrath [Wed, 18 Jun 2014 18:41:32 +0000 (11:41 -0700)]
Use stub implementations for get{e,}[ug]id

These functions are unusable stubs today, indirectly via the
kludges that replace the syscall macros and stubs.  But on x86-32
they wind up as stubs that return 0 (false success) whereas on
x86-64 they fail with ENOSYS.  In neither case are they properly
marked as stubs so as to generate linker warnings, though in
neither case is there any mechanism by which they could be made
to do anything different.  Instead, just always use the basic
stub implementations that uniformly fail with ENOSYS and generate
linker warnings.

BUG= https://code.google.com/p/nativeclient/issues/detail?id=3667
TEST= toolchain trybots
R=dyen@chromium.org

Review URL: https://codereview.chromium.org/341583004

4 months agoDisable use of fcntl in fdopen for nacl.
Brad Nelson [Fri, 13 Jun 2014 23:27:02 +0000 (16:27 -0700)]
Disable use of fcntl in fdopen for nacl.

As fcntl is not implemented currently in nacl, nor likely to be,
skip using it to check file descriptor state inside fdopen.

BUG=None
TEST=None
R=mcgrathr@chromium.org

Review URL: https://codereview.chromium.org/338613003

4 months agoFix some style issues in sysdeps/nacl/irt_syscalls.*
Shinichiro Hamaji [Wed, 28 May 2014 04:12:14 +0000 (13:12 +0900)]
Fix some style issues in sysdeps/nacl/irt_syscalls.*

- Untabify code
- Add line breaks for >80 lines
- Fix the type __nacl_irt_thread_create

BUG=https://code.google.com/p/chromium/issues/detail?id=352498
R=mseaborn@chromium.org

Review URL: https://codereview.chromium.org/200463002

7 months agoRemove __nacl_futex_fini
Sam Clegg [Tue, 4 Mar 2014 20:46:36 +0000 (12:46 -0800)]
Remove __nacl_futex_fini

This allows fuxtex's (and therefore pthreads) to keep working
even in _exit() after the atexit handlers have all been run.

TEST=toolchains trybots
R=mseaborn@chromium.org

Review URL: https://codereview.chromium.org/183973024

8 months agoConnecting IRT dev interfaces for fdio and filename.
Brad Nelson [Mon, 27 Jan 2014 23:41:12 +0000 (15:41 -0800)]
Connecting IRT dev interfaces for fdio and filename.

Connecting the irt dev interfaces (when available).

Adding hooks for:
  __nacl_irt_unlink;
  __nacl_irt_truncate;
  __nacl_irt_lstat;
  __nacl_irt_link;
  __nacl_irt_rename;
  __nacl_irt_symlink;
  __nacl_irt_chmod;
  __nacl_irt_access;
  __nacl_irt_readlink;
  __nacl_irt_utimes;
  __nacl_irt_fchdir;
  __nacl_irt_fchmod;
  __nacl_irt_fsync;
  __nacl_irt_fdatasync;
  __nacl_irt_ftruncate;

Changed type signature of getcwd to match irt.

Connected pre-existing hooks:
  __nacl_irt_mkdir
  __nacl_irt_rmdir
  __nacl_irt_chdir
  __nacl_irt_getcwd

Updated irt.h and added irt_dev.h

BUG=https://code.google.com/p/nativeclient/issues/detail?id=3583
R=mcgrathr@chromium.org

Review URL: https://codereview.chromium.org/145263007

12 months agoChange linker scripts to support new binutils
Victor Khimenko [Tue, 15 Oct 2013 15:59:45 +0000 (19:59 +0400)]
Change linker scripts to support new binutils

Files must be named differently and different name for the target
is used.

R=mcgrathr@chromium.org
BUG=

Review URL: https://codereview.chromium.org/23451041

13 months agoRemove linker warning when getpid() is including.
Sam Clegg [Thu, 12 Sep 2013 15:36:08 +0000 (08:36 -0700)]
Remove linker warning when getpid() is including.

When getpid() was recently added to the NaCl port it
mistakenly included a stub_warning() which causes any
programs that reference it to produce a linker warning.

BUG= http://code.google.com/p/nativeclient/issues/detail?id=2488
R=mseaborn@chromium.org

Review URL: https://codereview.chromium.org/23293002

14 months agoEnable process and thread CPU time clocks
Petr Hosek [Sat, 17 Aug 2013 19:40:03 +0000 (12:40 -0700)]
Enable process and thread CPU time clocks

The support for these was recently added to the core runtime.

BUG= https://code.google.com/p/nativeclient/issues/detail?id=3629
TEST= trybots
R=mcgrathr@chromium.org

Review URL: https://codereview.chromium.org/22802003

14 months agoReverting nacl_fixup_ldso.py sections change.
Brad Nelson [Fri, 9 Aug 2013 22:01:06 +0000 (15:01 -0700)]
Reverting nacl_fixup_ldso.py sections change.

It turns out the loader does not actually allow all of the sections our glibc
toolchain emits (PT_DYNAMIC + rw in particular). We should fix this,
but for now making an ABI breaking change is undesirable.

BUG=None
TEST=trybots
R=mseaborn@chromium.org

Review URL: https://codereview.chromium.org/22756002

14 months agoDrop section rewriting and format fixes.
Brad Nelson [Wed, 7 Aug 2013 19:44:02 +0000 (12:44 -0700)]
Drop section rewriting and format fixes.

Turning off section rewriting in fixup_ldso that's not required to
satisfy sel_ldr anymore.

Formatting fixes left over from:
https://codereview.chromium.org/21636003/

BUG=https://code.google.com/p/nativeclient/issues/detail?id=3607
TEST=trybots
R=mseaborn@chromium.org

Review URL: https://codereview.chromium.org/22527004

14 months agoAdd a PT_NOTE section to mark build_id.
Brad Nelson [Wed, 7 Aug 2013 18:18:44 +0000 (11:18 -0700)]
Add a PT_NOTE section to mark build_id.

Adding a PT_NOTE section to mark the location of the build_id note will allow
us to extract it from dl_iterate_phdrs at runtime.
This in turn will facilitate providing module information with minidumps.

BUG=https://code.google.com/p/nativeclient/issues/detail?id=3607
TEST=None
R=mcgrathr@chromium.org, mseaborn@chromium.org

Review URL: https://codereview.chromium.org/21636003

14 months agoAdd getpid implementation for NaCl.
Sam Clegg [Sat, 27 Jul 2013 03:12:12 +0000 (20:12 -0700)]
Add getpid implementation for NaCl.

This change adds a getpid() implementation bases on the
IRT's GETPID interface.

In adding this I also updated the copy of nacl/irt.h
to match the latest version in the nacl repo.

BUG= http://code.google.com/p/nativeclient/issues/detail?id=2488
TEST= run_getpid_test
R=mseaborn@chromium.org

Review URL: https://codereview.chromium.org/20204004

15 months agoFix undefined NULL by including stddef.h
Sam Clegg [Wed, 17 Jul 2013 21:24:09 +0000 (14:24 -0700)]
Fix undefined NULL by including stddef.h

BUG= http://code.google.com/p/chromium/issues/detail?id=246246
R=mseaborn@chromium.org

Review URL: https://codereview.chromium.org/19421002

15 months agoAllow use of alternative 'main' symbol.
Sam Clegg [Thu, 11 Jul 2013 20:41:38 +0000 (13:41 -0700)]
Allow use of alternative 'main' symbol.

If the __nacl_main symbol is found at runtime
them use this in place of the normal 'main'.

The idea is that if/when libppapi_simple.a is
linked into an executable __nacl_main will be
called as the startup symbol and then the real
main symbol can be called later on (e.g. on a
separate thread).

BUG=246246
R=mcgrathr@chromium.org

Review URL: https://codereview.chromium.org/16514007

16 months agonacl-glibc: Provide symbols for .note.gnu.build-id section bounds
Roland McGrath [Fri, 7 Jun 2013 19:40:26 +0000 (12:40 -0700)]
nacl-glibc: Provide symbols for .note.gnu.build-id section bounds

This causes the linker to define (if referenced) symbols
__note_gnu_build_id_start and __note_gnu_build_id_end for the bounds
of the .note.gnu.build-id section.  This makes it possible for the
program to discover its own build ID, without having ELF program
headers accessible in the runtime memory image as they are with the
next-generation linkers.

BUG= https://code.google.com/p/nativeclient/issues/detail?id=3462
TEST= toolchain trybots
R=mseaborn@chromium.org

Review URL: https://codereview.chromium.org/16427003

18 months ago[NOUPSTREAM] Make non-executable stack default for NaCl.
Victor Khimenko [Thu, 25 Apr 2013 17:18:58 +0000 (21:18 +0400)]
[NOUPSTREAM] Make non-executable stack default for NaCl.

It makes no sense to try to support executable stacks in NaCl.

Disable them at GLibC level.

In the new toolchain we probably don't want to do that and want to change default_execstack instead.

BUG=https://code.google.com/p/nativeclient/issues/detail?id=3402
TEST= run cordy with patch applied on top of Chrome 28.0.1486.1
R=halyavin@google.com

Review URL: https://codereview.chromium.org/14494008

18 months agoFill tz in gettimeofday function.
Andrey Khalyavin [Thu, 25 Apr 2013 15:24:55 +0000 (19:24 +0400)]
Fill tz in gettimeofday function.

Manual says that this obsolete field should be filled but we ignore it.
Fill it with zero values instead to increase compatibility.

BUG= NONE
TEST= NONE
R=khim@chromium.org

Review URL: https://codereview.chromium.org/14373015

18 months agoPrepare for fast loading through mmap'ing text.
Ken Mixter [Tue, 23 Apr 2013 18:51:40 +0000 (11:51 -0700)]
Prepare for fast loading through mmap'ing text.

This changes the dynamic text mapping code to attempt PROT_EXEC mapping the text and only if it fails, falling back to read-mapping and using dyncode create.

TEST=newly generated libraries loaded by unmodified sel_ldr.
     dyncode create path is used, code validates, runs fine.
TEST=newly generated libraries loaded by a modified sel_ldr
     that allows PROT_EXEC mmaping if mmap starts and ends
     on a page align. libraries load.

BUG=https://code.google.com/p/nativeclient/issues/detail?id=3371

Review URL: https://codereview.chromium.org/13598032

18 months agoLinker scripts: Fold .fini into .text
Roland McGrath [Thu, 11 Apr 2013 18:47:56 +0000 (11:47 -0700)]
Linker scripts: Fold .fini into .text

In the previous iteration, a link with no .fini sections in any
of its input files would foul up the page alignment and padding.
The output section must be one with some code sections among its
input sections to ensure that the padding emitted in the output
section is nop instructions rather than zero bytes.

BUG= https://code.google.com/p/nativeclient/issues/detail?id=3371
TEST= toolchain trybot and inspection of binaries

R=mseaborn@chromium.org

Review URL: https://codereview.chromium.org/13954009

18 months agoAlign and pad code segments to 64k
Roland McGrath [Fri, 5 Apr 2013 20:11:57 +0000 (13:11 -0700)]
Align and pad code segments to 64k

Fiddle the linker scripts to ensure that the code segment starts and ends
on a 64k boundary and the end is padded with valid instructions (nop).
This is necessary to permit direct mapping of code segments from files.

BUG= https://code.google.com/p/nativeclient/issues/detail?id=3371
TEST= toolchain trybot and inspection of binaries

R=mseaborn@chromium.org

Review URL: https://codereview.chromium.org/13638011

18 months agoProvide mprotect syscall
Petr Hosek [Thu, 4 Apr 2013 15:04:08 +0000 (08:04 -0700)]
Provide mprotect syscall

Expose the mprotect syscall which is a part of experimental IRT interface.

BUG= http://code.google.com/p/nativeclient/issues/detail?id=895
TEST= glibc trybots

Review URL: https://codereview.chromium.org/12382030

20 months agoDisable ld.so.cache support
Roland McGrath [Fri, 22 Feb 2013 00:07:54 +0000 (16:07 -0800)]
Disable ld.so.cache support

The ld.so.cache file never exists in a NaCl manifest and there
is no benefit to using such a file in the NaCl context.  When
using sel_ldr -a or the environment variable equivalent on a
Linux host, searching for this file can hit the native host
file and have unintended effects on library search.

BUG= http://code.google.com/p/nativeclient/issues/detail?id=3316
TEST= toolchain trybot

R=bradnelson@google.com

Review URL: https://codereview.chromium.org/12340013

21 months agoRemove alignment of code and data segments for shared libraries.
Andrey Khalyavin [Mon, 21 Jan 2013 15:33:51 +0000 (19:33 +0400)]
Remove alignment of code and data segments for shared libraries.

Unlike ld.so code and data segments in shared libraries do not need
to be aligned to page boundary.  So I remove the alignment from
linker scripts but return it back in elf/Makefile for ld.so.

Also fix ld.so to allocate ELF header in the heap if code segment
is not aligned to page boundary.

BUG= https://code.google.com/p/nativeclient/issues/detail?id=1794
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3266
TEST= toolchain glibc try bots.

Review URL: https://codereview.chromium.org/11958039

21 months agoRemove alignment between read-only and read-write data segments.
Andrey Khalyavin [Thu, 17 Jan 2013 08:02:34 +0000 (12:02 +0400)]
Remove alignment between read-only and read-write data segments.

Executables loaded by sel_ldr are not required to have read-write data segment
aligned to page boundary.  Libraries loaded by ld.so do not need it either.

BUG= http://code.google.com/p/nativeclient/issues/detail?id=1794
TEST= glibc toolchain trybots

Review URL: https://codereview.chromium.org/11875034

21 months agoRemove unnecessary alignment between .got.plt and .data sections.
Andrey Khalyavin [Mon, 14 Jan 2013 14:41:42 +0000 (18:41 +0400)]
Remove unnecessary alignment between .got.plt and .data sections.

The end of .got.plt and start of the .data section must be located
in read-write segment.  So we don't need any alignment between them.

BUG= http://code.google.com/p/nativeclient/issues/detail?id=1794

Review URL: https://codereview.chromium.org/11888007

2 years agoRemove aliases to stat64, fstat64, fstatat64 and lstat64. master-backup
Andrey Khalyavin [Mon, 1 Oct 2012 10:55:37 +0000 (14:55 +0400)]
Remove aliases to stat64, fstat64, fstatat64 and lstat64.

This aliases were enabled if inline functions were not used because of low optimization level.

BUG= none
TEST= none

R=khim@google.com,eaeltsin@google.com

Review URL: https://codereview.chromium.org/10986081

2 years agoFix bswap_64 for x86-64
Roland McGrath [Mon, 2 Jul 2012 21:28:24 +0000 (14:28 -0700)]
Fix bswap_64 for x86-64

Use the correct type name for the 64-bit integer type.

BUG= http://code.google.com/p/chromium/issues/detail?id=133889
TEST= locally tested it fixes run_byteswap64_test

R=bradchen@google.com

Review URL: https://chromiumcodereview.appspot.com/10702071

2 years agoCorrect building runnable-ld.so to ensure that the stack on entry to main is
David Sehr [Thu, 31 May 2012 22:54:40 +0000 (15:54 -0700)]
Correct building runnable-ld.so to ensure that the stack on entry to main is
aligned for 0mod16 on x86-32.

BUG= http://code.google.com/p/nativeclient/issues/detail?id=2665
TEST=run_call_structs_test
     run_nameservice_test
     run_pagesize_test
     run_thread_test
     run_float2_test
     run_types_srpc_test_nexe
     run_simple_srpc_test_nexe

Review URL: https://chromiumcodereview.appspot.com/10443117

2 years agoFix pthread_cond_timedwait (and other similar functions)
Victor Khimenko [Wed, 23 May 2012 17:16:37 +0000 (21:16 +0400)]
Fix pthread_cond_timedwait (and other similar functions)

Fix absolute/relative times mixup in pthread_cond_timedwait (and
other timed wait functions).

Simple solution will be to fix it in futex_emulation.c, but this
will lead to two additional calls to gettimeofday in very timing-critical
parts of the code.

Instead we remove these calls in the cases where GLibC-provided interface
received absolute timeout and only keep them in cases where POSIX-mandated
API uses relative timeouts.

Change structured in a way to trigger error as early as possible (usually
in compilation time, if a few cases in linking time).

BUG=http://code.google.com/p/nativeclient/issues/detail?id=2804
TEST=cond_timedwait (see https://chromiumcodereview.appspot.com/10414059/)

Review URL: https://chromiumcodereview.appspot.com/10421027

2 years agoTurn waiting stack back into wating queue
Victor Khimenko [Wed, 16 May 2012 10:19:35 +0000 (14:19 +0400)]
Turn waiting stack back into wating queue

When hand-made list was changed to use glibc-offered primitives
it accidently turned wating list to waiting stack.  Formally this
is still POSIX-compatible interface, but many real programs don't
like it.

This is "good" version:
  http://codereview.chromium.org/3384028/#ps36030

This is "bad" one:
  http://codereview.chromium.org/3384028/#ps42001

R=halyavin@google.com

Review URL: https://chromiumcodereview.appspot.com/10391160

2 years agoadd clock() in nacl-glibc
Egor Pasko [Fri, 11 May 2012 12:31:30 +0000 (16:31 +0400)]
add clock() in nacl-glibc

BUG=none
TEST=none

Review URL: https://chromiumcodereview.appspot.com/10381109

2 years agofix 32-bit socket() interceptor
Stanislav Vorobyev [Thu, 26 Apr 2012 13:16:28 +0000 (17:16 +0400)]
fix 32-bit socket() interceptor

BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com/10235002

2 years agoberkeley sockets interception implementation
Stanislav Vorobyev [Mon, 23 Apr 2012 08:00:19 +0000 (12:00 +0400)]
berkeley sockets interception implementation

Adds hooks for all the socket-related functions. By default hooks return ENOSYS, but can be intercepted in the application.

Return these:
e98ec8c fixed signatures for several syscalls that return positive value in correct case
256e1ec removed epoll_create1 (EPOLL_CLOEXEC is not applicable to NaCl, as there is no possibility to fork); added recv and send to syscalls.list
0533bbb added several system call hooks for future sockets implementation

BUG=
TEST=trybot

Review URL: https://chromiumcodereview.appspot.com/10134022

2 years agorevert 4 untested commits
Egor Pasko [Thu, 19 Apr 2012 19:47:04 +0000 (23:47 +0400)]
revert 4 untested commits

Revert these:
e98ec8c fixed signatures for several syscalls that return positive value in
correct case
256e1ec removed epoll_create1 (EPOLL_CLOEXEC is not applicable to NaCl, as there
is no possibility to fork); added recv and send to syscalls.list
0533bbb added several system call hooks for future sockets implementation

BUG=broken REVISIONS roll
TEST=cd native_client/tools && make glibc-check

Review URL: https://chromiumcodereview.appspot.com/10070014

2 years agoMake it possible to run the loader with LD_DEBUG=all
Robert Muth [Wed, 18 Apr 2012 23:26:22 +0000 (16:26 -0700)]
Make it possible to run the loader with LD_DEBUG=all

This currently asserts because getpid() returns -1

BUG=none
TEST=manual

R=mcgrathr@chromium.org

Review URL: https://chromiumcodereview.appspot.com/10021073

2 years agofixed signatures for several syscalls that return positive value in correct case
Stanislav Vorobyev [Wed, 18 Apr 2012 12:40:59 +0000 (16:40 +0400)]
fixed signatures for several syscalls that return positive value in correct case

BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com/10095013

2 years agoremoved epoll_create1 (EPOLL_CLOEXEC is not applicable to NaCl, as there is no possib...
Stanislav Vorobyev [Mon, 16 Apr 2012 11:33:40 +0000 (15:33 +0400)]
removed epoll_create1 (EPOLL_CLOEXEC is not applicable to NaCl, as there is no possibility to fork); added recv and send to syscalls.list

BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com/10095010

2 years agoPatch NaCl glibc to avoid use of fsincos.
Brad Chen [Fri, 13 Apr 2012 17:01:06 +0000 (10:01 -0700)]
Patch NaCl glibc to avoid use of fsincos.

Additionally remove inline and 64-bit uses of fsincos.
Patch NaCl glibc to avoid use of fsincos.

BUG=http://code.google.com/p/nativeclient/issues/detail?id=2720
TEST=bots

Review URL: https://chromiumcodereview.appspot.com/10066026

2 years agoadded several system call hooks for future sockets implementation
Stanislav Vorobyev [Fri, 13 Apr 2012 12:13:43 +0000 (16:13 +0400)]
added several system call hooks for future sockets implementation

FOA, select or poll would be implemented, of course.
Should I add __nacl_irt_... call hooks for common berkeley socket calls (accept, bind, listen, connect, send, recv, gethostby[name,addr], sendto, recvfrom, [set,get]sockopt)?

BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com/9969049

2 years agoadded several syscalls for nacl mounts
Stanislav Vorobyev [Fri, 30 Mar 2012 14:36:55 +0000 (18:36 +0400)]
added several syscalls for nacl mounts

BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com/9965011

2 years agoImplement sleep function using nanosleep
Roland McGrath [Thu, 23 Feb 2012 00:50:59 +0000 (16:50 -0800)]
Implement sleep function using nanosleep

The Linux implementation we were getting fails because of missing
signal support (which is only used there for arcane reasons that
are now obsolete even on Linux).  The trivial version calling
nanosleep works just fine.

BUG= http://code.google.com/p/nativeclient/issues/detail?id=2288
TEST= none

R=bradchen@google.com

Review URL: https://chromiumcodereview.appspot.com/9431051

2 years agoplumb glibc clock_get interfaces to irt
Bennet Yee [Wed, 15 Feb 2012 22:48:08 +0000 (14:48 -0800)]
plumb glibc clock_get interfaces to irt

cargo-culted changes to add sysdeps/nacl/ files to librt's
clock_gettime/clock_getres implementation.  seems to work.

R=mcgrathr@google.com
BUG= http://code.google.com/p/nativeclient/issues/detail?id=2477
TEST= in separate CL that cannot be submitted w/o TC DEPS roll

Review URL: https://chromiumcodereview.appspot.com/9389024

2 years agoFix __jmp_buf size for x86-64
Roland McGrath [Wed, 14 Dec 2011 17:30:43 +0000 (09:30 -0800)]
Fix __jmp_buf size for x86-64

Because of the type used vs the ILP32 configuration, this type is too
small for the assembly code that uses it.  It's hard to notice in
straightforward tests because the public jmp_buf type effectively has
unused padding (the space for the signal state).  But the internal
type is used in the implementation of pthread_cleanup_push, such that
using that interface will clobber nearby stack.  Note that the C++
implementation and the C implementation used under -fexceptions don't
use this.

BUG= http://code.google.com/p/nativeclient/issues/detail?id=2490
TEST= toolchain trybot

R=elijahtaylor@google.com,pasko@google.com,khim@google.com,eaeltsin@google.com

Review URL: http://codereview.chromium.org/8937018

2 years agoFix x86-64 DT_PREINIT_ARRAY/DT_INIT_ARRAY/DT_FINI_ARRAY calls for ILP32 layout
Roland McGrath [Tue, 13 Dec 2011 22:01:47 +0000 (14:01 -0800)]
Fix x86-64 DT_PREINIT_ARRAY/DT_INIT_ARRAY/DT_FINI_ARRAY calls for ILP32 layout

We were skipping the odd-numbered elements of DT_PREINIT_ARRAY,
DT_INIT_ARRAY and DT_FINI_ARRAY because we were treating them as arrays
of 64-bit quantities but they actually hold 32-bit quantities.

BUG= http://code.google.com/p/nativeclient/issues/detail?id=2482
TEST= toolchain trybots

R=pdox@google.com,pasko@google.com,khim@google.com,eaeltsin@google.com

Review URL: http://codereview.chromium.org/8932007

2 years agoDefine __WORDSIZE 32 for strt* routines
Ivan Krasin [Fri, 18 Nov 2011 23:15:57 +0000 (15:15 -0800)]
Define __WORDSIZE 32 for strt* routines

BUG=http://code.google.com/p/nativeclient/issues/detail?id=2444
TEST=run_strtoll_test,run_strtoull_test

Review URL: http://codereview.chromium.org/8586057

2 years agoUse proper strto*ll implementation on x86-64
Roland McGrath [Wed, 16 Nov 2011 18:40:50 +0000 (10:40 -0800)]
Use proper strto*ll implementation on x86-64

On normal x86-64, this is replaced with an alias for strto*l
because long==long long.  On NaCl, that's not right.

BUG= http://code.google.com/p/nativeclient/issues/detail?id=2444
TEST= toolchain trybot

R=krasin@google.com,pasko@google.com,khim@google.com

Review URL: http://codereview.chromium.org/8578011

2 years agoFix recursive pthread_once.
Victor Khimenko [Tue, 1 Nov 2011 13:45:04 +0000 (17:45 +0400)]
Fix recursive pthread_once.

Use more robust Linux-IA64 implementation instead of generic one.

BUG=http://code.google.com/p/nativeclient/issues/detail?id=2398

R=pasko@google.com

Review URL: http://codereview.chromium.org/8387030

3 years agoDon't use Linux code in sysconf(_SC_NPROCESSORS_ONLN)
Victor Khimenko [Wed, 19 Oct 2011 20:34:30 +0000 (00:34 +0400)]
Don't use Linux code in sysconf(_SC_NPROCESSORS_ONLN)

BUG=http://code.google.com/p/nativeclient/issues/detail?id=2202
TEST=earth (look for "Using 16 processors based on sysconf" message)

R=pasko@google.com

Review URL: http://codereview.chromium.org/8339017

3 years agoFix negative values handling.
Victor Khimenko [Tue, 18 Oct 2011 12:35:32 +0000 (16:35 +0400)]
Fix negative values handling.

Don't try to be too clever - trust the IRT results in sbrk.

BUG=http://code.google.com/p/nativeclient/issues/detail?id=2294

R=pasko@google.com

Review URL: http://codereview.chromium.org/8321010

3 years agoFix compilation with newer version of linux-headers.
Victor Khimenko [Wed, 5 Oct 2011 15:41:33 +0000 (19:41 +0400)]
Fix compilation with newer version of linux-headers.

Found as result of Gentoo porting efforts.

R=halyavin@google.com

Review URL: http://codereview.chromium.org/8143020

3 years agoIntroduce __nacl_add_tp
Evgeny Eltsin [Tue, 4 Oct 2011 23:54:44 +0000 (16:54 -0700)]
Introduce __nacl_add_tp

__nacl_add_tp returns thread pointer plus an offset passed in the first argument.

BUG=http://code.google.com/p/nativeclient/issues/detail?id=237
TEST=

Review URL: http://codereview.chromium.org/8143011

3 years agoFix error codes in read and sched_yield.
Andrey Khalyavin [Mon, 3 Oct 2011 17:30:54 +0000 (21:30 +0400)]
Fix error codes in read and sched_yield.

BUG= http://code.google.com/p/nativeclient/issues/detail?id=2329
TEST= none

R=khim@google.com

Review URL: http://codereview.chromium.org/8116004

3 years agoFix GLibC compilation.
Victor Khimenko [Tue, 27 Sep 2011 18:59:20 +0000 (22:59 +0400)]
Fix GLibC compilation.

We need to explictly add ld.so to the list of libraries because
otherwise nscd can not call syscalls.  We don't really need or
support nscd in NaCl but it should be buildable.

R=pasko@google.com

Review URL: http://codereview.chromium.org/8050019

3 years agoUse irt's open_resource only for files in /lib
Victor Khimenko [Tue, 20 Sep 2011 13:31:23 +0000 (17:31 +0400)]
Use irt's open_resource only for files in /lib

When I've added "lib" prefix I was under impression that
open_resource should be used to open all kind of resources.

Such as:
  /lib/libc.so.VERSION - it's a libc binary itself
  /lib/gconv/gconv-modules - list of supported gconv modules
  /share/locale/locale.alias - locale aliases

But this plan was vetoed on Chrome side. Now resource_open
is supposed to be used exclusively for DSO. It makes no sense
to use directories in such a case.

Now we use different scheme:
  /lib/libpthread.so.VERSION is loaded using IRT's open_resource
  /usr/lib/libpthread.so.VERSION is loaded using regular open(2)

R=pasko@google.com

Review URL: http://codereview.chromium.org/7937005

3 years agoFix bug with open64.
Andrey Khalyavin [Tue, 20 Sep 2011 11:47:46 +0000 (15:47 +0400)]
Fix bug with open64.

BUG= http://code.google.com/p/nativeclient/issues/detail?id=2256

TEST= none

Review URL: http://codereview.chromium.org/7970007

3 years agoAdd nacl_interface_query public function
Roland McGrath [Mon, 12 Sep 2011 22:50:45 +0000 (15:50 -0700)]
Add nacl_interface_query public function

This adds a public function for doing the IRT interface query.
This matches the function being added to the newlib-based libnacl.

BUG=http://code.google.com/p/nativeclient/issues/detail?id=2246
TEST=none

R=khim@google.com,pasko@google.com,eaeltsin@google.com

Review URL: http://codereview.chromium.org/7844009

3 years agoRemove obsolete 16bit uid/gid code from IA32 glibc.
Victor Khimenko [Mon, 12 Sep 2011 12:31:48 +0000 (16:31 +0400)]
Remove obsolete 16bit uid/gid code from IA32 glibc.

Small step in IA32/x86-64 unification process: define
__ASSUME_32BITUIDS to remove all code related to 16bit uid/gid
syscalls.

Also define __ASSUME_LCHOWN_SYSCALL and __ASSUME_REALTIME_SIGNALS
to make code compileable. Later we'll probably want to define other
defines, but we'll need to carefully review them.

R=pasko@google.com

Review URL: http://codereview.chromium.org/7780002

3 years agoChange make-syscalls.sh to make syscall interception possible.
Victor Khimenko [Tue, 6 Sep 2011 16:33:57 +0000 (20:33 +0400)]
Change make-syscalls.sh to make syscall interception possible.

This is second patch in series: it makes it possible to intercept
auto-generated syscalls.  It uses "#define/#undef" trick to circumvent
type checking since syscalls.list contains only rough information
about types (int, char * or pointer to some struct - but WHICH
struct it's not known).  Long-term solution it should probably be
replaced with a simple set of .c files - or may be just better
auto-generation mechanism.

R=pasko@google.com

Review URL: http://codereview.chromium.org/7737022

3 years agoFix getdents function.
Victor Khimenko [Tue, 6 Sep 2011 12:25:03 +0000 (16:25 +0400)]
Fix getdents function.

Check for error was not inverted when conversion to IRT happened.

It was never noticed since we had no way to test this code in browser.

R=pasko@google.com

Review URL: http://codereview.chromium.org/7828098

3 years agoRemove temporary IMC hack.
Victor Khimenko [Sat, 3 Sep 2011 17:51:00 +0000 (21:51 +0400)]
Remove temporary IMC hack.

Browser support for this hack was removed about month ago and now
it's replaced with resources_open IRT interface... time for it to go.

R=pasko@google.com

Review URL: http://codereview.chromium.org/7739013

3 years agoReplace #define syscalls cancel machinery.
Victor Khimenko [Sat, 3 Sep 2011 12:30:59 +0000 (16:30 +0400)]
Replace #define syscalls cancel machinery.

Use inline functions for type-checking. Separate CL will allow
user to redefine/catch these functions.

R=pasko@google.com

Review URL: http://codereview.chromium.org/7785030

3 years agoDon't use auto-initialized pointers to functions.
Victor Khimenko [Sat, 3 Sep 2011 10:46:23 +0000 (14:46 +0400)]
Don't use auto-initialized pointers to functions.

ld.so initializes these pointers after call to _dl_sysdep_start.

This means IRT is used to load libraries, but then we were using
straight NACL_SYSCALLs.

BUG=http://code.google.com/p/nativeclient/issues/detail?id=2219

R=pasko@google.com

Review URL: http://codereview.chromium.org/7792065

3 years agoQuick and dirty fix to green the bots.
Victor Khimenko [Sat, 3 Sep 2011 09:17:41 +0000 (13:17 +0400)]
Quick and dirty fix to green the bots.

Replaces movdqa wath movups. Perhaps we can keep it as permanent solution:
1. Athlon XP (without SSE2!) is still around (under name Geode NX). One example:
  http://www.netbookchoice.com/2010/06/10/asus-eee-pc-1201k-packs-an-amd-geode-processor/
2. Upstream comment in sysdeps/x86_64/dl-trampoline.S looks ominous enough:
  /* Even though the stack is correctly aligned to allow using movaps
     we use movups.  Some callers might provide an incorrectly aligned
     stack and we do not want to have it blow up here.  */
     movups %xmm0, 16(%rcx)
     movups %xmm1, 32(%rcx)

This comment is removed (and code rewamped significantly) in upstream trunk,
but we'll need to redo porting work anyway: code is significantly different
there (because of the AVX support and other reasons).

Commited TBR to green the bots.

BUG= http://code.google.com/p/nativeclient/issues/detail?id=2208
TEST= look on buildbots

Review URL: http://codereview.chromium.org/7835015

3 years agoFix alignment for SSE register saving
Roland McGrath [Fri, 2 Sep 2011 18:01:45 +0000 (11:01 -0700)]
Fix alignment for SSE register saving

The movdqa instructions need the memory to be aligned to 16 bytes.

BUG= http://code.google.com/p/nativeclient/issues/detail?id=2208
TEST= none

R=pasko@google.com,khim@google.com,eaeltsin@google.com,mseaborn@chromium.org

Review URL: http://codereview.chromium.org/7828050

3 years agoPreserve SSE registers in PLT fixup
Roland McGrath [Thu, 1 Sep 2011 20:33:46 +0000 (13:33 -0700)]
Preserve SSE registers in PLT fixup

The dynamic linker's PLT fix-up path needs to preserve the x86-64 SSE
registers around calling complex code paths that can sometimes clobber
them.  In upstream glibc after 2.10, these registers are saved and restored
in (almost) the same place.

BUG= http://code.google.com/p/nativeclient/issues/detail?id=2208
TEST= manual run of float_math.nexe under NACLVERBOSITY=4 fails with old runnable-ld.so, works with new runnable-ld.so

R=pasko@google.com,khim@google.com,eaeltsin@google.com

Review URL: http://codereview.chromium.org/7830016

3 years agoChange dynamic-linking linker scripts to produce a PT_INTERP
Roland McGrath [Wed, 31 Aug 2011 17:58:11 +0000 (10:58 -0700)]
Change dynamic-linking linker scripts to produce a PT_INTERP

This is necessary for the -dynamic-linker option to the linker
(passed by the compiler driver for dynamic linking) to have any
useful effect.

BUG= none
TEST= hand-tested that links get a PT_INTERP

R=pasko@google.com,eaeltsin@google.com

Review URL: http://codereview.chromium.org/7785031

3 years agoChange soname of ld.so to say nacl rather than linux, use .1 in PT_INTERP name
Roland McGrath [Wed, 31 Aug 2011 16:48:48 +0000 (09:48 -0700)]
Change soname of ld.so to say nacl rather than linux, use .1 in PT_INTERP name

NaCl is not Linux, don't use that name in a SONAME.
The rtld-installed-name is what's used in PT_INTERP for locally-built
binaries.  We don't want the NACL_FAKE_SONAME munging in there, just
a permanent name we can use for enabling NaCl-on-Linux hacks.

BUG= none
TEST= toolchain trybot

R=pasko@google.com,eaeltsin@google.com

Review URL: http://codereview.chromium.org/7785014

3 years agoChange the size of runtime tls_index to match GOT reality.
Egor Pasko [Mon, 29 Aug 2011 14:57:45 +0000 (18:57 +0400)]
Change the size of runtime tls_index to match GOT reality.

BUG=http://code.google.com/p/nativeclient/issues/detail?id=2200
TEST=See http://code.google.com/p/nativeclient/issues/detail?id=2199

Review URL: http://codereview.chromium.org/7782008

3 years agoDon't use open_resource as regular file access.
Victor Khimenko [Mon, 29 Aug 2011 14:01:14 +0000 (18:01 +0400)]
Don't use open_resource as regular file access.

Use open_resource only for DSOs.  Don't use regular open for DSOs
if open_resource is available (can be changed by program later if
needed).

R=eaeltsin@google.com

Review URL: http://codereview.chromium.org/7776004

3 years agoAllow static linking with PIC libraries using TLS
Egor Pasko [Fri, 26 Aug 2011 09:21:02 +0000 (13:21 +0400)]
Allow static linking with PIC libraries using TLS

Added __tls_get_addr symbol to the static libc.a library.

Static linker scripts:
  * move .text section to lowest addresses
  * add .rela.got section to the readonly segment, it is needed when input
    object files use General Dynamic TLS model
  * move .plt in front of .text as it is done in non-static case
    (should use dlopen() with static linking to test that, not done)
  * adjust seg_rodata to start from .note.gnu.build-id
  * removed the .interp section, will it ever be non-empty for static
    executables?

The problem of .text section not being the first is that other sections, if
non-empty, add another noexec segment in front, which makes the load address of
the code segment different from 0x20000, i.e. not loadable by sel_ldr.

In dynamic linking script .text goes first as well which would make it easier to
merge the two scripts later.

BUG=http://code.google.com/p/nativeclient/issues/detail?id=1631
TEST=x86_64-nacl-g++ empty-main.c -static -T ldscripts/elf64_nacl.x.static

Review URL: http://codereview.chromium.org/7715035

3 years agoRemove nonzero %gs access from bits/atomic.h
Roland McGrath [Wed, 24 Aug 2011 18:08:22 +0000 (11:08 -0700)]
Remove nonzero %gs access from bits/atomic.h

We want to deprecate any segment register access other than %gs:0.
These cases were missed in the last change.

BUG= http://code.google.com/p/nativeclient/issues/detail?id=2176
TEST= hand-examined output code for %gs use and correct lock insn sequences

R=eaeltsin@google.com,pasko@google.com,khim@google.com

Review URL: http://codereview.chromium.org/7718012

3 years agoFix dynamic library linking.
Victor Khimenko [Wed, 24 Aug 2011 17:56:58 +0000 (21:56 +0400)]
Fix dynamic library linking.

Align the BSS to a 64k page boundary in order to work around the issue
NaCl's mmap() has with zero filling.

More discussion can be found here:
  http://code.google.com/p/nativeclient/issues/detail?id=1068

BUG=http://code.google.com/p/nativeclient/issues/detail?id=2184
TEST=see bug #2184

R=pasko@google.com

Review URL: http://codereview.chromium.org/7715030

3 years agoAccess only %gs:0, not other offsets from %gs
Roland McGrath [Tue, 23 Aug 2011 16:16:59 +0000 (09:16 -0700)]
Access only %gs:0, not other offsets from %gs

We want to deprecate any segment register access other than %gs:0.

BUG= http://code.google.com/p/nativeclient/issues/detail?id=2176
TEST= ran small_tests (including thread tests) with hand-built glibc

R=eaeltsin@google.com,pasko@google.com,khim@google.com

Review URL: http://codereview.chromium.org/7706022

3 years agoAlign TLS segment to 64 bytes
Roland McGrath [Mon, 22 Aug 2011 20:35:09 +0000 (13:35 -0700)]
Align TLS segment to 64 bytes

Atom pays a hefty penalty for segment bases that are not cache-aligned.
Cache lines are 64 bytes on these machines.

BUG= http://code.google.com/p/nativeclient/issues/detail?id=1905
TEST= none

R=pasko@google.com

Review URL: http://codereview.chromium.org/7542019

3 years ago[noupstream] Correctly handle sonames with "a-f" hex numbes.
Victor Khimenko [Thu, 18 Aug 2011 07:52:57 +0000 (11:52 +0400)]
[noupstream] Correctly handle sonames with "a-f" hex numbes.

Commited TBR to fix the bots.

R=eaeltsin@google.com

Review URL: http://codereview.chromium.org/7677009

3 years agoRemove useless __nacl_irt_ppapi_* functions.
Victor Khimenko [Wed, 17 Aug 2011 21:19:17 +0000 (01:19 +0400)]
Remove useless __nacl_irt_ppapi_* functions.

Also add "lost" Versions to fix the build.

Commited TBR to fix buildbots.

R=eaeltsin@google.com

Review URL: http://codereview.chromium.org/7621049

3 years agoRemove temporary DSO hack. Use open-resource call.
Victor Khimenko [Wed, 17 Aug 2011 15:25:01 +0000 (19:25 +0400)]
Remove temporary DSO hack. Use open-resource call.

Still hacky, but works. Commited TBR to unblock the team.

Please comment anyway since there will be follow up patch
to cleanup stuff.

Review URL: http://codereview.chromium.org/7648050

3 years ago[noupstream] Use unique filename: NACL_FAKE_SONAME.
Victor Khimenko [Mon, 15 Aug 2011 15:15:09 +0000 (19:15 +0400)]
[noupstream] Use unique filename: NACL_FAKE_SONAME.

This is temporary measure till we'll have stable ABI in NaCl GLibC.

BUG=http://code.google.com/p/nativeclient/issues/detail?id=2128

R=pasko@google.com

Review URL: http://codereview.chromium.org/7621016

3 years agoFix __brk function (vital for static linking).
Victor Khimenko [Tue, 9 Aug 2011 10:57:46 +0000 (14:57 +0400)]
Fix __brk function (vital for static linking).

BUG=http://code.google.com/p/nativeclient/issues/detail?id=2112
TEST=glibc_tests

R=pasko@google.com

Review URL: http://codereview.chromium.org/7602013

3 years agoFix up glibc for drift in syscall and IRT interfaces
Roland McGrath [Mon, 8 Aug 2011 18:26:44 +0000 (11:26 -0700)]
Fix up glibc for drift in syscall and IRT interfaces

The glibc copy of the IRT interfaces is out of date.  Fix it up.  The glibc
copy of the pre-IRT syscall interfaces was also out of date (passing extra
arguments since removed), and with http://codereview.chromium.org/7593001/
that mismatch comes to matter.  Fix that up too.

BUG= cleanup
TEST= hand built glibc and ran nacl tests against it

R=khim@google.com,pasko@google.com

Review URL: http://codereview.chromium.org/7569023

3 years agoSupport IRT. Use syscalls fallback if IRT is not available.
Victor Khimenko [Thu, 28 Jul 2011 15:41:30 +0000 (19:41 +0400)]
Support IRT. Use syscalls fallback if IRT is not available.

R=pasko@google.com

Review URL: http://codereview.chromium.org/7084002

3 years agoSkip IMC argument fetching for any kind of imc_accept failure
Roland McGrath [Mon, 11 Jul 2011 19:56:28 +0000 (12:56 -0700)]
Skip IMC argument fetching for any kind of imc_accept failure

No matter why imc_accept fails, if it does, we're not going to succeed in
doing the arguments-by-IPC dance.  In practice, the failure mode when there
is an IRT but no plugin is EINVAL (should probably be ENOTSOCK).

BUG=none
TEST=makes it possible for nacl scons blob_loading_library test to work

R=eaeltsin@google.com,khim@google.com,pasko@google.com

Review URL: http://codereview.chromium.org/7301017

3 years agoAdjust for new NaCl startup ABI
Roland McGrath [Thu, 30 Jun 2011 17:15:06 +0000 (10:15 -0700)]
Adjust for new NaCl startup ABI

This replaces the startup code for applications (crt1.o) and the dynamic
linker startup and glue code with versions adapted to the new NaCl startup
ABI.  This uses the normal C function-call ABI to start the e_entry address
as a function of one argument, that being an information block holding the
arguments, environment, etc.

This is to enable http://codereview.chromium.org/7276050/, which see.

BUG=http://code.google.com/p/nativeclient/issues/detail?id=1131
TEST=manually tested, bots can't test because of staging issues

R=pasko@google.com,eaeltsin@google.com,mseaborn@google.com

Review URL: http://codereview.chromium.org/7282019

3 years agoRevert "Set the GLIBC default version to 2.9."
Roland McGrath [Thu, 30 Jun 2011 17:11:41 +0000 (10:11 -0700)]
Revert "Set the GLIBC default version to 2.9."

This reverts commit 5c44c72879f8d0b4ed421f66ed01af30addf3678.
It breaks the glibc build and nobody has yet investigated how or why.

BUG=none
TEST=none

R=eaeltsin@google.com,pdox@google.com

Review URL: http://codereview.chromium.org/7292001

3 years agoSet the GLIBC default version to 2.9.
David Meyer [Tue, 14 Jun 2011 23:43:48 +0000 (16:43 -0700)]
Set the GLIBC default version to 2.9.
This prevents deprecated functions from being included in libc,
and also ensures that version numbers match between X86-32 and
X86-64 (for PNaCl compatibility).

R=sehr@google.com,eaeltsin@chromium.org,mcgrathr@google.com
BUG= http://code.google.com/p/nativeclient/issues/detail?id=1819
TEST=

Review URL: http://codereview.chromium.org/7108039

3 years agoMake alarm,fork,kill,pthread_kill return ENOSYS.
Egor Pasko [Mon, 6 Jun 2011 09:04:58 +0000 (13:04 +0400)]
Make alarm,fork,kill,pthread_kill return ENOSYS.

kill.c, fork.c:
  Cannot be overridden via make_sysd_rules.py since they are generated from
  syscalls.

register-atfork.c, unregister-atfork.c:
  The C library invokes internal atfork handlers, add stubs to ignore this
  activity.

tst-skeleton.c:
  Skip linking with nosys stubs to avoid excluding tests based on the stub
  warning.

BUG=http://code.google.com/p/nativeclient/issues/detail?id=1777
TEST=none

Review URL: http://codereview.chromium.org/7070003

3 years agoMake GLibC IRT-compatible
Victor Khimenko [Mon, 30 May 2011 16:21:00 +0000 (20:21 +0400)]
Make GLibC IRT-compatible

Make it possible to run GLibC with IRT preloaded. IRT will not be used
but will it least run.

BUG=http://code.google.com/p/nativeclient/issues/detail?id=1874
TEST=scons-out/dbg-linux-x86-64/staging/sel_ldr -B ../scons-out/nacl-x86-64/staging/irt.nexe -S -a -s -- toolchain/linux_x86/nacl64/lib/runnable-ld.so

R=pasko@google.com,eaeltsin@google.com

Review URL: http://codereview.chromium.org/7085035

3 years agoRemove non-validating functions that support gnu2 TLS dialect.
Andrey Khalyavin [Mon, 30 May 2011 07:05:50 +0000 (11:05 +0400)]
Remove non-validating functions that support gnu2 TLS dialect.

BUG= none
TEST= none

R=pasko@google.com

Review URL: http://codereview.chromium.org/7071041

3 years agoMake wait,waitpid,waitid nosys stubs.
Egor Pasko [Fri, 27 May 2011 10:31:23 +0000 (14:31 +0400)]
Make wait,waitpid,waitid nosys stubs.

The test skeleton is made not linked against waitpid to allow excluding other
tests based on a stub warning from waitpid linkage.

BUG=http://code.google.com/p/nativeclient/issues/detail?id=1777
TEST=none

Review URL: http://codereview.chromium.org/7079001

3 years agoRemove colon from perror argument because perror outputs colon too.
Andrey Khalyavin [Thu, 26 May 2011 06:56:07 +0000 (10:56 +0400)]
Remove colon from perror argument because perror outputs colon too.

BUG= none
TEST= none

R=pasko@google.com

Review URL: http://codereview.chromium.org/6976020

3 years agoSmall typo in _dl_runtime_profile.
Andrey Khalyavin [Wed, 25 May 2011 12:35:01 +0000 (16:35 +0400)]
Small typo in _dl_runtime_profile.

BUG= none
TEST= none

R=khim@google.com

Review URL: http://codereview.chromium.org/7053012

3 years agoFix one bug and validation errors in dynamic linker profile path.
Andrey Khalyavin [Wed, 25 May 2011 11:39:43 +0000 (15:39 +0400)]
Fix one bug and validation errors in dynamic linker profile path.

_dl_profile_fixup has last parameter "long int *framesizep". This
is 4 bytes in NaCl instead of 8 which are expected by assembler code
in _dl_runtime_profile.

BUG= http://code.google.com/p/nativeclient/issues/detail?id=876
TEST= run any nexe with sel_ldr option -E LD_PROFILE=some.nexe

R=khim@google.com

Review URL: http://codereview.chromium.org/6987008

3 years agoFix join with main thread bug.
Andrey Khalyavin [Wed, 25 May 2011 07:28:33 +0000 (11:28 +0400)]
Fix join with main thread bug.

We need to wake futex pthread_join is sleeping in. The code is the same as in the end of start_thread function in pthread_create.c.

BUG=http://code.google.com/p/nativeclient/issues/detail?id=1831
TEST=glibc tests

R=khim@google.com,pasko@google.com,mseaborn@chromium.org

Review URL: http://codereview.chromium.org/7066017

3 years agoRemove obsolete System V context functions because __start_context doesn't validate...
Andrey Khalyavin [Tue, 24 May 2011 06:42:42 +0000 (10:42 +0400)]
Remove obsolete System V context functions because __start_context doesn't validate in 64-bit.

R=pasko@google.com
BUG=http://code.google.com/p/nativeclient/issues/detail?id=876
TEST=compile glibc and run ./ncval --cpuid-all libc-2.9.so

Review URL: http://codereview.chromium.org/7037021

3 years agoIgnore parameter of __exit_thread which is always zero anyway.
Andrey Khalyavin [Tue, 24 May 2011 06:41:21 +0000 (10:41 +0400)]
Ignore parameter of __exit_thread which is always zero anyway.

R=mseaborn@chromium.org
BUG=none
TEST=http://codereview.chromium.org/7039039/

Review URL: http://codereview.chromium.org/7004032

3 years agoCheck that mmap-ed region size is positive before reporting it to Valgrind.
Evgeniy Stepanov [Fri, 20 May 2011 10:47:51 +0000 (14:47 +0400)]
Check that mmap-ed region size is positive before reporting it to Valgrind.

TEST=thread_test on the Valgrind/GLibC bot

R=pasko
BUG=

Review URL: http://codereview.chromium.org/7057003

3 years agoImplement __exit_thread function in C in order to remove validator errors.
Andrey Khalyavin [Thu, 19 May 2011 09:16:16 +0000 (13:16 +0400)]
Implement __exit_thread function in C in order to remove validator errors.

This function is called from csu/libc_start.c and should terminate the main thread
without terminating whole process. val is always 0 in the code.

BUG=http://code.google.com/p/nativeclient/issues/detail?id=876
TEST=http://codereview.chromium.org/7039039/

R=pasko@google.com,khim@google.com

Review URL: http://codereview.chromium.org/7034024

3 years agoStub warning for pthread_cancel.
Egor Pasko [Tue, 17 May 2011 15:51:53 +0000 (19:51 +0400)]
Stub warning for pthread_cancel.

NaCl does not support pthread_cancel().  Add a stub warning that would be
produced at link time:
warning: pthread_cancel is not implemented and will always fail

BUG=http://code.google.com/p/nativeclient/issues/detail?id=1777
TEST=cat >pthr.c <<END
#include <pthread.h>
#include <stdio.h>
int main() {
  pthread_t tid = pthread_self();
  printf("pthread_cancel: %d\n", pthread_cancel(tid));
  return 0;
}
END
/path/to/nacl64-gcc pthr.c -lpthread | \
grep "warning: warning: pthread_cancel is not implemented and will always fail"

Review URL: http://codereview.chromium.org/7031024