Mark Seaborn [Thu, 28 Jan 2010 22:08:46 +0000 (28 22:08 +0000)]
Override elf_nacl.xr linker script so that libc_pic.os links correctly
Add linker script for the "ld --relocatable" case.
Ensures that .text.compat is padded correctly with NOPs instead of zeroes.
This replaces a binutils hack to default to padding with 0x90.
Mark Seaborn [Thu, 28 Jan 2010 16:17:04 +0000 (28 16:17 +0000)]
ld.so: Don't try to read own ELF headers on startup
The ELF headers will not be mapped under NaCl.
This means the RELRO feature won't work on ld.so.
It will likely break dl_iterate_phdr() too.
Mark Seaborn [Thu, 28 Jan 2010 13:08:30 +0000 (28 13:08 +0000)]
Mark __libc_resp with attribute_tls_model_ie for consistency with __resp
This stops the linker from doing a link-time rewrite from a
General Dynamic TLS access to a Initial Exec TLS access.
Rewriting GD sequences doesn't work properly under NaCl at the
moment.
Mark Seaborn [Thu, 28 Jan 2010 12:18:50 +0000 (28 12:18 +0000)]
Support binutils 2.20.
Backported to glibc 2.9 to support NaCl's newer binutils.
Mark Seaborn [Thu, 21 Jan 2010 16:08:52 +0000 (21 16:08 +0000)]
Executable: Move most rodata sections into the main rodata segment
However, .interp remains to be moved. Removing the non-standard first PT_LOAD
messes up PT_PHDR, which the Linux ld.so doesn't seem to like.
Mark Seaborn [Wed, 20 Jan 2010 17:11:56 +0000 (20 17:11 +0000)]
Remove non-standard PT_LOAD segment containing ELF headers from libraries
PHDRs will not be mapped. It turns out ld.so is fine with this.
This means we can remove the support for this segment from sel_ldr.
First segment is now PROT_EXEC. Change ld.so to cope with this.
It wants to map a larger area as PROT_EXEC in order to reserve the
address space, but we cannot do this under NaCl.
Mark Seaborn [Mon, 18 Jan 2010 13:05:53 +0000 (18 13:05 +0000)]
Find nacl-gcc via PATH rather than hard-coding a relative pathname
Allows the glibc source tree to be put in a different location.
Mark Seaborn [Sun, 14 Jun 2009 13:29:40 +0000 (14 14:29 +0100)]
fstat(): Fix to convert between the NaCl and glibc struct layouts
We need NaCl's st_ino value to come out correctly because Python uses
it to determine whether an extension module is the same as a
previously-loaded module, which doesn't work if st_ino is always zero.
Mark Seaborn [Wed, 10 Jun 2009 21:35:10 +0000 (10 22:35 +0100)]
Fix up disallowed instructions in pthread_once
Mark Seaborn [Tue, 9 Jun 2009 20:46:50 +0000 (9 21:46 +0100)]
Fix some uses of ret in libpthread
This makes sem_wait() work, at least partially, when used by Python.
Done using:
perl -pi -e 's/^(\s*)ret(\s*)$/$1popl %ecx; nacljmp %ecx$2/' nptl/sysdeps/unix/sysv/linux/i386/i486/*.S
Mark Seaborn [Tue, 9 Jun 2009 20:45:53 +0000 (9 21:45 +0100)]
Allocate a larger TLS segment, so that initialising libpthread.so works
Normally on Linux, the TLS segment is unbounded. Before, under NaCl,
only 100 bytes were allocated. Increase this to 4k so that
__pthread_initialize_minimal works; it does "mov %eax,%gs:0x16c".
This is not a proper fix: we should really allocate upto the top of
address space.
Mark Seaborn [Tue, 2 Jun 2009 20:43:06 +0000 (2 21:43 +0100)]
Implement stat64() via NaCl RPC
Split some RPC-related code out of open.c into nacl_rpc.c
Mark Seaborn [Wed, 29 Apr 2009 19:51:50 +0000 (29 20:51 +0100)]
Add 4-byte header to messages so that we can have different message types
Mark Seaborn [Sun, 26 Apr 2009 20:00:50 +0000 (26 21:00 +0100)]
Update glibc for NaCl's new executable load address
Executables are now loaded at 0x20000.
Syscalls start at 0x10000.
Mark Seaborn [Thu, 23 Apr 2009 19:12:03 +0000 (23 20:12 +0100)]
Move gcc-wrapper out of glibc into nacl-build
Mark Seaborn [Wed, 22 Apr 2009 21:38:36 +0000 (22 22:38 +0100)]
Don't use regparm(3) for functions in ld.so called from libdl.so
because %ecx is clobbered when calling functions through PLT entries.
This fixes dlopen().
There are a couple of functions that are called from assembly code
and so still need to be defined with regparm.
Mark Seaborn [Tue, 21 Apr 2009 20:41:37 +0000 (21 21:41 +0100)]
Extend gcc-wrapper to apply "ncrewrite --nop" to its output
Mark Seaborn [Tue, 24 Mar 2009 19:36:57 +0000 (24 19:36 +0000)]
Implement open() with RPC when NACL_FD is set
Mark Seaborn [Thu, 5 Mar 2009 22:07:22 +0000 (5 22:07 +0000)]
Ensure .init section is nop-padded at end
Mark Seaborn [Sun, 22 Feb 2009 11:36:54 +0000 (22 11:36 +0000)]
Add gcc-wrapper script: wraps nacl-gcc to build with glibc
Mark Seaborn [Sun, 22 Feb 2009 11:34:39 +0000 (22 11:34 +0000)]
Combine link-ldso.sh into link-libcso.sh
Mark Seaborn [Sun, 22 Feb 2009 11:30:33 +0000 (22 11:30 +0000)]
Link more libraries in link-libcso.sh
Mark Seaborn [Wed, 18 Feb 2009 22:52:13 +0000 (18 22:52 +0000)]
Remove Linux versions of posix_fadvise64 in favour of stub version
The assembly version's .text.compat section was not aligned properly,
because binutils currently only implicitly aligns .text,
so it was causing a validator failure.
Mark Seaborn [Tue, 17 Feb 2009 22:23:34 +0000 (17 22:23 +0000)]
Fix up indirect jump in longjmp
Mark Seaborn [Mon, 16 Feb 2009 20:37:37 +0000 (16 20:37 +0000)]
Fix up indirect jump in _dl_start_user
Mark Seaborn [Mon, 16 Feb 2009 20:36:38 +0000 (16 20:36 +0000)]
Define __tls_template_* in order to fix configure script
Mark Seaborn [Thu, 5 Feb 2009 22:43:03 +0000 (5 22:43 +0000)]
Specify linker scripts using -L: they now apply to the whole build
* Move linker scripts into ld/ldscripts
* elf_nacl.xs: .tdata and .tbss need to go in writable segment
* It appears that .eh_frame/.gcc_except_table need to be writable too.
Mark Seaborn [Thu, 5 Feb 2009 22:11:56 +0000 (5 22:11 +0000)]
Disable finding duplicates of libraries using st_ino and st_dev from fstat()
-- NaCl does not fill out these fields
Mark Seaborn [Tue, 3 Feb 2009 19:11:09 +0000 (3 19:11 +0000)]
Install into a non-global prefix
Mark Seaborn [Sun, 1 Feb 2009 17:41:09 +0000 (1 17:41 +0000)]
Fix build of nscd
by disabling -fstack-protector (needs further investigation).
This means the build now runs to completion.
This fixes "make install" so that it now installs gnu/stubs-32.h.
Mark Seaborn [Sun, 25 Jan 2009 18:25:09 +0000 (25 18:25 +0000)]
Stub out syscall(), clone(), umount() and umount2()
Mark Seaborn [Sun, 25 Jan 2009 18:20:38 +0000 (25 18:20 +0000)]
Remove use of btr/bts instructions, which NaCl rejects
Mark Seaborn [Sun, 25 Jan 2009 18:16:52 +0000 (25 18:16 +0000)]
Fix get_pc_thunk in SETUP_PIC_REG to not use "ret"
Mark Seaborn [Sun, 25 Jan 2009 17:43:09 +0000 (25 17:43 +0000)]
Stub out two uses of syscall instructions
Mark Seaborn [Sun, 25 Jan 2009 17:39:21 +0000 (25 17:39 +0000)]
Fix alignment in ld.so entry point
Mark Seaborn [Thu, 22 Jan 2009 22:08:10 +0000 (22 22:08 +0000)]
Hook up NaCl exit syscall
Mark Seaborn [Thu, 22 Jan 2009 20:28:31 +0000 (22 20:28 +0000)]
Remove some uses of syscall instructions
Mark Seaborn [Wed, 21 Jan 2009 22:11:07 +0000 (21 22:11 +0000)]
Stub out a large set of syscall instructions
Mark Seaborn [Wed, 21 Jan 2009 20:00:58 +0000 (21 20:00 +0000)]
Fix padding of libc.so
Mark Seaborn [Tue, 20 Jan 2009 20:35:54 +0000 (20 20:35 +0000)]
Fix padding of dynamically linked executables
Mark Seaborn [Tue, 20 Jan 2009 20:33:53 +0000 (20 20:33 +0000)]
Also link libc_pic.os in shortcut script
Mark Seaborn [Mon, 19 Jan 2009 20:51:05 +0000 (19 20:51 +0000)]
Put PHDRs in a new data segment at the start instead of in the code segment
Mark Seaborn [Sat, 17 Jan 2009 19:08:12 +0000 (17 19:08 +0000)]
Update linker script to link a working libc.so
Mark Seaborn [Sat, 17 Jan 2009 18:50:20 +0000 (17 18:50 +0000)]
Change linker script to link ld.so better
Ensure there are separate PT_LOADs for code and read-only data
Move .rel (relocation) sections to be with the read-only data instead of before the code
Mark Seaborn [Sat, 10 Jan 2009 16:14:56 +0000 (10 16:14 +0000)]
Automate creation of kernel-headers directory in myconfig.sh
Mark Seaborn [Sat, 10 Jan 2009 11:29:03 +0000 (10 11:29 +0000)]
Add stub for mprotect()
Mark Seaborn [Sat, 10 Jan 2009 11:16:21 +0000 (10 11:16 +0000)]
Rewrite _dl_runtime_resolve to use nacljmp instead of ret
Note that it no longer preserves all registers
Mark Seaborn [Thu, 8 Jan 2009 20:39:58 +0000 (8 20:39 +0000)]
Link libc.so with the custom linker script
"ld.so --list" now works
Mark Seaborn [Thu, 8 Jan 2009 20:37:06 +0000 (8 20:37 +0000)]
Add scripts for building an example dynamically-linked executable
Mark Seaborn [Thu, 8 Jan 2009 20:12:13 +0000 (8 20:12 +0000)]
Disable ELF header check because the OS ABI field won't match yet
Mark Seaborn [Thu, 8 Jan 2009 20:10:07 +0000 (8 20:10 +0000)]
Fix tls_init() call to work in position independent code
Mark Seaborn [Thu, 8 Jan 2009 20:09:09 +0000 (8 20:09 +0000)]
Disable kernel version check
Mark Seaborn [Thu, 8 Jan 2009 20:07:55 +0000 (8 20:07 +0000)]
Disable use of "ud2" instruction (disallowed by NaCl) in consistency_check()
Mark Seaborn [Wed, 7 Jan 2009 23:00:59 +0000 (7 23:00 +0000)]
Implement mmap(), fxstat(), fxstat64()
The latter two don't do any struct stat conversions yet
Mark Seaborn [Wed, 7 Jan 2009 23:00:04 +0000 (7 23:00 +0000)]
Fix error handling for syscalls: return -1
Mark Seaborn [Wed, 7 Jan 2009 20:39:40 +0000 (7 20:39 +0000)]
Implement open(), read(), close()
Stop hard-coding syscall addresses
Mark Seaborn [Sun, 4 Jan 2009 17:39:15 +0000 (4 17:39 +0000)]
ld.so can now start under sel_ldr and print its help message
* Add linker script for ld.so
* Fix NaCl syscalls to work from position independent code
* Make writev() work; ld.so uses it
Mark Seaborn [Fri, 2 Jan 2009 19:16:52 +0000 (2 19:16 +0000)]
Allow building without --disable-shared
* Apply fix from http://sourceware.org/ml/libc-alpha/2008-11/msg00030.html
* Use hlt instead of abort() in ld.so -- abort() drags in stdio
* make-syscalls.sh: use hidden symbols properly - libc-symbols.h behaves differently in C compared to in assembler
* Override unwind-find-fde; it was being detected wrongly (needs further investigation)
Mark Seaborn [Thu, 1 Jan 2009 11:40:48 +0000 (1 11:40 +0000)]
Fix up auto-generated syscalls
- don't use syscall instruction; print debug message instead
Mark Seaborn [Tue, 30 Dec 2008 21:34:31 +0000 (30 21:34 +0000)]
Fix numerous uses of "ret"
Done with:
perl -pi -e 's/^(\s*)ret(\s*)$/$1popl %ecx; nacljmp %ecx$2/' $(find sysdeps/ -name "*.S" | grep i386)
Mark Seaborn [Tue, 30 Dec 2008 21:32:58 +0000 (30 21:32 +0000)]
Fix use of "ret" in bp-asm.h
Mark Seaborn [Tue, 30 Dec 2008 19:06:05 +0000 (30 19:06 +0000)]
Move tls_init code into TLS_INIT_TP, where it belongs
Mark Seaborn [Tue, 30 Dec 2008 18:51:43 +0000 (30 18:51 +0000)]
Disable uses of ret-with-argument in dl-trampoline.S
(will need to fix later)
Mark Seaborn [Tue, 30 Dec 2008 18:33:13 +0000 (30 18:33 +0000)]
Don't use sysconf() for Linux, which uses pushf/popf (rejected by NaCl)
Mark Seaborn [Tue, 30 Dec 2008 18:14:40 +0000 (30 18:14 +0000)]
Don't use "stmxcsr" instruction
Mark Seaborn [Tue, 30 Dec 2008 17:42:56 +0000 (30 17:42 +0000)]
Put NOP-padding after .init, not zero padding
Mark Seaborn [Tue, 30 Dec 2008 15:58:53 +0000 (30 15:58 +0000)]
Remove files that were earlier moved out of the way
Mark Seaborn [Tue, 30 Dec 2008 14:00:25 +0000 (30 14:00 +0000)]
Revert unnecessary configure script changes
Mark Seaborn [Tue, 30 Dec 2008 13:00:12 +0000 (30 13:00 +0000)]
Add -mno-tls-direct-seg-refs to CFLAGS
Now errno works and so printf() works
Mark Seaborn [Tue, 30 Dec 2008 12:57:55 +0000 (30 12:57 +0000)]
Change build directory to be "build"
Mark Seaborn [Tue, 30 Dec 2008 12:15:59 +0000 (30 12:15 +0000)]
Add example hellow.c program and script for building it
Mark Seaborn [Tue, 30 Dec 2008 12:12:43 +0000 (30 12:12 +0000)]
Remove debugging code from brk()
Mark Seaborn [Mon, 29 Dec 2008 16:19:25 +0000 (29 16:19 +0000)]
Fix _start: NaCl does not define %edx on entry
Mark Seaborn [Mon, 29 Dec 2008 01:16:53 +0000 (29 01:16 +0000)]
Add NaCl write syscall
Mark Seaborn [Mon, 29 Dec 2008 00:31:32 +0000 (29 00:31 +0000)]
Don't depend on libnacl
Mark Seaborn [Mon, 29 Dec 2008 00:31:05 +0000 (29 00:31 +0000)]
Set up TLS for NaCl
Mark Seaborn [Sun, 28 Dec 2008 19:13:14 +0000 (28 19:13 +0000)]
Fix brk()
Mark Seaborn [Sun, 28 Dec 2008 18:53:22 +0000 (28 18:53 +0000)]
Add NaCl brk(); disable calling uname()
Mark Seaborn [Sun, 28 Dec 2008 18:51:41 +0000 (28 18:51 +0000)]
Enable debugging
Mark Seaborn [Sun, 28 Dec 2008 17:49:25 +0000 (28 17:49 +0000)]
Remove more assembler files
Mark Seaborn [Sun, 28 Dec 2008 17:48:58 +0000 (28 17:48 +0000)]
Add config script
Mark Seaborn [Sun, 28 Dec 2008 16:20:50 +0000 (28 16:20 +0000)]
Fix more prefix-skipping
Mark Seaborn [Sun, 28 Dec 2008 15:42:49 +0000 (28 15:42 +0000)]
Disable assembler versions
Mark Seaborn [Sun, 28 Dec 2008 15:32:05 +0000 (28 15:32 +0000)]
Don't use jumps to skip lock prefixes
Mark Seaborn [Sun, 28 Dec 2008 15:03:09 +0000 (28 15:03 +0000)]
Fix padding of __libc_freeres_fn sections
Mark Seaborn [Sun, 28 Dec 2008 11:54:56 +0000 (28 11:54 +0000)]
Fix code/rodata split
Mark Seaborn [Sun, 28 Dec 2008 11:02:45 +0000 (28 11:02 +0000)]
Remove TLS header, not needed
Mark Seaborn [Sun, 28 Dec 2008 11:01:12 +0000 (28 11:01 +0000)]
Add linker script
Mark Seaborn [Sun, 28 Dec 2008 11:00:13 +0000 (28 11:00 +0000)]
Don't read _dl_phdr
Mark Seaborn [Sun, 21 Dec 2008 00:37:59 +0000 (21 00:37 +0000)]
changes to help make it build
Mark Seaborn [Sat, 20 Dec 2008 17:48:55 +0000 (20 17:48 +0000)]
changes so far
Mark Seaborn [Fri, 19 Dec 2008 23:33:17 +0000 (19 23:33 +0000)]
2.9