| 1 |
/* Definitions for PA_RISC with ELF-32 format |
| 2 |
Copyright (C) 2000-2025 Free Software Foundation, Inc. |
| 3 |
|
| 4 |
This file is part of GCC. |
| 5 |
|
| 6 |
GCC is free software; you can redistribute it and/or modify |
| 7 |
it under the terms of the GNU General Public License as published by |
| 8 |
the Free Software Foundation; either version 3, or (at your option) |
| 9 |
any later version. |
| 10 |
|
| 11 |
GCC is distributed in the hope that it will be useful, |
| 12 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 |
GNU General Public License for more details. |
| 15 |
|
| 16 |
You should have received a copy of the GNU General Public License |
| 17 |
along with GCC; see the file COPYING3. If not see |
| 18 |
<http://www.gnu.org/licenses/>. */ |
| 19 |
|
| 20 |
/* Turn off various SOM crap we don't want. */ |
| 21 |
#undef TARGET_ELF32 |
| 22 |
#define TARGET_ELF32 1 |
| 23 |
|
| 24 |
/* The libcall __canonicalize_funcptr_for_compare is referenced in |
| 25 |
crtend.o and the reference isn't resolved in objects that don't |
| 26 |
compare function pointers. Thus, we need to play games to provide |
| 27 |
a reference in crtbegin.o. The rest of the define is the same |
| 28 |
as that in crtstuff.c */ |
| 29 |
#define CTOR_LIST_BEGIN \ |
| 30 |
asm (".type __canonicalize_funcptr_for_compare,@function\n" \ |
| 31 |
" .text\n" \ |
| 32 |
" .word __canonicalize_funcptr_for_compare-$PIC_pcrel$0"); \ |
| 33 |
STATIC func_ptr __CTOR_LIST__[1] \ |
| 34 |
__attribute__ ((__used__, section(".ctors"), \ |
| 35 |
aligned(sizeof(func_ptr)))) \ |
| 36 |
= { (func_ptr) (-1) } |
| 37 |
|
| 38 |
/* This is a PIC version of CRT_CALL_STATIC_FUNCTION. The PIC |
| 39 |
register has to be saved before the call and restored after |
| 40 |
the call. We assume that register %r4 is available for this |
| 41 |
purpose. The hack prevents GCC from deleting the restore. */ |
| 42 |
#ifdef CRTSTUFFS_O |
| 43 |
#define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC) \ |
| 44 |
static void __attribute__((__used__)) \ |
| 45 |
call_ ## FUNC (void) \ |
| 46 |
{ \ |
| 47 |
asm (SECTION_OP); \ |
| 48 |
asm volatile ("bl " #FUNC ",%%r2\n\t" \ |
| 49 |
"copy %%r19,%%r4\n\t" \ |
| 50 |
"copy %%r4,%%r19\n" \ |
| 51 |
: \ |
| 52 |
: \ |
| 53 |
: "r1", "r2", "r4", "r20", "r21", \ |
| 54 |
"r22", "r23", "r24", "r25", "r26", \ |
| 55 |
"r27", "r28", "r29", "r31"); \ |
| 56 |
asm (TEXT_SECTION_ASM_OP); \ |
| 57 |
} |
| 58 |
#endif |
| 59 |
|
| 60 |
/* We need to link against libgcc.a for __canonicalize_funcptr_for_compare |
| 61 |
and $$dyncall. */ |
| 62 |
#undef ENDFILE_SPEC |
| 63 |
#define ENDFILE_SPEC GNU_USER_TARGET_ENDFILE_SPEC "libgcc.a%s" |
| 64 |
|
| 65 |
#undef WCHAR_TYPE |
| 66 |
#define WCHAR_TYPE "long int" |
| 67 |
|
| 68 |
#undef WCHAR_TYPE_SIZE |
| 69 |
#define WCHAR_TYPE_SIZE BITS_PER_WORD |
| 70 |
|
| 71 |
/* POSIX types such as pthread_mutex_t require 16-byte alignment to retain |
| 72 |
layout compatibility with the original linux thread implementation. */ |
| 73 |
#undef MALLOC_ABI_ALIGNMENT |
| 74 |
#define MALLOC_ABI_ALIGNMENT 128 |
| 75 |
|
| 76 |
/* Place jump tables in the text section except when generating non-PIC |
| 77 |
code. When generating non-PIC code, the relocations needed to load the |
| 78 |
address of the jump table result in a text label in the final executable |
| 79 |
if the jump table is placed in the text section. This breaks the unwind |
| 80 |
data for the function. Thus, the jump table needs to be placed in |
| 81 |
rodata when generating non-PIC code. */ |
| 82 |
#undef JUMP_TABLES_IN_TEXT_SECTION |
| 83 |
#define JUMP_TABLES_IN_TEXT_SECTION (flag_pic) |
| 84 |
|
| 85 |
/* We need to override default selection to put references to functions |
| 86 |
in COMDAT groups in .data.rel.ro.local. */ |
| 87 |
#undef TARGET_ASM_SELECT_RTX_SECTION |
| 88 |
#define TARGET_ASM_SELECT_RTX_SECTION pa_elf_select_rtx_section |