Bug 35222 - [4.3/4.4 Regression] EH output contains procedure label without P' selector
Summary: [4.3/4.4 Regression] EH output contains procedure label without P' selector
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.3.0
: P4 normal
Target Milestone: 4.3.0
Assignee: Not yet assigned to anyone
URL:
Keywords: build
Depends on:
Blocks:
 
Reported: 2008-02-16 22:45 UTC by John David Anglin
Modified: 2008-03-05 01:11 UTC (History)
2 users (show)

See Also:
Host: hppa1.1-hp-hpux10.20
Target: hppa1.1-hp-hpux10.20
Build: hppa1.1-hp-hpux10.20
Known to work:
Known to fail:
Last reconfirmed: 2008-03-03 16:22:12


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description John David Anglin 2008-02-16 22:45:37 UTC
The link command for libstdc++.sl.6.10 fails:

libtool: link: /xxx/gnu/gcc/objdir/./gcc/xgcc -shared-libgcc -B/xxx/gnu/gcc/objdir/./gcc -nostdinc++ -L/xxx/gnu/gcc/objdir/hppa1.1-hp-hpux10.20/threads/libstdc++-v3/src -L/xxx/gnu/gcc/objdir/hppa1.1-hp-hpux10.20/threads/libstdc++-v3/src/.libs -B/opt/gnu/gcc/gcc-4.3.0/hppa1.1-hp-hpux10.20/bin/ -B/opt/gnu/gcc/gcc-4.3.0/hppa1.1-hp-hpux10.20/lib/ -isystem /opt/gnu/gcc/gcc-4.3.0/hppa1.1-hp-hpux10.20/include -isystem /opt/gnu/gcc/gcc-4.3.0/hppa1.1-hp-hpux10.20/sys-include  -threads -shared -nostdlib -fPIC -Wl,+h -Wl,libstdc++.sl.6 -Wl,+b -Wl,/opt/gnu/gcc/gcc-4.3.0/lib/threads -o .libs/libstdc++.sl.6.10   .libs/bitmap_allocator.o .libs/pool_allocator.o .libs/mt_allocator.o .libs/codecvt.o .libs/compatibility.o .libs/complex_io.o .libs/ctype.o .libs/debug.o .libs/functexcept.o .libs/hash.o .libs/hash_c++0x.o .libs/globals_io.o .libs/hashtable.o .libs/hashtable_c++0x.o .libs/ios.o .libs/ios_failure.o .libs/ios_init.o .libs/ios_locale.o .libs/limits.o .libs/list.o .libs/debug_list.o .libs/locale.o .libs/locale_init.o .libs/locale_facets.o .libs/localename.o .libs/stdexcept.o .libs/strstream.o .libs/system_error.o .libs/tree.o .libs/allocator-inst.o .libs/concept-inst.o .libs/fstream-inst.o .libs/ext-inst.o .libs/ios-inst.o .libs/iostream-inst.o .libs/istream-inst.o .libs/istream.o .libs/locale-inst.o .libs/misc-inst.o .libs/ostream-inst.o .libs/sstream-inst.o .libs/streambuf-inst.o .libs/streambuf.o .libs/string-inst.o .libs/valarray-inst.o .libs/wlocale-inst.o .libs/wstring-inst.o .libs/atomicity.o .libs/codecvt_members.o .libs/collate_members.o .libs/ctype_members.o .libs/messages_members.o .libs/monetary_members.o .libs/numeric_members.o .libs/time_members.o .libs/basic_file.o .libs/c++locale.o   .libs/libstdc++.lax/libmath.a/stubs.o .libs/libstdc++.lax/libmath.a/signbit.o .libs/libstdc++.lax/libmath.a/signbitf.o  .libs/libstdc++.lax/libsupc++convenience.a/array_type_info.o .libs/libstdc++.lax/libsupc++convenience.a/atexit_arm.o .libs/libstdc++.lax/libsupc++convenience.a/bad_cast.o .libs/libstdc++.lax/libsupc++convenience.a/bad_typeid.o .libs/libstdc++.lax/libsupc++convenience.a/class_type_info.o .libs/libstdc++.lax/libsupc++convenience.a/del_op.o .libs/libstdc++.lax/libsupc++convenience.a/del_opnt.o .libs/libstdc++.lax/libsupc++convenience.a/del_opv.o .libs/libstdc++.lax/libsupc++convenience.a/del_opvnt.o .libs/libstdc++.lax/libsupc++convenience.a/dyncast.o .libs/libstdc++.lax/libsupc++convenience.a/eh_alloc.o .libs/libstdc++.lax/libsupc++convenience.a/eh_arm.o .libs/libstdc++.lax/libsupc++convenience.a/eh_aux_runtime.o .libs/libstdc++.lax/libsupc++convenience.a/eh_call.o .libs/libstdc++.lax/libsupc++convenience.a/eh_catch.o .libs/libstdc++.lax/libsupc++convenience.a/eh_exception.o .libs/libstdc++.lax/libsupc++convenience.a/eh_globals.o .libs/libstdc++.lax/libsupc++convenience.a/eh_personality.o .libs/libstdc++.lax/libsupc++convenience.a/eh_term_handler.o .libs/libstdc++.lax/libsupc++convenience.a/eh_terminate.o .libs/libstdc++.lax/libsupc++convenience.a/eh_throw.o .libs/libstdc++.lax/libsupc++convenience.a/eh_type.o .libs/libstdc++.lax/libsupc++convenience.a/eh_unex_handler.o .libs/libstdc++.lax/libsupc++convenience.a/enum_type_info.o .libs/libstdc++.lax/libsupc++convenience.a/function_type_info.o .libs/libstdc++.lax/libsupc++convenience.a/fundamental_type_info.o .libs/libstdc++.lax/libsupc++convenience.a/guard.o .libs/libstdc++.lax/libsupc++convenience.a/new_handler.o .libs/libstdc++.lax/libsupc++convenience.a/new_op.o .libs/libstdc++.lax/libsupc++convenience.a/new_opnt.o .libs/libstdc++.lax/libsupc++convenience.a/new_opv.o .libs/libstdc++.lax/libsupc++convenience.a/new_opvnt.o .libs/libstdc++.lax/libsupc++convenience.a/pbase_type_info.o .libs/libstdc++.lax/libsupc++convenience.a/pmem_type_info.o .libs/libstdc++.lax/libsupc++convenience.a/pointer_type_info.o .libs/libstdc++.lax/libsupc++convenience.a/pure.o .libs/libstdc++.lax/libsupc++convenience.a/si_class_type_info.o .libs/libstdc++.lax/libsupc++convenience.a/tinfo.o .libs/libstdc++.lax/libsupc++convenience.a/tinfo2.o .libs/libstdc++.lax/libsupc++convenience.a/vec.o .libs/libstdc++.lax/libsupc++convenience.a/vmi_class_type_info.o .libs/libstdc++.lax/libsupc++convenience.a/vterminate.o .libs/libstdc++.lax/libsupc++convenience.a/cp-demangle.o   -L/xxx/gnu/gcc/objdir/hppa1.1-hp-hpux10.20/threads/libstdc++-v3/src -L/xxx/gnu/gcc/objdir/hppa1.1-hp-hpux10.20/threads/libstdc++-v3/src/.libs -lm -L/xxx/gnu/gcc/objdir/./gcc/threads -L/xxx/gnu/gcc/objdir/./gcc -L/usr/ccs/lib -L/opt/langtools/lib -lgcc_s   -threads -threads  -threads  -threads  -threads  -threads
/usr/ccs/bin/ld: Procedure labels require the P' selector - use the P' selector on code symbol "$CODE$" in file .libs/pool_allocator.o
collect2: ld returned 1 exit status
make[8]: *** [libstdc++.la] Error 1

Looking at the assembler output for pool_allocator.cc, I see the following:

        .SPACE $PRIVATE$
        .SUBSPA $DATA$

        .align 4
        .EXPORT _GLOBAL__F_.._.._.._.._.._gcc_libstdc___v3_src_pool_allocator.cc
_79739C6C_A6218F4D,DATA
_GLOBAL__F_.._.._.._.._.._gcc_libstdc___v3_src_pool_allocator.cc_79739C6C_A6218F
4D:
L$frame0001:
        .word   L$ECIE0001-L$SCIE0001
L$SCIE0001:
        .word   0x0
        .byte   0x1
        .STRING "zPL\x00"
        .uleb128 0x1
        .sleb128 4
        .byte   0x2
        .uleb128 0x8
        .byte   0x50
        .align 4
        .word   P%__gxx_personality_v0
        .byte   0x0
        .byte   0xc
        .uleb128 0x1e
        .uleb128 0x0
        .align 4
L$ECIE0001:
L$SFDE0005:
        .word   L$EFDE0005-L$ASFDE0005
L$ASFDE0005:
        .word   L$ASFDE0005-L$frame0001
        .word   L$FB0098
        .word   L$FE0098-L$FB0098
        .uleb128 0x4
	   ...

L$FB0098 is a function label:

        .SPACE $TEXT$
        .NSUBSPA $CODE$
        .align 4
        .EXPORT _ZN9__gnu_cxx17__pool_alloc_base16_M_get_free_listEj,ENTRY,PRIV_
LEV=3,ARGW0=GR,ARGW1=GR,RTNVAL=GR
L$FB0098:
_ZN9__gnu_cxx17__pool_alloc_base16_M_get_free_listEj:
        .PROC
        .CALLINFO FRAME=0,NO_CALLS
        .ENTRY
        ldo 7(%r25),%r28

This is the cause of the error.  I'm not sure why we are missing
the P' selector in 4.3, but this works in 4.2.
Comment 1 John David Anglin 2008-02-16 23:37:12 UTC
Breakpoint 3, dw2_asm_output_encoded_addr_rtx (encoding=0, addr=0x7ab0fdd0,
    public=0 '\000', comment=0x5792c "FDE initial location")
    at ../../gcc/gcc/dwarf2asm.c:841
841       if (encoding == DW_EH_PE_aligned)
(gdb) p debug_rtx (addr)
(symbol_ref:SI ("*L$FB0098") [flags 0x2])

The encoding seems wrong.  Expected DW_EH_PE_aligned.
Comment 2 dave 2008-02-17 03:29:02 UTC
Subject: Re:  [4.3 Regression] EH output contains procedure label without P' selector

> The encoding seems wrong.  Expected DW_EH_PE_aligned.

Actually, the encoding is correct.  The procedure label error
only occurs is the symbol is an unsat.  This might might occur
if we have EH data for a function that has been eliminated.

Dave
Comment 3 Richard Biener 2008-02-17 15:58:54 UTC
Does this also fail for hppa2.0w-hp-hpux11.11 which would be a secondary target
unlike hppa1.1-hp-hpux10.20 which is neither primary nor secondary?
Comment 4 dave 2008-02-17 16:45:04 UTC
Subject: Re:  [4.3 Regression] EH output contains procedure label without P' selector

> Does this also fail for hppa2.0w-hp-hpux11.11 which would be a secondary target
> unlike hppa1.1-hp-hpux10.20 which is neither primary nor secondary?

It doesn't affect hppa2.0w-hp-hpux11.11.  There is a difference in the
methods used to achieve one-only support.  hppa2.0w-hp-hpux11.11 uses
secondary definitions and hppa1.1-hp-hpux10.20 COMDAT subspaces.

My current understanding of the problem is that the error occurs
when a COMDAT subspace is not used.  This leads to the situation
where the local symbols referenced in the EH data no longer are
satisfied.  It's still a puzzle as to why this didn't appear before.

I'm testing a one line fix to the encoding to add the P' descriptor.
This isn't exactly obvious as normally when the P' descriptor is used
the pointer ends up pointing to a function descriptor rather than
to the label in the code.  However, in this case, the labels are
local and not exported.  I think the linker is smart enough in this
case to create a direct pointer.  I'm hoping in the COMDAT case that
a function descriptor will be created and there won't be problems
with unresolved symbols.

If the above doesn't work, I have a small change to config.gcc to
force sjlj exception suport.

I've been trying to test the above change but hit the libstdc++
breakage on head.  I have had one successful build with the change
on hppa64-hp-hpux11.11 using 4.2.4.  libstdc++ builds with the
change on hppa2.0w-hp-hpux11.11 on head.  Unfortunately, my
hppa1.1-hp-hpux10.20 system is somewhat slow and I'm just restarting
the build there.  I'm also testing with 11.00.

Dave
Comment 5 dave 2008-03-03 16:33:48 UTC
Subject: Re:  [4.3/4.4 Regression] EH output contains procedure label without P' selector

The same fail occurs on hpux11 if I disable the use of secondary
definition symbols for one-only support.

Have tested all the alternatives that I can think of for the EH
encoding (pc-relative, indirect through function descriptor, etc)
and they all lead to linker warnings and segmentation faults linking
shared libraries.  So, I believe that the only viable work around
is to force the use of sjlj exceptions.

I'm testing a patch to configure.ac to do this and will submit as
soon as I know that libstdc++ links successfully..

Dave
Comment 6 John David Anglin 2008-03-04 23:31:37 UTC
Subject: Bug 35222

Author: danglin
Date: Tue Mar  4 23:30:47 2008
New Revision: 132876

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=132876
Log:
	PR target/35222
	* configure.ac (CONFIG_SJLJ_EXCEPTIONS): Force SJLJ exceptions
	on hpux10.
	* configure: Rebuilt.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/configure
    trunk/gcc/configure.ac

Comment 7 John David Anglin 2008-03-04 23:39:49 UTC
Subject: Bug 35222

Author: danglin
Date: Tue Mar  4 23:39:11 2008
New Revision: 132877

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=132877
Log:
	PR target/35222
	* configure.ac (CONFIG_SJLJ_EXCEPTIONS): Force SJLJ exceptions
	on hpux10.
	* configure: Rebuilt.


Modified:
    branches/gcc-4_3-branch/gcc/ChangeLog
    branches/gcc-4_3-branch/gcc/configure
    branches/gcc-4_3-branch/gcc/configure.ac

Comment 8 John David Anglin 2008-03-05 01:11:50 UTC
Patch to force use of sjlj applied to trunk and 4.3.
Comment 9 John David Anglin 2008-03-12 00:57:25 UTC
Subject: Bug 35222

Author: danglin
Date: Wed Mar 12 00:56:34 2008
New Revision: 133131

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=133131
Log:
	PR target/35222
	* configure.ac (CONFIG_SJLJ_EXCEPTIONS): Force SJLJ exceptions
	on hpux10.
	* configure: Rebuilt.


Modified:
    branches/gcc-4_2-branch/gcc/ChangeLog
    branches/gcc-4_2-branch/gcc/configure
    branches/gcc-4_2-branch/gcc/configure.ac