History

Fix environ variable for macos.

herman ten brugge committed 6 years ago

Commit 3c53d541 parent 039e4ec1 file · +7 −2Browse files

Unified · Split

tccrun.c+7−2
@@ -140,6 +140,11 @@ LIBTCCAPI int tcc_run(TCCState *s1, int argc, char **argv) · 139 unmodified lines
140#ifdef CONFIG_TCC_BACKTRACE140#ifdef CONFIG_TCC_BACKTRACE
141 rt_context *rc = &g_rtctxt;141 rt_context *rc = &g_rtctxt;
142#endif142#endif
143# if defined(__APPLE__)
144 char **envp = NULL;
145#else
146 char **envp = environ;
147#endif
143 148
144 s1->runtime_main = s1->nostdlib ? "_start" : "main";149 s1->runtime_main = s1->nostdlib ? "_start" : "main";
145 if ((s1->dflag & 16) && !find_c_sym(s1, s1->runtime_main))150 if ((s1->dflag & 16) && !find_c_sym(s1, s1->runtime_main))
@@ -184,12 +189,12 @@ LIBTCCAPI int tcc_run(TCCState *s1, int argc, char **argv) · 38 unmodified lines
184 fflush(stdout);189 fflush(stdout);
185 fflush(stderr);190 fflush(stderr);
186 /* These aren't C symbols, so don't need leading underscore handling. */191 /* These aren't C symbols, so don't need leading underscore handling. */
187 run_cdtors(s1, "__init_array_start", "__init_array_end", argc, argv, environ);192 run_cdtors(s1, "__init_array_start", "__init_array_end", argc, argv, envp);
188#ifdef CONFIG_TCC_BACKTRACE193#ifdef CONFIG_TCC_BACKTRACE
189 if (!rc->do_jmp || !(ret = setjmp(rc->jmp_buf)))194 if (!rc->do_jmp || !(ret = setjmp(rc->jmp_buf)))
190#endif195#endif
191 {196 {
192 ret = prog_main(argc, argv, environ);197 ret = prog_main(argc, argv, envp);
193 }198 }
194 run_cdtors(s1, "__fini_array_start", "__fini_array_end", 0, NULL, NULL);199 run_cdtors(s1, "__fini_array_start", "__fini_array_end", 0, NULL, NULL);
195 if ((s1->dflag & 16) && ret)200 if ((s1->dflag & 16) && ret)

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