summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2006-06-01 05:40:24 +0000
committerH.J. Lu <hjl.tools@gmail.com>2006-06-01 05:40:24 +0000
commit1224efb888c0f18139c170b28a57d67e80c90a40 (patch)
tree29c304c753951c38c55d71718ca677497d17357c /include
parent117ed4f8d5a9691c0bc1200d5d797e5211688c84 (diff)
downloadppe42-binutils-1224efb888c0f18139c170b28a57d67e80c90a40.tar.gz
ppe42-binutils-1224efb888c0f18139c170b28a57d67e80c90a40.zip
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 fb3476cf60..285457ed91 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 ff27c88bd4..d368a3fa6e 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 */
OpenPOWER on IntegriCloud