Bug 104189
Summary: | Problem with -fstack-limit-symbol | ||
---|---|---|---|
Product: | [Retired] Red Hat Linux | Reporter: | Sanjay Gupta <sgupta> |
Component: | gcc | Assignee: | Jakub Jelinek <jakub> |
Status: | CLOSED RAWHIDE | QA Contact: | Brian Brock <bbrock> |
Severity: | medium | Docs Contact: | |
Priority: | medium | ||
Version: | 8.0 | ||
Target Milestone: | --- | ||
Target Release: | --- | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Fixed In Version: | 3.2.3-20 | Doc Type: | Bug Fix |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2003-09-17 22:24:28 UTC | Type: | --- |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
Sanjay Gupta
2003-09-11 00:52:13 UTC
The problem is that for -fstack-limit-{register,symbol} ggc_strdup is used before GGC is initialized (and stringpool as well). In GCC 3.3 and later, GGC/stringpool are initialized much earlier, so this is not a problem. But note that you're using the option incorrectly, see info gcc. You need to give it a symbol name, not an integer constant. It may work by luck on some arches, but certainly will not work on other arches. 2003-09-11 Jakub Jelinek <jakub> * toplev.c (stack_limit_reg, stack_limit_symbol): New. (decode_f_option): Don't set stack_limit_rtx here, set stack_limit_{reg,symbol} instead. (lang_independent_init): Set stack_limit_rtx here. --- gcc/toplev.c.jj 2003-07-29 10:27:56.000000000 -0400 +++ gcc/toplev.c 2003-09-11 12:14:09.000000000 -0400 @@ -831,6 +831,9 @@ int flag_stack_check; the support provided depends on the backend. */ rtx stack_limit_rtx; +int stack_limit_reg = -1; +const char *stack_limit_symbol; + /* 0 if pointer arguments may alias each other. True in C. 1 if pointer arguments may not alias each other but may alias global variables. @@ -3977,14 +3980,13 @@ decode_f_option (arg) if (reg < 0) error ("unrecognized register name `%s'", option_value); else - stack_limit_rtx = gen_rtx_REG (Pmode, reg); + stack_limit_reg = reg; } else if ((option_value = skip_leading_substring (arg, "stack-limit-symbol="))) { - const char *nm; - nm = ggc_strdup (option_value); - stack_limit_rtx = gen_rtx_SYMBOL_REF (Pmode, nm); + stack_limit_symbol = xstrdup (option_value); + stack_limit_reg = -2; } else if ((option_value = skip_leading_substring (arg, "message-length="))) @@ -4003,7 +4005,7 @@ decode_f_option (arg) error ("unrecognized option `%s'", arg - 2); } else if (!strcmp (arg, "no-stack-limit")) - stack_limit_rtx = NULL_RTX; + stack_limit_reg = -1; else if (!strcmp (arg, "preprocessed")) /* Recognise this switch but do nothing. This prevents warnings about an unrecognized switch if cpplib has not been linked in. */ @@ -5118,6 +5120,14 @@ lang_independent_init () init_stringpool (); init_obstacks (); + if (stack_limit_reg == -2) + { + const char *nm = ggc_strdup (stack_limit_symbol); + stack_limit_rtx = gen_rtx_SYMBOL_REF (Pmode, nm); + } + else if (stack_limit_reg >= 0) + stack_limit_rtx = gen_rtx_REG (Pmode, stack_limit_reg); + /* init_emit_once uses reg_raw_mode and therefore must be called after init_regs which initialized reg_raw_mode. */ init_regs (); |