1 /* 2 * Copyright (C) 2025 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 #ifndef _ADLT_TEST_RELOCS_H_ 16 #define _ADLT_TEST_RELOCS_H_ 17 18 extern "C" { 19 // Dynamic relocations 20 int relative_test(void); // R_AARCH64_RELATIVE 21 int glob_dat_test(void); // R_AARCH64_GLOB_DAT 22 int jump_slot_test(void); // R_AARCH64_JUMP_SLOT 23 24 // ABS relocations 25 int abs64_test(void); // R_AARCH64_ABS64 26 27 // PLT relocations 28 int jump26_test(void); // R_AARCH64_JUMP26 29 int call26_test(void); // R_AARCH64_CALL26 30 int condbr19_test(void); // R_AARCH64_CONDBR19 31 int tstbr14_test(void); // R_AARCH64_TSTBR14 32 33 // GOT relocations 34 // R_AARCH64_ADR_GOT_PAGE and R_AARCH64_LD64_GOT_LO12_NC 35 int ld64_got_lo12_nc_test(void); 36 // R_AARCH64_ADR_GOT_PAGE and R_AARCH64_LD64_GOTPAGE_LO15 37 int ld64_gotpage_lo15_test(void); 38 39 // Relocations to generate 19, 21 and 33 bit PC-relative addresses 40 // R_AARCH64_ADD_ABS_LO12_NC and R_AARCH64_ADR_PREL_PG_HI21 41 int adr_prel_pg_hi21_test(void); 42 // R_AARCH64_ADD_ABS_LO12_NC and R_AARCH64_ADR_PREL_PG_HI21_NC 43 int adr_prel_pg_hi21_nc_test(void); 44 // R_AARCH64_ADR_PREL_LO21 45 int adr_prel_lo21_test(void); 46 // R_AARCH64_LD_PREL_LO19 47 int ld_prel_lo19_test(void); 48 49 // Null relocations 50 int none_test(void); // R_AARCH64_NONE 51 52 // TLS descriptor relocations 53 // R_AARCH64_TLSDESC, R_AARCH64_TLSDESC_ADR_PAGE21, R_AARCH64_TLSDESC_LD64_LO12, 54 // R_AARCH64_TLSDESC_ADD_LO12 and R_AARCH64_TLSDESC_CALL 55 int tlsdesc_test(void); 56 57 // TLS dynamic relocations 58 int tls_tprel64_test(void); // R_AARCH64_TLS_TPREL64 59 60 // TLS relocations init exec TLSIE 61 // R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21 and R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC 62 int tlsie_adr_ld64_test(void); 63 } 64 #endif 65