Bug 617719 - [RHEL6] info page for gcc needs update re: -pthread
Summary: [RHEL6] info page for gcc needs update re: -pthread
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: gcc
Version: 6.0
Hardware: All
OS: Linux
Target Milestone: rc
: ---
Assignee: Jakub Jelinek
QA Contact: qe-baseos-tools
Depends On:
TreeView+ depends on / blocked
Reported: 2010-07-23 19:40 UTC by Issue Tracker
Modified: 2018-11-14 19:16 UTC (History)
2 users (show)

Clone Of:
Last Closed: 2010-11-30 14:05:20 UTC

Attachments (Terms of Use)

Description Issue Tracker 2010-07-23 19:40:06 UTC
Escalated to Bugzilla from IssueTracker

Comment 1 Issue Tracker 2010-07-23 19:40:08 UTC
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 19:45:37 UTC
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 08:48:52 UTC
-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 14:05:20 UTC
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.