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

Unified Diff: third_party/crazy_linker/crazy_linker/tests/foo_with_relro.cpp

Issue 23542017: This patch adds a new third-party library that implements an ELF dynamic linker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Minor update Created 7 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: third_party/crazy_linker/crazy_linker/tests/foo_with_relro.cpp
diff --git a/third_party/crazy_linker/crazy_linker/tests/foo_with_relro.cpp b/third_party/crazy_linker/crazy_linker/tests/foo_with_relro.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..9de209a246617016717aad733c1b12687075bf15
--- /dev/null
+++ b/third_party/crazy_linker/crazy_linker/tests/foo_with_relro.cpp
@@ -0,0 +1,34 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include <android/log.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+// This is a large table that contains pointers to ensure that it
+// gets put inside the RELRO section.
+#define LINE "some example string",
+#define LINE8 LINE LINE LINE LINE LINE LINE LINE LINE
+#define LINE64 LINE8 LINE8 LINE8 LINE8 LINE8 LINE8 LINE8 LINE8
+#define LINE512 LINE64 LINE64 LINE64 LINE64 LINE64 LINE64 LINE64 LINE64
+#define LINE4096 LINE512 LINE512 LINE512 LINE512 LINE512 LINE512 LINE512 LINE512
+
+const char* const kStrings[] = {
+ LINE4096
+ LINE4096
+ LINE4096
+ LINE4096
+};
+
+extern "C" void Foo() {
+ printf("%s: Entering\n", __FUNCTION__);
+ for (size_t n = 0; n < sizeof(kStrings)/sizeof(kStrings[0]); ++n) {
+ const char* ptr = kStrings[n];
+ if (strcmp(ptr, "some example string")) {
+ printf("%s: Bad string at offset=%d\n", __FUNCTION__, n);
+ exit(1);
+ }
+ }
+ printf("%s: Exiting\n", __FUNCTION__);
+}

Powered by Google App Engine
This is Rietveld 408576698