sysdep.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /* Copyright (C) 1994-2026 Free Software Foundation, Inc.
  2. This file is part of the GNU C Library.
  3. The GNU C Library is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU Lesser General Public
  5. License as published by the Free Software Foundation; either
  6. version 2.1 of the License, or (at your option) any later version.
  7. The GNU C Library is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10. Lesser General Public License for more details.
  11. You should have received a copy of the GNU Lesser General Public
  12. License along with the GNU C Library; if not, see
  13. <https://www.gnu.org/licenses/>. */
  14. #ifdef __ASSEMBLER__
  15. /* Get the Mach definitions of ENTRY and kernel_trap. */
  16. #include <mach/machine/syscall_sw.h>
  17. /* This macro is defined in Mach system headers, but string functions use it
  18. with different definitions depending on whether being compiled for
  19. wide-characters or not. */
  20. #undef P2ALIGN
  21. /* The Mach definitions assume underscores should be prepended to
  22. symbol names. Redefine them to do so only when appropriate. */
  23. #undef EXT
  24. #undef LEXT
  25. #define EXT(x) C_SYMBOL_NAME(x)
  26. #define LEXT(x) C_SYMBOL_NAME(x##:)
  27. /* For ELF we need to add the `.type' directive to make shared libraries
  28. work right. */
  29. #undef ENTRY
  30. #undef ENTRY2
  31. #define ENTRY(name) \
  32. .globl name; \
  33. .align ALIGN; \
  34. .type name,@function; \
  35. name:
  36. #endif
  37. /* This is invoked by things run when there is random lossage, before they
  38. try to do anything else. Just to be safe, deallocate the reply port so
  39. bogons arriving on it don't foul up future RPCs. */
  40. #ifndef __ASSEMBLER__
  41. #define FATAL_PREPARE_INCLUDE <mach/mig_support.h>
  42. #define FATAL_PREPARE __mig_dealloc_reply_port (__mig_get_reply_port ())
  43. #endif
  44. /* sysdeps/mach/MACHINE/sysdep.h should define the following macros. */
  45. /* Produce a text assembler label for the C global symbol NAME. */
  46. #ifndef ENTRY
  47. #define ENTRY(name) .error ENTRY not defined by sysdeps/mach/MACHINE/sysdep.h
  48. /* This is not used on all machines. */
  49. #endif
  50. /* LOSE can be defined as the `halt' instruction or something
  51. similar which will cause the process to die in a characteristic
  52. way suggesting a bug. */
  53. #ifndef LOSE
  54. #define LOSE ({ volatile int zero = 0; zero / zero; })
  55. #endif
  56. /* One of these should be defined to specify the stack direction. */
  57. #if !defined (STACK_GROWTH_UP) && !defined (STACK_GROWTH_DOWN)
  58. #error stack direction unspecified
  59. #endif
  60. /* Used by some assembly code. */
  61. #define C_SYMBOL_NAME(name) name