Skip to content

Instantly share code, notes, and snippets.

@jperkin
Created July 3, 2014 15:00
Show Gist options
  • Save jperkin/e40dd387b531a2aedb89 to your computer and use it in GitHub Desktop.
Save jperkin/e40dd387b531a2aedb89 to your computer and use it in GitHub Desktop.
gcc abi env var
$NetBSD$
--- gcc/common/config/i386/i386-common.c.orig 2011-12-22 14:39:35.000000000 +0000
+++ gcc/common/config/i386/i386-common.c
@@ -160,6 +160,18 @@ ix86_handle_option (struct gcc_options *
{
size_t code = decoded->opt_index;
int value = decoded->value;
+ const char *abi;
+
+ /* ABI environment variable takes precedence. */
+ if ((abi = getenv("ABI")) != NULL) {
+ if (strcmp(abi, "32") == 0 || strcmp(abi, "i86") == 0) {
+ opts->x_ix86_isa_flags &= ~OPTION_MASK_ISA_64BIT;
+ opts->x_ix86_isa_flags_explicit &= ~OPTION_MASK_ISA_64BIT;
+ } else if (strcmp(abi, "64") == 0 || strcmp(abi, "amd64") == 0) {
+ opts->x_ix86_isa_flags |= OPTION_MASK_ISA_64BIT;
+ opts->x_ix86_isa_flags_explicit |= OPTION_MASK_ISA_64BIT;
+ }
+ }
switch (code)
{
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment