summaryrefslogtreecommitdiff
path: root/gcc/config/darwin.c
diff options
context:
space:
mode:
authormarxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4>2013-12-17 22:20:12 +0000
committermarxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4>2013-12-17 22:20:12 +0000
commitaf48f0b184090da9bd5bd5f959e2387385f92b8c (patch)
tree3ad29a01dabd9e49f49f9ebdc04f7655721d6300 /gcc/config/darwin.c
parentcf4f5d5e5a8bffc5c58b5dc64ac035adf9c98e1d (diff)
downloadgcc-af48f0b184090da9bd5bd5f959e2387385f92b8c.tar.gz
Time profile-based function reordering (phase 2).
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@206070 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/darwin.c')
-rw-r--r--gcc/config/darwin.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c
index ea056a9ab9d..4267c89dc06 100644
--- a/gcc/config/darwin.c
+++ b/gcc/config/darwin.c
@@ -3621,9 +3621,16 @@ darwin_function_section (tree decl, enum node_frequency freq,
unlikely executed (this happens especially with function splitting
where we can split away unnecessary parts of static constructors). */
if (startup && freq != NODE_FREQUENCY_UNLIKELY_EXECUTED)
- return (weak)
- ? darwin_sections[text_startup_coal_section]
- : darwin_sections[text_startup_section];
+ {
+ /* If we do have a profile or(and) LTO phase is executed, we do not need
+ these ELF section. */
+ if (!in_lto_p || !flag_profile_values)
+ return (weak)
+ ? darwin_sections[text_startup_coal_section]
+ : darwin_sections[text_startup_section];
+ else
+ return text_section;
+ }
/* Similarly for exit. */
if (exit && freq != NODE_FREQUENCY_UNLIKELY_EXECUTED)
@@ -3640,10 +3647,15 @@ darwin_function_section (tree decl, enum node_frequency freq,
: darwin_sections[text_cold_section];
break;
case NODE_FREQUENCY_HOT:
- return (weak)
- ? darwin_sections[text_hot_coal_section]
- : darwin_sections[text_hot_section];
- break;
+ {
+ /* If we do have a profile or(and) LTO phase is executed, we do not need
+ these ELF section. */
+ if (!in_lto_p || !flag_profile_values)
+ return (weak)
+ ? darwin_sections[text_hot_coal_section]
+ : darwin_sections[text_hot_section];
+ break;
+ }
default:
return (weak)
? darwin_sections[text_coal_section]