This repository has been archived by the owner on Jun 24, 2022. It is now read-only.
forked from EddyPronk/gub
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable compiling librestrict on macOS.
librestrict (source in the top-level directory of GUB) uses C aliases. Darwin (the underlying operating system that macOS is built on) does not support aliases, thus librestrict can not currently be compiled on macOS. This commit defines a 'safe_alias' macro that smooths over this missing feature by providing the current behavion on non-darwin systems and providing a workaround on darwin systems. The macro is defined in the 'alias.h' file inside the librestrict directory.
- Loading branch information
Showing
4 changed files
with
30 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/** | ||
* alias.h | ||
* | ||
* Darwin does not support alias attributes. | ||
* This header defines a 'safe' (i.e., platform-agnostic) way to create aliases. | ||
*/ | ||
|
||
/* Create a safe alias for NAME accessible via ALIASNAME. */ | ||
#define safe_alias(name, aliasname) _safe_alias(name, aliasname) | ||
|
||
/* Darwin does not support alias attributes. */ | ||
#ifndef __APPLE__ | ||
#define _safe_alias(name, aliasname) \ | ||
extern __typeof (name) aliasname __attribute__ ((alias (#name))) | ||
#else | ||
#define _safe_alias(name, aliasname) \ | ||
__asm__(".globl _" #aliasname); \ | ||
__asm__(".set _" #aliasname ", _" #name); \ | ||
extern __typeof(name) aliasname | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters