header-abi-diff: Fix return code for extension in presence of elf only changes.
Before this change, an elf symbol change not exported through public
headers would short circuit the check for api extension. As a result,
header-abi-diff would return a compatible return status (0). This isn't
correct, extensions should take precedence over elf only changes and an
extension status should be returned (non zero).
Bug: 79928919
Test: tests/test.py
Merged-In: I6907d0ebaf332d019cdf2e264316f7d521e00d82
Change-Id: I6907d0ebaf332d019cdf2e264316f7d521e00d82
(cherry picked from commit 03c4e279a8)
This commit is contained in:
@@ -1179,11 +1179,6 @@ CompatibilityStatusIR ProtobufIRDiffDumper::GetCompatibilityStatusIR() {
|
|||||||
return CompatibilityStatusIR::Incompatible;
|
return CompatibilityStatusIR::Incompatible;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(diff_tu_->removed_elf_functions().size() != 0 ||
|
|
||||||
diff_tu_->removed_elf_objects().size() != 0) {
|
|
||||||
return CompatibilityStatusIR::ElfIncompatible;
|
|
||||||
}
|
|
||||||
|
|
||||||
CompatibilityStatusIR combined_status = CompatibilityStatusIR::Compatible;
|
CompatibilityStatusIR combined_status = CompatibilityStatusIR::Compatible;
|
||||||
|
|
||||||
if (diff_tu_->enum_type_extension_diffs().size() != 0 ||
|
if (diff_tu_->enum_type_extension_diffs().size() != 0 ||
|
||||||
@@ -1203,6 +1198,11 @@ CompatibilityStatusIR ProtobufIRDiffDumper::GetCompatibilityStatusIR() {
|
|||||||
combined_status | CompatibilityStatusIR::UnreferencedChanges;
|
combined_status | CompatibilityStatusIR::UnreferencedChanges;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(diff_tu_->removed_elf_functions().size() != 0 ||
|
||||||
|
diff_tu_->removed_elf_objects().size() != 0) {
|
||||||
|
combined_status = combined_status | CompatibilityStatusIR::ElfIncompatible;
|
||||||
|
}
|
||||||
|
|
||||||
return combined_status;
|
return combined_status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,3 +2,12 @@
|
|||||||
|
|
||||||
void LowVolumeSpeaker::Speak() { }
|
void LowVolumeSpeaker::Speak() { }
|
||||||
LISTEN_RETURN_TYPE LowVolumeSpeaker::Listen() { LISTEN_RETURN_STATEMENT }
|
LISTEN_RETURN_TYPE LowVolumeSpeaker::Listen() { LISTEN_RETURN_STATEMENT }
|
||||||
|
|
||||||
|
#ifdef ADD_UNEXPORTED_ELF_SYMBOL
|
||||||
|
void UnexportedSymbol(int *a) {
|
||||||
|
if (a) {
|
||||||
|
a++;
|
||||||
|
}
|
||||||
|
a--;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
libcpp_golden_added_function {
|
||||||
|
global:
|
||||||
|
_Z26test_virtual_function_callP12SuperSpeaker;
|
||||||
|
_ZN12SuperSpeaker11SpeakLouderEv;
|
||||||
|
_ZN12SuperSpeaker18CreateSuperSpeakerEi;
|
||||||
|
_ZN12SuperSpeaker9SpeakLoudEv;
|
||||||
|
_ZN12SuperSpeakerD2Ev;
|
||||||
|
_ZN16LowVolumeSpeaker5SpeakEv;
|
||||||
|
_ZN16LowVolumeSpeaker6ListenEv;
|
||||||
|
_ZN16LowVolumeSpeakerD0Ev;
|
||||||
|
_ZN17HighVolumeSpeaker11BadPracticeEf;
|
||||||
|
_ZN17HighVolumeSpeaker13AddedFunctionEv;
|
||||||
|
_ZN17HighVolumeSpeaker5SpeakEv;
|
||||||
|
_ZN17HighVolumeSpeaker6ListenEv;
|
||||||
|
_ZN17HighVolumeSpeakerD0Ev;
|
||||||
|
_ZN12NotReferenced;
|
||||||
|
_ZN16UnexportedSymbol;
|
||||||
|
_ZTV16LowVolumeSpeaker; #var
|
||||||
|
_ZTV17HighVolumeSpeaker; #var
|
||||||
|
};
|
||||||
@@ -183,6 +183,18 @@ TEST_MODULES = [
|
|||||||
arch = '',
|
arch = '',
|
||||||
api = 'current',
|
api = 'current',
|
||||||
),
|
),
|
||||||
|
Module(
|
||||||
|
name = 'libgolden_cpp_add_function_and_unexported_elf',
|
||||||
|
srcs = ['integration/cpp/gold/golden_1.cpp',
|
||||||
|
'integration/cpp/gold/high_volume_speaker.cpp',
|
||||||
|
'integration/cpp/gold/low_volume_speaker.cpp',
|
||||||
|
],
|
||||||
|
version_script = 'integration/cpp/gold/map_add_function.txt',
|
||||||
|
export_include_dirs = ['integration/cpp/gold/include'],
|
||||||
|
cflags = ['-DGOLDEN_ADD_FUNCTION=1', '-DADD_UNEXPORTED_ELF_SYMBOL'],
|
||||||
|
arch = '',
|
||||||
|
api = 'current',
|
||||||
|
),
|
||||||
Module(
|
Module(
|
||||||
name = 'libgolden_cpp_change_function_access',
|
name = 'libgolden_cpp_change_function_access',
|
||||||
srcs = ['integration/cpp/gold/golden_1.cpp',
|
srcs = ['integration/cpp/gold/golden_1.cpp',
|
||||||
|
|||||||
@@ -159,6 +159,11 @@ class MyTest(unittest.TestCase):
|
|||||||
self.prepare_and_run_abi_diff_all_archs(
|
self.prepare_and_run_abi_diff_all_archs(
|
||||||
"libgolden_cpp", "libgolden_cpp_add_function", 4)
|
"libgolden_cpp", "libgolden_cpp_add_function", 4)
|
||||||
|
|
||||||
|
def test_libgolden_cpp_add_function_and_elf_symbol(self):
|
||||||
|
self.prepare_and_run_abi_diff_all_archs(
|
||||||
|
"libgolden_cpp", "libgolden_cpp_add_function_and_unexported_elf",
|
||||||
|
4)
|
||||||
|
|
||||||
def test_libgolden_cpp_change_function_access(self):
|
def test_libgolden_cpp_change_function_access(self):
|
||||||
self.prepare_and_run_abi_diff_all_archs(
|
self.prepare_and_run_abi_diff_all_archs(
|
||||||
"libgolden_cpp", "libgolden_cpp_change_function_access", 8)
|
"libgolden_cpp", "libgolden_cpp_change_function_access", 8)
|
||||||
|
|||||||
Reference in New Issue
Block a user