Hi Nish, Mel and Eric,

I added MIPS support to libhugetlbfs. It supports heap allocation (LD_PRELOAD=libhugetlbfs.so HUGETLB_MORECORE=yes ) currently. data and text segment not supported yet.

I can get data and text segment backed by hugepages in libhugetlbfs 2.10, but for still-unknown reason I can't get them backed by hugepage in 2.12. While I'm working on this problem, I submit the finished part here.

here is the patch:
------------------------------------------------------------

diff -rN libhugetlbfs-2.12-x86/Makefile libhugetlbfs-2.12-mips/Makefile
20c20
< LDSCRIPT_DIST_ELF = elf32ppclinux elf64ppc elf_i386 elf_x86_64
---
> LDSCRIPT_DIST_ELF = elf32ppclinux elf64ppc elf_i386 elf_x86_64 elf32ltmips
82a83,89
> ifeq ($(ARCH),mips64)
> CC64 = gcc
> CC32 = gcc
> TMPLIB64 = lib64
> ELF32= elf32ltmips
> ELF64= elf64ltmips
> else
90a98
> endif
189a198,200
> ifeq ($(ARCH),mips64)
> all:    libs tools
> else
190a202
> endif
diff -rN libhugetlbfs-2.12-x86/ld.hugetlbfs libhugetlbfs-2.12-mips/ld.hugetlbfs
75a76
> elf32ltmips|elf64ltmips) HPAGE_SIZE=$((32*$MB)) SLICE_SIZE=$((32*$MB));; diff -rN libhugetlbfs-2.12-x86/ldscripts/elf32ltmips.xB libhugetlbfs-2.12-mips/ldscripts/elf32ltmips.xB
0a1
>
diff -rN libhugetlbfs-2.12-x86/ldscripts/elf32ltmips.xBDT libhugetlbfs-2.12-mips/ldscripts/elf32ltmips.xBDT
0a1
>
diff -rN libhugetlbfs-2.12-x86/ldscripts/elf64ltmips.xB libhugetlbfs-2.12-mips/ldscripts/elf64ltmips.xB
0a1
>
diff -rN libhugetlbfs-2.12-x86/ldscripts/elf64ltmips.xBDT libhugetlbfs-2.12-mips/ldscripts/elf64ltmips.xBDT
0a1
>
diff -rN libhugetlbfs-2.12-x86/sys-elf32ltmips.S libhugetlbfs-2.12-mips/sys-elf32ltmips.S
0a1,72
> /*
> .text
> .globl direct_syscall
> direct_syscall:
> syscall
> j $ra
> */
>
> /* code port from
>  * glibc-2.1.3.tar.gz/glibc-2.1.3/sysdeps/mach/mips/syscall.S
>  */
>
>
> #define zero    $0      /* wired zero */
> #define AT $1 /* assembler temp - uppercase because of ".set at"
>                             */
> #define v0      $2      /* return value */
> #define v1      $3
> #define a0      $4      /* argument registers */
> #define a1      $5
> #define a2      $6
> #define a3      $7
> #define t0      $8      /* caller saved */
> #define t1      $9
> #define t2      $10
> #define t3      $11
> #define t4      $12
> #define t5      $13
> #define t6      $14
> #define t7      $15
> #define s0      $16     /* callee saved */
> #define s1      $17
> #define s2      $18
> #define s3      $19
> #define s4      $20
> #define s5      $21
> #define s6      $22
> #define s7      $23
> #define t8      $24     /* caller saved */
> #define t9      $25
> #define jp      $25     /* PIC jump register */
> #define k0      $26     /* kernel scratch */
> #define k1      $27
> #define gp      $28     /* global pointer */
> #define sp      $29     /* stack pointer */
> #define fp      $30     /* frame pointer */
> #define s8      $30     /* same like fp! */
> #define ra      $31     /* return address
>                             */
>
>
> .text
> .globl  direct_syscall
>
> direct_syscall:
> move    v0, a0          /* Load system call number from first arg.  */
> move    a0, a1          /* Move the next three args up a register.  */
> move    a1, a2
> move    a2, a3
>
> /* Load the remaining possible args (up to 11) from the stack.  */
>
> ld      t0,4*8(sp)
> ld      t1,5*8(sp)
> ld      t2,6*8(sp)
> ld      t3,7*8(sp)
> ld      t4,8*8(sp)
> ld      t5,9*8(sp)
> ld      t6,10*8(sp)
> syscall                 /* Do the system call.  */
> j ra                    /* Return to caller.  */
>
diff -rN libhugetlbfs-2.12-x86/sys-elf64ltmips.S libhugetlbfs-2.12-mips/sys-elf64ltmips.S
0a1,5
> .text
> .globl direct_syscall
> direct_syscall:
>     syscall
>     j $ra
diff -rN libhugetlbfs-2.12-x86/tests/Makefile libhugetlbfs-2.12-mips/tests/Makefile
39a40,41
> ARCH = $(shell uname -m | sed -e s/i.86/i386/)
>
41a44
> ifeq ($(ARCH),mips64)
44a48,50
> TESTS += $(LDSCRIPT_TESTS) $(HUGELINK_TESTS) $(HUGELINK_RW_TESTS)
> endif
> else
45a52
> ifeq ($(ARCH),mips64)
47a55,57
> else
> TESTS += $(LDSCRIPT_TESTS) $(HUGELINK_TESTS)
> endif
208a219,220
> ifneq ($(ARCH),mips64)
>     xx
231a244
> endif
diff -rN libhugetlbfs-2.12-x86/tests/icache-hygiene.c libhugetlbfs-2.12-mips/tests/icache-hygiene.c
88c88
<     defined(__s390__) || defined(__s390x__) || defined(__sparc__)
---
> defined(__s390__) || defined(__s390x__) || defined(__sparc__) || defined(__mips__)





On Sat, Jan 15, 2011 at 04:59:27PM +0800, Yu Huang wrote:
Thanks for David, Nish and Eric's reply!

In the past 3 days I have fully tested libhugetlbfs on MIPS platform
(Loongson 3A, a MIPS R4k arch imp).  I worked fine.

Before I post the patch I want to get one thing clear: do I have to
support --hugetlbfs-link option?  Is this a MUST? Since  I have only
make the code to support --hugetlbfs-align. I don't want to do the dirty
work of writing ldscripts for MIPS. --hugetlbfs-align is truely enough
for us.
I don't see any good reason to implement the old broken relinking
method on a new port.

   Since I don't support --hugetlbfs-link option, some test programs in
tests/  directory don't compile.  Currently I simply comment them
out.
While you're testing internally, yes.

For release, you'll need to teach the run_tests script to
automatically run the old-style link tests only on platforms which
support them.



--
Raywill
NCIC. ICT. China

diff -rN libhugetlbfs-2.12-x86/ld.hugetlbfs libhugetlbfs-2.12-mips/ld.hugetlbfs
75a76
> elf32ltsmip|elf64ltsmip)    HPAGE_SIZE=$((32*$MB)) SLICE_SIZE=$((32*$MB));;
diff -rN libhugetlbfs-2.12-x86/ldscripts/elf32ltsmip.xB 
libhugetlbfs-2.12-mips/ldscripts/elf32ltsmip.xB
0a1,270
> /* Script for -z combreloc: combine and sort reloc sections */
> OUTPUT_FORMAT("elf32-tradlittlemips", "elf32-tradbigmips",
>             "elf32-tradlittlemips")
> OUTPUT_ARCH(mips)
> ENTRY(__start)
> SEARCH_DIR("/usr/mipsel-linux-gnu/lib"); SEARCH_DIR("/usr/local/lib"); 
> SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
> INPUT(-lhugetlbfs);
> /* Do we need any of these for elf?
>    __DYNAMIC = 0;    */
> PHDRS
> {
>     headers PT_PHDR PHDRS ;
>     interp PT_INTERP ;
>     text PT_LOAD FILEHDR PHDRS ;
>     data PT_LOAD ;
>     htlb PT_LOAD FLAGS (0x00100007);
>     dynamic PT_DYNAMIC ;
>     note PT_NOTE ;
>     gnu_stack PT_GNU_STACK ;
>     /* this is the value of PT_GNU_EH_FRAME as defined in
>        usr/include/elf.h but binutils does not recognize that identifier
>        as it does other PT_ constants. */
>     eh_frame_hdr 1685382480 FLAGS (0x00000004);
> }
> 
> 
> SECTIONS
> {
>   /* Read-only sections, merged into text segment: */
>   PROVIDE (__executable_start = 0x0400000); . = 0x0400000 + SIZEOF_HEADERS;
>   .interp         : { *(.interp) } :text :interp
>   .reginfo        : { *(.reginfo) } :text
>   .note.gnu.build-id : { *(.note.gnu.build-id) } :text :note
>   .dynamic        : { *(.dynamic) } :text
>   .hash           : { *(.hash) }
>   .gnu.hash       : { *(.gnu.hash) }
>   .dynsym         : { *(.dynsym) }
>   .dynstr         : { *(.dynstr) }
>   .gnu.version    : { *(.gnu.version) }
>   .gnu.version_d  : { *(.gnu.version_d) }
>   .gnu.version_r  : { *(.gnu.version_r) }
>   .rel.dyn        :
>     {
>       *(.rel.init)
>       *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*)
>       *(.rel.fini)
>       *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*)
>       *(.rel.data.rel.ro* .rel.gnu.linkonce.d.rel.ro.*)
>       *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*)
>       *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*)
>       *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*)
>       *(.rel.ctors)
>       *(.rel.dtors)
>       *(.rel.got)
>       *(.rel.dyn)
>       *(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*)
>       *(.rel.sbss .rel.sbss.* .rel.gnu.linkonce.sb.*)
>       *(.rel.sdata2 .rel.sdata2.* .rel.gnu.linkonce.s2.*)
>       *(.rel.sbss2 .rel.sbss2.* .rel.gnu.linkonce.sb2.*)
>       *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*)
>     }
>   .rela.dyn       :
>     {
>       *(.rela.init)
>       *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)
>       *(.rela.fini)
>       *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)
>       *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)
>       *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*)
>       *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*)
>       *(.rela.ctors)
>       *(.rela.dtors)
>       *(.rela.got)
>       *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*)
>       *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*)
>       *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*)
>       *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*)
>       *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)
>     }
>   .rel.plt        : { *(.rel.plt) }
>   .rela.plt       : { *(.rela.plt) }
>   .init           :
>   {
>     KEEP (*(.init))
>   } =0
>   .plt            : { *(.plt) }
>   .text           :
>   {
>     _ftext = . ;
>     *(.text .stub .text.* .gnu.linkonce.t.*)
>     KEEP (*(.text.*personality*))
>     /* .gnu.warning sections are handled specially by elf32.em.  */
>     *(.gnu.warning)
>     *(.mips16.fn.*) *(.mips16.call.*)
>   } =0
>   .fini           :
>   {
>     KEEP (*(.fini))
>   } =0
>   PROVIDE (__etext = .);
>   PROVIDE (_etext = .);
>   PROVIDE (etext = .);
>   .rodata         : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
>   .rodata1        : { *(.rodata1) }
>   .sdata2         :
>   {
>     *(.sdata2 .sdata2.* .gnu.linkonce.s2.*)
>   }
>   .sbss2          : { *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) }
>   
>   .eh_frame_hdr : { *(.eh_frame_hdr) } :data :eh_frame_hdr
>   .eh_frame       : ONLY_IF_RO { KEEP (*(.eh_frame)) } :data
>   .gcc_except_table   : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) 
> }
>   /* Adjust the address for the data segment.  We want to adjust up to
>      the same address within the page on the next page up.  */
>   . = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & 
> (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT 
> (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
>   /* Exception handling  */
>   .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
>   .gcc_except_table   : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) 
> }
>   /* Thread Local Storage sections  */
>   .tdata        : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
>   .tbss                 : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
>   .preinit_array     :
>   {
>     PROVIDE_HIDDEN (__preinit_array_start = .);
>     KEEP (*(.preinit_array))
>     PROVIDE_HIDDEN (__preinit_array_end = .);
>   }
>   .init_array     :
>   {
>      PROVIDE_HIDDEN (__init_array_start = .);
>      KEEP (*(SORT(.init_array.*)))
>      KEEP (*(.init_array))
>      PROVIDE_HIDDEN (__init_array_end = .);
>   }
>   .fini_array     :
>   {
>     PROVIDE_HIDDEN (__fini_array_start = .);
>     KEEP (*(.fini_array))
>     KEEP (*(SORT(.fini_array.*)))
>     PROVIDE_HIDDEN (__fini_array_end = .);
>   }
>   .ctors          :
>   {
>     /* gcc uses crtbegin.o to find the start of
>        the constructors, so we make sure it is
>        first.  Because this is a wildcard, it
>        doesn't matter if the user does not
>        actually link against crtbegin.o; the
>        linker won't look for a file to match a
>        wildcard.  The wildcard also means that it
>        doesn't matter which directory crtbegin.o
>        is in.  */
>     KEEP (*crtbegin.o(.ctors))
>     KEEP (*crtbegin?.o(.ctors))
>     /* We don't want to include the .ctor section from
>        the crtend.o file until after the sorted ctors.
>        The .ctor section from the crtend file contains the
>        end of ctors marker and it must be last */
>     KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
>     KEEP (*(SORT(.ctors.*)))
>     KEEP (*(.ctors))
>   }
>   .dtors          :
>   {
>     KEEP (*crtbegin.o(.dtors))
>     KEEP (*crtbegin?.o(.dtors))
>     KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
>     KEEP (*(SORT(.dtors.*)))
>     KEEP (*(.dtors))
>   }
>   .jcr            : { KEEP (*(.jcr)) }
>   .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) 
> *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*) }
>   . = DATA_SEGMENT_RELRO_END (0, .);
>   .data           :
>   {
>     _fdata = . ;
>     *(.data .data.* .gnu.linkonce.d.*)
>     KEEP (*(.gnu.linkonce.d.*personality*))
>     SORT(CONSTRUCTORS)
>   }
>   .data1          : { *(.data1) }
>   . = .;
>   _gp = ALIGN(16) + 0x7ff0;
>   .got            : { *(.got.plt) *(.got) }
>   /* We want the small data sections together, so single-instruction offsets
>      can access them all, and initialized data all before uninitialized, so
>      we can shorten the on-disk segment size.  */
>   .sdata          :
>   {
>     *(.sdata .sdata.* .gnu.linkonce.s.*)
>   }
>   .lit8           : { *(.lit8) }
>   .lit4           : { *(.lit4) }
>   _edata = .; PROVIDE (edata = .);
>   __bss_start = .;
>   _fbss = .;
>   .sbss           :
>   {
>     *(.dynsbss)
>     *(.sbss .sbss.* .gnu.linkonce.sb.*)
>     *(.scommon)
>   } :htlb
>   .bss            :
>   {
>    *(.dynbss)
>    *(.bss .bss.* .gnu.linkonce.b.*)
>    *(COMMON)
>    /* Align here to ensure that the .bss section occupies space up to
>       _end.  Align after .bss to ensure correct alignment even if the
>       .bss section disappears because there are no input sections.
>       FIXME: Why do we need it? When there is no .bss section, we don't
>       pad the .data section.  */
>    . = ALIGN(. != 0 ? 32 / 8 : 1);
>   }
>   . = ALIGN(32 / 8);
>   . = ALIGN(32 / 8);
>   _end = .; PROVIDE (end = .);
>   . = DATA_SEGMENT_END (.);
>   /* Stabs debugging sections.  */
>   .stab          0 : { *(.stab) }
>   .stabstr       0 : { *(.stabstr) }
>   .stab.excl     0 : { *(.stab.excl) }
>   .stab.exclstr  0 : { *(.stab.exclstr) }
>   .stab.index    0 : { *(.stab.index) }
>   .stab.indexstr 0 : { *(.stab.indexstr) }
>   .comment       0 : { *(.comment) }
>   /* DWARF debug sections.
>      Symbols in the DWARF debugging sections are relative to the beginning
>      of the section so we begin them at 0.  */
>   /* DWARF 1 */
>   .debug          0 : { *(.debug) }
>   .line           0 : { *(.line) }
>   /* GNU DWARF 1 extensions */
>   .debug_srcinfo  0 : { *(.debug_srcinfo) }
>   .debug_sfnames  0 : { *(.debug_sfnames) }
>   /* DWARF 1.1 and DWARF 2 */
>   .debug_aranges  0 : { *(.debug_aranges) }
>   .debug_pubnames 0 : { *(.debug_pubnames) }
>   /* DWARF 2 */
>   .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
>   .debug_abbrev   0 : { *(.debug_abbrev) }
>   .debug_line     0 : { *(.debug_line) }
>   .debug_frame    0 : { *(.debug_frame) }
>   .debug_str      0 : { *(.debug_str) }
>   .debug_loc      0 : { *(.debug_loc) }
>   .debug_macinfo  0 : { *(.debug_macinfo) }
>   /* SGI/MIPS DWARF 2 extensions */
>   .debug_weaknames 0 : { *(.debug_weaknames) }
>   .debug_funcnames 0 : { *(.debug_funcnames) }
>   .debug_typenames 0 : { *(.debug_typenames) }
>   .debug_varnames  0 : { *(.debug_varnames) }
>   /* DWARF 3 */
>   .debug_pubtypes 0 : { *(.debug_pubtypes) }
>   .debug_ranges   0 : { *(.debug_ranges) }
>   .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
>   .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }
>   .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }
>   .mdebug.abi32 : { KEEP(*(.mdebug.abi32)) }
>   .mdebug.abiN32 : { KEEP(*(.mdebug.abiN32)) }
>   .mdebug.abi64 : { KEEP(*(.mdebug.abi64)) }
>   .mdebug.abiO64 : { KEEP(*(.mdebug.abiO64)) }
>   .mdebug.eabi32 : { KEEP(*(.mdebug.eabi32)) }
>   .mdebug.eabi64 : { KEEP(*(.mdebug.eabi64)) }
>   .gcc_compiled_long32 : { KEEP(*(.gcc_compiled_long32)) }
>   .gcc_compiled_long64 : { KEEP(*(.gcc_compiled_long64)) }
>   /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) }
> }
> 
> 
diff -rN libhugetlbfs-2.12-x86/ldscripts/elf32ltsmip.xBDT 
libhugetlbfs-2.12-mips/ldscripts/elf32ltsmip.xBDT
0a1,249
> /* Script for -z combreloc: combine and sort reloc sections */
> OUTPUT_FORMAT("elf32-tradlittlemips", "elf32-tradbigmips",
>             "elf32-tradlittlemips")
> OUTPUT_ARCH(mips)
> ENTRY(__start)
> SEARCH_DIR("/usr/mipsel-linux-gnu/lib"); SEARCH_DIR("/usr/local/lib"); 
> SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
> SECTIONS
> {
>   /* Read-only sections, merged into text segment: */
>   PROVIDE (__executable_start = 0x0400000); . = 0x0400000 + SIZEOF_HEADERS;
>   .interp         : { *(.interp) }
>   .reginfo        : { *(.reginfo) }
>   .note.gnu.build-id : { *(.note.gnu.build-id) }
>   .dynamic        : { *(.dynamic) }
>   .hash           : { *(.hash) }
>   .gnu.hash       : { *(.gnu.hash) }
>   .dynsym         : { *(.dynsym) }
>   .dynstr         : { *(.dynstr) }
>   .gnu.version    : { *(.gnu.version) }
>   .gnu.version_d  : { *(.gnu.version_d) }
>   .gnu.version_r  : { *(.gnu.version_r) }
>   .rel.dyn        :
>     {
>       *(.rel.init)
>       *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*)
>       *(.rel.fini)
>       *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*)
>       *(.rel.data.rel.ro* .rel.gnu.linkonce.d.rel.ro.*)
>       *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*)
>       *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*)
>       *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*)
>       *(.rel.ctors)
>       *(.rel.dtors)
>       *(.rel.got)
>       *(.rel.dyn)
>       *(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*)
>       *(.rel.sbss .rel.sbss.* .rel.gnu.linkonce.sb.*)
>       *(.rel.sdata2 .rel.sdata2.* .rel.gnu.linkonce.s2.*)
>       *(.rel.sbss2 .rel.sbss2.* .rel.gnu.linkonce.sb2.*)
>       *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*)
>     }
>   .rela.dyn       :
>     {
>       *(.rela.init)
>       *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)
>       *(.rela.fini)
>       *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)
>       *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)
>       *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*)
>       *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*)
>       *(.rela.ctors)
>       *(.rela.dtors)
>       *(.rela.got)
>       *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*)
>       *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*)
>       *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*)
>       *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*)
>       *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)
>     }
>   .rel.plt        : { *(.rel.plt) }
>   .rela.plt       : { *(.rela.plt) }
>   .init           :
>   {
>     KEEP (*(.init))
>   } =0
>   .plt            : { *(.plt) }
>   .text           :
>   {
>     _ftext = . ;
>     *(.text .stub .text.* .gnu.linkonce.t.*)
>     KEEP (*(.text.*personality*))
>     /* .gnu.warning sections are handled specially by elf32.em.  */
>     *(.gnu.warning)
>     *(.mips16.fn.*) *(.mips16.call.*)
>   } =0
>   .fini           :
>   {
>     KEEP (*(.fini))
>   } =0
>   PROVIDE (__etext = .);
>   PROVIDE (_etext = .);
>   PROVIDE (etext = .);
>   .rodata         : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
>   .rodata1        : { *(.rodata1) }
>   .sdata2         :
>   {
>     *(.sdata2 .sdata2.* .gnu.linkonce.s2.*)
>   }
>   .sbss2          : { *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) }
>   .eh_frame_hdr : { *(.eh_frame_hdr) }
>   .eh_frame       : ONLY_IF_RO { KEEP (*(.eh_frame)) }
>   .gcc_except_table   : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) 
> }
>   /* Adjust the address for the data segment.  We want to adjust up to
>      the same address within the page on the next page up.  */
>   . = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & 
> (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT 
> (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
>   /* Exception handling  */
>   .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
>   .gcc_except_table   : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) 
> }
>   /* Thread Local Storage sections  */
>   .tdata        : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
>   .tbss                 : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
>   .preinit_array     :
>   {
>     PROVIDE_HIDDEN (__preinit_array_start = .);
>     KEEP (*(.preinit_array))
>     PROVIDE_HIDDEN (__preinit_array_end = .);
>   }
>   .init_array     :
>   {
>      PROVIDE_HIDDEN (__init_array_start = .);
>      KEEP (*(SORT(.init_array.*)))
>      KEEP (*(.init_array))
>      PROVIDE_HIDDEN (__init_array_end = .);
>   }
>   .fini_array     :
>   {
>     PROVIDE_HIDDEN (__fini_array_start = .);
>     KEEP (*(.fini_array))
>     KEEP (*(SORT(.fini_array.*)))
>     PROVIDE_HIDDEN (__fini_array_end = .);
>   }
>   .ctors          :
>   {
>     /* gcc uses crtbegin.o to find the start of
>        the constructors, so we make sure it is
>        first.  Because this is a wildcard, it
>        doesn't matter if the user does not
>        actually link against crtbegin.o; the
>        linker won't look for a file to match a
>        wildcard.  The wildcard also means that it
>        doesn't matter which directory crtbegin.o
>        is in.  */
>     KEEP (*crtbegin.o(.ctors))
>     KEEP (*crtbegin?.o(.ctors))
>     /* We don't want to include the .ctor section from
>        the crtend.o file until after the sorted ctors.
>        The .ctor section from the crtend file contains the
>        end of ctors marker and it must be last */
>     KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
>     KEEP (*(SORT(.ctors.*)))
>     KEEP (*(.ctors))
>   }
>   .dtors          :
>   {
>     KEEP (*crtbegin.o(.dtors))
>     KEEP (*crtbegin?.o(.dtors))
>     KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
>     KEEP (*(SORT(.dtors.*)))
>     KEEP (*(.dtors))
>   }
>   .jcr            : { KEEP (*(.jcr)) }
>   .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) 
> *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*) }
>   . = DATA_SEGMENT_RELRO_END (0, .);
>   .data           :
>   {
>     _fdata = . ;
>     *(.data .data.* .gnu.linkonce.d.*)
>     KEEP (*(.gnu.linkonce.d.*personality*))
>     SORT(CONSTRUCTORS)
>   }
>   .data1          : { *(.data1) }
>   . = .;
>   _gp = ALIGN(16) + 0x7ff0;
>   .got            : { *(.got.plt) *(.got) }
>   /* We want the small data sections together, so single-instruction offsets
>      can access them all, and initialized data all before uninitialized, so
>      we can shorten the on-disk segment size.  */
>   .sdata          :
>   {
>     *(.sdata .sdata.* .gnu.linkonce.s.*)
>   }
>   .lit8           : { *(.lit8) }
>   .lit4           : { *(.lit4) }
>   _edata = .; PROVIDE (edata = .);
>   __bss_start = .;
>   _fbss = .;
>   .sbss           :
>   {
>     *(.dynsbss)
>     *(.sbss .sbss.* .gnu.linkonce.sb.*)
>     *(.scommon)
>   }
>   .bss            :
>   {
>    *(.dynbss)
>    *(.bss .bss.* .gnu.linkonce.b.*)
>    *(COMMON)
>    /* Align here to ensure that the .bss section occupies space up to
>       _end.  Align after .bss to ensure correct alignment even if the
>       .bss section disappears because there are no input sections.
>       FIXME: Why do we need it? When there is no .bss section, we don't
>       pad the .data section.  */
>    . = ALIGN(. != 0 ? 32 / 8 : 1);
>   }
>   . = ALIGN(32 / 8);
>   . = ALIGN(32 / 8);
>   _end = .; PROVIDE (end = .);
>   . = DATA_SEGMENT_END (.);
>   /* Stabs debugging sections.  */
>   .stab          0 : { *(.stab) }
>   .stabstr       0 : { *(.stabstr) }
>   .stab.excl     0 : { *(.stab.excl) }
>   .stab.exclstr  0 : { *(.stab.exclstr) }
>   .stab.index    0 : { *(.stab.index) }
>   .stab.indexstr 0 : { *(.stab.indexstr) }
>   .comment       0 : { *(.comment) }
>   /* DWARF debug sections.
>      Symbols in the DWARF debugging sections are relative to the beginning
>      of the section so we begin them at 0.  */
>   /* DWARF 1 */
>   .debug          0 : { *(.debug) }
>   .line           0 : { *(.line) }
>   /* GNU DWARF 1 extensions */
>   .debug_srcinfo  0 : { *(.debug_srcinfo) }
>   .debug_sfnames  0 : { *(.debug_sfnames) }
>   /* DWARF 1.1 and DWARF 2 */
>   .debug_aranges  0 : { *(.debug_aranges) }
>   .debug_pubnames 0 : { *(.debug_pubnames) }
>   /* DWARF 2 */
>   .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
>   .debug_abbrev   0 : { *(.debug_abbrev) }
>   .debug_line     0 : { *(.debug_line) }
>   .debug_frame    0 : { *(.debug_frame) }
>   .debug_str      0 : { *(.debug_str) }
>   .debug_loc      0 : { *(.debug_loc) }
>   .debug_macinfo  0 : { *(.debug_macinfo) }
>   /* SGI/MIPS DWARF 2 extensions */
>   .debug_weaknames 0 : { *(.debug_weaknames) }
>   .debug_funcnames 0 : { *(.debug_funcnames) }
>   .debug_typenames 0 : { *(.debug_typenames) }
>   .debug_varnames  0 : { *(.debug_varnames) }
>   /* DWARF 3 */
>   .debug_pubtypes 0 : { *(.debug_pubtypes) }
>   .debug_ranges   0 : { *(.debug_ranges) }
>   .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
>   .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }
>   .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }
>   .mdebug.abi32 : { KEEP(*(.mdebug.abi32)) }
>   .mdebug.abiN32 : { KEEP(*(.mdebug.abiN32)) }
>   .mdebug.abi64 : { KEEP(*(.mdebug.abi64)) }
>   .mdebug.abiO64 : { KEEP(*(.mdebug.abiO64)) }
>   .mdebug.eabi32 : { KEEP(*(.mdebug.eabi32)) }
>   .mdebug.eabi64 : { KEEP(*(.mdebug.eabi64)) }
>   .gcc_compiled_long32 : { KEEP(*(.gcc_compiled_long32)) }
>   .gcc_compiled_long64 : { KEEP(*(.gcc_compiled_long64)) }
>   /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) }
> }
> 
> 
diff -rN libhugetlbfs-2.12-x86/ldscripts/elf64ltsmip.xB 
libhugetlbfs-2.12-mips/ldscripts/elf64ltsmip.xB
0a1,241
> /* Script for -z combreloc: combine and sort reloc sections */
> /* mipsfs://usr/lib/ldscripts/elf64ltsmip.xc                */
> 
> OUTPUT_FORMAT("elf64-tradlittlemips", "elf64-tradbigmips",
>             "elf64-tradlittlemips")
> OUTPUT_ARCH(mips)
> ENTRY(__start)
> SEARCH_DIR("/usr/mipsel-linux-gnu/lib64"); SEARCH_DIR("/usr/local/lib64"); 
> SEARCH_DIR("/lib64"); SEARCH_DIR("/usr/lib64"); 
> SEARCH_DIR("/usr/mipsel-linux-gnu/lib"); SEARCH_DIR("/usr/local/lib"); 
> SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
> SECTIONS
> {
>   /* Read-only sections, merged into text segment: */
>   PROVIDE (__executable_start = 0x120000000); . = 0x120000000 + 
> SIZEOF_HEADERS;
>   .MIPS.options : { *(.MIPS.options) }
>   .note.gnu.build-id : { *(.note.gnu.build-id) }
>   .dynamic        : { *(.dynamic) }
>   .hash           : { *(.hash) }
>   .gnu.hash       : { *(.gnu.hash) }
>   .dynsym         : { *(.dynsym) }
>   .dynstr         : { *(.dynstr) }
>   .gnu.version    : { *(.gnu.version) }
>   .gnu.version_d  : { *(.gnu.version_d) }
>   .gnu.version_r  : { *(.gnu.version_r) }
>   .rel.dyn        :
>     {
>       *(.rel.init)
>       *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*)
>       *(.rel.fini)
>       *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*)
>       *(.rel.data.rel.ro* .rel.gnu.linkonce.d.rel.ro.*)
>       *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*)
>       *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*)
>       *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*)
>       *(.rel.ctors)
>       *(.rel.dtors)
>       *(.rel.got)
>       *(.rel.dyn)
>       *(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*)
>       *(.rel.sbss .rel.sbss.* .rel.gnu.linkonce.sb.*)
>       *(.rel.sdata2 .rel.sdata2.* .rel.gnu.linkonce.s2.*)
>       *(.rel.sbss2 .rel.sbss2.* .rel.gnu.linkonce.sb2.*)
>       *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*)
>     }
>   .rela.dyn       :
>     {
>       *(.rela.init)
>       *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)
>       *(.rela.fini)
>       *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)
>       *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)
>       *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*)
>       *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*)
>       *(.rela.ctors)
>       *(.rela.dtors)
>       *(.rela.got)
>       *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*)
>       *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*)
>       *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*)
>       *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*)
>       *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)
>     }
>   .rel.plt        : { *(.rel.plt) }
>   .rela.plt       : { *(.rela.plt) }
>   .init           :
>   {
>     KEEP (*(.init))
>   } =0
>   .plt            : { *(.plt) }
>   .text           :
>   {
>     _ftext = . ;
>     *(.text .stub .text.* .gnu.linkonce.t.*)
>     KEEP (*(.text.*personality*))
>     /* .gnu.warning sections are handled specially by elf32.em.  */
>     *(.gnu.warning)
>     *(.mips16.fn.*) *(.mips16.call.*)
>   } =0
>   .fini           :
>   {
>     KEEP (*(.fini))
>   } =0
>   PROVIDE (__etext = .);
>   PROVIDE (_etext = .);
>   PROVIDE (etext = .);
>   .rodata         : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
>   .rodata1        : { *(.rodata1) }
>   .sdata2         :
>   {
>     *(.sdata2 .sdata2.* .gnu.linkonce.s2.*)
>   }
>   .sbss2          : { *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) }
>   .eh_frame_hdr : { *(.eh_frame_hdr) }
>   .eh_frame       : ONLY_IF_RO { KEEP (*(.eh_frame)) }
>   .gcc_except_table   : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) 
> }
>   /* Adjust the address for the data segment.  We want to adjust up to
>      the same address within the page on the next page up.  */
>   . = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & 
> (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT 
> (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
>   /* Exception handling  */
>   .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
>   .gcc_except_table   : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) 
> }
>   /* Thread Local Storage sections  */
>   .tdata        : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
>   .tbss                 : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
>   .preinit_array     :
>   {
>     PROVIDE_HIDDEN (__preinit_array_start = .);
>     KEEP (*(.preinit_array))
>     PROVIDE_HIDDEN (__preinit_array_end = .);
>   }
>   .init_array     :
>   {
>      PROVIDE_HIDDEN (__init_array_start = .);
>      KEEP (*(SORT(.init_array.*)))
>      KEEP (*(.init_array))
>      PROVIDE_HIDDEN (__init_array_end = .);
>   }
>   .fini_array     :
>   {
>     PROVIDE_HIDDEN (__fini_array_start = .);
>     KEEP (*(.fini_array))
>     KEEP (*(SORT(.fini_array.*)))
>     PROVIDE_HIDDEN (__fini_array_end = .);
>   }
>   .ctors          :
>   {
>     /* gcc uses crtbegin.o to find the start of
>        the constructors, so we make sure it is
>        first.  Because this is a wildcard, it
>        doesn't matter if the user does not
>        actually link against crtbegin.o; the
>        linker won't look for a file to match a
>        wildcard.  The wildcard also means that it
>        doesn't matter which directory crtbegin.o
>        is in.  */
>     KEEP (*crtbegin.o(.ctors))
>     KEEP (*crtbegin?.o(.ctors))
>     /* We don't want to include the .ctor section from
>        the crtend.o file until after the sorted ctors.
>        The .ctor section from the crtend file contains the
>        end of ctors marker and it must be last */
>     KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
>     KEEP (*(SORT(.ctors.*)))
>     KEEP (*(.ctors))
>   }
>   .dtors          :
>   {
>     KEEP (*crtbegin.o(.dtors))
>     KEEP (*crtbegin?.o(.dtors))
>     KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
>     KEEP (*(SORT(.dtors.*)))
>     KEEP (*(.dtors))
>   }
>   .jcr            : { KEEP (*(.jcr)) }
>   .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) 
> *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*) }
>   . = DATA_SEGMENT_RELRO_END (0, .);
>   .data           :
>   {
>     _fdata = . ;
>     *(.data .data.* .gnu.linkonce.d.*)
>     KEEP (*(.gnu.linkonce.d.*personality*))
>     SORT(CONSTRUCTORS)
>   }
>   .data1          : { *(.data1) }
>   . = .;
>   _gp = ALIGN(16) + 0x7ff0;
>   .got            : { *(.got.plt) *(.got) }
>   /* We want the small data sections together, so single-instruction offsets
>      can access them all, and initialized data all before uninitialized, so
>      we can shorten the on-disk segment size.  */
>   .sdata          :
>   {
>     *(.sdata .sdata.* .gnu.linkonce.s.*)
>   }
>   .lit8           : { *(.lit8) }
>   .lit4           : { *(.lit4) }
>   .srdata         : { *(.srdata) }
>   _edata = .; PROVIDE (edata = .);
>   __bss_start = .;
>   _fbss = .;
>   .sbss           :
>   {
>     *(.dynsbss)
>     *(.sbss .sbss.* .gnu.linkonce.sb.*)
>     *(.scommon)
>   }
>   .bss            :
>   {
>    *(.dynbss)
>    *(.bss .bss.* .gnu.linkonce.b.*)
>    *(COMMON)
>    /* Align here to ensure that the .bss section occupies space up to
>       _end.  Align after .bss to ensure correct alignment even if the
>       .bss section disappears because there are no input sections.
>       FIXME: Why do we need it? When there is no .bss section, we don't
>       pad the .data section.  */
>    . = ALIGN(. != 0 ? 64 / 8 : 1);
>   }
>   . = ALIGN(64 / 8);
>   . = ALIGN(64 / 8);
>   _end = .; PROVIDE (end = .);
>   . = DATA_SEGMENT_END (.);
>   /* Stabs debugging sections.  */
>   .stab          0 : { *(.stab) }
>   .stabstr       0 : { *(.stabstr) }
>   .stab.excl     0 : { *(.stab.excl) }
>   .stab.exclstr  0 : { *(.stab.exclstr) }
>   .stab.index    0 : { *(.stab.index) }
>   .stab.indexstr 0 : { *(.stab.indexstr) }
>   .comment       0 : { *(.comment) }
>   /* DWARF debug sections.
>      Symbols in the DWARF debugging sections are relative to the beginning
>      of the section so we begin them at 0.  */
>   /* DWARF 1 */
>   .debug          0 : { *(.debug) }
>   .line           0 : { *(.line) }
>   /* GNU DWARF 1 extensions */
>   .debug_srcinfo  0 : { *(.debug_srcinfo) }
>   .debug_sfnames  0 : { *(.debug_sfnames) }
>   /* DWARF 1.1 and DWARF 2 */
>   .debug_aranges  0 : { *(.debug_aranges) }
>   .debug_pubnames 0 : { *(.debug_pubnames) }
>   /* DWARF 2 */
>   .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
>   .debug_abbrev   0 : { *(.debug_abbrev) }
>   .debug_line     0 : { *(.debug_line) }
>   .debug_frame    0 : { *(.debug_frame) }
>   .debug_str      0 : { *(.debug_str) }
>   .debug_loc      0 : { *(.debug_loc) }
>   .debug_macinfo  0 : { *(.debug_macinfo) }
>   /* SGI/MIPS DWARF 2 extensions */
>   .debug_weaknames 0 : { *(.debug_weaknames) }
>   .debug_funcnames 0 : { *(.debug_funcnames) }
>   .debug_typenames 0 : { *(.debug_typenames) }
>   .debug_varnames  0 : { *(.debug_varnames) }
>   /* DWARF 3 */
>   .debug_pubtypes 0 : { *(.debug_pubtypes) }
>   .debug_ranges   0 : { *(.debug_ranges) }
>   .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
>   .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }
>   .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }
>   /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) }
> }
diff -rN libhugetlbfs-2.12-x86/ldscripts/elf64ltsmip.xBDT 
libhugetlbfs-2.12-mips/ldscripts/elf64ltsmip.xBDT
0a1,239
> /* Script for -z combreloc: combine and sort reloc sections */
> OUTPUT_FORMAT("elf64-tradlittlemips", "elf64-tradbigmips",
>             "elf64-tradlittlemips")
> OUTPUT_ARCH(mips)
> ENTRY(__start)
> SEARCH_DIR("/usr/mipsel-linux-gnu/lib64"); SEARCH_DIR("/usr/local/lib64"); 
> SEARCH_DIR("/lib64"); SEARCH_DIR("/usr/lib64"); 
> SEARCH_DIR("/usr/mipsel-linux-gnu/lib"); SEARCH_DIR("/usr/local/lib"); 
> SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
> SECTIONS
> {
>   /* Read-only sections, merged into text segment: */
>   PROVIDE (__executable_start = 0x120000000); . = 0x120000000 + 
> SIZEOF_HEADERS;
>   .MIPS.options : { *(.MIPS.options) }
>   .note.gnu.build-id : { *(.note.gnu.build-id) }
>   .dynamic        : { *(.dynamic) }
>   .hash           : { *(.hash) }
>   .gnu.hash       : { *(.gnu.hash) }
>   .dynsym         : { *(.dynsym) }
>   .dynstr         : { *(.dynstr) }
>   .gnu.version    : { *(.gnu.version) }
>   .gnu.version_d  : { *(.gnu.version_d) }
>   .gnu.version_r  : { *(.gnu.version_r) }
>   .rel.dyn        :
>     {
>       *(.rel.init)
>       *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*)
>       *(.rel.fini)
>       *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*)
>       *(.rel.data.rel.ro* .rel.gnu.linkonce.d.rel.ro.*)
>       *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*)
>       *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*)
>       *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*)
>       *(.rel.ctors)
>       *(.rel.dtors)
>       *(.rel.got)
>       *(.rel.dyn)
>       *(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*)
>       *(.rel.sbss .rel.sbss.* .rel.gnu.linkonce.sb.*)
>       *(.rel.sdata2 .rel.sdata2.* .rel.gnu.linkonce.s2.*)
>       *(.rel.sbss2 .rel.sbss2.* .rel.gnu.linkonce.sb2.*)
>       *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*)
>     }
>   .rela.dyn       :
>     {
>       *(.rela.init)
>       *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)
>       *(.rela.fini)
>       *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)
>       *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)
>       *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*)
>       *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*)
>       *(.rela.ctors)
>       *(.rela.dtors)
>       *(.rela.got)
>       *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*)
>       *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*)
>       *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*)
>       *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*)
>       *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)
>     }
>   .rel.plt        : { *(.rel.plt) }
>   .rela.plt       : { *(.rela.plt) }
>   .init           :
>   {
>     KEEP (*(.init))
>   } =0
>   .plt            : { *(.plt) }
>   .text           :
>   {
>     _ftext = . ;
>     *(.text .stub .text.* .gnu.linkonce.t.*)
>     KEEP (*(.text.*personality*))
>     /* .gnu.warning sections are handled specially by elf32.em.  */
>     *(.gnu.warning)
>     *(.mips16.fn.*) *(.mips16.call.*)
>   } =0
>   .fini           :
>   {
>     KEEP (*(.fini))
>   } =0
>   PROVIDE (__etext = .);
>   PROVIDE (_etext = .);
>   PROVIDE (etext = .);
>   .rodata         : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
>   .rodata1        : { *(.rodata1) }
>   .sdata2         :
>   {
>     *(.sdata2 .sdata2.* .gnu.linkonce.s2.*)
>   }
>   .sbss2          : { *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) }
>   .eh_frame_hdr : { *(.eh_frame_hdr) }
>   .eh_frame       : ONLY_IF_RO { KEEP (*(.eh_frame)) }
>   .gcc_except_table   : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) 
> }
>   /* Adjust the address for the data segment.  We want to adjust up to
>      the same address within the page on the next page up.  */
>   . = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & 
> (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT 
> (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
>   /* Exception handling  */
>   .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
>   .gcc_except_table   : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) 
> }
>   /* Thread Local Storage sections  */
>   .tdata        : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
>   .tbss                 : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
>   .preinit_array     :
>   {
>     PROVIDE_HIDDEN (__preinit_array_start = .);
>     KEEP (*(.preinit_array))
>     PROVIDE_HIDDEN (__preinit_array_end = .);
>   }
>   .init_array     :
>   {
>      PROVIDE_HIDDEN (__init_array_start = .);
>      KEEP (*(SORT(.init_array.*)))
>      KEEP (*(.init_array))
>      PROVIDE_HIDDEN (__init_array_end = .);
>   }
>   .fini_array     :
>   {
>     PROVIDE_HIDDEN (__fini_array_start = .);
>     KEEP (*(.fini_array))
>     KEEP (*(SORT(.fini_array.*)))
>     PROVIDE_HIDDEN (__fini_array_end = .);
>   }
>   .ctors          :
>   {
>     /* gcc uses crtbegin.o to find the start of
>        the constructors, so we make sure it is
>        first.  Because this is a wildcard, it
>        doesn't matter if the user does not
>        actually link against crtbegin.o; the
>        linker won't look for a file to match a
>        wildcard.  The wildcard also means that it
>        doesn't matter which directory crtbegin.o
>        is in.  */
>     KEEP (*crtbegin.o(.ctors))
>     KEEP (*crtbegin?.o(.ctors))
>     /* We don't want to include the .ctor section from
>        the crtend.o file until after the sorted ctors.
>        The .ctor section from the crtend file contains the
>        end of ctors marker and it must be last */
>     KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
>     KEEP (*(SORT(.ctors.*)))
>     KEEP (*(.ctors))
>   }
>   .dtors          :
>   {
>     KEEP (*crtbegin.o(.dtors))
>     KEEP (*crtbegin?.o(.dtors))
>     KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
>     KEEP (*(SORT(.dtors.*)))
>     KEEP (*(.dtors))
>   }
>   .jcr            : { KEEP (*(.jcr)) }
>   .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) 
> *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*) }
>   . = DATA_SEGMENT_RELRO_END (0, .);
>   .data           :
>   {
>     _fdata = . ;
>     *(.data .data.* .gnu.linkonce.d.*)
>     KEEP (*(.gnu.linkonce.d.*personality*))
>     SORT(CONSTRUCTORS)
>   }
>   .data1          : { *(.data1) }
>   . = .;
>   _gp = ALIGN(16) + 0x7ff0;
>   .got            : { *(.got.plt) *(.got) }
>   /* We want the small data sections together, so single-instruction offsets
>      can access them all, and initialized data all before uninitialized, so
>      we can shorten the on-disk segment size.  */
>   .sdata          :
>   {
>     *(.sdata .sdata.* .gnu.linkonce.s.*)
>   }
>   .lit8           : { *(.lit8) }
>   .lit4           : { *(.lit4) }
>   .srdata         : { *(.srdata) }
>   _edata = .; PROVIDE (edata = .);
>   __bss_start = .;
>   _fbss = .;
>   .sbss           :
>   {
>     *(.dynsbss)
>     *(.sbss .sbss.* .gnu.linkonce.sb.*)
>     *(.scommon)
>   }
>   .bss            :
>   {
>    *(.dynbss)
>    *(.bss .bss.* .gnu.linkonce.b.*)
>    *(COMMON)
>    /* Align here to ensure that the .bss section occupies space up to
>       _end.  Align after .bss to ensure correct alignment even if the
>       .bss section disappears because there are no input sections.
>       FIXME: Why do we need it? When there is no .bss section, we don't
>       pad the .data section.  */
>    . = ALIGN(. != 0 ? 64 / 8 : 1);
>   }
>   . = ALIGN(64 / 8);
>   . = ALIGN(64 / 8);
>   _end = .; PROVIDE (end = .);
>   . = DATA_SEGMENT_END (.);
>   /* Stabs debugging sections.  */
>   .stab          0 : { *(.stab) }
>   .stabstr       0 : { *(.stabstr) }
>   .stab.excl     0 : { *(.stab.excl) }
>   .stab.exclstr  0 : { *(.stab.exclstr) }
>   .stab.index    0 : { *(.stab.index) }
>   .stab.indexstr 0 : { *(.stab.indexstr) }
>   .comment       0 : { *(.comment) }
>   /* DWARF debug sections.
>      Symbols in the DWARF debugging sections are relative to the beginning
>      of the section so we begin them at 0.  */
>   /* DWARF 1 */
>   .debug          0 : { *(.debug) }
>   .line           0 : { *(.line) }
>   /* GNU DWARF 1 extensions */
>   .debug_srcinfo  0 : { *(.debug_srcinfo) }
>   .debug_sfnames  0 : { *(.debug_sfnames) }
>   /* DWARF 1.1 and DWARF 2 */
>   .debug_aranges  0 : { *(.debug_aranges) }
>   .debug_pubnames 0 : { *(.debug_pubnames) }
>   /* DWARF 2 */
>   .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
>   .debug_abbrev   0 : { *(.debug_abbrev) }
>   .debug_line     0 : { *(.debug_line) }
>   .debug_frame    0 : { *(.debug_frame) }
>   .debug_str      0 : { *(.debug_str) }
>   .debug_loc      0 : { *(.debug_loc) }
>   .debug_macinfo  0 : { *(.debug_macinfo) }
>   /* SGI/MIPS DWARF 2 extensions */
>   .debug_weaknames 0 : { *(.debug_weaknames) }
>   .debug_funcnames 0 : { *(.debug_funcnames) }
>   .debug_typenames 0 : { *(.debug_typenames) }
>   .debug_varnames  0 : { *(.debug_varnames) }
>   /* DWARF 3 */
>   .debug_pubtypes 0 : { *(.debug_pubtypes) }
>   .debug_ranges   0 : { *(.debug_ranges) }
>   .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
>   .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }
>   .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }
>   /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) }
> }
diff -rN libhugetlbfs-2.12-x86/Makefile libhugetlbfs-2.12-mips/Makefile
20c20
< LDSCRIPT_DIST_ELF = elf32ppclinux elf64ppc elf_i386 elf_x86_64
---
> LDSCRIPT_DIST_ELF = elf32ppclinux elf64ppc elf_i386 elf_x86_64 elf32ltsmip
82a83,89
> ifeq ($(ARCH),mips64)
> CC64 = gcc
> CC32 = gcc
> TMPLIB64 = lib64
> ELF32= elf32ltmips
> ELF64= elf64ltmips
> else
90a98
> endif
189a198,200
> ifeq ($(ARCH),mips64)
> all:  libs tools
> else
190a202
> endif
diff -rN libhugetlbfs-2.12-x86/sys-elf32ltsmip.S 
libhugetlbfs-2.12-mips/sys-elf32ltsmip.S
0a1,72
> /*
> .text
> .globl direct_syscall
> direct_syscall:
> syscall
> j $ra
> */
> 
> /* code port from 
>  * glibc-2.1.3.tar.gz/glibc-2.1.3/sysdeps/mach/mips/syscall.S
>  */
> 
> 
> #define zero    $0      /* wired zero */
> #define AT      $1      /* assembler temp  - uppercase because of ".set at"
>                             */
> #define v0      $2      /* return value */
> #define v1      $3
> #define a0      $4      /* argument registers */
> #define a1      $5
> #define a2      $6
> #define a3      $7
> #define t0      $8      /* caller saved */
> #define t1      $9
> #define t2      $10
> #define t3      $11
> #define t4      $12
> #define t5      $13
> #define t6      $14
> #define t7      $15
> #define s0      $16     /* callee saved */
> #define s1      $17
> #define s2      $18
> #define s3      $19
> #define s4      $20
> #define s5      $21
> #define s6      $22
> #define s7      $23
> #define t8      $24     /* caller saved */
> #define t9      $25
> #define jp      $25     /* PIC jump register */
> #define k0      $26     /* kernel scratch */
> #define k1      $27
> #define gp      $28     /* global pointer */
> #define sp      $29     /* stack pointer */
> #define fp      $30     /* frame pointer */
> #define s8      $30     /* same like fp! */
> #define ra      $31     /* return address
>                             */
> 
> 
> .text
> .globl  direct_syscall
> 
> direct_syscall:
> move    v0, a0          /* Load system call number from first arg.  */
> move    a0, a1          /* Move the next three args up a register.  */
> move    a1, a2
> move    a2, a3
> 
> /* Load the remaining possible args (up to 11) from the stack.  */
> 
> ld      t0,4*8(sp)
> ld      t1,5*8(sp)
> ld      t2,6*8(sp)
> ld      t3,7*8(sp)
> ld      t4,8*8(sp)
> ld      t5,9*8(sp)
> ld      t6,10*8(sp)
> syscall                 /* Do the system call.  */
> j ra                    /* Return to caller.  */
> 
diff -rN libhugetlbfs-2.12-x86/sys-elf64ltsmip.S 
libhugetlbfs-2.12-mips/sys-elf64ltsmip.S
0a1,5
> .text
> .globl direct_syscall
> direct_syscall:
>     syscall
>     j $ra
diff -rN libhugetlbfs-2.12-x86/tests/icache-hygiene.c 
libhugetlbfs-2.12-mips/tests/icache-hygiene.c
88c88
<     defined(__s390__) || defined(__s390x__) || defined(__sparc__)
---
>     defined(__s390__) || defined(__s390x__) || defined(__sparc__) || 
> defined(__mips__)
diff -rN libhugetlbfs-2.12-x86/tests/Makefile 
libhugetlbfs-2.12-mips/tests/Makefile
39a40,41
> ARCH = $(shell uname -m | sed -e s/i.86/i386/)
> 
41a44
> ifeq ($(ARCH),mips64)
44a48,50
> TESTS += $(LDSCRIPT_TESTS) $(HUGELINK_TESTS) $(HUGELINK_RW_TESTS)
> endif
> else
45a52
> ifeq ($(ARCH),mips64)
47a55,57
> else
> TESTS += $(LDSCRIPT_TESTS) $(HUGELINK_TESTS)
> endif
208a219,220
> ifneq ($(ARCH),mips64)
>       xx
231a244
> endif
------------------------------------------------------------------------------
Simplify data backup and recovery for your virtual environment with vRanger.
Installation's a snap, and flexible recovery options mean your data is safe,
secure and there when you need it. Discover what all the cheering's about.
Get your free trial download today. 
http://p.sf.net/sfu/quest-dev2dev2 
_______________________________________________
Libhugetlbfs-devel mailing list
Libhugetlbfs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libhugetlbfs-devel

Reply via email to