Improve popen compatibility with glibc.
* libc/posix/popen.c (popen): The 2006-08-22 change to use
FD_CLOEXEC disagrees with other implementations; instead, use
pidlist to work even when fcntl is not available. Meanwhile,
support the 'e' modifier to set CLOEXEC, as in glibc. Drop
cygwin-specific code, now that cygwin has its own version.
* libc/posix/Makefile.am (CHEWOUT_FILES): Document popen.
* libc/posix/posix.tex: New file.
Eric Blake [Tue, 18 Aug 2009 16:43:21 +0000 (16:43 +0000)]
Improve popen compatibility with glibc.
* libc/posix/popen.c (popen): The 2006-08-22 change to use
FD_CLOEXEC disagrees with other implementations; instead, use
pidlist to work even when fcntl is not available. Meanwhile,
support the 'e' modifier to set CLOEXEC, as in glibc. Drop
cygwin-specific code, now that cygwin has its own version.
* libc/posix/Makefile.am (CHEWOUT_FILES): Document popen.
* libc/posix/posix.tex: New file.
* pipe.cc (fhandler_pipe::create_selectable): Add -pipe to default pipe names.
* lib/_cygwin_crt0_common.cc (_cygwin_crt0_common): Use bool/true/false for
what is actually a boolean variable.
Ralf Wildenhues [Sun, 16 Aug 2009 12:49:48 +0000 (12:49 +0000)]
Sync config/ from GCC:
--- config/ChangeLog
+++ config/ChangeLog
@@ -19,6 +19,10 @@
* tls.m4 (GCC_CHECK_TLS): Also test TLS in a shared library when
cross-compiling.
+2009-06-25 Olivier Hainque <hainque@adacore.com>
+
+ * config/mh-ppc-aix (BOOT_ADAFLAGS): Remove -mminimal-toc.
+
2009-05-26 Rafael Avila de Espindola <espindola@google.com>
* plugins.m4: New.
@@ -39,6 +43,27 @@
"# no Tcl configs found".
(SC_LOAD_TKCONFIG): Similarily for TK_BIN_DIR.
+2009-04-09 Jakub Jelinek <jakub@redhat.com>
+
+ * lead-dot.m4: Change copyright header to refer to version
+ 3 of the GNU General Public License and to point readers at the
+ COPYING3 file and the FSF's license web page.
+ * warnings.m4: Likewise.
+
+2009-02-11 Kai Tietz <kai.tietz@onevision.com>
+
+ * mh-cygwin (LDFLAGS): Add linker option to increase stack limit
+ up to 8MB.
+
+2009-01-23 Jie Zhang <jie.zhang@analog.com>
+
+ * tls.m4 (GCC_CHECK_EMUTLS): Define.
+
+2008-12-21 Andrew Pinski <pinskia@gmail.com>
+
+ PR target/38300
+ * unwind_ipinfo.m4: Darwin before 9 does not have _Unwind_GetIPInfo.
+
2008-11-21 Kai Tietz <kai.tietz@onevision.com>
Corinna Vinschen [Fri, 14 Aug 2009 13:39:07 +0000 (13:39 +0000)]
* fhandler_disk_file.cc (fhandler_disk_file::readdir_helper): Remove
ill-advised attempt to optimize "." and ".." handling by checking for
specific position in directory listing. Explain why.
(fhandler_disk_file.cc (fhandler_disk_file::readdir): Ditto.
Special-case opening file on NFS to fetch inode number and add longish
comment to explain why.
Corinna Vinschen [Fri, 14 Aug 2009 06:58:44 +0000 (06:58 +0000)]
* (fhandler_socket::getsockname): Fix length returned for unbound
AF_LOCAL sockets.
(fhandler_socket::getpeername): Ditto.
* net.cc (socketpair): Don't set sun_path and peer_sun_path to
make sure getsockname and getpeername return the correct values
for AF_LOCAL sockets.
Corinna Vinschen [Thu, 13 Aug 2009 15:44:29 +0000 (15:44 +0000)]
* fhandler_socket.cc (fhandler_socket::accept): Use sizeof rather
then constant size. Truncate returned data, but return full address
length as per POSIX.
(fhandler_socket::getsockname): Truncate returned data, but return full
address length as per POSIX.
(fhandler_socket::getpeername): Ditto.
Corinna Vinschen [Thu, 13 Aug 2009 10:26:42 +0000 (10:26 +0000)]
* fhandler.h (class fhandler_socket): Add peer_sun_path member.
(fhandler_socket::set_peer_sun_path): New method.
(fhandler_socket::get_peer_sun_path): New method.
* fhandler_socket.cc (fhandler_socket::fhandler_socket): Initialize
peer_sun_path to NULL.
(fhandler_socket::~fhandler_socket): Free peer_sun_path if necessary.
(fhandler_socket::dup): Duplicate peer_sun_path.
(fhandler_socket::accept): Ditto. Return fake unbound peer content
and len in case of AF_LOCAL sockets.
(fhandler_socket::getsockname): Always use local sockaddr_storage to
store socket address and copy over to incoming address. Handle every
namelen correctly per POSIX.
(fhandler_socket::getpeername): Ditto. Add code path to return
correct value for AF_LOCAL sockets.
(fhandler_socket::set_peer_sun_path): New method.
* net.cc (socketpair): Set peer_sun_path to empty string, just like
sun_path.
Corinna Vinschen [Wed, 12 Aug 2009 14:48:16 +0000 (14:48 +0000)]
* fhandler_socket.cc (fhandler_socket::accept): Always use local
sockaddr_storage to store peer address and copy over to incoming
peer address if available. Truncate data as necessary according
to POSIX.
Corinna Vinschen [Tue, 11 Aug 2009 08:59:50 +0000 (08:59 +0000)]
* mkgroup.c (enum_local_groups): Avoid error message if given group
name isn't found and return 0 to allow searching to proceed. Always
return 0 or 1, not -1.
(enum_groups): Avoid error message if given group name isn't found.
* mkpasswd.c (enum_users): Ditto.
Jan Kratochvil [Mon, 10 Aug 2009 22:02:41 +0000 (22:02 +0000)]
include/coff/
Fix references past allocated memory for i386-*-go32.
* ti.h (COFF_ADJUST_FILEHDR_IN_POST, COFF_ADJUST_FILEHDR_OUT_POST):
Reference F_TARGET_ID only when !COFF0_P.
Jan Kratochvil [Mon, 10 Aug 2009 21:56:42 +0000 (21:56 +0000)]
bfd/
Stop using bfd_usrdata in libbfd.
* coff-stgo32.c (bfd_coff_go32stub): Remove.
(stub_bytes, comment): Replace STUBSIZE by GO32_STUBSIZE.
(adjust_filehdr_in_post): Declare the abfd parameter as unused.
Replace STUBSIZE by GO32_STUBSIZE. Save now the stub in
filehdr_dst->u.go32.stub. New comment with the reason.
(adjust_filehdr_out_pre): Replace STUBSIZE by GO32_STUBSIZE.
Substitute the removed macro bfd_coff_go32stub.
(adjust_filehdr_out_post, adjust_scnhdr_in_post, adjust_scnhdr_out_pre)
(adjust_scnhdr_out_post, adjust_aux_in_post, adjust_aux_out_pre)
(adjust_aux_out_post): Replace STUBSIZE by GO32_STUBSIZE.
(create_go32_stub, go32_stubbed_coff_bfd_copy_private_bfd_data):
Replace STUBSIZE by GO32_STUBSIZE. Substitute the removed macro
bfd_coff_go32stub.
* coffcode.h (coff_mkobject_hook): Initialize coff->go32stub.
* libcoff-in.h (coff_data_type): New field go32stub.
* libcoff.h: Regenerated.
include/coff/
Stop using bfd_usrdata in libbfd.
* go32exe.h (struct external_filehdr_go32_exe <stub>, FILHSZ): Replace
STUBSIZE by GO32_STUBSIZE.
(STUBSIZE): Move the definition ...
* internal.h (GO32_STUBSIZE): ... here and rename it.
(struct internal_filehdr <go32stub>, F_GO32STUB): New.
Corinna Vinschen [Mon, 10 Aug 2009 15:38:37 +0000 (15:38 +0000)]
* dtable.cc (DEV_SOCKET): New static WCHAR string. Name of
the native NT socket device.
(dtable::init_std_file_from_handle): Remove unused tmp_pathbuf
variable. Move check for sockets into FILE_TYPE_PIPE clause.
Rely on handle_to_fn having recognized socket, or check if
getsockopt works to accommodate NT4 shortcoming.
(handle_to_fn): Use tmp_pathbuf for OBJECT_NAME_INFORMATION
buffer and simplify code due to that. Check name returned by
NtQueryObject for socket device.
* dtable.cc (dtable::init_std_file_from_handle): Fix comment to
document change in the Windows 7 workaround.
* wincap.cc (wincapc::init): Don't set has_console_handle_problem
to false on 32 bit systems.
* net.cc (cygwin_getnameinfo): Force setting NI_NUMERICSERV only
on Windows 2003 and earlier, only if the port number doesn't
resolve to a well-known service. Change comment accordingly.
* cygheap.h (cygheap_debug::endh): Delete.
* debug.cc (lock_debug::acquired): Delete.
(lock_debug::lock_debug): Simplify.
(lock_debug::unlock): Ditto.
(find_handle): Don't set endh here.
(add_handle): Add new handle to beginning of the list rather than trying to
maintain an end list pointer.
(delete_handle): Minor optimization.
(mark_closed): Make logic clearer.
(verify_handle): Lock handle list before scanning.
(setclexec): Ditto.
(modify_handle): Ditto.
(newh): Don't lock handle list here. Assume caller did this.
(mark_closed): Ditto.
(close_handle): Remove unneeded #if.
* dtable.cc (dtable::dup2): Tweak debug output.
* fhandler_socket.cc (fhandler_socket::send_internal): Just use wmem size if
the length exceeds it.
* net.cc (fdsock): Use 65535 as window size, just like the comment says or we
run into problems with DuplicateHandle.
* path.cc (patch_conv::check): Use set_path to set invalid filename.
* path.h (path_conv::path_conv): Ditto.
* fhandler.h (fhandler_cygdrive:DRVSZ): New enum.
(pdrive_buf): New place to hold information about cygdrive.
* fhandler_disk_file.cc (fhandler_cygdrive::set_drives): Store drive info in
pdrive_buf since get_win32_name() could now be too small to hold everything.
(fhandler_cygdrive::rewinddir): Reset pdrive to pdrive_buf.
(fhandler_cygdrive::closedir): Ditto.
* pipe.cc (fhandler_pipe::init): Be more defensive when referencing
get_win32_name(). Rework logic which made a copy of the POSIX path and then
never used it.
* sigproc.cc (stopped_or_terminated): Don't return a match when stopsig ==
SIGCONT and not WCONTINUED.
* termios.cc (tcsetpgrp): Improve debugging output.
* cygheap_malloc.h: New file.
* cygheap.h: Remove stuff now included in cygheap_malloc.h and include that
file. Make cygheap_init a standard c++ function. Remove unneeded child_info
declaration.
* path.h: Include cygheap_malloc.h. Remove extra cstrdup declaration.
(path_conv): Reorganize to group variables together.
(path_conv::path): Make const char *.
(path_conv::known_suffix): Ditto.
(path_conv::normalized_path): Ditto.
(path_conv::path_conv): Reorganize initializers to reflect new element
ordering.
(path_conv::get_win32): Change return value to const char *.
(path_conv::set_path): Move back here from spawn.cc.
(parh_conv::modifiable_path): New function.
* path.cc (path_conv::add_ext_from_sym): Accommodate const'ness of
known_suffixes.
(path_conv::set_normalized_path): Ditto for normalized_path.
(path_conv::check): Use modifiable_path whereever we need to modify the path
element. Use set_path to set the path.
(path_conv::~path_conv): Accommodate new const'ness.
* spawn.cc (perhaps_suffix): Declare ext as const since that's what is being
returned.
(path_conv::set_path): Move back to path.h.
* winf.f (linebuf): Perform minor cleanup.
(linebuf::fromargv): Change second parameter to const.
* winf.cc (linebuf::fromargv): Ditto.
* path.h (path_conv::set_path): Change return value.
* spawn.cc (path_conv::set_path): Return newly set value.
(find_exec): Set retval to newly set value when calling set_path.
intl/
* Makefile.in (aclocal_deps): New variable.
($(srcdir)/aclocal.m4): Use it, for portable makefile syntax.
libdecnumber/
* Makefile.in (aclocal_deps): New variable.
($(srcdir)/aclocal.m4): Use it, for portable makefile syntax.
etc/
* Makefile.in (AUTOCONF, configure_deps): New variables.
($(srcdir)/configure, config.status): New rules.
(Makefile): Depend on config.status.
* configure.in: Accept --enable-maintainer-mode, set and
substitute MAINT accordingly.
gdb/
* Makefile.in (ACLOCAL, ACLOCAL_AMFLAGS, aclocal_m4_deps)
(AUTOCONF, configure_deps, AUTOHEADER): New variables.
($(srcdir)/aclocal.m4, $(srcdir)/configure, $(srcdir)/config.in)
(am--refresh): New rules.
(stamp-h, config.status): List config.in and configure including
$(srcdir)/ prefix.
* aclocal.m4: Regenerate.
* configure: Regenerate.
config/
* extensions.m4 (AC_USE_SYSTEM_EXTENSIONS): Do not expand
for Autoconf 2.62 or newer.
* tls.m4 (GCC_CHECK_TLS): Fix m4 quotation.
* no-executables.m4 (_AC_COMPILER_EXEEXT): Fix m4 quotation.
* override.m4 (m4_copy_force, m4_rename_force): Provide
macros if not defined.
(AC_PREREQ): Use m4_copy_force.
* globals.cc (enum exit_states::ES_GLOBAL_DTORS): Delete.
* dcrt0.cc (__main): Schedule dll_global_dtors to run
atexit before global dtors.
(do_exit): Delete test for ES_GLOBAL_DTORS and call to
dll_global_dtors.
* path.h (class path_conv): Convert path from char array to char *.
Initialize to NULL in constructors. Drop normalized_path_size member.
(path_conv::size): Remove.
(path_conv::operator =): Always copy with sizeof path_conv. Always
duplicate path on cygheap.
(path_conv::set_path): Move implementation to spawn.cc.
* path.cc (path_conv::set_normalized_path): Always allocate
normalized_path on cygheap.
(path_conv::check): Don't work on path, rather allocate THIS_path in
TLS and use it throughout. When finished, allocate path on cygheap
and copy over. Defer tacking on extension after having copied path.
* spawn.cc (path_conv::set_path): Implement here.
* libc/stdlib/mbtowc_r.c (__utf8_mbtowc): Rework UTF-16 surrogate
pair handling to be more bullet-proof even with incomplete UTF-8
sequences. Add check for 4 byte sequences resulting in values
outside the valid Unicode range. Add a comment to clarify checking
for invalid CESU-8 sequences.
* mount.h (enum fs_info_type): New type.
(IMPLEMENT_FS_FLAG): New define.
(class fs_info): Convert filesystem type status flags into an enum
fs_info_type. Add cifs FS. Revert change to has_buggy_open and
has_buggy_fileid_dirinfo. Make them normal; status flags again.
Implement is_FS functions using IMPLEMENT_FS_FLAG.
* mount.cc (fs_info::update): Define MINIMAL_WIN_NTFS_FLAGS and
FS_IS_WINDOWS_NTFS. Add comment. Only test remote filesystems
for "NTFS" once. Add is_cifs check using FS_IS_WINDOWS_NTFS.
Set has_buggy_open flag for SUNWNFS. Set has_buggy_fileid_dirinfo
flag for UNIXFS and all cifs type filesystems. Only check for
caseinsensitivity once.
(fillout_mntent): Create locale fs_names array. Use for setting
_my_tls.locals.mnt_type.
* config.bfd (targ64_selvecs): Add bfd_elf64_l1om_vec if
bfd_elf64_x86_64_vec is supported. Add bfd_elf64_l1om_freebsd_vec
if bfd_elf64_x86_64_freebsd_vec is supported.
(targ_selvecs): Likewise.
* configure.in: Support bfd_elf64_l1om_vec and
bfd_elf64_l1om_freebsd_vec.
* configure: Regenerated.
* configure.tgt (targ64_extra_emuls): Add elf_l1om if elf_x86_64
is supported. Add elf_l1om_fbsd if elf_x86_64_fbsd is supported.
(targ_extra_emuls): Likewise.
* i386-dis.c (print_insn): Handle bfd_mach_l1om and
bfd_mach_l1om_intel_syntax. Use 8 bytes per line for Intel L1OM.
* i386-gen.c (cpu_flag_init): Set CPU_UNKNOWN_FLAGS to ~CpuL1OM.
Add CPU_L1OM_FLAGS.
(cpu_flags): Add CpuL1OM.
(set_bitfield): Take an argument to set the value field.
(process_i386_cpu_flag): Support ~CpuXXX and ~(CpuXXX|CpuYYY).
(process_i386_opcode_modifier): Updated.
(process_i386_operand_type): Likewise.
* i386-init.h: Regenerated.
* i386-tbl.h: Likewise.
* sigproc.h (wait_for_sigthread): Eliminate parameter.
* sigproc.cc (wait_for_sigthread): Ditto. Don't synchronize with wait_sig
after receiving an event that it is ready to go.
(init_sig_pipe): New function.
(wait_sig): Call init_sig_pipe to create pipes for communicating signals to
this process. Don't send sigCONT signal when initializing.
* fork.cc (frok::child): Accommodate wait_for_sigpipe parameter change.
* fhandler.h (fhandler_*::write): Make ssize_t/__stdcall.
(fhandler_*::write_overlapped): Ditto.
(fhandler_*::raw_write): Ditto.
(fhandler_*::readv): Ditto.
(fhandler_*::writev): Ditto.
(fhandler_*::raw_read): Make __stdcall.
* fhandler: Accommodate changes to read/write functions throughout.
* fhandler_clipboard.cc: Ditto.
* fhandler_console.cc: Ditto.
* fhandler_dsp.cc: Ditto.
* fhandler_fifo.cc: Ditto.
* fhandler_mailslot.cc: Ditto.
* fhandler_mem.cc: Ditto.
* fhandler_mem.cc: Ditto.
* fhandler_random.cc: Ditto.
* fhandler_tape.cc: Ditto.
* fhandler_tty.cc: Ditto.
* fhandler_virtual.cc: Ditto.
* fhandler_windows.cc: Ditto.
* fhandler_zero.cc: Ditto.
* syscalls.cc (readv): Use ssize_t as temp variable.
* fhandler.cc (fhandler_base::read): Coerce returned len to signed or it will
never be treated as < 0.
(fhandler_base::wait_overlapped): Minimize calls to GetLastError. Remove
duplicate debugging test. Fix error return.
* fhandler.h (fhandler_fifo::fifo_name): Declare new function.
(fhandler_fifo::close): Ditto.
(fhandler_fifo::dup): Ditto.
(fhandler_fifo::close_on_exec): Ditto.
* fhandler.cc (fhandler_fifo::fifo_name): Define new function.
(FIFO_BUF_SIZE): New define.
(cnp): Ditto.
(fhandler_fifo::open): Rework. Use cnp to open named pipe. Always open write
side as a client. Open dummy client when writing and can't connect.
(wait): Rework. Implement fifo_wait_for_next_client. Handle signals during
connect better. Add new fifo_wait_for_server code which polls
(sigh) waiting for server.
(fhandler_fifo::raw_read): Handle transition states when one client closes and
another is available.
(fhandler_fifo::close): Define.
(fhandler_fifo::dup): Ditto.
(fhandler_fifo::close_on_exec): Ditto.
Nick Clifton [Thu, 23 Jul 2009 13:00:30 +0000 (13:00 +0000)]
* config/obj-elf.c (obj_elf_type): Add code to support a type of
gnu_unique_object.
* doc/as.texinfo: Document new feature of .type directive.
* NEWS: Mention support for gnu_unique_object symbol type.
* common.h (STB_GNU_UNIQUE): Define.
* NEWS: Mention the linker's support for symbols with a binding of
STB_GNU_UNIQUE.
* gas/elf/type.s: Add unique global symbol definition.
* gas/elf/type.e: Add expected readelf output for global unique
symbol.
* elfcpp.h (enum STB): Add STB_GNU_UNIQUE.
* readelf.c (get_symbol_binding): For Linux targeted files return
UNIQUE for symbols with the STB_GNU_UNIQUE binding.
* doc/binutils.texi: Document the meaning of the 'u' symbol
binding in the output of nm and objdump --syms.
* elf-bfd.h (struct elf_link_hash_entry): Add unique_global field.
* elf.c (swap_out_syms): Set binding to STB_GNU_UNIQUE for symbols
with the BSF_GNU_UNIQUE flag bit set.
* elfcode.h (elf_slurp_symbol_table): Set the BSF_GNU_UNIQUE flag
for symbols with STB_GNU_UNIQUE binding.
* elflink.c (_bfd_elf_merge_symbol): Set unique_global for symbols
with the STB_GNU_UNIQUE binding.
(elf_link_add_object_symbols): Set the BSF_GNU_UNIQUE flag for
symbols with STB_GNU_UNIQUE binding. Set STB_GNU_UNIQUE for
symbols with the unique_global field set.
(elf_link_output_extsym): Set unique_global field for symbols with
the STB_GNU_UNIQUE binding.
* syms.c (struct bfd_symbol): Define BSF_GNU_UNIQUE flag bit.
(bfd_print_symbol_vandf): Print a 'u' character for BSF_GNU_UNIQUE
symbols.
(bfd_decode_symclass): Return a 'u' character for BSF_GNU_UNIQUE
symbols.
* bfd-in2.h: Regenerate.
* mount.h (fs_info::fsn): New member.
(fs_info::clear): Clear fsn.
(fs_info::fsname): New read accessor for fsn.
* mount.cc (fs_info::update): Fill in fsn member with lowercased
filesystem name if filesystem is not well-known. Fall back to
"unknown" if filesystem name is missing.
(fillout_mntent): Print filesystem name retrieved in fs_info::update
rather than static string "unknown".
* faq-using.xml (faq.using.ipv6): Try to clarify OS specific support.
* faq-what.xml (faq.what.supported): Add Windows 7 and 2008 R2.
* new-features.sgml: Add "and later" to rcmd news.
* mount.cc (do_mount): Replace --no-executable flag with notexec
mount option in hint for remote filesystems.
* path.cc (getmntent): Fix typo (noexec -> notexec).
* fhandler.h (enum del_lock_called_from): New enumeration.
(fhandler_base::del_my_locks): Declare taking a del_lock_called_from
as argument.
* fhandler.cc (fhandler_base::close): Call del_my_locks with "on_close".
(fhandler_base::fixup_after_fork): Call del_my_locks with "after_fork".
(fhandler_base::fixup_after_exec): Call del_my_locks with "after_exec".
* flock.cc (fhandler_base::del_my_locks): Take del_lock_called_from
as argument. Call node->del_my_locks with NULL handle in after_exec
case. Explain why.
* Makefile.in (path-mount.o): Add a rule to build stripped down version
of path.cc for usage in mount.
(mount.exe): Add dependency to path-mount.o.
* mount.cc (force): Convert to bool value. Accommodate throughout.
(from_fstab): New function.
(do_mount_from_fstab): New function.
(longopts): Add --all option.
(opts): Add -a option.
(usage): Document -a/--all option.
(main): Handle -a option as well as single parameter.
* path.cc: Add FSTAB_ONLY conditional to allow building path-mount.o.
(mount_table): Remove static storage class.
(max_mount_entry): Ditto.
(root_here): Unused. Remove.
(from_fstab_line): Remove static.
* path.h (struct mnt_t): Define here rather than in path.cc.
(from_fstab_line): Declare.
(mount_table): Declare.
(max_mount_entry): Declare.
* utils.sgml (mount): Document -a/--all option and mounting of single
path from fstab files.