* heap.cc (heap_init): Change type of largest_found to PVOID. Start
querying memory at 0x20000000. Use largest_found pointer when trying
to allocate largest free memory area found.
Jeff Johnston [Fri, 15 Jul 2011 17:20:16 +0000 (17:20 +0000)]
2011-07-15 Yufeng Zhang <yufeng.zhang@arm.com>
* libc/stdio/vfwprintf.c (wcvt): Add a new parameter len of type
int. *length is set to the value of (rev - digits) regardless
of whether _MB_CAPABLE is defined or not. Replace BUF with len
in calling _mbsnrtowcs_r and also in the loop where _MB_CAPABLE
is not defined.
(_VFWPRINTF_R): Call wcvt with an extra argument. Call wcvt
again with allocated new buffer if buf is not large enough for
the conversion.
* testsuite/newlib.stdio/stdio.exp: New.
* testsuite/newlib.stdio/swprintf.c: Likewise.
* fhandler_console.cc (fhandler_console::input_tcsetattr): Revert to
setting ENABLE_PROCESSED_INPUT depending on ISIG and IGNBRK.
(fhandler_console::tcgetattr): Set ISIG depending on
ENABLE_PROCESSED_INPUT as well.
* plugin-api.h
(ld_plugin_section): New struct.
(ld_plugin_get_section_count): New typedef.
(ld_plugin_get_section_type): New typedef.
(ld_plugin_get_section_name): New typedef.
(ld_plugin_get_section_contents): New typedef.
(ld_plugin_update_section_order): New typedef.
(ld_plugin_allow_section_ordering): New typedef.
(LDPT_GET_SECTION_COUNT): New enum value.
(LDPT_GET_SECTION_TYPE): New enum value.
(LDPT_GET_SECTION_NAME): New enum value.
(LDPT_GET_SECTION_CONTENTS): New enum value.
(LDPT_UPDATE_SECTION_ORDER): New enum value.
(LDPT_ALLOW_SECTION_ORDERING): New enum value.
(tv_get_section_count): New struct members.
(tv_get_section_type): New struct members.
(tv_get_section_name): New struct members.
(tv_get_section_contents): New struct members.
(tv_update_section_order): New struct members.
(tv_allow_section_ordering): New struct members.
* archive.cc (Archive::get_elf_object_for_member): Add extra parameter
to claim_file call.
* layout.cc (Layout::Layout): Initialize section_ordering_specified_,
input_section_position_, and input_section_glob_.
(read_layout_from_file): Call function section_ordering_specified.
* layout.h (is_section_ordering_specified): New function.
(section_ordering_specified): New function.
(section_ordering_specified_): New boolean member.
* main.cc(main): Call load_plugins after layout object is defined.
* output.cc (Output_section::add_input_section): Use
function section_ordering_specified to check if section ordering is
needed.
* output.cc (Output_section::add_relaxed_input_section): Use
function section_ordering_specified to check if section ordering is
needed.
(Output_section::update_section_layout): New function.
(Output_section::sort_attached_input_sections): Check if input section
must be reordered.
* output.h (Output_section::update_section_layout): New function.
* plugin.cc (get_section_count): New function.
(get_section_type): New function.
(get_section_name): New function.
(get_section_contents): New function.
(update_section_order): New function.
(allow_section_ordering): New function.
(Plugin::load): Add the new interfaces to the transfer vector.
(Plugin_manager::load_plugins): New parameter.
(Plugin_manager::all_symbols_read): New parameter.
(Plugin_manager::claim_file): New parameter. Save the elf object for
unclaimed objects.
(Plugin_manager::get_elf_object): New function.
(Plugin_manager::get_view): Change to directly use the bool to check
if get_view is called from claim_file_hook.
* plugin.h (input_objects): New function
(Plugin__manager::load_plugins): New parameter.
(Plugin_manager::claim_file): New parameter.
(Plugin_manager::get_elf_object): New function.
(Plugin_manager::in_claim_file_handler): New function.
(Plugin_manager::in_claim_file_handler_): New member.
(layout): New function.
* readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
handler with an extra parameter. Make the elf object before calling
claim_file handler.
* testsuite/plugin_test.c (get_section_count): New function pointer.
(get_section_type): New function pointer.
(get_section_name): New function pointer.
(get_section_contents): New function pointer.
(update_section_order): New function pointer.
(allow_section_ordering): New function pointer.
(onload): Check if the new interfaces exist.
* fhandler_tty.cc (fhandler_pty_slave::ioctl): Remove erroneous support for
TIOCLINUX for pty. Get rid of unneeded EINVAL handling in wake of tty removal.
Remove now-unneeded variable.
Alan Modra [Sat, 9 Jul 2011 06:20:51 +0000 (06:20 +0000)]
PR ld/12942
bfd/
* elflink.c (elf_link_add_object_symbols): Use elf_discarded_section
rather than kept_section to determine whether a symbol is from
a discarded section.
* cofflink.c (coff_link_add_symbols): Make symbols from discarded
sections appear undefined.
* elf-bfd.h (_bfd_elf_section_already_linked): Replace
"asection *" with "struct already_linked *".
* libbfd-in.h (_bfd_nolink_section_already_linked): Likewise.
(_bfd_generic_section_already_linked): Likewise.
(bfd_section_already_linked_table_insert): Likewise.
(struct already_linked): New.
(struct bfd_section_already_linked): Use it.
* elflink.c (_bfd_elf_section_already_linked): Replace.
"asection *" with "struct already_linked *". Replace the plugin
dummy with the LTO output.
* linker.c (_bfd_generic_section_already_linked): Likewise.
* targets.c (struct already_linked): Add forward declaration.
(bfd_target): Replace "struct bfd_section *" with
"struct already_linked *" in _section_already_linked.
* bfd-in2.h: Regenerate.
* libbfd.h: Regenerate.
* exceptions.cc (_cygtls::interrupt_now): Back out previous change since it
could theoretically cause a non-CTRL-C-able program if a program has suffered
memory corruption.
(setup_handler): Ditto.
* exceptions.cc (_cygtls::interrupt_now): Don't check for spinning here.
(setup_handler): Check for spinning here, assuming that it is transitory and
should not affect the retry loop.
* exceptions.cc (CALL_HANDLER_RETRY_INNER): Rename to reflect different
functionality.
(CALL_HANDLER_RETRY_OUTER): New define.
(setup_handler): Add outer loop to signal handler to try harder to deliver the
signal.
* miscfuncs.cc (yield): Drop priority and use SleepEx() to force thread
rescheduling rather than relying on SwitchToThread().
* fhandler_console.cc (fhandler_console::input_tcsetattr): Make
ENABLE_PROCESSED_INPUT flag only depending on value of IGNBRK.
(fhandler_console::tcgetattr): Don't set ISIG depending on
ENABLE_PROCESSED_INPUT, set IGNBRK instead.
Throughout, open console handles with sharing for reading and writing.
* dcrt0.cc (insert_file): Open file with full sharing allowed.
* hookapi.cc (find_first_notloaded_dll): Ditto.
* spawn.cc (av::fixup): Ditto.
* fhandler.cc (fhandler_base::open_with_arch): Call close_on_exec last to avoid
setting close_on_exec for archetype.
* fhandler_tty.cc (fhandler_pty_master::setup): Protect {from,to}_pty handles.
Use consistent naming in debug output. Use inheritable handles and...
(fhandler_pty_master::fixup_after_fork): ...avoid duplicating handles here.
(fhandler_pty_slave::open): Don't set close_on_exec flag here.
Thomas Schwinge [Sun, 3 Jul 2011 13:45:32 +0000 (13:45 +0000)]
ELFOSABI_GNU
bfd/
* elf.c (_bfd_elf_set_osabi): Use ELFOSABI_GNU name instead of
ELFOSABI_LINUX alias.
* elf32-hppa.c: Likewise.
* elf32-i370.c: Likewise.
* elf64-hppa.c: Likewise.
binutils/
* elfedit.c (osabis): Use ELFOSABI_GNU name instead of ELFOSABI_LINUX
alias and ELFOSABI_HURD. Add GNU alias.
* readelf.c (get_osabi_name, get_symbol_binding, get_symbol_type):
Likewise.
* doc/binutils.texi <elfedit>: Update accordingly.
elfcpp/
* elfcpp.h (ELFOSABI): Add ELFOSABI_GNU with value of ELFOSABI_LINUX,
keep ELFOSABI_LINUX as an alias. Remove ELFOSABI_HURD.
gas/
* config/obj-elf.c (obj_elf_type): Use ELFOSABI_GNU name instead of
ELFOSABI_LINUX alias.
* config/tc-ia64.c: Likewise.
include/elf/
* common.h (ELFOSABI_GNU): Define, replaces...
(ELFOSABI_LINUX): ... this, kept as an alias.
(ELFOSABI_HURD): Remove.
ld/testsuite/
* ld-ifunc/ifunc.exp: Update for changed output.
* ld-unique/unique.exp: Likewise.
Thomas Schwinge [Sun, 3 Jul 2011 13:37:08 +0000 (13:37 +0000)]
ELFOSABI_GNU
bfd/
* elf.c (_bfd_elf_set_osabi): Use ELFOSABI_GNU name instead of
ELFOSABI_LINUX alias.
* elf32-hppa.c: Likewise.
* elf32-i370.c: Likewise.
* elf64-hppa.c: Likewise.
binutils/
* elfedit.c (osabis): Use ELFOSABI_GNU name instead of ELFOSABI_LINUX
alias and ELFOSABI_HURD. Add GNU alias.
* readelf.c (get_osabi_name, get_symbol_binding, get_symbol_type):
Likewise.
* doc/binutils.texi <elfedit>: Update accordingly.
elfcpp/
* elfcpp.h (ELFOSABI): Add ELFOSABI_GNU with value of ELFOSABI_LINUX,
keep ELFOSABI_LINUX as an alias. Remove ELFOSABI_HURD.
gas/
* config/obj-elf.c (obj_elf_type): Use ELFOSABI_GNU name instead of
ELFOSABI_LINUX alias.
* config/tc-ia64.c: Likewise.
include/elf/
* common.h (ELFOSABI_GNU): Define, replaces...
(ELFOSABI_LINUX): ... this, kept as an alias.
(ELFOSABI_HURD): Remove.
ld/testsuite/
* ld-ifunc/ifunc.exp: Update for changed output.
* ld-unique/unique.exp: Likewise.
The current syscalls.c implements getpid/fstat/stat/link/unlink as mere
stubs. So replace them with useful calls to do_syscall now that our sim
can support them.
* include/sys/param.h (NGROUPS): Redefine as NGROUPS_MAX.
(MAXHOSTNAMELEN): Redefine with same value as MAX_HOSTNAME_LEN. Change
comment.
(MAXPATHLEN): Improve comment.
(MAXSYMLINKS): Define and add comment.
Corinna Vinschen [Thu, 30 Jun 2011 14:04:51 +0000 (14:04 +0000)]
* dtable.cc (fh_oom): Remove.
(fh_calloc): Remove.
(cnew): Redefine to handle NULL returns from cmalloc.
(build_fh_name): Accommodate new definition of cnew. Remove unneeded
test for fh_oom.
(fh_alloc): Ditto.
Corinna Vinschen [Thu, 30 Jun 2011 13:55:57 +0000 (13:55 +0000)]
* fhandler_console.cc (fhandler_console::read): Add comment.
(fhandler_console::input_tcsetattr): Don't set ENABLE_PROCESSED_INPUT
if IGNBRK flag is set.
Corinna Vinschen [Thu, 30 Jun 2011 09:37:36 +0000 (09:37 +0000)]
* dtable.cc (fh_oom): New static fhandler storage.
(fh_calloc): New static function. Add a comment to explain why this
is needed.
(cnew): Call fh_calloc as placement argument.
(build_fh_name): Check return code from cnew against address of
fh_oom to test for out of memory condition.
(fh_alloc): Ditto.
(build_fh_pc): Avoid a crash due to useing a NULL fhandler.
* pipe.cc (fhandler_pipe::create): Check if build_fh_dev returned a
valid pointer before using it.
Corinna Vinschen [Tue, 28 Jun 2011 10:21:34 +0000 (10:21 +0000)]
* fhandler_process.cc (heap_info::fill_if_match): Rename info to
note that this heap is a Windows heap.
(format_process_maps): Print info about application heap.
* dwarf.c (decode_location_expression): For DW_OP_GNU_convert and
DW_OP_GNU_reinterpret, if uvalue is 0, don't add cu_offset.
Handle DW_OP_GNU_parameter_ref.
libgloss: bfin: handle result2/errcode in sim syscalls
The sim passes back results via two values, and the error code via a 3rd.
make sure libgloss extracts all three so that things like errno work as
expected. This fixes many gdb tests which look for this sort of thing.
sim: bfin: fix sign extension in dsp insns with MM flag
After testing the hardware with all the different dsp flags, the MM flag
triggers sign extension in all modes. So drop the limited use of it, and
the local custom helper that was also extending unsigned values. We also
can see that the flag checks in the mult/mac insns have the same behavior
with sign extending, so add a helper func to keep the logic the same in
both places.
Signed-off-by: Robin Getz <robin.getz@analog.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Corinna Vinschen [Fri, 17 Jun 2011 11:04:44 +0000 (11:04 +0000)]
* fhandler.cc (fhandler_base::open): Drop local create_options variable.
Use options member instead.
* fhandler.h (class fhandler_base): Change type of access member to
ACCESS_MASK. Change get_access and set_access methods accordingly.
Add options member. Add get_options and set_options methods.
(class fhandler_disk_file): Add prw_handle.
(fhandler_disk_file::prw_open): Declare.
(fhandler_disk_file::close): Declare.
(fhandler_disk_file::dup): Declare.
(fhandler_disk_file::fixup_after_fork): Declare.
* fhandler_disk_file.cc (fhandler_disk_file::fhandler_disk_file):
Initialize prw_handle to NULL.
(fhandler_disk_file::close): Close prw_handle.
(fhandler_disk_file::dup): New method.
(fhandler_disk_file::fixup_after_fork): Set prw_handle to NULL since
prw_handle is not inherited.
(fhandler_disk_file::prw_open): New method. Add long comment to
explain current behaviour.
(fhandler_disk_file::pread): Revert previous change. Change to use
prw_handle if possible.
(fhandler_disk_file::pwrite): Change to use prw_handle if possible.
Corinna Vinschen [Fri, 17 Jun 2011 08:30:27 +0000 (08:30 +0000)]
* dcrt0.cc (dll_crt0_1): Call strace.dll_info after call to pinfo_init.
* strace.cc (strace::hello): Drop printing DLL information here since
application info is not always available at this point.
(strace::dll_info): New method to print DLL info.
* include/sys/strace.h (strace::dll_info): Declare.
Ulrich Weigand [Wed, 15 Jun 2011 16:36:58 +0000 (16:36 +0000)]
include/elf/
* common.h (NT_ARM_VFP): Define.
bfd/
* elf-bfd.h (elfcore_write_arm_vfp): Add prototype.
* elf.c (elfcore_grok_arm_vfp): New function.
(elfcore_grok_note): Call it to handle NT_ARM_VFP notes.
(elfcore_write_arm_vfp): New function.
(elfcore_write_register_note): Call it to handle .reg-arm-vfp.
Corinna Vinschen [Tue, 14 Jun 2011 14:31:59 +0000 (14:31 +0000)]
* libc/time/asctime_r.c (asctime_r): Replace call to sprintf with call
to siprintf.
* libc/time/strftime.c: Define snprintf to sniprintf in multibyte case.
* libc/time/tzset_r.c: Define sscanf to siscanf.
Corinna Vinschen [Tue, 14 Jun 2011 07:50:40 +0000 (07:50 +0000)]
* libc/time/tzset_r.c (tzset_r): Correct behavior for changing from
non-GMT to GMT, when un-setting TZ. Set _timezone and _daylight even
if no DST is given in TZ.
* common.h: Add EM_TILEGX.
* tilegx.h: New file.
* tilepro.h: New file.
* Makefile.am (ALL_EMULATION_SOURCES): Add eelf32tilegx.c and
eelf32tilepro.c.
(ALL_64_EMULATION_SOURCES): Add eelf64tilegx.c.
(eelf32tilegx.c): New target.
(eelf32tilepro.c): Likewise.
(eelf64tilegx.c): Likewise.
* Makefile.in: Regenerate.
* configure.tgt: Handle tilegx-*-* and tilepro-*-*.
* emulparams/elf32tilegx.sh: New file.
* emulparams/elf64tilegx.sh: New file.
* emulparams/elf32tilepro.sh: New file.
* ld-elf/eh5.d: Don't run on tile*.
* ld-srec/srec.exp: xfail on tile*.
* ld-tilegx/external.s: New file.
* ld-tilegx/reloc.d: New file.
* ld-tilegx/reloc.s: New file.
* ld-tilegx/tilegx.exp: New file.
* ld-tilepro/external.s: New file.
* ld-tilepro/reloc.d: New file.
* ld-tilepro/reloc.s: New file.
* ld-tilepro/tilepro.exp: New file.
* Makefile.am (TARGET_LIBOPCODES_CFILES): Add tilegx-dis.c,
tilegx-opc.c, tilepro-dis.c, and tilepro-opc.c.
* Makefile.in: Regenerate.
* configure.in: Handle bfd_tilegx_arch and bfd_tilepro_arch.
* configure: Regenerate.
* disassemble.c (disassembler): Add ARCH_tilegx and ARCH_tilepro.
* po/POTFILES.in: Regenerate.
* tilegx-dis.c: New file.
* tilegx-opc.c: New file.
* tilepro-dis.c: New file.
* tilepro-opc.c: New file.
Rename FH_BAD to FH_NADA throughout.
* devices.h (FH_ERROR): New value.
(iscons_dev): Extend to detect all the console device types.
* devices.in: Set aside storage for FH_ERROR.
* dtable.cc (dtable::init_std_file_from_handle): Use iscons_dev to detect when
device is a console.
(fh_alloc): Pass device to console constructor.
(build_fh_pc): Short circuit when we detect that the constructor saw an error.
* fhandler.h (fhandler_console::fhandler_console): Accept fh_devices parameter.
(get_tty_stuff): Change to void.
* fhandler_console (fhandler_console::set_unit): Set device to FH_ERROR on
attempt to access anything other than the current console.
(fhandler_console::get_tty_stuff): Change to void return.
(fhandler_console::open): Return EPERM on FH_ERROR device type.
(fhandler_console::fhandler_console): Set the device type appropriately before
calling get_tty_stuff and rely on that function to reset it if necessary.
* environ.c: Move code earlier to allow:
(_addenv): Call parse_options() when CYGWIN environment variable is being
changed.
(parse_options): Change parameter to 'const'.
* environ.cc (settings::set_process_state): Delete.
(tty_is_gone): New function.
(known): Change "tty" to call tty_is_gone(). Remove unneeded '&' from
beginning of function address.
(parse_options): Remove set_process_state handling.
* shared_info.h (CURR_USER_MAGIC): Reset.
(user_info::warned_notty): New member.
2011-05-30 Chris Metcalf <cmetcalf@tilera.com>
Ben Elliston <bje@gnu.org>
* config.guess (tile*:Linux:*:*): Use vendor "unknown", not
"tilera", for consistency with other architectures.
* config.sub (tile*-*, tilegx-*): Use a more general pattern for
"tile" to allow matching tilepro, tilegx32 and other variants.
* fhandler_console.cc (fhandler_console::open_shared_console): Don't zero
handle to open_shared since it is supposed to be an input.
(enum_windows): Set handle input to open_shared to NULL since it does not
represent any previously opened shared region.
* shared.cc (open_shared): Tweak debugging output.
* fhandler.cc (fhandler_base_overlapped::wait_overlapped): Only raise SIGPIPE
when writing.
* fhandler.h: Include "tty.h".
(fhandler_termios::_tc): Rename from tc.
(fhandler_termios::tc): New method.
(fhandler_termios::tcinit): Remove an argument.
(fhandler_termios::get_ttyp): Use method to retrieve value.
(fhandler_console::console_state): Move here.
(fhandler_console::dev_state): Delete.
(fhandler_console::shared_console_info): Define.
(fhandler_console::open_shared_console): Move this function under
fhandler_console umbrella.
(fhandler_console::tc): Define. Return static value.
(fhandler_console::focus_aware): Accommodate deletion of dev_state.
(fhandler_console): Add tty_list::get_cttyp as a friend.
* fhandler_console.cc (dev_state): Redefine as a pointer within
shared_console_info and change dev-> to dev. throughout.
(fhandler_console::shared_console_info): Move into fhandler_console.
(fhandler_console::open_shared_console): Move into fhandler_console change
argument to simple bool.
(enum_windows): Accommodate changes to console_state and open_shared_console.
(console_unit::console_unit): Ditto.
(fhandler_console::get_tty_stuff): Accommodate change to dev_state.
(tty_list::get_cttyp): Accommodate change to
handler_console::shared_console_info.
(fhandler_console::read): Accommodate change from tc to tc ().
(fhandler_console::set_input_state): Ditto.
(fhandler_console::open): Accommodate tcinit argument change and change from tc
to tc().
(fhandler_console::input_tcsetattr): Accomodate change from tc to tc().
(fhandler_console::input_tcsetattr): Ditto.
(fhandler_console::write_normal): Ditto.
(fhandler_console::init): Ditto.
(fhandler_console::igncr_enabled): Ditto.
* fhandler_termios.cc (fhandler_termios::tcinit): Remove first argument.
Expect tc() to have been set up first. Use tc() rather than tc.
(fhandler_termios::tcsetpgrp): Accomodate change from tc to tc().
(fhandler_termios::tcgetpgrp): Ditto.
(fhandler_termios::bg_check): Ditto.
(fhandler_termios::line_edit: Ditto.
(fhandler_tty_master::set_winsize): Ditto.
(fhandler_tty_slave::open): Ditto.
(fhandler_tty_slave::init): Ditto.
(fhandler_pty_master::write): Ditto.
(fhandler_pty_master::setup): Ditto. Accommodate change in arguments to
tcinit.
(fhandler_tty_slave::fch_open_handles): Set _tc directly.
(tty_min::is_orphaned_process_group): Don't assume that parent pid exists.
* pinfo.cc (_pinfo::set_ctty): Reset myself->{pgid,sid} here if we were started
by a non-Cygwin process but the tty exists.
* shared_info.h (console_state): Delete from here.
* tty.h: Make multiple inclusion safe.
* exceptions.cc (ctrl_c_handler): Simplify test for no parent tty.
* fhandler_console.cc (fhandler_console::get_tty_stuff): Return NULL if ctty is
not tty/console. Improve test for slave tty/pty device.