Bug 617719 - [RHEL6] info page for gcc needs update re: -pthread
[RHEL6] info page for gcc needs update re: -pthread
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: gcc (Show other bugs)
All Linux
medium Severity medium
: rc
: ---
Assigned To: Jakub Jelinek
Depends On:
  Show dependency treegraph
Reported: 2010-07-23 15:40 EDT by Issue Tracker
Modified: 2011-05-13 08:44 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2010-11-30 09:05:20 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Issue Tracker 2010-07-23 15:40:06 EDT
Escalated to Bugzilla from IssueTracker
Comment 1 Issue Tracker 2010-07-23 15:40:08 EDT
Event posted on 07-21-2010 12:46pm EDT by woodard

Description of problem:
The info page says one thing:

     Add support for multithreading using the POSIX threads library.
     This option sets flags for both the preprocessor and linker.  It
     does not affect the thread safety of object code produced by the
     compiler or that of libraries supplied with it.  These are HP-UX
     specific flags.

This email says something else:

It looks like the docs need to be updated a bit.

This issue needs to be cloned for RHEL5 as well. Same problem.
This event sent from IssueTracker by tgummels  [LLNL (HPC)]
 issue 1168973
Comment 3 Travis Gummels 2010-07-23 15:45:37 EDT
Email referenced in Comment 1

Magnus Fromreide <magfr@lysator.liu.se> writes:

> I recently ended up in a discussion about the -pthread flag at work and
> when looking at the documentation I noticed that it is defined onlt for
> SPARC and RS/6000/PowerPC.
> Additionally -fopenmp and -ftree-parallelize-loops say they are only
> supported on targets where -pthread are available.
> Now, on x86-linux it seems as if -pthread does something but there is no
> documentation of it so I'd like to know
>       * What does -pthread do on x86?

On x86 GNU/Linux -pthread defines _REENTRANT for the preprocessor and
links against -lpthread.

>       * If I am to compile a threaded program am I then requiered to use
>         -pthread?

On GNU/Linux, you need to use -pthread or -D_REENTRANT at compilation
time, and you need to use -pthread or -lpthread at link time.

I agree that this really ought to be documented.

Comment 4 Jakub Jelinek 2010-11-22 03:48:52 EST
-D_REENTRANT has so little effect on Linux that it is IMNSHO not worth mentioning.
It affects only presence of getlogin_r prototype in unistd.h, but that prototype is defined either if _REENTRANT is defined, or if POSIX >= 199506 is requested (the latter is by default, unless you request strict compliance with something older).  So, in reality, -pthread is basically ignored during compilation, and during linking it is just equivalent of -lpthread.
Comment 5 RHEL Product and Program Management 2010-11-30 09:05:20 EST
Development Management has reviewed and declined this request.  You may appeal
this decision by reopening this request.

Note You need to log in before you can comment on or make changes to this bug.