History

Add support for -dumpmachine option.

Better compatibility with some build systems assuming gcc.

Reimar Döffinger committed 3 years ago

Commit 32ac2361 parent 7a530291 file · +36 −0Browse files

Unified · Split

libtcc.c+36−0
@@ -1582,6 +1582,7 @@ enum { · 1581 unmodified lines
1582 TCC_OPTION_ba,1582 TCC_OPTION_ba,
1583 TCC_OPTION_g,1583 TCC_OPTION_g,
1584 TCC_OPTION_c,1584 TCC_OPTION_c,
1585 TCC_OPTION_dumpmachine,
1585 TCC_OPTION_dumpversion,1586 TCC_OPTION_dumpversion,
1586 TCC_OPTION_d,1587 TCC_OPTION_d,
1587 TCC_OPTION_static,1588 TCC_OPTION_static,
@@ -1659,6 +1660,7 @@ static const TCCOption tcc_options[] = { · 71 unmodified lines
1659#ifdef TCC_TARGET_MACHO1660#ifdef TCC_TARGET_MACHO
1660 { "dynamiclib", TCC_OPTION_dynamiclib, 0 },1661 { "dynamiclib", TCC_OPTION_dynamiclib, 0 },
1661#endif1662#endif
1663 { "dumpmachine", TCC_OPTION_dumpmachine, 0},
1662 { "dumpversion", TCC_OPTION_dumpversion, 0},1664 { "dumpversion", TCC_OPTION_dumpversion, 0},
1663 { "d", TCC_OPTION_d, TCC_OPTION_HAS_ARG | TCC_OPTION_NOSEP },1665 { "d", TCC_OPTION_d, TCC_OPTION_HAS_ARG | TCC_OPTION_NOSEP },
1664 { "static", TCC_OPTION_static, 0 },1666 { "static", TCC_OPTION_static, 0 },
@@ -2138,6 +2140,40 @@ dorun: · 473 unmodified lines
2138 case TCC_OPTION_MP:2140 case TCC_OPTION_MP:
2139 s->gen_phony_deps = 1;2141 s->gen_phony_deps = 1;
2140 break;2142 break;
2143 case TCC_OPTION_dumpmachine:
2144 /* this is a best guess, please refine as necessary */
2145 printf("%s",
2146#ifdef TCC_TARGET_I386
2147 "i386-pc"
2148#elif defined TCC_TARGET_X86_64
2149 "x86_64-pc"
2150#elif defined TCC_TARGET_C67
2151 "c67"
2152#elif defined TCC_TARGET_ARM
2153 "arm"
2154#elif defined TCC_TARGET_ARM64
2155 "aarch64"
2156#elif defined TCC_TARGET_RISCV64
2157 "riscv64"
2158#endif
2159 "-"
2160#ifdef TCC_TARGET_PE
2161 "mingw32"
2162#elif defined(TCC_TARGET_MACHO)
2163 "apple-darwin"
2164#elif TARGETOS_FreeBSD || TARGETOS_FreeBSD_kernel
2165 "freebsd"
2166#elif TARGETOS_OpenBSD
2167 "openbsd"
2168#elif TARGETOS_NetBSD
2169 "netbsd"
2170#else
2171 "linux-gnu"
2172#endif
2173 "\n"
2174 );
2175 exit(0);
2176 break;
2141 case TCC_OPTION_dumpversion:2177 case TCC_OPTION_dumpversion:
2142 printf ("%s\n", TCC_VERSION);2178 printf ("%s\n", TCC_VERSION);
2143 exit(0);2179 exit(0);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t