Merge "header-abi-diff: Fix return code for extension in presence of elf only changes."

am: 0aeced009b

Change-Id: Id2606798507e443cde89073479f0c1a57290b6f2
This commit is contained in:
Jayant Chowdhary
2018-05-24 07:28:21 -07:00
committed by android-build-merger
5 changed files with 51 additions and 5 deletions

View File

@@ -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;
} }

View File

@@ -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

View File

@@ -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
};

View File

@@ -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',

View File

@@ -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)