Module Name: src Committed By: mrg Date: Thu Feb 14 10:29:58 UTC 2019
Modified Files: src/external/gpl3/gcc/dist/gcc: output.h varasm.c Log Message: put joerg's varasm.c patch back with additional upstream fixes. now crtbegin.o has a read-only .eh_frame, and libstdc++ builds. 2017-09-01 Joerg Sonnenberger <jo...@bec.de> Jeff Law <l...@redhat.com> * varasm.c (bss_initializer_p): Do not put constants into .bss (categorize_decl_for_section): Handle bss_initializer_p returning false when DECL_INITIAL is NULL. 2017-11-27 Jakub Jelinek <ja...@redhat.com> PR target/83100 * varasm.c (bss_initializer_p): Return true for DECL_COMMON TREE_READONLY decls. 2018-02-09 Jakub Jelinek <ja...@redhat.com> PR middle-end/84237 * output.h (bss_initializer_p): Add NAMED argument, defaulted to false. * varasm.c (bss_initializer_p): Add NAMED argument, if true, ignore TREE_READONLY bit. (get_variable_section): For decls in named .bss* sections pass true as second argument to bss_initializer_p. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/external/gpl3/gcc/dist/gcc/output.h \ src/external/gpl3/gcc/dist/gcc/varasm.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/external/gpl3/gcc/dist/gcc/output.h diff -u src/external/gpl3/gcc/dist/gcc/output.h:1.7 src/external/gpl3/gcc/dist/gcc/output.h:1.8 --- src/external/gpl3/gcc/dist/gcc/output.h:1.7 Sat Jan 19 12:10:04 2019 +++ src/external/gpl3/gcc/dist/gcc/output.h Thu Feb 14 10:29:58 2019 @@ -556,7 +556,7 @@ extern void output_file_directive (FILE extern unsigned int default_section_type_flags (tree, const char *, int); extern bool have_global_bss_p (void); -extern bool bss_initializer_p (const_tree); +extern bool bss_initializer_p (const_tree, bool = false); extern void default_no_named_section (const char *, unsigned int, tree); extern void default_elf_asm_named_section (const char *, unsigned int, tree); Index: src/external/gpl3/gcc/dist/gcc/varasm.c diff -u src/external/gpl3/gcc/dist/gcc/varasm.c:1.7 src/external/gpl3/gcc/dist/gcc/varasm.c:1.8 --- src/external/gpl3/gcc/dist/gcc/varasm.c:1.7 Thu Jan 31 08:53:07 2019 +++ src/external/gpl3/gcc/dist/gcc/varasm.c Thu Feb 14 10:29:58 2019 @@ -972,18 +972,18 @@ decode_reg_name (const char *name) /* Return true if DECL's initializer is suitable for a BSS section. */ bool -bss_initializer_p (const_tree decl) +bss_initializer_p (const_tree decl, bool named) { - return (DECL_INITIAL (decl) == NULL - /* In LTO we have no errors in program; error_mark_node is used - to mark offlined constructors. */ - || (DECL_INITIAL (decl) == error_mark_node - && !in_lto_p) - || (flag_zero_initialized_in_bss - /* Leave constant zeroes in .rodata so they - can be shared. */ - && !TREE_READONLY (decl) - && initializer_zerop (DECL_INITIAL (decl)))); + /* Do not put non-common constants into the .bss section, they belong in + a readonly section, except when NAMED is true. */ + return ((!TREE_READONLY (decl) || DECL_COMMON (decl) || named) + && (DECL_INITIAL (decl) == NULL + /* In LTO we have no errors in program; error_mark_node is used + to mark offlined constructors. */ + || (DECL_INITIAL (decl) == error_mark_node + && !in_lto_p) + || (flag_zero_initialized_in_bss + && initializer_zerop (DECL_INITIAL (decl))))); } /* Compute the alignment of variable specified by DECL. @@ -1154,7 +1154,8 @@ get_variable_section (tree decl, bool pr { section *sect = get_named_section (decl, NULL, reloc); - if ((sect->common.flags & SECTION_BSS) && !bss_initializer_p (decl)) + if ((sect->common.flags & SECTION_BSS) + && !bss_initializer_p (decl, true)) { error_at (DECL_SOURCE_LOCATION (decl), "only zero initializers are allowed in section %qs", @@ -6465,7 +6466,8 @@ categorize_decl_for_section (const_tree ret = SECCAT_BSS; else if (! TREE_READONLY (decl) || TREE_SIDE_EFFECTS (decl) - || ! TREE_CONSTANT (DECL_INITIAL (decl))) + || (DECL_INITIAL (decl) + && ! TREE_CONSTANT (DECL_INITIAL (decl)))) { /* Here the reloc_rw_mask is not testing whether the section should be read-only or not, but whether the dynamic link will have to @@ -6485,7 +6487,8 @@ categorize_decl_for_section (const_tree location. -fmerge-all-constants allows even that (at the expense of not conforming). */ ret = SECCAT_RODATA; - else if (TREE_CODE (DECL_INITIAL (decl)) == STRING_CST) + else if (DECL_INITIAL (decl) + && TREE_CODE (DECL_INITIAL (decl)) == STRING_CST) ret = SECCAT_RODATA_MERGE_STR_INIT; else ret = SECCAT_RODATA_MERGE_CONST;