Message ID | CAPrih1kNpjE1ZeyRq3QA+iDsLvbLYfojFqqdETDWd72zUsUKkA@mail.gmail.com |
---|---|
State | New |
Headers | show |
Hi, The following patch substantially reduces the memory requirements of GCC compiled C++ programs on AIX. Currently there are two different pieces of code to decide if a read-only or a read-write section is required for exception information: - If the target supports named sections, there is good logic which considers the dwarf encoding types, flag_pic and also has a target hook for override. - If the target doesn't support named sections, the only consideration is flag_pic. The key part of this patch is removing the second sub-optimal code and using the optimal logic on all targets. I understand David has approved the target specifics, and this just needs a review for the dwarf changes. I believe I have CCed the dwarf maintainers on this email. https://gcc.gnu.org/ml/gcc-patches/2014-09/msg01897.html Thanks, Andrew
On 09/22/2014 09:06 PM, Andrew Dixie wrote: > - || ((fde_encoding & 0x70) != DW_EH_PE_absptr > - && (fde_encoding & 0x70) != DW_EH_PE_aligned > - && (per_encoding & 0x70) != DW_EH_PE_absptr > - && (per_encoding & 0x70) != DW_EH_PE_aligned > - && (lsda_encoding & 0x70) != DW_EH_PE_absptr > - && (lsda_encoding & 0x70) != DW_EH_PE_aligned)) > - ? 0 : SECTION_WRITE); > + || ((fde_encoding & 0x70) != DW_EH_PE_absptr > + && (fde_encoding & 0x70) != DW_EH_PE_aligned > + && (per_encoding & 0x70) != DW_EH_PE_absptr > + && (per_encoding & 0x70) != DW_EH_PE_aligned > + && (lsda_encoding & 0x70) != DW_EH_PE_absptr > + && (lsda_encoding & 0x70) != DW_EH_PE_aligned)) > + ? 0 : SECTION_WRITE); Please don't change whitespace on lines unrelated to your change. OK with that removed. Jason
diff -rupN orig/gcc-4.10-20140706/gcc/except.c gcc-4.10-20140706/gcc/except.c --- orig/gcc-4.10-20140706/gcc/except.c 2014-07-01 07:30:52.000000000 +1200 +++ gcc-4.10-20140706/gcc/except.c 2014-09-19 21:24:57.668816306 +1200 @@ -2851,24 +2851,24 @@ switch_to_exception_section (const char s = exception_section; else { - /* Compute the section and cache it into exception_section, - unless it depends on the function name. */ - if (targetm_common.have_named_sections) - { - int flags; + int flags; - if (EH_TABLES_CAN_BE_READ_ONLY) - { - int tt_format = - ASM_PREFERRED_EH_DATA_FORMAT (/*code=*/0, /*global=*/1); - flags = ((! flag_pic + if (EH_TABLES_CAN_BE_READ_ONLY) + { + int tt_format = + ASM_PREFERRED_EH_DATA_FORMAT (/*code=*/0, /*global=*/1); + flags = ((! flag_pic || ((tt_format & 0x70) != DW_EH_PE_absptr && (tt_format & 0x70) != DW_EH_PE_aligned)) ? 0 : SECTION_WRITE); - } - else - flags = SECTION_WRITE; + } + else + flags = SECTION_WRITE; + /* Compute the section and cache it into exception_section, + unless it depends on the function name. */ + if (targetm_common.have_named_sections) + { #ifdef HAVE_LD_EH_GC_SECTIONS if (flag_function_sections || (DECL_COMDAT_GROUP (current_function_decl) && HAVE_COMDAT_GROUP)) @@ -2889,7 +2889,7 @@ switch_to_exception_section (const char } else exception_section - = s = flag_pic ? data_section : readonly_data_section; + = s = flags == SECTION_WRITE ? data_section : readonly_data_section; } switch_to_section (s); diff -rupN orig/gcc-4.10-20140706/gcc/system.h gcc-4.10-20140706/gcc/system.h --- orig/gcc-4.10-20140706/gcc/system.h 2014-06-12 04:59:01.000000000 +1200 +++ gcc-4.10-20140706/gcc/system.h 2014-09-20 03:58:33.417938836 +1200 @@ -933,7 +933,8 @@ extern void fancy_abort (const char *, i CONST_DOUBLE_OK_FOR_LETTER_P EXTRA_CONSTRAINT \ REG_CLASS_FROM_CONSTRAINT REG_CLASS_FOR_CONSTRAINT \ EXTRA_CONSTRAINT_STR EXTRA_MEMORY_CONSTRAINT \ - EXTRA_ADDRESS_CONSTRAINT CONST_DOUBLE_OK_FOR_CONSTRAINT_P + EXTRA_ADDRESS_CONSTRAINT CONST_DOUBLE_OK_FOR_CONSTRAINT_P \ + EH_FRAME_IN_DATA_SECTION /* Hooks that are no longer used. */ #pragma GCC poison LANG_HOOKS_FUNCTION_MARK LANG_HOOKS_FUNCTION_FREE \