Revert "Omit calls to set composing region when pasting image."
[chromium-blink-merge.git] / third_party / android_crazy_linker / src / tests / bar_with_relro.cpp
bloba0377c9b5ccc52d0c9944f5d87b4c649b4dd077b
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include <android/log.h>
6 #include <stdio.h>
7 #include <stdlib.h>
9 // A variant of bar.cpp that also includes a large RELRO section.
10 // Used to test RELRO sharing with two different libraries at the
11 // same time.
13 // This is a large table that contains pointers to ensure that it
14 // gets put inside the RELRO section.
15 #define LINE "another example string",
16 #define LINE8 LINE LINE LINE LINE LINE LINE LINE LINE
17 #define LINE64 LINE8 LINE8 LINE8 LINE8 LINE8 LINE8 LINE8 LINE8
18 #define LINE512 LINE64 LINE64 LINE64 LINE64 LINE64 LINE64 LINE64 LINE64
19 #define LINE4096 LINE512 LINE512 LINE512 LINE512 LINE512 LINE512 LINE512 LINE512
21 const char* const kStrings[] = {LINE4096 LINE4096 LINE4096 LINE4096};
23 extern "C" void Foo();
25 extern "C" void Bar() {
26 printf("%s: Entering\n", __FUNCTION__);
27 __android_log_print(ANDROID_LOG_INFO, "bar", "Hi There!");
28 fprintf(stderr, "Hi There! from Bar\n");
30 for (size_t n = 0; n < sizeof(kStrings) / sizeof(kStrings[0]); ++n) {
31 const char* ptr = kStrings[n];
32 if (strcmp(ptr, "another example string")) {
33 printf("%s: Bad string at offset=%zu\n", __FUNCTION__, n);
34 exit(1);
38 printf("%s: Calling Foo()\n", __FUNCTION__);
39 Foo();
41 printf("%s: Exiting\n", __FUNCTION__);