public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/24201]  New: Potential problems with HOT_TEXT_SECTION_NAME
@ 2005-10-04 21:45 hjl at lucon dot org
  2005-10-04 21:53 ` [Bug middle-end/24201] " pinskia at gcc dot gnu dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: hjl at lucon dot org @ 2005-10-04 21:45 UTC (permalink / raw)
  To: gcc-bugs

We have

#define HOT_TEXT_SECTION_NAME ".text.hot"
#define UNLIKELY_EXECUTED_TEXT_SECTION_NAME ".text.unlikely"

There is a little potential for confusion, for example suppose we have a very
hot function with the unlikely name of "unlikely" or a very cold function
called "hot". With -ffunction-sections, we got

[hjl@gnu-13 hot]$ cat x.c
void hot () { }

void unlikely () { }
[hjl@gnu-13 hot]$ gcc -c x.c -ffunction-sections
[hjl@gnu-13 hot]$ readelf --wide -S x.o | grep text
  [ 1] .text             PROGBITS        0000000000000000 000040 000000 00  AX 
0   0  4
  [ 4] .text.hot         PROGBITS        0000000000000000 000040 000006 00  AX 
0   0  1
  [ 5] .text.unlikely    PROGBITS        0000000000000000 000046 000006 00  AX 
0   0  1

Should we use a slightly different standard naming scheme so as to distinguish
the special names such as huge, hot and unlikely from the function naming
cheme?


-- 
           Summary: Potential problems with HOT_TEXT_SECTION_NAME
           Product: gcc
           Version: 4.0.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: hjl at lucon dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24201


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug middle-end/24201] Potential problems with HOT_TEXT_SECTION_NAME
  2005-10-04 21:45 [Bug c/24201] New: Potential problems with HOT_TEXT_SECTION_NAME hjl at lucon dot org
@ 2005-10-04 21:53 ` pinskia at gcc dot gnu dot org
  2005-10-04 22:36 ` [Bug c/24201] " hjl at lucon dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-10-04 21:53 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2005-10-04 21:52 -------
I don't see why this is really a problem.  It only effects the gcing sections,
it just means you are not going to remove those functions when used with other
functions which are in the hold/cold section.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c                           |middle-end


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24201


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c/24201] Potential problems with HOT_TEXT_SECTION_NAME
  2005-10-04 21:45 [Bug c/24201] New: Potential problems with HOT_TEXT_SECTION_NAME hjl at lucon dot org
  2005-10-04 21:53 ` [Bug middle-end/24201] " pinskia at gcc dot gnu dot org
@ 2005-10-04 22:36 ` hjl at lucon dot org
  2005-10-04 22:41 ` [Bug middle-end/24201] " pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: hjl at lucon dot org @ 2005-10-04 22:36 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from hjl at lucon dot org  2005-10-04 22:36 -------
The problem is with -ffunction-sections, we may put a very big cold function in
the .text.hot section and a very hot function in the .text.unlikely section. It
defeats the whole purpose of .text.hot/.text.unlikely.


-- 

hjl at lucon dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|middle-end                  |c


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24201


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug middle-end/24201] Potential problems with HOT_TEXT_SECTION_NAME
  2005-10-04 21:45 [Bug c/24201] New: Potential problems with HOT_TEXT_SECTION_NAME hjl at lucon dot org
  2005-10-04 21:53 ` [Bug middle-end/24201] " pinskia at gcc dot gnu dot org
  2005-10-04 22:36 ` [Bug c/24201] " hjl at lucon dot org
@ 2005-10-04 22:41 ` pinskia at gcc dot gnu dot org
  2005-10-04 22:58 ` hjl at lucon dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-10-04 22:41 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pinskia at gcc dot gnu dot org  2005-10-04 22:41 -------
(In reply to comment #2)
> The problem is with -ffunction-sections, we may put a very big cold function in
> the .text.hot section and a very hot function in the .text.unlikely section. It
> defeats the whole purpose of .text.hot/.text.unlikely.

But -ffunction-sections disables the use hot/unlikely sections so what is the
problem?
Maybe you should not be mixing code compiled with and without
-ffunction-sections.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |minor
          Component|c                           |middle-end


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24201


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug middle-end/24201] Potential problems with HOT_TEXT_SECTION_NAME
  2005-10-04 21:45 [Bug c/24201] New: Potential problems with HOT_TEXT_SECTION_NAME hjl at lucon dot org
                   ` (2 preceding siblings ...)
  2005-10-04 22:41 ` [Bug middle-end/24201] " pinskia at gcc dot gnu dot org
@ 2005-10-04 22:58 ` hjl at lucon dot org
  2005-10-04 23:14 ` pinskia at gcc dot gnu dot org
  2005-10-05  0:37 ` hjl at lucon dot org
  5 siblings, 0 replies; 7+ messages in thread
From: hjl at lucon dot org @ 2005-10-04 22:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from hjl at lucon dot org  2005-10-04 22:58 -------
A library may be compiled with -ffunction-sections. It doesn't mean that all
codes linked against that library have to use -ffunction-sections. For example,
libstdc++ is compiled with -ffunction-sections. Do I have to use it for all
programs linked against libstdc++? A better naming scheme can help this.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24201


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug middle-end/24201] Potential problems with HOT_TEXT_SECTION_NAME
  2005-10-04 21:45 [Bug c/24201] New: Potential problems with HOT_TEXT_SECTION_NAME hjl at lucon dot org
                   ` (3 preceding siblings ...)
  2005-10-04 22:58 ` hjl at lucon dot org
@ 2005-10-04 23:14 ` pinskia at gcc dot gnu dot org
  2005-10-05  0:37 ` hjl at lucon dot org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-10-04 23:14 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from pinskia at gcc dot gnu dot org  2005-10-04 23:14 -------
(In reply to comment #4)
> A library may be compiled with -ffunction-sections. It doesn't mean that all
> codes linked against that library have to use -ffunction-sections. For example,
> libstdc++ is compiled with -ffunction-sections. Do I have to use it for all
> programs linked against libstdc++? A better naming scheme can help this.

but libstdc++ is dynamic/shared library so it should not matter with respect
linking.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24201


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug middle-end/24201] Potential problems with HOT_TEXT_SECTION_NAME
  2005-10-04 21:45 [Bug c/24201] New: Potential problems with HOT_TEXT_SECTION_NAME hjl at lucon dot org
                   ` (4 preceding siblings ...)
  2005-10-04 23:14 ` pinskia at gcc dot gnu dot org
@ 2005-10-05  0:37 ` hjl at lucon dot org
  5 siblings, 0 replies; 7+ messages in thread
From: hjl at lucon dot org @ 2005-10-05  0:37 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from hjl at lucon dot org  2005-10-05 00:37 -------
I used libstdc++ as an example to show that it isn't unreasonable to have
.o files compiled with and without -fffunction-sections. Besides, on my system
there is a libstdc++.a. We can just use something like

#define HOT_TEXT_SECTION_NAME ".text..hot"
#define UNLIKELY_EXECUTED_TEXT_SECTION_NAME ".text..unlikely"

to avoid this issue.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24201


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2005-10-05  0:37 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-10-04 21:45 [Bug c/24201] New: Potential problems with HOT_TEXT_SECTION_NAME hjl at lucon dot org
2005-10-04 21:53 ` [Bug middle-end/24201] " pinskia at gcc dot gnu dot org
2005-10-04 22:36 ` [Bug c/24201] " hjl at lucon dot org
2005-10-04 22:41 ` [Bug middle-end/24201] " pinskia at gcc dot gnu dot org
2005-10-04 22:58 ` hjl at lucon dot org
2005-10-04 23:14 ` pinskia at gcc dot gnu dot org
2005-10-05  0:37 ` hjl at lucon dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).