From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26559 invoked by alias); 8 Jul 2005 23:44:26 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 26359 invoked by uid 22791); 8 Jul 2005 23:44:17 -0000 Received: from mail1.thewrittenword.com (HELO mail1.thewrittenword.com) (67.95.107.114) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Fri, 08 Jul 2005 23:44:17 +0000 Received: by mail1.thewrittenword.com (Postfix, from userid 1000) id 81B451DA; Fri, 8 Jul 2005 18:44:15 -0500 (CDT) Date: Fri, 08 Jul 2005 23:44:00 -0000 From: Albert Chin To: gcc-help@gcc.gnu.org Subject: pthread_mutex_init() with gcc-3.4.3 on Tru64 UNIX Message-ID: <20050708234415.GH10913@mail1.thewrittenword.com> Reply-To: gcc-help@gcc.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.6i X-SW-Source: 2005-07/txt/msg00095.txt.bz2 $ uname -a OSF1 [name] V4.0 878 alpha $ uname -a OSF1 [name] V5.1 732 alpha $ cat mutex.c #include #include int main (void) { pthread_mutex_t lck; if (pthread_mutex_init(&lck, 0) != 0) exit (2); if (pthread_mutex_lock(&lck) != 0) exit (3); if (pthread_mutex_unlock(&lck) != 0) exit (4); if (pthread_mutex_destroy(&lck) != 0) exit (5); exit (0); } $ cc mutex.c ld: Unresolved: __pthread_mutex_init __pthread_mutex_destroy __pthread_mutex_lock __pthread_mutex_unlock $ cc -pthread mutex.c $ ls -ld a.out -rwxrwxr-x 1 china china 20288 Jul 8 18:40 a.out $ nm a.out | grep pthread_mutex __pthread_mutex_destroy | 0000000000000000 | U | 0000000000000008 __pthread_mutex_init | 0000000000000000 | U | 0000000000000008 __pthread_mutex_lock | 0000000000000000 | U | 0000000000000008 __pthread_mutex_unlock | 0000000000000000 | U | 0000000000000008 $ /opt/TWWfsw/gcc343/bin/gcc -v Reading specs from /opt/TWWfsw/gcc343/lib/gcc/alpha-dec-osf5.1/3.4.3/specs Configured with: /opt/build/gcc-3.4.3/configure --enable-nls --with-included-gettext --enable-shared --enable-threads --host=alpha-dec-osf5.1 --with-local-prefix=/opt/TWWfsw/gcc343 --prefix=/opt/TWWfsw/gcc343 Thread model: posix gcc version 3.4.3 (TWW) $ /opt/TWWfsw/gcc343/bin/gcc mutex.c $ ls -ld a.out -rwxrwxr-x 1 china china 41072 Jul 8 18:40 a.out $ nm a.out | grep pthread_mutex __pthread_mutex_destroy | 0000004831844816 | T | 0000000000000008 __pthread_mutex_init | 0000004831844800 | T | 0000000000000008 __pthread_mutex_lock | 0000004831844640 | T | 0000000000000008 __pthread_mutex_trylock | 0000004831844656 | T | 0000000000000008 __pthread_mutex_unlock | 0000004831844672 | T | 0000000000000008 $ /opt/TWWfsw/gcc332/bin/gcc -v Reading specs from /opt/TWWfsw/gcc332/lib/gcc-lib/alphaev67-dec-osf5.1/3.3.2/specs Configured with: /opt/build/gcc-3.3.2/configure --enable-nls --with-included-gettext --enable-shared --enable-threads --with-local-prefix=/opt/TWWfsw/gcc332 --prefix=/opt/TWWfsw/gcc332 Thread model: single gcc version 3.3.2 (TWW) $ /opt/TWWfsw/gcc332/bin/gcc mutex.c __pthread_mutex_init __pthread_mutex_lock __pthread_mutex_unlock __pthread_mutex_destroy collect2: ld returned 1 exit status So, why does /opt/TWWfsw/gcc343/bin/gcc resolve the pthread_mutex_* symbols and cc does not? Should the GCC behavior mirror the cc behavior? -- albert chin (china@thewrittenword.com)