elflink.c tests slice boundaries for all architectures, but this is
not necessary on x86[_64] as there are no rules for placement of
huge pages with respect to small pages.  This patch addes a define
that will skip this check on x86[_64] builds.

Signed-off-by: Eric B Munson <ebmun...@us.ibm.com>
---
 Makefile  |    2 ++
 elflink.c |    7 ++++++-
 2 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/Makefile b/Makefile
index 944ab0a..bd8c511 100644
--- a/Makefile
+++ b/Makefile
@@ -52,12 +52,14 @@ ifeq ($(ARCH),i386)
 CC32 = gcc
 ELF32 = elf_i386
 TMPLIB32 = lib
+CPPFLAGS += -D__NO_SLICE_CHECK__
 else
 ifeq ($(ARCH),x86_64)
 CC64 = gcc -m64
 ELF64 = elf_x86_64
 TMPLIB64 = lib64
 TMPLIB32 = lib
+CPPFLAGS += -D__NO_SLICE_CHECK__
 ifneq ($(BUILDTYPE),NATIVEONLY)
 CC32 = gcc -m32
 ELF32 = elf_i386
diff --git a/elflink.c b/elflink.c
index ac4a898..08d74a1 100644
--- a/elflink.c
+++ b/elflink.c
@@ -655,7 +655,11 @@ static int verify_segment_layout(struct seg_layout *segs, 
int num_segs)
                                "Segments would overlap\n", i - 1, i);
                        return 1;
                }
-
+/*
+ * This check is unnecessary on x86 and its derivatives because there are no
+ * rules about placement of huge pages with respect to small pages.
+ */
+#ifndef __NO_SLICE_CHECK__
                /* Make sure page size transitions occur on slice boundaries */
                if ((segs[i - 1].page_size != segs[i].page_size) &&
                                hugetlb_slice_end(prev_end) >
@@ -664,6 +668,7 @@ static int verify_segment_layout(struct seg_layout *segs, 
int num_segs)
                                "Only one page size per slice\n", i - 1, i);
                        return 1;
                }
+#endif /* ifndef __NO_SLICE_CHECK__ */
        }
        return 0;
 }
-- 
1.6.3.3


------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
Libhugetlbfs-devel mailing list
Libhugetlbfs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libhugetlbfs-devel

Reply via email to