summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Abseil Team <absl-team@google.com>2018-03-19 13:32:04 -0700
committerGravatar katzdm <katzdm@google.com>2018-03-20 15:06:07 -0400
commit506fb4b56a339314fde23802bd749dbc3b3c1c79 (patch)
tree57ad7eeef087524fc383a5125163d9a5c4ee1957
parent3837bd9aaeeb31aa397eef5fd2784b6674fba207 (diff)
Changes imported from Abseil "staging" branch:
- deb12f2a67aafb3568bf83109b6814e69a70473d Add tests to check symbolization with linker flag: -z,kee... by Abseil Team <absl-team@google.com> GitOrigin-RevId: deb12f2a67aafb3568bf83109b6814e69a70473d Change-Id: I4139e27395610734ccd21fa80b70b03deff786f8
-rw-r--r--absl/debugging/symbolize_test.cc30
1 files changed, 30 insertions, 0 deletions
diff --git a/absl/debugging/symbolize_test.cc b/absl/debugging/symbolize_test.cc
index 52c69155..8b28e5c5 100644
--- a/absl/debugging/symbolize_test.cc
+++ b/absl/debugging/symbolize_test.cc
@@ -51,6 +51,28 @@ void ABSL_ATTRIBUTE_NOINLINE Foo::func(int) {
ABSL_BLOCK_TAIL_CALL_OPTIMIZATION();
}
+// Create functions that will remain in different text sections in the
+// final binary when linker option "-z,keep-text-section-prefix" is used.
+int ABSL_ATTRIBUTE_SECTION_VARIABLE(.text.unlikely) unlikely_func() {
+ return 0;
+}
+
+int ABSL_ATTRIBUTE_SECTION_VARIABLE(.text.hot) hot_func() {
+ return 0;
+}
+
+int ABSL_ATTRIBUTE_SECTION_VARIABLE(.text.startup) startup_func() {
+ return 0;
+}
+
+int ABSL_ATTRIBUTE_SECTION_VARIABLE(.text.exit) exit_func() {
+ return 0;
+}
+
+int ABSL_ATTRIBUTE_SECTION_VARIABLE(.text) regular_func() {
+ return 0;
+}
+
// Thread-local data may confuse the symbolizer, ensure that it does not.
// Variable sizes and order are important.
#if ABSL_PER_THREAD_TLS
@@ -136,6 +158,14 @@ TEST(Symbolize, SymbolizeWithDemangling) {
EXPECT_STREQ("Foo::func()", TrySymbolize((void *)(&Foo::func)));
}
+TEST(Symbolize, SymbolizeSplitTextSections) {
+ EXPECT_STREQ("unlikely_func()", TrySymbolize((void *)(&unlikely_func)));
+ EXPECT_STREQ("hot_func()", TrySymbolize((void *)(&hot_func)));
+ EXPECT_STREQ("startup_func()", TrySymbolize((void *)(&startup_func)));
+ EXPECT_STREQ("exit_func()", TrySymbolize((void *)(&exit_func)));
+ EXPECT_STREQ("regular_func()", TrySymbolize((void *)(&regular_func)));
+}
+
// Tests that verify that Symbolize stack footprint is within some limit.
#ifdef ABSL_INTERNAL_HAVE_DEBUGGING_STACK_CONSUMPTION