From patchwork Thu Nov 25 18:58:35 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rainer Orth X-Patchwork-Id: 73115 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 9D11EB7080 for ; Fri, 26 Nov 2010 05:59:17 +1100 (EST) Received: (qmail 20681 invoked by alias); 25 Nov 2010 18:59:14 -0000 Received: (qmail 20646 invoked by uid 22791); 25 Nov 2010 18:59:06 -0000 X-SWARE-Spam-Status: No, hits=-0.5 required=5.0 tests=AWL, BAYES_50, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from snape.CeBiTec.Uni-Bielefeld.DE (HELO smtp-relay.CeBiTec.Uni-Bielefeld.DE) (129.70.160.84) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 25 Nov 2010 18:58:55 +0000 Received: from localhost (localhost.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) by smtp-relay.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTP id 7A88DA04 for ; Thu, 25 Nov 2010 19:58:52 +0100 (CET) Received: from smtp-relay.CeBiTec.Uni-Bielefeld.DE ([127.0.0.1]) by localhost (malfoy.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) (amavisd-new, port 10024) with LMTP id YW6GNSNH0cVL for ; Thu, 25 Nov 2010 19:58:36 +0100 (CET) Received: from manam.CeBiTec.Uni-Bielefeld.DE (manam.CeBiTec.Uni-Bielefeld.DE [129.70.161.120]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp-relay.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTPS id 43B40A01 for ; Thu, 25 Nov 2010 19:58:36 +0100 (CET) Received: (from ro@localhost) by manam.CeBiTec.Uni-Bielefeld.DE (8.14.4+Sun/8.14.4/Submit) id oAPIwZKU010265; Thu, 25 Nov 2010 19:58:35 +0100 (MET) From: Rainer Orth To: gcc-patches@gcc.gnu.org Subject: [4.5, testsuite] Backport several Tru64 UNIX testsuite fixes Date: Thu, 25 Nov 2010 19:58:35 +0100 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (usg-unix-v) MIME-Version: 1.0 X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Similarly to the IRIX testsuite backports, I'd like to backport a couple of testsuite fixes for Tru64 UNIX to the 4.5 branch, especially given that Tru64 UNIX V4.0 was deprecated in 4.5 and removed in 4.6. osf-unwind.h fully works on Tru64 UNIX V5.1B, but seems to need a couple of tweaks for V4.0F. I'll try to look into this later. The only part I seem to need approval for is the dg-add-options tls backport. Bootstrapped without regressions on alpha-dec-osf4.0f and alpha-dec-osf5.1b. Ok for 4.5 (and eventually 4.4) branch? Rainer 2010-11-21 Rainer Orth gcc: Backport from mainline: 2010-09-15 Olivier Hainque Jose Ruiz * config/alpha/osf.h (MD_UNWIND_SUPPORT): Define. * config/alpha/osf-unwind.h: New file. 2010-07-23 Rainer Orth * doc/sourcebuild.texi (Add Options): Document tls. gcc/testsuite: Backport from mainline: 2010-11-10 Rainer Orth * g++.dg/abi/rtti3.C: Scan for .weakext on alpha*-dec-osf*. * g++.dg/abi/thunk4.C: Likewise. * g++.dg/opt/combine.C: Add dg-require-visibility. * g++.dg/other/anon5.C: Skip on alpha*-dec-osf*. * g++.dg/warn/miss-format-1.C: XFAIL scanf attribute warning on alpha*-dec-osf*. * g++.dg/warn/pr31246.C: XFAIL on alpha*-dec-osf*. * g++.dg/warn/weak1.C: Skip on alpha*-dec-osf*. * g++.old-deja/g++.eh/badalloc1.C [!STACK_SIZE && __osf__]: Use large arena_size. * gcc.dg/attr-weakref-1.c: Skip on alpha*-dec-osf*. * gcc.dg/intmax_t-1.c: Likewise. 2010-07-23 Rainer Orth * lib/target-supports.exp (add_options_for_tls): New proc. * g++.dg/tls/static-1.C: Use dg-add-options tls. * g++.dg/tls/static-1a.cc: Likewise. * gcc.dg/tls/emutls-1.c: Likewise. * gcc.dg/tls/opt-11.c: Likewise. * gcc.dg/tls/opt-12.c: Likewise. * gcc.dg/tls/pr24428-2.c: Likewise. * gcc.dg/tls/pr24428.c: Likewise. libjava: Backport from mainline: 2010-11-09 Rainer Orth * testsuite/libjava.jvmti/jvmti.exp (gcj_jvmti_compile_cxx_to_o): Add -pthread on alpha*-dec-osf*. * testsuite/libjava.jvmti/jvmti-interp.exp (gcj_jni_compile_c_to_so): Likewise. libstdc++-v3: 2010-11-02 Rainer Orth PR target/45693 * configure.host (osf*): Set os_include_dir to os/generic. Add -lpthread to OPT_LDFLAGS. diff -r 1b55ce8ede18 gcc/config/alpha/osf-unwind.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gcc/config/alpha/osf-unwind.h Thu Nov 25 19:41:55 2010 +0100 @@ -0,0 +1,329 @@ +/* DWARF2 EH unwinding support for Alpha Tru64. + Copyright (C) 2010 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +/* This file implements the MD_FALLBACK_FRAME_STATE_FOR macro, triggered when + the GCC table based unwinding process hits a frame for which no unwind info + has been registered. This typically occurs when raising an exception from a + signal handler, because the handler is actually called from the OS kernel. + + The basic idea is to detect that we are indeed trying to unwind past a + signal handler and to fill out the GCC internal unwinding structures for + the OS kernel frame as if it had been directly called from the interrupted + context. + + This is all assuming that the code to set the handler asked the kernel to + pass a pointer to such context information. */ + +/* -------------------------------------------------------------------------- + -- Basic principles of operation: + -------------------------------------------------------------------------- + + 1/ We first need a way to detect if we are trying to unwind past a signal + handler. + + The typical method that is used on most platforms is to look at the code + around the return address we have and check if it matches the OS code + calling a handler. To determine what this code is expected to be, get a + breakpoint into a real signal handler and look at the code around the + return address. Depending on the library versions the pattern of the + signal handler is different; this is the reason why we check against more + than one pattern. + + On this target, the return address is right after the call and every + instruction is 4 bytes long. For the simple case of a null dereference in + a single-threaded app, it went like: + + # Check that we indeed have something we expect: the instruction right + # before the return address is within a __sigtramp function and is a call. + + [... run gdb and break at the signal handler entry ...] + + (gdb) x /i $ra-4 + <__sigtramp+160>: jsr ra,(a3),0x3ff800d0ed4 <_fpdata+36468> + + # Look at the code around that return address, and eventually observe a + # significantly large chunk of *constant* code right before the call: + + (gdb) x /10i $ra-44 + <__sigtramp+120>: lda gp,-27988(gp) + <__sigtramp+124>: ldq at,-18968(gp) + <__sigtramp+128>: lda t0,-1 + <__sigtramp+132>: stq t0,0(at) + <__sigtramp+136>: ldq at,-18960(gp) + <__sigtramp+140>: ldl t1,8(at) + <__sigtramp+144>: ldq at,-18960(gp) + <__sigtramp+148>: stl t1,12(at) + <__sigtramp+152>: ldq at,-18960(gp) + <__sigtramp+156>: stl t0,8(at) + + # The hexadecimal equivalent that we will have to match is: + + (gdb) x /10x $ra-44 + <__sigtramp+120>: 0x23bd92ac 0xa79db5e8 0x203fffff 0xb43c0000 + <__sigtramp+136>: 0xa79db5f0 0xa05c0008 0xa79db5f0 0xb05c000c + <__sigtramp+152>: 0xa79db5f0 0xb03c0008 + + The problem observed on this target with this approach is that although + we found a constant set of instruction patterns there were some + gp-related offsets that made the machine code to differ from one + installation to another. This problem could have been overcome by masking + these offsets, but we found that it would be simpler and more efficient to + check whether the return address was part of a signal handler, by comparing + it against some expected code offset from __sigtramp. + + # Check that we indeed have something we expect: the instruction + # right before the return address is within a __sigtramp + # function and is a call. We also need to obtain the offset + # between the return address and the start address of __sigtramp. + + [... run gdb and break at the signal handler entry ...] + + (gdb) x /2i $ra-4 + <__sigtramp+160>: jsr ra,(a3),0x3ff800d0ed4 <_fpdata+36468> + <__sigtramp+164>: ldah gp,16381(ra) + + (gdb) p (long)$ra - (long)&__sigtramp + $2 = 164 + + -------------------------------------------------------------------------- + + 2/ Once we know we are going through a signal handler, we need a way to + retrieve information about the interrupted run-time context. + + On this platform, the third handler's argument is a pointer to a structure + describing this context (struct sigcontext *). We unfortunately have no + direct way to transfer this value here, so a couple of tricks are required + to compute it. + + As documented at least in some header files (e.g. sys/machine/context.h), + the structure the handler gets a pointer to is located on the stack. As of + today, while writing this macro, we have unfortunately not been able to + find a detailed description of the full stack layout at handler entry time, + so we'll have to resort to empirism :) + + When unwinding here, we have the handler's CFA at hand, as part of the + current unwinding context which is one of our arguments. We presume that + for each call to a signal handler by the same kernel routine, the context's + structure location on the stack is always at the same offset from the + handler's CFA, and we compute that offset from bare observation: + + For the simple case of a bare null dereference in a single-threaded app, + computing the offset was done using GNAT like this: + + # Break on the first handler's instruction, before the prologue to have the + # CFA in $sp, and get there: + + (gdb) b *&__gnat_error_handler + Breakpoint 1 at 0x120016090: file init.c, line 378. + + (gdb) r + Program received signal SIGSEGV, Segmentation fault. + + (gdb) c + Breakpoint 1, __gnat_error_handler (sig=..., sip=..., context=...) + + # The displayed argument value are meaningless because we stopped before + # their final "homing". We know they are passed through $a0, $a1 and $a2 + # from the ABI, though, so ... + + # Observe that $sp and the context pointer are in the same (stack) area, + # and compute the offset: + + (gdb) p /x $sp + $2 = 0x11fffbc80 + + (gdb) p /x $a2 + $3 = 0x11fffbcf8 + + (gdb) p /x (long)$a2 - (long)$sp + $4 = 0x78 + + -------------------------------------------------------------------------- + + 3/ Once we know we are unwinding through a signal handler and have the + address of the structure describing the interrupted context at hand, we + have to fill the internal frame-state/unwind-context structures properly + to allow the unwinding process to proceed. + + Roughly, we are provided with an *unwinding* CONTEXT, describing the state + of some point P in the call chain we are unwinding through. The macro we + implement has to fill a "frame state" structure FS that describe the P's + caller state, by way of *rules* to compute its CFA, return address, and + **saved** registers *locations*. + + For the case we are going to deal with, the caller is some kernel code + calling a signal handler, and: + + o The saved registers are all in the interrupted run-time context, + + o The CFA is the stack pointer value when the kernel code is entered, that + is, the stack pointer value at the interruption point, also part of the + interrupted run-time context. + + o We want the return address to appear as the address of the active + instruction at the interruption point, so that the unwinder proceeds as + if the interruption had been a regular call. This address is also part + of the interrupted run-time context. + + -- + + Also, note that there is an important difference between the return address + we need to claim for the kernel frame and the value of the return address + register at the interruption point. + + The latter might be required to be able to unwind past the interrupted + routine, for instance if it is interrupted before saving the incoming + register value in its own frame, which may typically happen during stack + probes for stack-checking purposes. + + It is then essential that the rules stated to locate the kernel frame + return address don't clobber the rules describing where is saved the return + address register at the interruption point, so some scratch register state + entry should be used for the former. We have DWARF_ALT_FRAME_RETURN_COLUMN + at hand exactly for that purpose. + + -------------------------------------------------------------------------- + + 4/ Depending on the context (single-threaded or multi-threaded app, ...), + the code calling the handler and the handler-cfa to interrupted-context + offset might change, so we use a simple generic data structure to track + the possible variants. */ + +/* This is the structure to wrap information about each possible sighandler + caller we may have to identify. */ + +typedef struct { + /* Expected return address when being called from a sighandler. */ + void *ra_value; + + /* Offset to get to the sigcontext structure from the handler's CFA + when the pattern matches. */ + int cfa_to_context_offset; + +} sighandler_call_t; + +/* Helper macro for MD_FALLBACK_FRAME_STATE_FOR below. + + Look at RA to see if it matches within a sighandler caller. + Set SIGCTX to the corresponding sigcontext structure (computed from + CFA) if it does, or to 0 otherwise. */ + +#define COMPUTE_SIGCONTEXT_FOR(RA,CFA,SIGCTX) \ +do { \ + /* Define and register the applicable patterns. */ \ + extern void __sigtramp (void); \ + \ + sighandler_call_t sighandler_calls [] = { \ + {__sigtramp + 164, 0x78} \ + }; \ + \ + int n_patterns_to_match \ + = sizeof (sighandler_calls) / sizeof (sighandler_call_t); \ + \ + int pn; /* pattern number */ \ + \ + int match = 0; /* Did last pattern match ? */ \ + \ + /* Try to match each pattern in turn. */ \ + for (pn = 0; !match && pn < n_patterns_to_match; pn ++) \ + match = ((RA) == sighandler_calls[pn].ra_value); \ + \ + (SIGCTX) = (struct sigcontext *) \ + (match ? ((CFA) + sighandler_calls[pn - 1].cfa_to_context_offset) : 0); \ +} while (0); + +#include + +#define REG_SP 30 /* hard reg for stack pointer */ +#define REG_RA 26 /* hard reg for return address */ + +#define MD_FALLBACK_FRAME_STATE_FOR alpha_fallback_frame_state + +static _Unwind_Reason_Code +alpha_fallback_frame_state (struct _Unwind_Context *context, + _Unwind_FrameState *fs) +{ + /* Return address and CFA of the frame we're attempting to unwind through, + possibly a signal handler. */ + void *ctx_ra = (void *)context->ra; + void *ctx_cfa = (void *)context->cfa; + + /* CFA of the intermediate abstract kernel frame between the interrupted + code and the signal handler, if we're indeed unwinding through a signal + handler. */ + void *k_cfa; + + /* Pointer to the sigcontext structure pushed by the kernel when we're + unwinding through a signal handler. */ + struct sigcontext *sigctx; + int i; + + COMPUTE_SIGCONTEXT_FOR (ctx_ra, ctx_cfa, sigctx); + + if (sigctx == 0) + return _URC_END_OF_STACK; + + /* The kernel frame's CFA is exactly the stack pointer value at the + interruption point. */ + k_cfa = (void *) sigctx->sc_regs [REG_SP]; + + /* State the rules to compute the CFA we have the value of: use the + previous CFA and offset by the difference between the two. See + uw_update_context_1 for the supporting details. */ + fs->regs.cfa_how = CFA_REG_OFFSET; + fs->regs.cfa_reg = __builtin_dwarf_sp_column (); + fs->regs.cfa_offset = k_cfa - ctx_cfa; + + /* Fill the internal frame_state structure with information stating + where each register of interest in the saved context can be found + from the CFA. */ + + /* The general registers are in sigctx->sc_regs. Leave out r31, which + is read-as-zero. It makes no sense restoring it, and we are going to + use the state entry for the kernel return address rule below. + + This loop must cover at least all the callee-saved registers, and + we just don't bother specializing the set here. */ + for (i = 0; i <= 30; i ++) + { + fs->regs.reg[i].how = REG_SAVED_OFFSET; + fs->regs.reg[i].loc.offset + = (void *) &sigctx->sc_regs[i] - (void *) k_cfa; + } + + /* Ditto for the floating point registers in sigctx->sc_fpregs. */ + for (i = 0; i <= 31; i ++) + { + fs->regs.reg[32+i].how = REG_SAVED_OFFSET; + fs->regs.reg[32+i].loc.offset + = (void *) &sigctx->sc_fpregs[i] - (void *) k_cfa; + } + + /* State the rules to find the kernel's code "return address", which + is the address of the active instruction when the signal was caught, + in sigctx->sc_pc. Use DWARF_ALT_FRAME_RETURN_COLUMN since the return + address register is a general register and should be left alone. */ + fs->retaddr_column = DWARF_ALT_FRAME_RETURN_COLUMN; + fs->regs.reg[DWARF_ALT_FRAME_RETURN_COLUMN].how = REG_SAVED_OFFSET; + fs->regs.reg[DWARF_ALT_FRAME_RETURN_COLUMN].loc.offset + = (void *) &sigctx->sc_pc - (void *) k_cfa; + fs->signal_frame = 1; + + return _URC_NO_REASON; +} diff -r 1b55ce8ede18 gcc/config/alpha/osf.h --- a/gcc/config/alpha/osf.h Mon Nov 22 19:44:14 2010 +0100 +++ b/gcc/config/alpha/osf.h Thu Nov 25 19:41:55 2010 +0100 @@ -1,6 +1,6 @@ /* Definitions of target machine for GNU compiler, for DEC Alpha on OSF/1. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2001, 2002, 2003, - 2004, 2007, 2009 Free Software Foundation, Inc. + 2004, 2007, 2009, 2010 Free Software Foundation, Inc. Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu) This file is part of GCC. @@ -246,3 +246,5 @@ /* Handle #pragma extern_prefix. Technically only needed for Tru64 5.x, but easier to manipulate preprocessor bits from here. */ #define TARGET_HANDLE_PRAGMA_EXTERN_PREFIX 1 + +#define MD_UNWIND_SUPPORT "config/alpha/osf-unwind.h" diff -r 1b55ce8ede18 gcc/doc/sourcebuild.texi --- a/gcc/doc/sourcebuild.texi Mon Nov 22 19:44:14 2010 +0100 +++ b/gcc/doc/sourcebuild.texi Thu Nov 25 19:41:55 2010 +0100 @@ -1892,6 +1892,9 @@ @item mips16_attribute @code{mips16} function attributes. Only MIPS targets support this feature, and only then in certain modes. + +@item tls +Add the target-specific flags needed to use thread-local storage. @end table @node Require Support diff -r 1b55ce8ede18 gcc/testsuite/g++.dg/abi/rtti3.C --- a/gcc/testsuite/g++.dg/abi/rtti3.C Mon Nov 22 19:44:14 2010 +0100 +++ b/gcc/testsuite/g++.dg/abi/rtti3.C Thu Nov 25 19:41:55 2010 +0100 @@ -3,10 +3,12 @@ // { dg-require-weak "" } // { dg-skip-if "Linkonce not weak" { *-*-mingw* *-*-cygwin } { "*" } { "" } } -// { dg-final { scan-assembler ".weak\[ \t\]_?_ZTSPP1A" { target { ! { *-*-darwin* } } } } } -// { dg-final { scan-assembler-not ".weak\[ \t\]_?_ZTIPP1A" { target { ! { *-*-darwin* } } } } } +// { dg-final { scan-assembler ".weak\[ \t\]_?_ZTSPP1A" { target { ! { *-*-darwin* alpha*-dec-osf* } } } } } +// { dg-final { scan-assembler-not ".weak\[ \t\]_?_ZTIPP1A" { target { ! { *-*-darwin* alpha*-dec-osf* } } } } } // { dg-final { scan-assembler ".weak_definition\[ \t\]_?_ZTSPP1A" { target { *-*-darwin* } } } } // { dg-final { scan-assembler-not ".weak_definition\[ \t\]_?_ZTIPP1A" { target { *-*-darwin* } } } } +// { dg-final { scan-assembler ".weakext\[ \t\]_?_ZTSPP1A" { target { alpha*-dec-osf* } } } } +// { dg-final { scan-assembler-not ".weakext\[ \t\]_?_ZTIPP1A" { target { alpha*-dec-osf* } } } } struct A; diff -r 1b55ce8ede18 gcc/testsuite/g++.dg/abi/thunk4.C --- a/gcc/testsuite/g++.dg/abi/thunk4.C Mon Nov 22 19:44:14 2010 +0100 +++ b/gcc/testsuite/g++.dg/abi/thunk4.C Thu Nov 25 19:41:55 2010 +0100 @@ -1,7 +1,8 @@ // { dg-require-weak "" } // { dg-skip-if "Linkonce not weak" { *-*-mingw* *-*-cygwin } { "*" } { "" } } -// { dg-final { scan-assembler ".weak\[ \t\]_?_ZThn._N7Derived3FooEv" { target { ! { *-*-darwin* } } } } } +// { dg-final { scan-assembler ".weak\[ \t\]_?_ZThn._N7Derived3FooEv" { target { ! { *-*-darwin* alpha*-dec-osf* } } } } } // { dg-final { scan-assembler ".weak_definition\[ \t\]_?_ZThn._N7Derived3FooEv" { target { *-*-darwin* } } } } +// { dg-final { scan-assembler ".weakext\[ \t\]_?_ZThn._N7Derived3FooEv" { target { alpha*-dec-osf* } } } } struct Base { diff -r 1b55ce8ede18 gcc/testsuite/g++.dg/other/anon5.C --- a/gcc/testsuite/g++.dg/other/anon5.C Mon Nov 22 19:44:14 2010 +0100 +++ b/gcc/testsuite/g++.dg/other/anon5.C Thu Nov 25 19:41:55 2010 +0100 @@ -1,5 +1,5 @@ // PR c++/34094 -// { dg-do link { target { ! { *-*-darwin* *-*-hpux* *-*-solaris2.* } } } } +// { dg-do link { target { ! { *-*-darwin* *-*-hpux* *-*-solaris2.* alpha*-dec-osf* } } } } // { dg-options "-g" } namespace { diff -r 1b55ce8ede18 gcc/testsuite/g++.dg/tls/static-1.C --- a/gcc/testsuite/g++.dg/tls/static-1.C Mon Nov 22 19:44:14 2010 +0100 +++ b/gcc/testsuite/g++.dg/tls/static-1.C Thu Nov 25 19:41:55 2010 +0100 @@ -1,6 +1,7 @@ // { dg-do run } // { dg-options "-O2" } // { dg-require-effective-target tls_runtime } +// { dg-add-options tls } // { dg-additional-sources "static-1a.cc" } extern "C" void abort (); diff -r 1b55ce8ede18 gcc/testsuite/g++.dg/tls/static-1a.cc --- a/gcc/testsuite/g++.dg/tls/static-1a.cc Mon Nov 22 19:44:14 2010 +0100 +++ b/gcc/testsuite/g++.dg/tls/static-1a.cc Thu Nov 25 19:41:55 2010 +0100 @@ -1,6 +1,7 @@ // { dg-do run } // { dg-options "-O2" } // { dg-require-effective-target tls_runtime } +// { dg-add-options tls } // { dg-additional-sources "static-1a.cc" } struct A diff -r 1b55ce8ede18 gcc/testsuite/g++.dg/warn/pr31246.C --- a/gcc/testsuite/g++.dg/warn/pr31246.C Mon Nov 22 19:44:14 2010 +0100 +++ b/gcc/testsuite/g++.dg/warn/pr31246.C Thu Nov 25 19:41:55 2010 +0100 @@ -1,6 +1,7 @@ // PR 31246 // { dg-do compile } // { dg-options "-Wunreachable-code -D_GLIBCXX_DEBUG" } +// { dg-xfail-if "lack of weak symbols" { alpha*-dec-osf* } } #include int main() diff -r 1b55ce8ede18 gcc/testsuite/g++.dg/warn/weak1.C --- a/gcc/testsuite/g++.dg/warn/weak1.C Mon Nov 22 19:44:14 2010 +0100 +++ b/gcc/testsuite/g++.dg/warn/weak1.C Thu Nov 25 19:41:55 2010 +0100 @@ -1,7 +1,8 @@ // { dg-do run } // { dg-require-weak "" } -// The PA HP-UX dynamic loader doesn't support unsatisfied weak symbols. -// { dg-skip-if "No unsat" { hppa*-*-hpux* } { "*" } { "" } } +// The PA HP-UX and Tru64 UNIX dynamic loaders don't support unsatisfied +// weak symbols. +// { dg-skip-if "No unsat" { alpha*-dec-osf* hppa*-*-hpux* } { "*" } { "" } } // The darwin loader does, but they do need to exist at link time. // { dg-skip-if "No link unsat" { *-*-darwin* } { "*" } { "" } } // For kernel modules and static RTPs, the loader treats undefined weak diff -r 1b55ce8ede18 gcc/testsuite/g++.old-deja/g++.eh/badalloc1.C --- a/gcc/testsuite/g++.old-deja/g++.eh/badalloc1.C Mon Nov 22 19:44:14 2010 +0100 +++ b/gcc/testsuite/g++.old-deja/g++.eh/badalloc1.C Thu Nov 25 19:41:55 2010 +0100 @@ -3,7 +3,7 @@ // itself call malloc(), and will fail if there is no more // memory available. // { dg-do run { xfail { { xstormy16-*-* *-*-darwin[3-7]* } || vxworks_rtp } } } -// Copyright (C) 2000, 2002, 2003 Free Software Foundation, Inc. +// Copyright (C) 2000, 2002, 2003, 2010 Free Software Foundation, Inc. // Contributed by Nathan Sidwell 6 June 2000 // Check we can throw a bad_alloc exception when malloc dies. @@ -18,8 +18,8 @@ #ifdef STACK_SIZE const int arena_size = 256; #else -#if defined(__FreeBSD__) || defined(__sun__) || defined(__hpux__) -// FreeBSD, Solaris and HP-UX with threads require even more +#if defined(__FreeBSD__) || defined(__sun__) || defined(__hpux__) || defined(__osf__) +// FreeBSD, Solaris, HP-UX and Tru64 UNIX with threads require even more // space at initialization time. FreeBSD 5 now requires over 131072 bytes. const int arena_size = 262144; #else diff -r 1b55ce8ede18 gcc/testsuite/gcc.dg/attr-weakref-1.c --- a/gcc/testsuite/gcc.dg/attr-weakref-1.c Mon Nov 22 19:44:14 2010 +0100 +++ b/gcc/testsuite/gcc.dg/attr-weakref-1.c Thu Nov 25 19:41:55 2010 +0100 @@ -2,9 +2,10 @@ // { dg-require-weak "" } // On darwin, we use attr-weakref-1-darwin.c. // This test requires support for undefined weak symbols. This support -// is not available on hppa*-*-hpux*. The test is skipped rather than -// xfailed to suppress the warning that would otherwise arise. -// { dg-skip-if "" { "*-*-darwin*" "hppa*-*-hpux*" } "*" { "" } } +// is not available on alpha*-dec-osf* and hppa*-*-hpux*. The test is +// skipped rather than xfailed to suppress the warning that would otherwise +// arise. +// { dg-skip-if "" { "alpha*-dec-osf*" "*-*-darwin*" "hppa*-*-hpux*" } "*" { "" } } // For kernel modules and static RTPs, the loader treats undefined weak // symbols in the same way as undefined strong symbols. The test // therefore fails to load, so skip it. diff -r 1b55ce8ede18 gcc/testsuite/gcc.dg/intmax_t-1.c --- a/gcc/testsuite/gcc.dg/intmax_t-1.c Mon Nov 22 19:44:14 2010 +0100 +++ b/gcc/testsuite/gcc.dg/intmax_t-1.c Thu Nov 25 19:41:55 2010 +0100 @@ -1,6 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-Wall" } */ /* { dg-error "" "" { target { { *arm*-*-*elf* xtensa*-*-elf* } || vxworks_kernel } } 0 } */ +/* { dg-skip-if "No *intmax_t in " { alpha*-dec-osf* } } */ /* Compile with -Wall to get a warning if built-in and system intmax_t don't match. */ diff -r 1b55ce8ede18 gcc/testsuite/gcc.dg/tls/emutls-1.c --- a/gcc/testsuite/gcc.dg/tls/emutls-1.c Mon Nov 22 19:44:14 2010 +0100 +++ b/gcc/testsuite/gcc.dg/tls/emutls-1.c Thu Nov 25 19:41:55 2010 +0100 @@ -1,5 +1,6 @@ /* { dg-do run { target *-wrs-vxworks } } */ /* { dg-require-effective-target tls } */ +/* { dg-add-options tls } */ /* vxworks' TLS model requires no extra padding on the tls proxy objects. */ diff -r 1b55ce8ede18 gcc/testsuite/gcc.dg/tls/opt-11.c --- a/gcc/testsuite/gcc.dg/tls/opt-11.c Mon Nov 22 19:44:14 2010 +0100 +++ b/gcc/testsuite/gcc.dg/tls/opt-11.c Thu Nov 25 19:41:55 2010 +0100 @@ -1,5 +1,6 @@ /* { dg-do run } */ /* { dg-require-effective-target tls_runtime } */ +/* { dg-add-options tls } */ extern void abort (void); extern void *memset (void *, int, __SIZE_TYPE__); diff -r 1b55ce8ede18 gcc/testsuite/gcc.dg/tls/opt-12.c --- a/gcc/testsuite/gcc.dg/tls/opt-12.c Mon Nov 22 19:44:14 2010 +0100 +++ b/gcc/testsuite/gcc.dg/tls/opt-12.c Thu Nov 25 19:41:55 2010 +0100 @@ -2,6 +2,7 @@ /* { dg-do run } */ /* { dg-options "-O2 -fpic" } */ /* { dg-require-effective-target tls_runtime } */ +/* { dg-add-options tls } */ /* { dg-require-effective-target fpic } */ extern void abort (void); diff -r 1b55ce8ede18 gcc/testsuite/gcc.dg/tls/pr24428-2.c --- a/gcc/testsuite/gcc.dg/tls/pr24428-2.c Mon Nov 22 19:44:14 2010 +0100 +++ b/gcc/testsuite/gcc.dg/tls/pr24428-2.c Thu Nov 25 19:41:55 2010 +0100 @@ -1,6 +1,7 @@ /* { dg-do run } */ /* { dg-options "-O2" } */ /* { dg-require-effective-target tls_runtime } */ +/* { dg-add-options tls } */ __thread double thrtest[81]; int main () diff -r 1b55ce8ede18 gcc/testsuite/gcc.dg/tls/pr24428.c --- a/gcc/testsuite/gcc.dg/tls/pr24428.c Mon Nov 22 19:44:14 2010 +0100 +++ b/gcc/testsuite/gcc.dg/tls/pr24428.c Thu Nov 25 19:41:55 2010 +0100 @@ -1,6 +1,7 @@ /* { dg-do run } */ /* { dg-options "-O2" } */ /* { dg-require-effective-target tls_runtime } */ +/* { dg-add-options tls } */ __thread double thrtest[81]; int main () diff -r 1b55ce8ede18 gcc/testsuite/lib/target-supports.exp --- a/gcc/testsuite/lib/target-supports.exp Mon Nov 22 19:44:14 2010 +0100 +++ b/gcc/testsuite/lib/target-supports.exp Thu Nov 25 19:41:55 2010 +0100 @@ -569,6 +569,17 @@ }] } +# Add to FLAGS all the target-specific flags needed to use thread-local storage. + +proc add_options_for_tls { flags } { + # Tru64 UNIX uses emutls, which relies on a couple of pthread functions + # which only live in libpthread, so always pass -pthread for TLS. + if { [istarget *-*-osf*] } { + return "$flags -pthread" + } + return $flags +} + # Return 1 if thread local storage (TLS) is supported, 0 otherwise. proc check_effective_target_tls {} { diff -r 1b55ce8ede18 libjava/testsuite/libjava.jvmti/jvmti-interp.exp --- a/libjava/testsuite/libjava.jvmti/jvmti-interp.exp Mon Nov 22 19:44:14 2010 +0100 +++ b/libjava/testsuite/libjava.jvmti/jvmti-interp.exp Thu Nov 25 19:41:55 2010 +0100 @@ -37,6 +37,10 @@ if { [istarget "arm*"] } { lappend options "additional_flags=-Wno-abi" } + # Tru64 UNIX requires to be compiled with -pthread. + if { [istarget "alpha*-dec-osf*"] } { + lappend options "additional_flags=-pthread" + } set filename [file tail $file] set name [file rootname $filename] diff -r 1b55ce8ede18 libjava/testsuite/libjava.jvmti/jvmti.exp --- a/libjava/testsuite/libjava.jvmti/jvmti.exp Mon Nov 22 19:44:14 2010 +0100 +++ b/libjava/testsuite/libjava.jvmti/jvmti.exp Thu Nov 25 19:41:55 2010 +0100 @@ -20,6 +20,10 @@ if { [istarget "arm*"] } { lappend options "additional_flags=-Wno-abi" } + # Tru64 UNIX requires to be compiled with -pthread. + if { [istarget "alpha*-dec-osf*"] } { + lappend options "additional_flags=-pthread" + } set x [libjava_prune_warnings \ [target_compile $file $oname object $options]] diff -r 1b55ce8ede18 libstdc++-v3/configure.host --- a/libstdc++-v3/configure.host Mon Nov 22 19:44:14 2010 +0100 +++ b/libstdc++-v3/configure.host Thu Nov 25 19:41:55 2010 +0100 @@ -264,6 +264,13 @@ netbsd*) os_include_dir="os/bsd/netbsd" ;; + osf*) + os_include_dir="os/generic" + # libstdc++.so relies on emutls on Tru64 UNIX, which only works with the + # real functions implemented in libpthread.so, not with the dummies in + # libgcc, so always pass -lpthread. + OPT_LDFLAGS="${OPT_LDFLAGS} -lpthread" + ;; qnx6.[12]*) os_include_dir="os/qnx/qnx6.1" c_model=c