📄 pa64-hpux.h
字号:
lot better than the assembler shipped with older versions of hpux. However, it doesn't support weak symbols and is a bad fit with ELF. */#undef NEW_HP_ASSEMBLER#define NEW_HP_ASSEMBLER 1/* It looks like DWARF2 will be the easiest debug format to handle on this platform. */#define DWARF2_DEBUGGING_INFO 1#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG/* This target uses the ELF object file format. */#define OBJECT_FORMAT_ELF#undef ASM_FILE_START#define ASM_FILE_START(FILE) \do { \ if (TARGET_64BIT) \ fputs("\t.LEVEL 2.0w\n", FILE); \ else if (TARGET_PA_20) \ fputs("\t.LEVEL 2.0\n", FILE); \ else if (TARGET_PA_11) \ fputs("\t.LEVEL 1.1\n", FILE); \ else \ fputs("\t.LEVEL 1.0\n", FILE); \ fputs("\t.SPACE $PRIVATE$,SORT=16\n\\t.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31\n\\t.SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82\n\\t.SPACE $TEXT$,SORT=8\n\\t.SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44\n\\t.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY\n", FILE); \ if (profile_flag) \ fprintf (FILE, "\t.IMPORT _mcount, CODE\n"); \ if (write_symbols != NO_DEBUG) \ output_file_directive ((FILE), main_input_filename); \} while (0)#undef TEXT_SECTION_ASM_OP#define TEXT_SECTION_ASM_OP "\t.SUBSPA $CODE$\n"#undef READONLY_DATA_SECTION_ASM_OP#define READONLY_DATA_SECTION_ASM_OP "\t.SUBSPA $LIT$\n"#undef DATA_SECTION_ASM_OP#define DATA_SECTION_ASM_OP "\t.SUBSPA $DATA$\n"#undef BSS_SECTION_ASM_OP#define BSS_SECTION_ASM_OP "\t.SUBSPA $BSS$\n"/* We provide explicit defines for CTORS_SECTION_ASM_OP and DTORS_SECTION_ASM_OP since we don't yet have support for named sections with the HP assembler. */#undef CTORS_SECTION_ASM_OP#define CTORS_SECTION_ASM_OP "\t.SUBSPA \\.ctors,QUAD=1,ALIGN=8,ACCESS=31"#undef DTORS_SECTION_ASM_OP#define DTORS_SECTION_ASM_OP "\t.SUBSPA \\.dtors,QUAD=1,ALIGN=8,ACCESS=31"#define HP_INIT_ARRAY_SECTION_ASM_OP \ "\t.SUBSPA \\.init,QUAD=1,ALIGN=8,ACCESS=31"#define GNU_INIT_ARRAY_SECTION_ASM_OP \ "\t.SUBSPA \\.init_array,QUAD=1,ALIGN=8,ACCESS=31"#define HP_FINI_ARRAY_SECTION_ASM_OP \ "\t.SUBSPA \\.fini,QUAD=1,ALIGN=8,ACCESS=31"#define GNU_FINI_ARRAY_SECTION_ASM_OP \ "\t.SUBSPA \\.fini_array,QUAD=1,ALIGN=8,ACCESS=31"#endif /* USING_ELFOS_H *//* The following defines, used to run constructors and destructors with the SOM linker under HP-UX 11, are not needed. */#undef HAS_INIT_SECTION#undef LD_INIT_SWITCH#undef LD_FINI_SWITCH/* The following STARTFILE_SPEC and ENDFILE_SPEC defines provide the magic needed to run initializers and finalizers. */#undef STARTFILE_SPEC#define STARTFILE_SPEC \ "%{!shared: %{!symbolic: crt0.o%s}} %{static:crtbeginT.o%s} \ %{!static:%{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}}"#undef ENDFILE_SPEC#define ENDFILE_SPEC "%{!shared:crtend.o%s} %{shared:crtendS.o%s}"/* Since HP uses the .init and .fini sections for array initializers and finalizers, we need different defines for INIT_SECTION_ASM_OP and FINI_SECTION_ASM_OP. With the implementation adopted below, the sections are not actually used. However, we still must provide defines to select the proper code path. */#undef INIT_SECTION_ASM_OP#define INIT_SECTION_ASM_OP#undef FINI_SECTION_ASM_OP#define FINI_SECTION_ASM_OP/* We are using array initializers and don't want calls in the INIT and FINI sections. */#undef CRT_CALL_STATIC_FUNCTION#define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC)/* The init_priority attribute is not supported with HP ld. This could be supported if collect2 was used with LD_INIT_SWITCH. Unfortunately, this approach doesn't work with GNU ld since HP-UX doesn't support DT_INIT, and therefore the -init and -fini GNU ld switches. */#undef SUPPORTS_INIT_PRIORITY#define SUPPORTS_INIT_PRIORITY (TARGET_GNU_LD ? 1 : 0)/* We use DTOR_LIST_BEGIN to carry a bunch of hacks to allow us to use the init and fini array sections with both the HP and GNU linkers. The linkers setup the required dynamic entries in the dynamic segment and the dynamic linker does the calls. This approach avoids using collect2. The first hack is to implement __do_global_ctors_aux in crtbegin as it needs to be the first entry in the init array so that it is called last. HP got the order of the init array backwards. The DT_INIT_ARRAY is supposed to be executed in the same order as the addresses appear in the array. DT_FINI_ARRAY is supposed to be executed in the opposite order. The second hack is stubs for __cxa_finalize and _Jv_RegisterClasses. The HP implementation of undefined weak symbols is broken. The linker and dynamic loader both search for undefined weak symbols contrary the generic System V ABI. An undefined weak symbol should resolve to a value of 0 rather than causing an error. The prototypes for __cxa_finalize and _Jv_RegisterClasses in crtstuff.c are weak when weak is supported (GNU as), so in theory a strong define should override the stub functions provided here. The final hack is a set of plabels to implement the effect of CRT_CALL_STATIC_FUNCTION. HP-UX 11 only supports DI_INIT_ARRAY and DT_FINI_ARRAY and they put the arrays in .init and .fini, rather than in .init_array and .fini_array. The standard defines for .init and .fini have the execute flag set. So, the assembler has to be hacked to munge the standard flags for these sections to make them agree with what the HP linker expects. With the GNU linker, we need to used the .init_array and .fini_array sections. So, we set up for both just in case. Once we have built the table, the linker does the rest of the work. The order is significant. Placing __do_global_ctors_aux first in the list, results in it being called last. User specified initializers, either using the linker +init command or a plabel, run before the initializers specified here. *//* We need a __cxa_finalize stub if CRTSTUFFS_O is defined. */#ifdef CRTSTUFFS_O#define PA_CXA_FINALIZE_STUB \extern void __cxa_finalize (void *) TARGET_ATTRIBUTE_WEAK; \void \__cxa_finalize (void *p __attribute__((unused))) {}#else#define PA_CXA_FINALIZE_STUB#endif/* We need a _Jv_RegisterClasses stub if JCR_SECTION_NAME is defined. */#ifdef JCR_SECTION_NAME#define PA_JV_REGISTERCLASSES_STUB \void \_Jv_RegisterClasses (void *p __attribute__((unused))) {}#else#define PA_JV_REGISTERCLASSES_STUB#endif/* We need to add frame_dummy to the initializer list if EH_FRAME_SECTION_NAME or JCR_SECTION_NAME is defined. */#if defined(EH_FRAME_SECTION_NAME) || defined(JCR_SECTION_NAME)#define PA_INIT_FRAME_DUMMY_ASM_OP ".dword P%frame_dummy"#else#define PA_INIT_FRAME_DUMMY_ASM_OP ""#endif#define PA_INIT_FINI_HACK \static void __attribute__((used)) \__do_global_ctors_aux (void) \{ \ func_ptr *p = __CTOR_LIST__; \ while (*(p + 1)) \ p++; \ for (; *p != (func_ptr) -1; p--) \ (*p) (); \} \ \PA_CXA_FINALIZE_STUB \PA_JV_REGISTERCLASSES_STUB \ \asm (HP_INIT_ARRAY_SECTION_ASM_OP); \asm (".dword P%__do_global_ctors_aux"); \asm (PA_INIT_FRAME_DUMMY_ASM_OP); \asm (GNU_INIT_ARRAY_SECTION_ASM_OP); \asm (".dword P%__do_global_ctors_aux"); \asm (PA_INIT_FRAME_DUMMY_ASM_OP); \asm (HP_FINI_ARRAY_SECTION_ASM_OP); \asm (".dword P%__do_global_dtors_aux"); \asm (GNU_FINI_ARRAY_SECTION_ASM_OP); \asm (".dword P%__do_global_dtors_aux")/* The following two variants of DTOR_LIST_BEGIN are identical to those in crtstuff.c except for the addition of the above init-fini hack. */#ifdef DTORS_SECTION_ASM_OP#define DTOR_LIST_BEGIN \asm (DTORS_SECTION_ASM_OP); \STATIC func_ptr __DTOR_LIST__[1] \ __attribute__ ((aligned(sizeof(func_ptr)))) \ = { (func_ptr) (-1) }; \PA_INIT_FINI_HACK#else#define DTOR_LIST_BEGIN \STATIC func_ptr __DTOR_LIST__[1] \ __attribute__ ((section(".dtors"), aligned(sizeof(func_ptr)))) \ = { (func_ptr) (-1) }; \PA_INIT_FINI_HACK#endif/* If using HP ld do not call pxdb. Use size as a program that does nothing and returns 0. /bin/true cannot be used because it is a script without an interpreter. */#define INIT_ENVIRONMENT "LD_PXDB=/usr/ccs/bin/size"/* The HPUX dynamic linker objects to weak symbols with no definitions, so do not use them in gthr-posix.h. */#define GTHREAD_USE_WEAK 0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -