diff options
| author | danglin <danglin@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-08-23 15:57:57 +0000 |
|---|---|---|
| committer | danglin <danglin@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-08-23 15:57:57 +0000 |
| commit | 022f8f1ec8559e42497134cb77d4a49da526564f (patch) | |
| tree | 0a302c5c90b04b3c8849d776996bbf60b3030842 | |
| parent | a245a1076d5a1cfd7710ff1767f6cdcbd08e00fd (diff) | |
| download | ppe42-gcc-022f8f1ec8559e42497134cb77d4a49da526564f.tar.gz ppe42-gcc-022f8f1ec8559e42497134cb77d4a49da526564f.zip | |
PR target/62038
* config/pa/pa.c (pa_output_function_epilogue): Don't set
last_address when the current function is a thunk.
(pa_asm_output_mi_thunk): When we don't have named sections or they
are not being used, check that thunk can reach the stub table with a
short branch.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_9-branch@214398 138bc75d-0d04-0410-961f-82ee72b054a4
| -rw-r--r-- | gcc/ChangeLog | 9 | ||||
| -rw-r--r-- | gcc/config/pa/pa.c | 18 |
2 files changed, 21 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f7b4be9d893..99fc06c19fa 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2014-08-23 John David Anglin <danglin@gcc.gnu.org> + + PR target/62038 + * config/pa/pa.c (pa_output_function_epilogue): Don't set + last_address when the current function is a thunk. + (pa_asm_output_mi_thunk): When we don't have named sections or they + are not being used, check that thunk can reach the stub table with a + short branch. + 2014-08-22 Michael Meissner <meissner@linux.vnet.ibm.com> Backport fro mainline diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c index cf82cd32634..5a7598ca7cf 100644 --- a/gcc/config/pa/pa.c +++ b/gcc/config/pa/pa.c @@ -4155,8 +4155,7 @@ static void pa_output_function_epilogue (FILE *file, HOST_WIDE_INT size ATTRIBUTE_UNUSED) { rtx insn = get_last_insn (); - - last_address = 0; + bool extra_nop; /* pa_expand_epilogue does the dirty work now. We just need to output the assembler directives which denote the end @@ -4180,8 +4179,10 @@ pa_output_function_epilogue (FILE *file, HOST_WIDE_INT size ATTRIBUTE_UNUSED) if (insn && CALL_P (insn)) { fputs ("\tnop\n", file); - last_address += 4; + extra_nop = true; } + else + extra_nop = false; fputs ("\t.EXIT\n\t.PROCEND\n", file); @@ -4194,12 +4195,13 @@ pa_output_function_epilogue (FILE *file, HOST_WIDE_INT size ATTRIBUTE_UNUSED) cfun->machine->in_nsubspa = 2; } - /* Thunks do their own accounting. */ + /* Thunks do their own insn accounting. */ if (cfun->is_thunk) return; if (INSN_ADDRESSES_SET_P ()) { + last_address = extra_nop ? 4 : 0; insn = get_last_nonnote_insn (); last_address += INSN_ADDRESSES (INSN_UID (insn)); if (INSN_P (insn)) @@ -8293,12 +8295,16 @@ pa_asm_output_mi_thunk (FILE *file, tree thunk_fndecl, HOST_WIDE_INT delta, || ((DECL_SECTION_NAME (thunk_fndecl) == DECL_SECTION_NAME (function)) && last_address < 262132))) + /* In this case, we need to be able to reach the start of + the stub table even though the function is likely closer + and can be jumped to directly. */ || (targetm_common.have_named_sections && DECL_SECTION_NAME (thunk_fndecl) == NULL && DECL_SECTION_NAME (function) == NULL - && last_address < 262132) + && total_code_bytes < MAX_PCREL17F_OFFSET) + /* Likewise. */ || (!targetm_common.have_named_sections - && last_address < 262132)))) + && total_code_bytes < MAX_PCREL17F_OFFSET)))) { if (!val_14) output_asm_insn ("addil L'%2,%%r26", xoperands); |

