1 /* 2 * Copyright (C) 2017 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 #include <elf.h> 18 19 #include <gtest/gtest.h> 20 21 // https://github.com/android-ndk/ndk/issues/377 TEST(elf,have_ELF_ST_INFO_macros)22 TEST(elf, have_ELF_ST_INFO_macros) { 23 uint8_t info; 24 25 // 0x0f 26 info = ELF32_ST_INFO(STB_LOCAL, STT_HIPROC); 27 ASSERT_EQ(STB_LOCAL, ELF32_ST_BIND(info)); 28 ASSERT_EQ(STT_HIPROC, ELF32_ST_TYPE(info)); 29 30 // 0x0f 31 info = ELF64_ST_INFO(STB_LOCAL, STT_HIPROC); 32 ASSERT_EQ(STB_LOCAL, ELF64_ST_BIND(info)); 33 ASSERT_EQ(STT_HIPROC, ELF64_ST_TYPE(info)); 34 35 // 0xf0 36 info = ELF32_ST_INFO(STB_LOCAL, STT_HIPROC); 37 ASSERT_EQ(STB_LOCAL, ELF32_ST_BIND(info)); 38 ASSERT_EQ(STT_HIPROC, ELF32_ST_TYPE(info)); 39 40 // 0xf0 41 info = ELF64_ST_INFO(STB_LOCAL, STT_HIPROC); 42 ASSERT_EQ(STB_LOCAL, ELF64_ST_BIND(info)); 43 ASSERT_EQ(STT_HIPROC, ELF64_ST_TYPE(info)); 44 } 45