2007-09-17  H.J. Lu  <hongjiu.lu@intel.com>

	PR binutils/3281
	PR binutils/5037
	* elf-bfd.h (elf_obj_tdata): Remove relro.

	* elf.c (get_program_header_size): Check info->relro instead
	of elf_tdata (abfd)->relro.
	(_bfd_elf_map_sections_to_segments): Likewise.
	(assign_file_positions_for_load_sections): Don't set
	PT_GNU_RELRO segment alignment here.
	(assign_file_positions_for_non_load_sections): Properly set up
	PT_GNU_RELRO segment for copying executable/shared library.
	(rewrite_elf_program_header): Remove PT_GNU_RELRO segment.
	(copy_elf_program_header): Set p_size and p_size_valid fields for
	PT_GNU_RELRO segment.

include/elf/

2007-09-17  H.J. Lu  <hongjiu.lu@intel.com>

	PR binutils/3281
	PR binutils/5037
	* internal.h (elf_segment_map): Add p_size and p_size_valid.
	(ELF_IS_SECTION_IN_SEGMENT): Allow SHF_TLS sections in
	PT_GNU_RELRO segments.

ld/

2007-09-17  H.J. Lu  <hongjiu.lu@intel.com>

	PR binutils/3281
	PR binutils/5037
	* ldexp.h (ldexp_control): Add relro, relro_start_stat and
	relro_end_stat.

	* ldexp.c (fold_binary): Set expld.dataseg.relro to
	exp_dataseg_relro_start or exp_dataseg_relro_end when
	seeing DATA_SEGMENT_ALIGN or DATA_SEGMENT_RELRO_END,
	respectively.

	* ldlang.c (lang_size_sections_1): Properly set
	expld.dataseg.relro_start_stat and
	expld.dataseg.relro_end_stat.
	(find_relro_section_callback): New function.
	(lang_find_relro_sections_1): Likewise.
	(lang_find_relro_sections): Likewise.
	(lang_process): Call lang_find_relro_sections for
	non-relocatable link.

ld/testsuite/

2007-09-17  H.J. Lu  <hongjiu.lu@intel.com>

	PR binutils/3281
	PR binutils/5037
	* ld-elf/binutils.exp: Update "-z relro" tests to use relro1.s.
	Add "-z relro" tests with relro2.s.  Add "-z relro" tests with
	TLS for objcopy.

	* ld-elf/relro1.s: New file.
	* ld-elf/relro2.s: Likewise.
This commit is contained in:
H.J. Lu 2007-09-18 00:25:07 +00:00
parent 76053dfb52
commit 668b4a9519
2 changed files with 16 additions and 2 deletions

View File

@ -1,3 +1,11 @@
2007-09-17 H.J. Lu <hongjiu.lu@intel.com>
PR binutils/3281
PR binutils/5037
* internal.h (elf_segment_map): Add p_size and p_size_valid.
(ELF_IS_SECTION_IN_SEGMENT): Allow SHF_TLS sections in
PT_GNU_RELRO segments.
2007-09-11 Nathan Sidwell <nathan@codesourcery.com>
* m68k.h (EF_M68K_CF_ISA_C_NODIV): New.

View File

@ -239,6 +239,8 @@ struct elf_segment_map
bfd_vma p_vaddr_offset;
/* Program segment alignment. */
bfd_vma p_align;
/* Segment size in file and memory */
bfd_vma p_size;
/* Whether the p_flags field is valid; if not, the flags are based
on the section flags. */
unsigned int p_flags_valid : 1;
@ -248,6 +250,9 @@ struct elf_segment_map
/* Whether the p_align field is valid; if not, PT_LOAD segment
alignment is based on the default maximum page size. */
unsigned int p_align_valid : 1;
/* Whether the p_size field is valid; if not, the size are based
on the section sizes. */
unsigned int p_size_valid : 1;
/* Whether this segment includes the file header. */
unsigned int includes_filehdr : 1;
/* Whether this segment includes the program headers. */
@ -266,11 +271,12 @@ struct elf_segment_map
|| segment->p_type == PT_TLS) ? sec_hdr->sh_size : 0)
/* Decide if the given sec_hdr is in the given segment. PT_TLS segment
contains only SHF_TLS sections. Only PT_LOAD and PT_TLS segments
can contain SHF_TLS sections. */
contains only SHF_TLS sections. Only PT_LOAD, PT_GNU_RELRO and
and PT_TLS segments can contain SHF_TLS sections. */
#define ELF_IS_SECTION_IN_SEGMENT(sec_hdr, segment) \
(((((sec_hdr->sh_flags & SHF_TLS) != 0) \
&& (segment->p_type == PT_TLS \
|| segment->p_type == PT_GNU_RELRO \
|| segment->p_type == PT_LOAD)) \
|| ((sec_hdr->sh_flags & SHF_TLS) == 0 \
&& segment->p_type != PT_TLS)) \