-fdata-sections stopped working
Andreas Schwab
schwab@suse.de
Mon May 13 07:00:00 GMT 2002
This patch makes -ffunction-sections and -fdata-sections work again as
intented, after being broken since 2001-08-03. Tested on ia64-suse-linux.
Andreas.
2002-05-13 Andreas Schwab <schwab@suse.de>
* varasm.c (resolve_unique_section): Add third parameter
flag_function_or_data_sections and use it instead of
flag_function_sections.
(assemble_start_function): Pass flag_function_sections.
(asm_emit_uninitialised): Pass flag_data_sections.
(assemble_variable): Likewise.
--- gcc/varasm.c.~1.250.2.10.~ 2002-05-10 10:04:13.000000000 +0200
+++ gcc/varasm.c 2002-05-13 15:04:28.000000000 +0200
@@ -186,7 +186,7 @@ static hashval_t const_str_htab_hash PAR
static int const_str_htab_eq PARAMS ((const void *x, const void *y));
static void const_str_htab_del PARAMS ((void *));
static void asm_emit_uninitialised PARAMS ((tree, const char*, int, int));
-static void resolve_unique_section PARAMS ((tree, int));
+static void resolve_unique_section PARAMS ((tree, int, int));
static void mark_weak PARAMS ((tree));
static enum in_section { no_section, in_text, in_data, in_named
@@ -461,12 +461,13 @@ named_section (decl, name, reloc)
/* If required, set DECL_SECTION_NAME to a unique name. */
static void
-resolve_unique_section (decl, reloc)
+resolve_unique_section (decl, reloc, flag_function_or_data_sections)
tree decl;
int reloc ATTRIBUTE_UNUSED;
+ int flag_function_or_data_sections;
{
if (DECL_SECTION_NAME (decl) == NULL_TREE
- && (flag_function_sections
+ && (flag_function_or_data_sections
|| (targetm.have_named_sections
&& DECL_ONE_ONLY (decl))))
UNIQUE_SECTION (decl, reloc);
@@ -1188,7 +1189,7 @@ assemble_start_function (decl, fnname)
if (CONSTANT_POOL_BEFORE_FUNCTION)
output_constant_pool (fnname, decl);
- resolve_unique_section (decl, 0);
+ resolve_unique_section (decl, 0, flag_function_sections);
function_section (decl);
/* Tell assembler to move to target machine's alignment for functions. */
@@ -1397,7 +1398,7 @@ asm_emit_uninitialised (decl, name, size
if (destination == asm_dest_bss)
globalize_decl (decl);
- resolve_unique_section (decl, 0);
+ resolve_unique_section (decl, 0, flag_data_sections);
if (flag_shared_data)
{
@@ -1642,7 +1643,7 @@ assemble_variable (decl, top_level, at_e
reloc = output_addressed_constants (DECL_INITIAL (decl));
/* Switch to the appropriate section. */
- resolve_unique_section (decl, reloc);
+ resolve_unique_section (decl, reloc, flag_data_sections);
variable_section (decl, reloc);
/* dbxout.c needs to know this. */
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE GmbH, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
More information about the Gcc-patches
mailing list