include/elf/

2006-05-31  H.J. Lu  <hongjiu.lu@intel.com>

	* internal.h (ELF_SECTION_SIZE): New.
	(ELF_IS_SECTION_IN_SEGMENT): Likewise.
	(ELF_IS_SECTION_IN_SEGMENT_FILE): Updated.
	(ELF_IS_SECTION_IN_SEGMENT_MEMORY): Likewise.

ld/testsuite/

2006-05-31  H.J. Lu  <hongjiu.lu@intel.com>

	* ld-elf/binutils.exp: Make it Linux only.
	(strip_test): Renamed to binutils_test. Check for unsupported
	options.
	Add more tests.

	* ld-elf/commonpage1.d: Make it Linux only.
	* ld-elf/maxpage1.d: Likewise.

	* ld-elf/maxpage1.s: Add main, start and __start.

	* ld-elf/maxpage2.d: New file.
	* ld-elf/tbss1.s: Likewise.
	* ld-elf/tbss2.s: Likewise.
	* ld-elf/tdata1.s: Likewise.
	* ld-elf/tdata2.s: Likewise.
This commit is contained in:
H.J. Lu 2006-06-01 05:40:24 +00:00
parent f15f78bf55
commit 022c1ffc94
2 changed files with 35 additions and 15 deletions

View File

@ -1,3 +1,10 @@
2006-05-31 H.J. Lu <hongjiu.lu@intel.com>
* internal.h (ELF_SECTION_SIZE): New.
(ELF_IS_SECTION_IN_SEGMENT): Likewise.
(ELF_IS_SECTION_IN_SEGMENT_FILE): Updated.
(ELF_IS_SECTION_IN_SEGMENT_MEMORY): Likewise.
2006-05-27 H.J. Lu <hongjiu.lu@intel.com> 2006-05-27 H.J. Lu <hongjiu.lu@intel.com>
* internal.h (struct elf_segment_map): Add p_align and p_align_valid. * internal.h (struct elf_segment_map): Add p_align and p_align_valid.

View File

@ -256,29 +256,42 @@ struct elf_segment_map
asection *sections[1]; asection *sections[1];
}; };
/* Decide if the given sec_hdr is in the given segment in file. */ /* .tbss is special. It doesn't contribute memory space to normal
#define ELF_IS_SECTION_IN_SEGMENT_FILE(sec_hdr, segment) \ segments and it doesn't take file space in normal segments. */
(sec_hdr->sh_size > 0 \ #define ELF_SECTION_SIZE(sec_hdr, segment) \
/* PT_TLS segment contains only SHF_TLS sections. */ \ (((sec_hdr->sh_flags & SHF_TLS) == 0 \
&& (segment->p_type != PT_TLS \ || sec_hdr->sh_type != SHT_NOBITS \
|| (sec_hdr->sh_flags & SHF_TLS) != 0) \ || 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. */
#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_LOAD)) \
|| ((sec_hdr->sh_flags & SHF_TLS) == 0 \
&& segment->p_type != PT_TLS)) \
/* Compare allocated sec_hdrs by VMA, unallocated sec_hdrs \ /* Compare allocated sec_hdrs by VMA, unallocated sec_hdrs \
by file offset. */ \ by file offset. */ \
&& (sec_hdr->sh_flags & SHF_ALLOC \ && (sec_hdr->sh_flags & SHF_ALLOC \
? (sec_hdr->sh_addr >= segment->p_vaddr \ ? (sec_hdr->sh_addr >= segment->p_vaddr \
&& sec_hdr->sh_addr + sec_hdr->sh_size \ && (sec_hdr->sh_addr \
<= segment->p_vaddr + segment->p_memsz) \ + ELF_SECTION_SIZE(sec_hdr, segment) \
<= segment->p_vaddr + segment->p_memsz)) \
: ((bfd_vma) sec_hdr->sh_offset >= segment->p_offset \ : ((bfd_vma) sec_hdr->sh_offset >= segment->p_offset \
&& (sec_hdr->sh_offset + sec_hdr->sh_size \ && (sec_hdr->sh_offset \
+ ELF_SECTION_SIZE(sec_hdr, segment) \
<= segment->p_offset + segment->p_filesz)))) <= segment->p_offset + segment->p_filesz))))
/* Decide if the given sec_hdr is in the given segment in file. */
#define ELF_IS_SECTION_IN_SEGMENT_FILE(sec_hdr, segment) \
(sec_hdr->sh_size > 0 \
&& ELF_IS_SECTION_IN_SEGMENT (sec_hdr, segment))
/* Decide if the given sec_hdr is in the given segment in memory. */ /* Decide if the given sec_hdr is in the given segment in memory. */
#define ELF_IS_SECTION_IN_SEGMENT_MEMORY(sec_hdr, segment) \ #define ELF_IS_SECTION_IN_SEGMENT_MEMORY(sec_hdr, segment) \
(ELF_IS_SECTION_IN_SEGMENT_FILE (sec_hdr, segment) \ (ELF_SECTION_SIZE(sec_hdr, segment) > 0 \
/* .tbss is special. It doesn't contribute memory space to \ && ELF_IS_SECTION_IN_SEGMENT (sec_hdr, segment))
normal segments. */ \
&& (!((sec_hdr->sh_flags & SHF_TLS) != 0 \
&& sec_hdr->sh_type == SHT_NOBITS) \
|| segment->p_type == PT_TLS))
#endif /* _ELF_INTERNAL_H */ #endif /* _ELF_INTERNAL_H */