Merge "Made sync-test actually wait for first thread to start."
diff --git a/compiler/optimizing/code_generator.cc b/compiler/optimizing/code_generator.cc
index c0964e6..bd8c27e 100644
--- a/compiler/optimizing/code_generator.cc
+++ b/compiler/optimizing/code_generator.cc
@@ -30,16 +30,16 @@
 
 namespace art {
 
-void CodeGenerator::CompileBaseline(CodeAllocator* allocator) {
+void CodeGenerator::CompileBaseline(CodeAllocator* allocator, bool is_leaf) {
   const GrowableArray<HBasicBlock*>& blocks = GetGraph()->GetBlocks();
   DCHECK(blocks.Get(0) == GetGraph()->GetEntryBlock());
   DCHECK(GoesToNextBlock(GetGraph()->GetEntryBlock(), blocks.Get(1)));
   block_labels_.SetSize(blocks.Size());
 
   DCHECK_EQ(frame_size_, kUninitializedFrameSize);
-  // The baseline compiler does not do graph analysis prior to generating
-  // code.
-  MarkNotLeaf();
+  if (!is_leaf) {
+    MarkNotLeaf();
+  }
   ComputeFrameSize(GetGraph()->GetMaximumNumberOfOutVRegs()
                    + GetGraph()->GetNumberOfLocalVRegs()
                    + GetGraph()->GetNumberOfTemporaries()
diff --git a/compiler/optimizing/code_generator.h b/compiler/optimizing/code_generator.h
index 936ca28..b31c3a3 100644
--- a/compiler/optimizing/code_generator.h
+++ b/compiler/optimizing/code_generator.h
@@ -70,7 +70,7 @@
  public:
   // Compiles the graph to executable instructions. Returns whether the compilation
   // succeeded.
-  void CompileBaseline(CodeAllocator* allocator);
+  void CompileBaseline(CodeAllocator* allocator, bool is_leaf = false);
   void CompileOptimized(CodeAllocator* allocator);
   static CodeGenerator* Create(ArenaAllocator* allocator,
                                HGraph* graph,
diff --git a/compiler/optimizing/codegen_test.cc b/compiler/optimizing/codegen_test.cc
index bfdc30f..d7ac10d 100644
--- a/compiler/optimizing/codegen_test.cc
+++ b/compiler/optimizing/codegen_test.cc
@@ -76,19 +76,21 @@
   InternalCodeAllocator allocator;
 
   CodeGenerator* codegen = CodeGenerator::Create(&arena, graph, kX86);
-  codegen->CompileBaseline(&allocator);
+  // We avoid doing a stack overflow check that requires the runtime being setup,
+  // by making sure the compiler knows the methods we are running are leaf methods.
+  codegen->CompileBaseline(&allocator, true);
 #if defined(__i386__)
   Run(allocator, *codegen, has_result, expected);
 #endif
 
   codegen = CodeGenerator::Create(&arena, graph, kArm);
-  codegen->CompileBaseline(&allocator);
+  codegen->CompileBaseline(&allocator, true);
 #if defined(__arm__)
   Run(allocator, *codegen, has_result, expected);
 #endif
 
   codegen = CodeGenerator::Create(&arena, graph, kX86_64);
-  codegen->CompileBaseline(&allocator);
+  codegen->CompileBaseline(&allocator, true);
 #if defined(__x86_64__)
   Run(allocator, *codegen, has_result, expected);
 #endif
diff --git a/runtime/gc/space/image_space.cc b/runtime/gc/space/image_space.cc
index 3eaa64c..7a3cbf3 100644
--- a/runtime/gc/space/image_space.cc
+++ b/runtime/gc/space/image_space.cc
@@ -159,8 +159,8 @@
   } else {
     r = RoundDown(r, kPageSize);
   }
-  CHECK_LT(min_delta, r);
-  CHECK_GT(max_delta, r);
+  CHECK_LE(min_delta, r);
+  CHECK_GE(max_delta, r);
   CHECK_ALIGNED(r, kPageSize);
   return r;
 }
diff --git a/test/Android.oat.mk b/test/Android.oat.mk
index 111680a..a83c527 100644
--- a/test/Android.oat.mk
+++ b/test/Android.oat.mk
@@ -470,6 +470,22 @@
 $(eval $(call define-test-art-oat-combination,host,HOST,-interpreter,_INTERPRETER,$(2ND_ART_PHONY_TEST_HOST_SUFFIX)))
 endif
 
+# List -relocate version on the target as broken.
+
+# List all the test names for target and compiler variants.
+# $(1): test name, e.g. Main
+# $(2): -relocate, -norelocate, -prebuild, or undefined.
+define all-oat-test-target-names
+  test-art-target-oat-default$(2)-$(1)32 \
+  test-art-target-oat-optimizing$(2)-$(1)32 \
+  test-art-target-oat-interpreter$(2)-$(1)32 \
+  test-art-target-oat-default$(2)-$(1)64 \
+  test-art-target-oat-optimizing$(2)-$(1)64 \
+  test-art-target-oat-interpreter$(2)-$(1)64
+endef  # all-oat-test-target-names
+
+ART_TEST_KNOWN_BROKEN += $(foreach test, $(TEST_OAT_DIRECTORIES), $(call all-oat-test-target-names,$(test),-relocate))
+
 # Clear locally defined variables.
 define-test-art-oat-rule-target :=
 define-test-art-oat-rules-target :=