From 487b39dfdd6cdfcac1124f2bcacd70a2da92f242 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Sat, 25 Jun 2011 00:40:57 +0000 Subject: * layout.cc: Include "object.h". (ctors_sections_in_init_array): New static variable. (Layout::is_ctors_in_init_array): New function. (Layout::layout): Add entry to ctors_sections_in_init_array if appropriate. * layout.h (class Layout): Declare is_ctors_in_init_array. * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if is_ctors_reverse_view is set. (Sized_relobj_file::write_sections): Add layout parameter. Change all callers. Set is_ctors_reverse_view field of View_size. (Sized_relobj_file::reverse_words): New function. * object.h (Sized_relobj_file::View_size): Add is_ctors_reverse_view field. (class Sized_relobj_file): Update declarations. * testsuite/initpri3.c: New test. * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and initpri3b. (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables. (initpri3a_LDFLAGS, initpri3a_LDADD): New variables. (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables. (initpri3b_LDFLAGS, initpri3b_LDADD): New variables. * testsuite/Makefile.in: Rebuild. --- gold/object.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'gold/object.h') diff --git a/gold/object.h b/gold/object.h index 1031833..8735f9e 100644 --- a/gold/object.h +++ b/gold/object.h @@ -2220,6 +2220,7 @@ class Sized_relobj_file : public Sized_relobj section_size_type view_size; bool is_input_output_view; bool is_postprocessing_view; + bool is_ctors_reverse_view; }; typedef std::vector Views; @@ -2311,7 +2312,8 @@ class Sized_relobj_file : public Sized_relobj // Write section data to the output file. Record the views and // sizes in VIEWS for use when relocating. void - write_sections(const unsigned char* pshdrs, Output_file*, Views*); + write_sections(const Layout*, const unsigned char* pshdrs, Output_file*, + Views*); // Relocate the sections in the output file. void @@ -2320,6 +2322,11 @@ class Sized_relobj_file : public Sized_relobj Views* pviews) { this->do_relocate_sections(symtab, layout, pshdrs, of, pviews); } + // Reverse the words in a section. Used for .ctors sections mapped + // to .init_array sections. + void + reverse_words(unsigned char*, section_size_type); + // Scan the input relocations for --emit-relocs. void emit_relocs_scan(Symbol_table*, Layout*, const unsigned char* plocal_syms, -- cgit v1.1