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

Unified Diff: third_party/android_crazy_linker/src/src/crazy_linker_library_view.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 side-by-side diff with in-line comments
Download patch
Index: third_party/android_crazy_linker/src/src/crazy_linker_library_view.cpp
diff --git a/third_party/android_crazy_linker/src/src/crazy_linker_library_view.cpp b/third_party/android_crazy_linker/src/src/crazy_linker_library_view.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..28fc62e5c7d695f87cafb6c06af449f18c8ed08c
--- /dev/null
+++ b/third_party/android_crazy_linker/src/src/crazy_linker_library_view.cpp
@@ -0,0 +1,53 @@
+// 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 "crazy_linker_library_view.h"
+
+#include <dlfcn.h>
+#include "crazy_linker_debug.h"
+#include "crazy_linker_globals.h"
+#include "crazy_linker_shared_library.h"
+
+namespace crazy {
+
+LibraryView::~LibraryView() {
+ LOG("%s: Destroying %s\n", __FUNCTION__, name_.c_str());
+ if (type_ == TYPE_SYSTEM) {
+ ::dlclose(system_);
+ system_ = NULL;
+ }
+ if (type_ == TYPE_CRAZY) {
+ delete crazy_;
+ crazy_ = NULL;
+ }
+ type_ = TYPE_NONE;
+}
+
+void* LibraryView::LookupSymbol(const char* symbol_name) {
+ if (type_ == TYPE_SYSTEM)
+ return ::dlsym(system_, symbol_name);
+
+ if (type_ == TYPE_CRAZY) {
+ LibraryList* lib_list = Globals::GetLibraries();
+ return lib_list->FindSymbolFrom(symbol_name, this);
+ }
+
+ return NULL;
+}
+
+bool LibraryView::GetInfo(size_t* load_address,
+ size_t* load_size,
+ size_t* relro_start,
+ size_t* relro_size,
+ Error* error) {
+ if (type_ != TYPE_CRAZY) {
+ *error = "No RELRO sharing with system libraries";
+ return false;
+ }
+
+ crazy_->GetInfo(load_address, load_size, relro_start, relro_size);
+ return true;
+}
+
+} // namespace crazy

Powered by Google App Engine
This is Rietveld 408576698