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
This commit is contained in:
parent
3837bd9aae
commit
506fb4b56a
1 changed files with 30 additions and 0 deletions
|
@ -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 *)(®ular_func)));
|
||||
}
|
||||
|
||||
// Tests that verify that Symbolize stack footprint is within some limit.
|
||||
#ifdef ABSL_INTERNAL_HAVE_DEBUGGING_STACK_CONSUMPTION
|
||||
|
||||
|
|
Loading…
Reference in a new issue