Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2006-06-01 09:40:24 +0400
committerH.J. Lu <hjl.tools@gmail.com>2006-06-01 09:40:24 +0400
commit022c1ffc94282eb8937145b07ac22e0995d749b5 (patch)
treef456fbcdbdc4a53b63f08e5ad1a259c9ca5f219a /include
parentf15f78bf554ccf7889d56a336995d5aec98429c0 (diff)
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.
Diffstat (limited to 'include')
-rw-r--r--include/elf/ChangeLog7
-rw-r--r--include/elf/internal.h43
2 files changed, 35 insertions, 15 deletions
diff --git a/include/elf/ChangeLog b/include/elf/ChangeLog
index fb3476cf6..285457ed9 100644
--- a/include/elf/ChangeLog
+++ b/include/elf/ChangeLog
@@ -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>
* internal.h (struct elf_segment_map): Add p_align and p_align_valid.
diff --git a/include/elf/internal.h b/include/elf/internal.h
index ff27c88bd..d368a3fa6 100644
--- a/include/elf/internal.h
+++ b/include/elf/internal.h
@@ -256,29 +256,42 @@ struct elf_segment_map
asection *sections[1];
};
-/* 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 \
- /* PT_TLS segment contains only SHF_TLS sections. */ \
- && (segment->p_type != PT_TLS \
- || (sec_hdr->sh_flags & SHF_TLS) != 0) \
+/* .tbss is special. It doesn't contribute memory space to normal
+ segments and it doesn't take file space in normal segments. */
+#define ELF_SECTION_SIZE(sec_hdr, segment) \
+ (((sec_hdr->sh_flags & SHF_TLS) == 0 \
+ || sec_hdr->sh_type != SHT_NOBITS \
+ || 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 \
by file offset. */ \
&& (sec_hdr->sh_flags & SHF_ALLOC \
? (sec_hdr->sh_addr >= segment->p_vaddr \
- && sec_hdr->sh_addr + sec_hdr->sh_size \
- <= segment->p_vaddr + segment->p_memsz) \
+ && (sec_hdr->sh_addr \
+ + ELF_SECTION_SIZE(sec_hdr, segment) \
+ <= segment->p_vaddr + segment->p_memsz)) \
: ((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))))
+/* 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. */
#define ELF_IS_SECTION_IN_SEGMENT_MEMORY(sec_hdr, segment) \
- (ELF_IS_SECTION_IN_SEGMENT_FILE (sec_hdr, segment) \
- /* .tbss is special. It doesn't contribute memory space to \
- normal segments. */ \
- && (!((sec_hdr->sh_flags & SHF_TLS) != 0 \
- && sec_hdr->sh_type == SHT_NOBITS) \
- || segment->p_type == PT_TLS))
+ (ELF_SECTION_SIZE(sec_hdr, segment) > 0 \
+ && ELF_IS_SECTION_IN_SEGMENT (sec_hdr, segment))
#endif /* _ELF_INTERNAL_H */