Merge "Add ifuncs to the elf symbol list."
This commit is contained in:
@@ -101,11 +101,18 @@ ELFSoFileParser<T>::ELFSoFileParser(const llvm::object::ELFObjectFile<T> *obj) {
|
||||
LLVMToIRSymbolBinding(elf_sym->getBinding());
|
||||
std::string symbol_name = UnWrap(symbol_it.getName());
|
||||
|
||||
llvm::object::SymbolRef::Type type = UnWrap(symbol_it.getType());
|
||||
if (type == llvm::object::SymbolRef::Type::ST_Function) {
|
||||
exported_symbols_->AddFunction(symbol_name, symbol_binding);
|
||||
} else if (type == llvm::object::SymbolRef::Type::ST_Data) {
|
||||
exported_symbols_->AddVar(symbol_name, symbol_binding);
|
||||
switch (symbol_it.getELFType()) {
|
||||
case llvm::ELF::STT_OBJECT:
|
||||
case llvm::ELF::STT_COMMON:
|
||||
case llvm::ELF::STT_TLS:
|
||||
exported_symbols_->AddVar(symbol_name, symbol_binding);
|
||||
break;
|
||||
case llvm::ELF::STT_FUNC:
|
||||
case llvm::ELF::STT_GNU_IFUNC:
|
||||
exported_symbols_->AddFunction(symbol_name, symbol_binding);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
23
vndk/tools/header-checker/tests/integration/ifunc/Android.bp
Normal file
23
vndk/tools/header-checker/tests/integration/ifunc/Android.bp
Normal file
@@ -0,0 +1,23 @@
|
||||
//
|
||||
// Copyright (C) 2020 The Android Open Source Project
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
cc_library {
|
||||
name: "libifunc",
|
||||
srcs: [
|
||||
"ifunc.c",
|
||||
],
|
||||
enabled: false,
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
__attribute__((used)) static void *ifunc_resolver() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ifunc() __attribute__((ifunc("ifunc_resolver")));
|
||||
@@ -0,0 +1,4 @@
|
||||
libifunc {
|
||||
global:
|
||||
ifunc;
|
||||
};
|
||||
BIN
vndk/tools/header-checker/tests/integration/ifunc/prebuilts/libifunc.so
Executable file
BIN
vndk/tools/header-checker/tests/integration/ifunc/prebuilts/libifunc.so
Executable file
Binary file not shown.
@@ -413,6 +413,17 @@ TEST_MODULES = [
|
||||
version_script='integration/c_and_cpp/repro_map.txt',
|
||||
export_include_dirs=['integration/c_and_cpp/include'],
|
||||
),
|
||||
LsdumpModule(
|
||||
name='libifunc',
|
||||
srcs=['integration/ifunc/ifunc.c'],
|
||||
version_script='integration/ifunc/map.txt',
|
||||
export_include_dirs=[],
|
||||
linker_flags=[
|
||||
'-so', relative_to_abs_path(
|
||||
'integration/ifunc/prebuilts/libifunc.so'
|
||||
),
|
||||
]
|
||||
),
|
||||
LsdumpModule(
|
||||
name='libgolden_cpp_member_name_changed',
|
||||
srcs=[
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
builtin_types {
|
||||
type_info {
|
||||
name: "void"
|
||||
size: 0
|
||||
alignment: 0
|
||||
referenced_type: "_ZTIv"
|
||||
source_file: ""
|
||||
linker_set_key: "_ZTIv"
|
||||
self_type: "_ZTIv"
|
||||
}
|
||||
is_unsigned: false
|
||||
is_integral: false
|
||||
}
|
||||
functions {
|
||||
return_type: "_ZTIv"
|
||||
function_name: "ifunc"
|
||||
source_file: "/development/vndk/tools/header-checker/tests/integration/ifunc/ifunc.c"
|
||||
linker_set_key: "ifunc"
|
||||
access: public_access
|
||||
}
|
||||
elf_functions {
|
||||
name: "ifunc"
|
||||
binding: Global
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
builtin_types {
|
||||
type_info {
|
||||
name: "void"
|
||||
size: 0
|
||||
alignment: 0
|
||||
referenced_type: "_ZTIv"
|
||||
source_file: ""
|
||||
linker_set_key: "_ZTIv"
|
||||
self_type: "_ZTIv"
|
||||
}
|
||||
is_unsigned: false
|
||||
is_integral: false
|
||||
}
|
||||
functions {
|
||||
return_type: "_ZTIv"
|
||||
function_name: "ifunc"
|
||||
source_file: "/development/vndk/tools/header-checker/tests/integration/ifunc/ifunc.c"
|
||||
linker_set_key: "ifunc"
|
||||
access: public_access
|
||||
}
|
||||
elf_functions {
|
||||
name: "ifunc"
|
||||
binding: Global
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
builtin_types {
|
||||
type_info {
|
||||
name: "void"
|
||||
size: 0
|
||||
alignment: 0
|
||||
referenced_type: "_ZTIv"
|
||||
source_file: ""
|
||||
linker_set_key: "_ZTIv"
|
||||
self_type: "_ZTIv"
|
||||
}
|
||||
is_unsigned: false
|
||||
is_integral: false
|
||||
}
|
||||
functions {
|
||||
return_type: "_ZTIv"
|
||||
function_name: "ifunc"
|
||||
source_file: "/development/vndk/tools/header-checker/tests/integration/ifunc/ifunc.c"
|
||||
linker_set_key: "ifunc"
|
||||
access: public_access
|
||||
}
|
||||
elf_functions {
|
||||
name: "ifunc"
|
||||
binding: Global
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
builtin_types {
|
||||
type_info {
|
||||
name: "void"
|
||||
size: 0
|
||||
alignment: 0
|
||||
referenced_type: "_ZTIv"
|
||||
source_file: ""
|
||||
linker_set_key: "_ZTIv"
|
||||
self_type: "_ZTIv"
|
||||
}
|
||||
is_unsigned: false
|
||||
is_integral: false
|
||||
}
|
||||
functions {
|
||||
return_type: "_ZTIv"
|
||||
function_name: "ifunc"
|
||||
source_file: "/development/vndk/tools/header-checker/tests/integration/ifunc/ifunc.c"
|
||||
linker_set_key: "ifunc"
|
||||
access: public_access
|
||||
}
|
||||
elf_functions {
|
||||
name: "ifunc"
|
||||
binding: Global
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
builtin_types {
|
||||
type_info {
|
||||
name: "void"
|
||||
size: 0
|
||||
alignment: 0
|
||||
referenced_type: "_ZTIv"
|
||||
source_file: ""
|
||||
linker_set_key: "_ZTIv"
|
||||
self_type: "_ZTIv"
|
||||
}
|
||||
is_unsigned: false
|
||||
is_integral: false
|
||||
}
|
||||
functions {
|
||||
return_type: "_ZTIv"
|
||||
function_name: "ifunc"
|
||||
source_file: "/development/vndk/tools/header-checker/tests/integration/ifunc/ifunc.c"
|
||||
linker_set_key: "ifunc"
|
||||
access: public_access
|
||||
}
|
||||
elf_functions {
|
||||
name: "ifunc"
|
||||
binding: Global
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
builtin_types {
|
||||
type_info {
|
||||
name: "void"
|
||||
size: 0
|
||||
alignment: 0
|
||||
referenced_type: "_ZTIv"
|
||||
source_file: ""
|
||||
linker_set_key: "_ZTIv"
|
||||
self_type: "_ZTIv"
|
||||
}
|
||||
is_unsigned: false
|
||||
is_integral: false
|
||||
}
|
||||
functions {
|
||||
return_type: "_ZTIv"
|
||||
function_name: "ifunc"
|
||||
source_file: "/development/vndk/tools/header-checker/tests/integration/ifunc/ifunc.c"
|
||||
linker_set_key: "ifunc"
|
||||
access: public_access
|
||||
}
|
||||
elf_functions {
|
||||
name: "ifunc"
|
||||
binding: Global
|
||||
}
|
||||
@@ -372,6 +372,10 @@ class HeaderCheckerTest(unittest.TestCase):
|
||||
self.prepare_and_absolute_diff_all_archs(
|
||||
"libanonymous_enum_odr", "libanonymous_enum_odr")
|
||||
|
||||
def test_libifunc(self):
|
||||
self.prepare_and_absolute_diff_all_archs(
|
||||
"libifunc", "libifunc")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user