TLS orphan section placement

Ensures TLS orphans are placed adjacent to existing TLS sections,
and fixes places where the output_section_statement flags (which might
not be set) were tested when bfd_section flags were available.

	* ldlang.c (lang_output_section_find_by_flags): Be careful to
	test look->bfd_section->flags if available rather than
	look->flags.  Separate SEC_THREAD_LOCAL handling from
	SEC_READONLY loop, and rewrite.
Change len's type to ULONGEST: remote_write_bytes_aux

Hi,
This patch changes the type of 'len' from ssize_t to ULONGEST.

At the beginning Siddhesh Poyarekar proposed this patch

  [PATCH] Memory reads and writes should have size_t length
  https://sourceware.org/ml/gdb-patches/2012-05/msg01073.html

to change type of 'len' to size_t.  However, after Jan's review, we
decide to change it to ssize_t, because callers of these functions
may pass signed type to them.

AFAICS, the target layer is a boundary.  In one side, we pass size_t
or ssize_t to target related APIs, and in the other side, the
implementation side, we used LONGEST (ULONGEST in latest code) because
of to_xfer_partial.

Since remote_write_bytes_aux and remote_write_bytes belong to the
implementation of remote target, we should use ULONGEST for len, IMO.

Regression tested on x86_64-linux.  Is it OK?

gdb:

2014-01-24  Yao Qi  <yao@codesourcery.com>

	* remote.c (remote_write_bytes_aux): Change type of 'len' to
	ULONGEST.  Don't check 'len' is negative.
	(remote_write_bytes):  Change type of 'len' to ULONGEST.
Change len's type to ULONGEST: remote_read_bytes and get_core_siginfo

Functions remote_read_bytes and get_core_siginfo are the callees of
target to_xfer_partial interface, so argument 'len' should be changed
to type ULONGEST.

gdb:

2014-01-24  Yao Qi  <yao@codesourcery.com>

	* remote.c (remote_read_bytes): Change type of len to ULONGEST.
	* corelow.c (get_core_siginfo): Likewise.