[SyncFS] Build indexes from FileTracker entries on disk.
[chromium-blink-merge.git] / third_party / android_crazy_linker / src / tests / foo_with_relro.cpp
blob3e447a98ed261e527530271d9fcbea65d24348c0
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 // This is a large table that contains pointers to ensure that it
10 // gets put inside the RELRO section.
11 #define LINE "some example string",
12 #define LINE8 LINE LINE LINE LINE LINE LINE LINE LINE
13 #define LINE64 LINE8 LINE8 LINE8 LINE8 LINE8 LINE8 LINE8 LINE8
14 #define LINE512 LINE64 LINE64 LINE64 LINE64 LINE64 LINE64 LINE64 LINE64
15 #define LINE4096 LINE512 LINE512 LINE512 LINE512 LINE512 LINE512 LINE512 LINE512
17 const char* const kStrings[] = {LINE4096 LINE4096 LINE4096 LINE4096};
19 extern "C" void Foo() {
20 printf("%s: Entering\n", __FUNCTION__);
21 for (size_t n = 0; n < sizeof(kStrings) / sizeof(kStrings[0]); ++n) {
22 const char* ptr = kStrings[n];
23 if (strcmp(ptr, "some example string")) {
24 printf("%s: Bad string at offset=%zu\n", __FUNCTION__, n);
25 exit(1);
28 printf("%s: Exiting\n", __FUNCTION__);