dl_preempt_library_2.cpp revision d225a5e65223b375a63548c4b780f04d8f3d7b60
1/* 2 * Copyright (C) 2014 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17// This one should be preempted by the function 18// defined in libdl_preempt_test_1.so 19extern "C" int __attribute__((weak)) lib_global_default_serial() { 20 return 2716057; 21} 22 23// Even though this one is defined by 24// libdl_preempt_test_1.so it should not be 25// preempted because of protected visibility 26extern "C" int __attribute__((weak,visibility("protected"))) lib_global_protected_serial() { 27 return 3370318; 28} 29 30extern "C" int lib_global_default_get_serial() { 31 return lib_global_default_serial(); 32} 33 34extern "C" int lib_global_protected_get_serial() { 35 return lib_global_protected_serial(); 36} 37 38