Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(311)

Side by Side Diff: third_party/android_crazy_linker/src/tests/foo_with_relro.cpp

Issue 322433006: Fork of the Android NDK crazy linker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add a required license header to a cpp module, missing in the original. Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2013 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.
4
5 #include <android/log.h>
6 #include <stdio.h>
7 #include <stdlib.h>
8
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
16
17 const char* const kStrings[] = {LINE4096 LINE4096 LINE4096 LINE4096};
18
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=%d\n", __FUNCTION__, n);
25 exit(1);
26 }
27 }
28 printf("%s: Exiting\n", __FUNCTION__);
29 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698