Bug 26532 - libmudflap failures on ia64
Summary: libmudflap failures on ia64
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.1.1
: P3 normal
Target Milestone: 4.1.1
Assignee: Paolo Carlini
URL:
Keywords: link-failure
Depends on:
Blocks:
 
Reported: 2006-03-02 19:22 UTC by H.J. Lu
Modified: 2006-03-12 16:57 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail: 4.0.3 4.1.0 4.2.0
Last reconfirmed: 2006-03-05 18:09:27


Attachments
Removal of _S_local_word_size (356 bytes, patch)
2006-03-05 20:14 UTC, Paolo Carlini
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description H.J. Lu 2006-03-02 19:22:16 UTC
From

http://gcc.gnu.org/ml/gcc-testresults/2006-03/msg00084.html

there are

		=== libmudflap tests ===


Running target unix
FAIL: libmudflap.c++/pass41-frag.cxx (test for excess errors)
WARNING: libmudflap.c++/pass41-frag.cxx compilation failed to produce executable
FAIL: libmudflap.c++/pass41-frag.cxx (-O) (test for excess errors)
WARNING: libmudflap.c++/pass41-frag.cxx (-O) compilation failed to produce executable
FAIL: libmudflap.c++/pass41-frag.cxx (-O2) (test for excess errors)
WARNING: libmudflap.c++/pass41-frag.cxx (-O2) compilation failed to produce executable
FAIL: libmudflap.c++/pass41-frag.cxx (-O3) (test for excess errors)
WARNING: libmudflap.c++/pass41-frag.cxx (-O3) compilation failed to produce executable
FAIL: ctors-12 linkage 
FAIL: ctors-21 linkage 
WARNING: program timed out.
FAIL: ctors-12 execution 
WARNING: program timed out.
FAIL: ctors-21 execution 
FAIL: ctors-12 linkage -static
FAIL: ctors-21 linkage -static
WARNING: program timed out.
FAIL: ctors-12 execution -static
WARNING: program timed out.
FAIL: ctors-21 execution -static
FAIL: ctors-12 linkage -O2
FAIL: ctors-21 linkage -O2
WARNING: program timed out.
FAIL: ctors-12 execution -O2
WARNING: program timed out.
FAIL: ctors-21 execution -O2
FAIL: ctors-12 linkage -O3
FAIL: ctors-21 linkage -O3
WARNING: program timed out.
FAIL: ctors-12 execution -O3
WARNING: program timed out.
FAIL: ctors-21 execution -O3

But Linux/x86 and Linux/x86-64 have no problems. The error message looks like

pass41-frag.o: In function `global constructors keyed to 0_main':/net/gnu-13/export/gnu/src/gcc-4.1-blended/gcc/libmudflap/testsuite/libmudflap.c++/pass41-frag.cxx:13: undefined reference to `std::ios_base::_S_local_word_size'
:/net/gnu-13/export/gnu/src/gcc-4.1-blended/gcc/libmudflap/testsuite/libmudflap.c++/pass41-frag.cxx:13: undefined reference to `std::ios_base::_S_local_word_size'
:/net/gnu-13/export/gnu/src/gcc-4.1-blended/gcc/libmudflap/testsuite/libmudflap.c++/pass41-frag.cxx:13: undefined reference to `std::__ios_flags::_S_trunc'
:/net/gnu-13/export/gnu/src/gcc-4.1-blended/gcc/libmudflap/testsuite/libmudflap.c++/pass41-frag.cxx:13: undefined reference to `std::__ios_flags::_S_trunc'
:/net/gnu-13/export/gnu/src/gcc-4.1-blended/gcc/libmudflap/testsuite/libmudflap.c++/pass41-frag.cxx:13: undefined reference to `std::__ios_flags::_S_out'
...

Those undefined symbols are from things like:

 struct __ios_flags
  {
    typedef short __int_type;

    static const __int_type _S_boolalpha = 0x0001;
    static const __int_type _S_dec = 0x0002;
    static const __int_type _S_fixed = 0x0004;
...

Mudflap generates

        .mii
        addl r35 = @ltoffx(_ZNSt11__ios_flags12_S_boolalphaE#), r1
        addl r38 = @ltoffx(.LC72), r1
        ;;
        nop 0
        .mmb
        ld8.mov r35 = [r35], _ZNSt11__ios_flags12_S_boolalphaE#
        ld8.mov r38 = [r38], .LC72
        br.call.sptk.many b0 = __mf_register#

I don't see why it should even bother. This problem doesn't exist in 4.2. Does
anyone know which patch fixes it?
Comment 1 Andrew Pinski 2006-03-05 15:54:18 UTC
One thing is that if libmudflap generates references to std::ios_base::_S_local_word_size and they are not in libstdc++, then libstdc++ is broken as this would be invalid C++.
Comment 2 H.J. Lu 2006-03-05 18:00:18 UTC
std::ios_base::_S_local_word_size is in libstdc++.so. But it is marked as
local via linker version script. It is true for x86, x86-64 and ia64.
Comment 3 Andrew Pinski 2006-03-05 18:03:55 UTC
Subject: Re:  [4.1]: libmudflap failures on ia64


On Mar 5, 2006, at 1:00 PM, hjl at lucon dot org wrote:

>
>
> ------- Comment #2 from hjl at lucon dot org  2006-03-05 18:00 -------
> std::ios_base::_S_local_word_size is in libstdc++.so. But it is marked 
> as
> local via linker version script. It is true for x86, x86-64 and ia64.

There is a bug in libstdc++ then.

Comment 4 Andrew Pinski 2006-03-05 18:09:10 UTC
Reduced testcase:
#include <iostream>
struct a : std::ios_base
{
 static const int*f;
};
const int *a::f = & std::ios_base::_S_local_word_size;
int main(void)
{
  return *a::f;
}
Comment 5 Paolo Carlini 2006-03-05 19:07:21 UTC
I would like to know why the original problem doesn't exist in 4.2. Because, in general, we don't want to export _S_local_word_size, only an implementation detail. In other terms, strictly speaking, the reduced testcase is invalid.
Comment 6 Paolo Carlini 2006-03-05 20:14:18 UTC
Created attachment 10973 [details]
Removal of _S_local_word_size
Comment 7 Paolo Carlini 2006-03-05 20:18:14 UTC
In yet other terms: I could easily apply the attached, without affecting the functionality of the library and binary compatibility. No, we don't want to export that symbol and the real reason of the link failure on those targets must be investigated first. 
Comment 8 Paolo Carlini 2006-03-06 13:17:57 UTC
Working on it.
Comment 9 paolo@gcc.gnu.org 2006-03-06 18:06:53 UTC
Subject: Bug 26532

Author: paolo
Date: Mon Mar  6 18:06:47 2006
New Revision: 111789

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=111789
Log:
2006-03-06  Paolo Carlini  <pcarlini@suse.de>

	PR target/26532
	* config/io/c_io_stdio.h (struct __ios_flags): Remove.
	* include/bits/ios_base.h: Adjust consistently.
	(ios_base::_S_local_word_size): Change to an anonymous enum.
	* src/ios.cc: Do not define static const data of __ios_flags,
	likewise for ios_base::_S_local_word_size.	
	* include/bits/locale_classes.h (locale::_S_categories_size):
	Change to an anonymous enum.
	* src/locale.cc: Don't define.

Modified:
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/config/io/c_io_stdio.h
    trunk/libstdc++-v3/include/bits/ios_base.h
    trunk/libstdc++-v3/include/bits/locale_classes.h
    trunk/libstdc++-v3/src/ios.cc
    trunk/libstdc++-v3/src/locale.cc

Comment 10 paolo@gcc.gnu.org 2006-03-12 16:56:13 UTC
Subject: Bug 26532

Author: paolo
Date: Sun Mar 12 16:56:08 2006
New Revision: 111979

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=111979
Log:
2006-03-12  Paolo Carlini  <pcarlini@suse.de>

	PR target/26532
	* config/io/c_io_stdio.h (struct __ios_flags): Remove.
	* include/bits/ios_base.h: Adjust consistently.
	(ios_base::_S_local_word_size): Change to an anonymous enum.
	* src/ios.cc: Do not define static const data of __ios_flags,
	likewise for ios_base::_S_local_word_size.	
	* include/bits/locale_classes.h (locale::_S_categories_size):
	Change to an anonymous enum.
	* src/locale.cc: Don't define.

Modified:
    branches/gcc-4_1-branch/libstdc++-v3/ChangeLog
    branches/gcc-4_1-branch/libstdc++-v3/config/io/c_io_stdio.h
    branches/gcc-4_1-branch/libstdc++-v3/include/bits/ios_base.h
    branches/gcc-4_1-branch/libstdc++-v3/include/bits/locale_classes.h
    branches/gcc-4_1-branch/libstdc++-v3/src/ios.cc
    branches/gcc-4_1-branch/libstdc++-v3/src/locale.cc

Comment 11 Paolo Carlini 2006-03-12 16:57:46 UTC
Fixed for 4.1.1.