Patchwork use -fno-pie on darwin in boehm-gc.exp

login
register
mail settings
Submitter Jack Howarth
Date Dec. 8, 2011, 3:38 p.m.
Message ID <20111208153855.GA8678@bromo.med.uc.edu>
Download mbox | patch
Permalink /patch/130187/
State New
Headers show

Comments

Jack Howarth - Dec. 8, 2011, 3:38 p.m.
Currently the boehm-gc testsuite fails...

FAIL: boehm-gc.c/gctest.c -O2 execution test
FAIL: boehm-gc.c/leak_test.c -O2 execution test
FAIL: boehm-gc.c/thread_leak_test.c -O2 execution test
FAIL: boehm-gc.lib/staticrootstest.c -O2 execution test

on x86_64-apple-darwin11 due to the -pie linker default. The attached patch
uses -fno-pie on darwin to insure that -no_pie is passed to the linker when
targeting darwin11 or later. This approach is used because istarget doesn't
support complex regex to allow -Wl,-no_pie to be passed for darwin11 and later
only (since only recent Xcode releases understand the -no_pie linker option).
Also, -fno_pie has the advantage of supporting -mmacosx-version-min usage.
Regression tested on x86_64-apple-darwin11...

http://gcc.gnu.org/ml/gcc-testresults/2011-12/msg00856.html

Okay for gcc trunk?
                 Jack


boehm-gc/

2011-12-08  Jack Howarth <howarth@bromo.med.uc.edu>

        * testsuite/lib/boehm-gc.exp: Use -fno-pie on darwin.
IainS - Dec. 8, 2011, 3:54 p.m.
On 8 Dec 2011, at 15:38, Jack Howarth wrote:

> Currently the boehm-gc testsuite fails...
>
> FAIL: boehm-gc.c/gctest.c -O2 execution test
> FAIL: boehm-gc.c/leak_test.c -O2 execution test
> FAIL: boehm-gc.c/thread_leak_test.c -O2 execution test
> FAIL: boehm-gc.lib/staticrootstest.c -O2 execution test

you have not answered these questions:

a) "what is anything being built in these tests which is not PIC"?
b) and why is it being built that way?

ISTM the fix below should not be required
- and the problem lies in something being built with -mdynamic-no-pic  
or similar

- that is what we should fix.
cheers
Iain

>
> on x86_64-apple-darwin11 due to the -pie linker default. The  
> attached patch
> uses -fno-pie on darwin to insure that -no_pie is passed to the  
> linker when
> targeting darwin11 or later. This approach is used because istarget  
> doesn't
> support complex regex to allow -Wl,-no_pie to be passed for darwin11  
> and later
> only (since only recent Xcode releases understand the -no_pie linker  
> option).
> Also, -fno_pie has the advantage of supporting -mmacosx-version-min  
> usage.
> Regression tested on x86_64-apple-darwin11...
>
> http://gcc.gnu.org/ml/gcc-testresults/2011-12/msg00856.html
>
> Okay for gcc trunk?
>                 Jack
>
>
> boehm-gc/
>
> 2011-12-08  Jack Howarth <howarth@bromo.med.uc.edu>
>
>        * testsuite/lib/boehm-gc.exp: Use -fno-pie on darwin.
>
> Index: boehm-gc/testsuite/lib/boehm-gc.exp
> ===================================================================
> --- boehm-gc/testsuite/lib/boehm-gc.exp	(revision 182117)
> +++ boehm-gc/testsuite/lib/boehm-gc.exp	(working copy)
> @@ -214,6 +214,11 @@ proc boehm-gc_target_compile { source de
>     lappend options "additional_flags=-I${gc_include} -I${srcdir}/../ 
> include"
>     lappend options "additional_flags=${threadcflags}"
>
> +    # Disable -pie linker default for darwin11 and later using -fno- 
> pie.
> +    if { [istarget *-*-darwin*] } {
> +	lappend options "additional_flags=-fno-pie"
> +    }
> +
>     lappend options "libs=-Wc,-shared-libgcc"
>
>     if { [file extension $dest] == ".la" } {
Mike Stump - Dec. 8, 2011, 4:24 p.m.
On Dec 8, 2011, at 7:38 AM, Jack Howarth <howarth@bromo.med.uc.edu> wrote:
> Currently the boehm-gc testsuite fails...
> 
> FAIL: boehm-gc.c/gctest.c -O2 execution test
> FAIL: boehm-gc.c/leak_test.c -O2 execution test
> FAIL: boehm-gc.c/thread_leak_test.c -O2 execution test
> FAIL: boehm-gc.lib/staticrootstest.c -O2 execution test

> Okay for gcc trunk?

Ok.
Rainer Orth - Dec. 8, 2011, 4:30 p.m.
Iain Sandoe <developer@sandoe-acoustics.co.uk> writes:

> On 8 Dec 2011, at 15:38, Jack Howarth wrote:
>
>> Currently the boehm-gc testsuite fails...
>>
>> FAIL: boehm-gc.c/gctest.c -O2 execution test
>> FAIL: boehm-gc.c/leak_test.c -O2 execution test
>> FAIL: boehm-gc.c/thread_leak_test.c -O2 execution test
>> FAIL: boehm-gc.lib/staticrootstest.c -O2 execution test
>
> you have not answered these questions:
>
> a) "what is anything being built in these tests which is not PIC"?
> b) and why is it being built that way?
>
> ISTM the fix below should not be required
> - and the problem lies in something being built with -mdynamic-no-pic or
> similar
>
> - that is what we should fix.

Agreed.  We shouldn't spread target-specific code like this all over the
testsuite.

	Rainer
Jack Howarth - Dec. 8, 2011, 4:58 p.m.
On Thu, Dec 08, 2011 at 03:54:35PM +0000, Iain Sandoe wrote:
>
> On 8 Dec 2011, at 15:38, Jack Howarth wrote:
>
>> Currently the boehm-gc testsuite fails...
>>
>> FAIL: boehm-gc.c/gctest.c -O2 execution test
>> FAIL: boehm-gc.c/leak_test.c -O2 execution test
>> FAIL: boehm-gc.c/thread_leak_test.c -O2 execution test
>> FAIL: boehm-gc.lib/staticrootstest.c -O2 execution test
>
> you have not answered these questions:
>
> a) "what is anything being built in these tests which is not PIC"?
> b) and why is it being built that way?
>
> ISTM the fix below should not be required
> - and the problem lies in something being built with -mdynamic-no-pic or 
> similar

Nothing in boehm-gc is built non-PIC (see the attached log for boehm-gc).
Likewise nothing in the testsuite is built non-PIC. For example, gctest.c
at -O2 is built, according to -v, as...

 /sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/gcc/cc1 -quiet -v -I /sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/x86_64-apple-darwin11.2.0/./boehm-gc/include -I /sw/src/fink.build/gcc47-4.7.0-1/gcc-4.7-20111207/boehm-gc/testsuite/../include -iprefix /sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/gcc/../lib/gcc/x86_64-apple-darwin11.2.0/4.7.0/ -isystem /sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/gcc/include -isystem /sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/gcc/include-fixed -D__DYNAMIC__ /sw/src/fink.build/gcc47-4.7.0-1/gcc-4.7-20111207/boehm-gc/testsuite/boehm-gc.c/gctest.c -fPIC -quiet -dumpbase gctest.c -mmacosx-version-min=10.7.2 -mtune=core2 -auxbase gctest -O2 -version -o /var/tmp//ccgHCNRC.s

The test is also just linked to the the libgcjgcj built in boehm-gc...

/sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/gcc/collect-ld -dynamic -arch x86_64 -macosx_version_min 10.7.2 -weak_reference_mismatches non-weak -o ./.libs/gctest -lcrt1.10.6.o -L/sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/gcc /var/tmp//ccb3OaQl.o /sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/x86_64-apple-darwin11.2.0/./boehm-gc/.libs/libgcjgc.dylib -no_compact_unwind -lSystem -lgcc_ext.10.5 -lgcc -lSystem -v

so the build in boehm-gc appears to be self-contained.

>
> - that is what we should fix.
> cheers
> Iain
>
>>
>> on x86_64-apple-darwin11 due to the -pie linker default. The attached 
>> patch
>> uses -fno-pie on darwin to insure that -no_pie is passed to the linker 
>> when
>> targeting darwin11 or later. This approach is used because istarget  
>> doesn't
>> support complex regex to allow -Wl,-no_pie to be passed for darwin11  
>> and later
>> only (since only recent Xcode releases understand the -no_pie linker  
>> option).
>> Also, -fno_pie has the advantage of supporting -mmacosx-version-min  
>> usage.
>> Regression tested on x86_64-apple-darwin11...
>>
>> http://gcc.gnu.org/ml/gcc-testresults/2011-12/msg00856.html
>>
>> Okay for gcc trunk?
>>                 Jack
>>
>>
>> boehm-gc/
>>
>> 2011-12-08  Jack Howarth <howarth@bromo.med.uc.edu>
>>
>>        * testsuite/lib/boehm-gc.exp: Use -fno-pie on darwin.
>>
>> Index: boehm-gc/testsuite/lib/boehm-gc.exp
>> ===================================================================
>> --- boehm-gc/testsuite/lib/boehm-gc.exp	(revision 182117)
>> +++ boehm-gc/testsuite/lib/boehm-gc.exp	(working copy)
>> @@ -214,6 +214,11 @@ proc boehm-gc_target_compile { source de
>>     lappend options "additional_flags=-I${gc_include} -I${srcdir}/../ 
>> include"
>>     lappend options "additional_flags=${threadcflags}"
>>
>> +    # Disable -pie linker default for darwin11 and later using -fno- 
>> pie.
>> +    if { [istarget *-*-darwin*] } {
>> +	lappend options "additional_flags=-fno-pie"
>> +    }
>> +
>>     lappend options "libs=-Wc,-shared-libgcc"
>>
>>     if { [file extension $dest] == ".la" } {
IainS - Dec. 8, 2011, 5:05 p.m.
On 8 Dec 2011, at 16:58, Jack Howarth wrote:

> On Thu, Dec 08, 2011 at 03:54:35PM +0000, Iain Sandoe wrote:
>>
>> On 8 Dec 2011, at 15:38, Jack Howarth wrote:
>>
>>> Currently the boehm-gc testsuite fails...
>>>
>>> FAIL: boehm-gc.c/gctest.c -O2 execution test
>>> FAIL: boehm-gc.c/leak_test.c -O2 execution test
>>> FAIL: boehm-gc.c/thread_leak_test.c -O2 execution test
>>> FAIL: boehm-gc.lib/staticrootstest.c -O2 execution test
>>
>> you have not answered these questions:
>>
>> a) "what is anything being built in these tests which is not PIC"?
>> b) and why is it being built that way?
>>
>> ISTM the fix below should not be required
>> - and the problem lies in something being built with -mdynamic-no- 
>> pic or
>> similar
>
> Nothing in boehm-gc is built non-PIC (see the attached log for boehm- 
> gc).
> Likewise nothing in the testsuite is built non-PIC. For example,  
> gctest.c
> at -O2 is built, according to -v, as...
>
> /sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/gcc/cc1 -quiet -v -I / 
> sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/x86_64-apple- 
> darwin11.2.0/./boehm-gc/include -I /sw/src/fink.build/gcc47-4.7.0-1/ 
> gcc-4.7-20111207/boehm-gc/testsuite/../include -iprefix /sw/src/ 
> fink.build/gcc47-4.7.0-1/darwin_objdir/gcc/../lib/gcc/x86_64-apple- 
> darwin11.2.0/4.7.0/ -isystem /sw/src/fink.build/gcc47-4.7.0-1/ 
> darwin_objdir/gcc/include -isystem /sw/src/fink.build/gcc47-4.7.0-1/ 
> darwin_objdir/gcc/include-fixed -D__DYNAMIC__ /sw/src/fink.build/ 
> gcc47-4.7.0-1/gcc-4.7-20111207/boehm-gc/testsuite/boehm-gc.c/ 
> gctest.c -fPIC -quiet -dumpbase gctest.c -mmacosx-version-min=10.7.2  
> -mtune=core2 -auxbase gctest -O2 -version -o /var/tmp//ccgHCNRC.s
>
> The test is also just linked to the the libgcjgcj built in boehm-gc...
>
> /sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/gcc/collect-ld - 
> dynamic -arch x86_64 -macosx_version_min 10.7.2 - 
> weak_reference_mismatches non-weak -o ./.libs/gctest -lcrt1.10.6.o - 
> L/sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/gcc /var/tmp// 
> ccb3OaQl.o /sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/x86_64- 
> apple-darwin11.2.0/./boehm-gc/.libs/libgcjgc.dylib - 
> no_compact_unwind -lSystem -lgcc_ext.10.5 -lgcc -lSystem -v
>
> so the build in boehm-gc appears to be self-contained.

OK- so it appears ...
... so why is ld complaining that there's non-PIC code present?

if it's a tool bug, then we should XFAIL the tests ...

cheers
Iain

>> - that is what we should fix.
>> cheers
>> Iain
>>
>>>
>>> on x86_64-apple-darwin11 due to the -pie linker default. The  
>>> attached
>>> patch
>>> uses -fno-pie on darwin to insure that -no_pie is passed to the  
>>> linker
>>> when
>>> targeting darwin11 or later. This approach is used because istarget
>>> doesn't
>>> support complex regex to allow -Wl,-no_pie to be passed for darwin11
>>> and later
>>> only (since only recent Xcode releases understand the -no_pie linker
>>> option).
>>> Also, -fno_pie has the advantage of supporting -mmacosx-version-min
>>> usage.
>>> Regression tested on x86_64-apple-darwin11...
>>>
>>> http://gcc.gnu.org/ml/gcc-testresults/2011-12/msg00856.html
>>>
>>> Okay for gcc trunk?
>>>                Jack
>>>
>>>
>>> boehm-gc/
>>>
>>> 2011-12-08  Jack Howarth <howarth@bromo.med.uc.edu>
>>>
>>>       * testsuite/lib/boehm-gc.exp: Use -fno-pie on darwin.
>>>
>>> Index: boehm-gc/testsuite/lib/boehm-gc.exp
>>> ===================================================================
>>> --- boehm-gc/testsuite/lib/boehm-gc.exp	(revision 182117)
>>> +++ boehm-gc/testsuite/lib/boehm-gc.exp	(working copy)
>>> @@ -214,6 +214,11 @@ proc boehm-gc_target_compile { source de
>>>    lappend options "additional_flags=-I${gc_include} -I${srcdir}/../
>>> include"
>>>    lappend options "additional_flags=${threadcflags}"
>>>
>>> +    # Disable -pie linker default for darwin11 and later using - 
>>> fno-
>>> pie.
>>> +    if { [istarget *-*-darwin*] } {
>>> +	lappend options "additional_flags=-fno-pie"
>>> +    }
>>> +
>>>    lappend options "libs=-Wc,-shared-libgcc"
>>>
>>>    if { [file extension $dest] == ".la" } {
> <boehm-gc.log.bz2>
Jack Howarth - Dec. 8, 2011, 5:24 p.m.
On Thu, Dec 08, 2011 at 05:05:12PM +0000, Iain Sandoe wrote:
>
> On 8 Dec 2011, at 16:58, Jack Howarth wrote:
>
>> On Thu, Dec 08, 2011 at 03:54:35PM +0000, Iain Sandoe wrote:
>>>
>>> On 8 Dec 2011, at 15:38, Jack Howarth wrote:
>>>
>>>> Currently the boehm-gc testsuite fails...
>>>>
>>>> FAIL: boehm-gc.c/gctest.c -O2 execution test
>>>> FAIL: boehm-gc.c/leak_test.c -O2 execution test
>>>> FAIL: boehm-gc.c/thread_leak_test.c -O2 execution test
>>>> FAIL: boehm-gc.lib/staticrootstest.c -O2 execution test
>>>
>>> you have not answered these questions:
>>>
>>> a) "what is anything being built in these tests which is not PIC"?
>>> b) and why is it being built that way?
>>>
>>> ISTM the fix below should not be required
>>> - and the problem lies in something being built with -mdynamic-no- 
>>> pic or
>>> similar
>>
>> Nothing in boehm-gc is built non-PIC (see the attached log for boehm- 
>> gc).
>> Likewise nothing in the testsuite is built non-PIC. For example,  
>> gctest.c
>> at -O2 is built, according to -v, as...
>>
>> /sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/gcc/cc1 -quiet -v -I / 
>> sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/x86_64-apple- 
>> darwin11.2.0/./boehm-gc/include -I /sw/src/fink.build/gcc47-4.7.0-1/ 
>> gcc-4.7-20111207/boehm-gc/testsuite/../include -iprefix /sw/src/ 
>> fink.build/gcc47-4.7.0-1/darwin_objdir/gcc/../lib/gcc/x86_64-apple- 
>> darwin11.2.0/4.7.0/ -isystem /sw/src/fink.build/gcc47-4.7.0-1/ 
>> darwin_objdir/gcc/include -isystem /sw/src/fink.build/gcc47-4.7.0-1/ 
>> darwin_objdir/gcc/include-fixed -D__DYNAMIC__ /sw/src/fink.build/ 
>> gcc47-4.7.0-1/gcc-4.7-20111207/boehm-gc/testsuite/boehm-gc.c/gctest.c 
>> -fPIC -quiet -dumpbase gctest.c -mmacosx-version-min=10.7.2  
>> -mtune=core2 -auxbase gctest -O2 -version -o /var/tmp//ccgHCNRC.s
>>
>> The test is also just linked to the the libgcjgcj built in boehm-gc...
>>
>> /sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/gcc/collect-ld -dynamic 
>> -arch x86_64 -macosx_version_min 10.7.2 -weak_reference_mismatches 
>> non-weak -o ./.libs/gctest -lcrt1.10.6.o - 
>> L/sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/gcc /var/tmp// 
>> ccb3OaQl.o /sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/x86_64- 
>> apple-darwin11.2.0/./boehm-gc/.libs/libgcjgc.dylib -no_compact_unwind 
>> -lSystem -lgcc_ext.10.5 -lgcc -lSystem -v
>>
>> so the build in boehm-gc appears to be self-contained.
>
> OK- so it appears ...
> ... so why is ld complaining that there's non-PIC code present?

Where do you see ld complaining of non-PIC code?

Running target unix
Using /sw/share/dejagnu/baseboards/unix.exp as board description file for target.
Using /sw/share/dejagnu/config/unix.exp as generic interface file for target.
Using /sw/src/fink.build/gcc47-4.7.0-1/gcc-4.7-20111207/boehm-gc/testsuite/config/default.exp as tool-and-target-specific interface file.
Running /sw/src/fink.build/gcc47-4.7.0-1/gcc-4.7-20111207/boehm-gc/testsuite/boehm-gc.c/c.exp ...
set_ld_library_path_env_vars: ld_library_path=.:/sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/gcc:/sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/x86_64-apple-darwin11.2.0/./boehm-gc/.libs:.libs
Executing on host: ../libtool --silent --tag=CC --mode=link  /sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/gcc/xgcc -B/sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/gcc/ /sw/src/fink.build/gcc47-4.7.0-1/gcc-4.7-20111207/boehm-gc/testsuite/boehm-gc.c/gctest.c /sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/x86_64-apple-darwin11.2.0/./boehm-gc/libgcjgc.la  -O2  -I/sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/x86_64-apple-darwin11.2.0/./boehm-gc/include -I/sw/src/fink.build/gcc47-4.7.0-1/gcc-4.7-20111207/boehm-gc/testsuite/../include   -Wc,-shared-libgcc -lpthread -lm   -o ./gctest    (timeout = 300)
PASS: boehm-gc.c/gctest.c -O2 (test for excess errors)
Setting LD_LIBRARY_PATH to .:/sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/gcc:/sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/x86_64-apple-darwin11.2.0/./boehm-gc/.libs:.libs:.:/sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/gcc:/sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/x86_64-apple-darwin11.2.0/./boehm-gc/.libs:.libs
FAIL: boehm-gc.c/gctest.c -O2 execution test

which shows no warnings...

../libtool --silent --tag=CC --mode=link  /sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/gcc/xgcc -B/sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/gcc/ /sw/src/fink.build/gcc47-4.7.0-1/gcc-4.7-20111207/boehm-gc/testsuite/boehm-gc.c/gctest.c /sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/x86_64-apple-darwin11.2.0/./boehm-gc/libgcjgc.la  -O2  -I/sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/x86_64-apple-darwin11.2.0/./boehm-gc/include -I/sw/src/fink.build/gcc47-4.7.0-1/gcc-4.7-20111207/boehm-gc/testsuite/../include   -Wc,-shared-libgcc -lpthread -lm  -v  -o ./gctest
Reading specs from /sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/gcc/specs
COLLECT_GCC=/sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/gcc/xgcc
COLLECT_LTO_WRAPPER=/sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/gcc/lto-wrapper
Target: x86_64-apple-darwin11.2.0
Configured with: ../gcc-4.7-20111207/configure --prefix=/sw --prefix=/sw/lib/gcc4.7 --mandir=/sw/share/man --infodir=/sw/lib/gcc4.7/info --with-build-config=bootstrap-lto --enable-stage1-languages=c,lto --enable-languages=c,c++,fortran,lto,objc,obj-c++,java --with-gmp=/sw --with-libiconv-prefix=/sw --with-ppl=/sw --with-cloog=/sw --with-mpc=/sw --with-system-zlib --x-includes=/usr/X11R6/include --x-libraries=/usr/X11R6/lib --program-suffix=-fsf-4.7 --enable-checking=yes --enable-cloog-backend=isl
Thread model: posix
gcc version 4.7.0 20111207 (experimental) (GCC) 
COLLECT_GCC_OPTIONS='-mmacosx-version-min=10.7.2' '-B' '/sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/gcc/' '-O2' '-I' '/sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/x86_64-apple-darwin11.2.0/./boehm-gc/include' '-I' '/sw/src/fink.build/gcc47-4.7.0-1/gcc-4.7-20111207/boehm-gc/testsuite/../include' '-shared-libgcc' '-v' '-o' './.libs/gctest' '-mtune=core2'
 /sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/gcc/cc1 -quiet -v -I /sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/x86_64-apple-darwin11.2.0/./boehm-gc/include -I /sw/src/fink.build/gcc47-4.7.0-1/gcc-4.7-20111207/boehm-gc/testsuite/../include -iprefix /sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/gcc/../lib/gcc/x86_64-apple-darwin11.2.0/4.7.0/ -isystem /sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/gcc/include -isystem /sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/gcc/include-fixed -D__DYNAMIC__ /sw/src/fink.build/gcc47-4.7.0-1/gcc-4.7-20111207/boehm-gc/testsuite/boehm-gc.c/gctest.c -fPIC -quiet -dumpbase gctest.c -mmacosx-version-min=10.7.2 -mtune=core2 -auxbase gctest -O2 -version -o /var/tmp//ccJtQ5Pa.s
GNU C (GCC) version 4.7.0 20111207 (experimental) (x86_64-apple-darwin11.2.0)
	compiled by GNU C version 4.7.0 20111207 (experimental), GMP version 5.0.2, MPFR version 3.1.0, MPC version 0.9
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
ignoring nonexistent directory "/sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/gcc/../lib/gcc/x86_64-apple-darwin11.2.0/4.7.0/include"
ignoring nonexistent directory "/sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/gcc/../lib/gcc/x86_64-apple-darwin11.2.0/4.7.0/include-fixed"
ignoring nonexistent directory "/sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/gcc/../lib/gcc/x86_64-apple-darwin11.2.0/4.7.0/../../../../x86_64-apple-darwin11.2.0/include"
ignoring nonexistent directory "/sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/gcc/../lib/gcc/../../lib/gcc/x86_64-apple-darwin11.2.0/4.7.0/include"
ignoring nonexistent directory "/usr/local/include"
ignoring nonexistent directory "/sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/gcc/../lib/gcc/../../include"
ignoring nonexistent directory "/sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/gcc/../lib/gcc/../../lib/gcc/x86_64-apple-darwin11.2.0/4.7.0/include-fixed"
ignoring nonexistent directory "/sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/gcc/../lib/gcc/../../lib/gcc/x86_64-apple-darwin11.2.0/4.7.0/../../../../x86_64-apple-darwin11.2.0/include"
#include "..." search starts here:
#include <...> search starts here:
 /sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/x86_64-apple-darwin11.2.0/./boehm-gc/include
 /sw/src/fink.build/gcc47-4.7.0-1/gcc-4.7-20111207/boehm-gc/testsuite/../include
 /sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/gcc/include
 /sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/gcc/include-fixed
 /usr/include
 /System/Library/Frameworks
 /Library/Frameworks
End of search list.
GNU C (GCC) version 4.7.0 20111207 (experimental) (x86_64-apple-darwin11.2.0)
	compiled by GNU C version 4.7.0 20111207 (experimental), GMP version 5.0.2, MPFR version 3.1.0, MPC version 0.9
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
Compiler executable checksum: d717e692788ee15b8ed2ea38e31fce4d
COLLECT_GCC_OPTIONS='-mmacosx-version-min=10.7.2' '-B' '/sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/gcc/' '-O2' '-I' '/sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/x86_64-apple-darwin11.2.0/./boehm-gc/include' '-I' '/sw/src/fink.build/gcc47-4.7.0-1/gcc-4.7-20111207/boehm-gc/testsuite/../include' '-shared-libgcc' '-v' '-o' './.libs/gctest' '-mtune=core2'
 /sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/gcc/as -arch x86_64 -force_cpusubtype_ALL -o /var/tmp//cc2YMxyw.o /var/tmp//ccJtQ5Pa.s
COMPILER_PATH=/sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/gcc/
LIBRARY_PATH=/sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/gcc/:/usr/lib/
COLLECT_GCC_OPTIONS='-mmacosx-version-min=10.7.2' '-B' '/sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/gcc/' '-O2' '-I' '/sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/x86_64-apple-darwin11.2.0/./boehm-gc/include' '-I' '/sw/src/fink.build/gcc47-4.7.0-1/gcc-4.7-20111207/boehm-gc/testsuite/../include' '-shared-libgcc' '-v' '-o' './.libs/gctest' '-mtune=core2'
 /sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/gcc/collect2 -dynamic -arch x86_64 -macosx_version_min 10.7.2 -weak_reference_mismatches non-weak -o ./.libs/gctest -lcrt1.10.6.o -L/sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/gcc /var/tmp//cc2YMxyw.o /sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/x86_64-apple-darwin11.2.0/./boehm-gc/.libs/libgcjgc.dylib -no_compact_unwind -lSystem -lgcc_ext.10.5 -lgcc -lSystem -v
collect2 version 4.7.0 20111207 (experimental)
/sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/gcc/collect-ld -dynamic -arch x86_64 -macosx_version_min 10.7.2 -weak_reference_mismatches non-weak -o ./.libs/gctest -lcrt1.10.6.o -L/sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/gcc /var/tmp//cc2YMxyw.o /sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/x86_64-apple-darwin11.2.0/./boehm-gc/.libs/libgcjgc.dylib -no_compact_unwind -lSystem -lgcc_ext.10.5 -lgcc -lSystem -v
@(#)PROGRAM:ld  PROJECT:ld64-127.2
Library search paths:
	/sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/gcc
	/usr/lib
	/usr/local/lib
Framework search paths:
	/Library/Frameworks/
	/System/Library/Frameworks/

Unless you suspect that the fact that PIC code is being bundled into a convenience archive which
is then linked into libgcjgc is causing the problems?
                 Jack

>
> if it's a tool bug, then we should XFAIL the tests ...
>
> cheers
> Iain
>
>>> - that is what we should fix.
>>> cheers
>>> Iain
>>>
>>>>
>>>> on x86_64-apple-darwin11 due to the -pie linker default. The  
>>>> attached
>>>> patch
>>>> uses -fno-pie on darwin to insure that -no_pie is passed to the  
>>>> linker
>>>> when
>>>> targeting darwin11 or later. This approach is used because istarget
>>>> doesn't
>>>> support complex regex to allow -Wl,-no_pie to be passed for darwin11
>>>> and later
>>>> only (since only recent Xcode releases understand the -no_pie linker
>>>> option).
>>>> Also, -fno_pie has the advantage of supporting -mmacosx-version-min
>>>> usage.
>>>> Regression tested on x86_64-apple-darwin11...
>>>>
>>>> http://gcc.gnu.org/ml/gcc-testresults/2011-12/msg00856.html
>>>>
>>>> Okay for gcc trunk?
>>>>                Jack
>>>>
>>>>
>>>> boehm-gc/
>>>>
>>>> 2011-12-08  Jack Howarth <howarth@bromo.med.uc.edu>
>>>>
>>>>       * testsuite/lib/boehm-gc.exp: Use -fno-pie on darwin.
>>>>
>>>> Index: boehm-gc/testsuite/lib/boehm-gc.exp
>>>> ===================================================================
>>>> --- boehm-gc/testsuite/lib/boehm-gc.exp	(revision 182117)
>>>> +++ boehm-gc/testsuite/lib/boehm-gc.exp	(working copy)
>>>> @@ -214,6 +214,11 @@ proc boehm-gc_target_compile { source de
>>>>    lappend options "additional_flags=-I${gc_include} -I${srcdir}/../
>>>> include"
>>>>    lappend options "additional_flags=${threadcflags}"
>>>>
>>>> +    # Disable -pie linker default for darwin11 and later using - 
>>>> fno-
>>>> pie.
>>>> +    if { [istarget *-*-darwin*] } {
>>>> +	lappend options "additional_flags=-fno-pie"
>>>> +    }
>>>> +
>>>>    lappend options "libs=-Wc,-shared-libgcc"
>>>>
>>>>    if { [file extension $dest] == ".la" } {
>> <boehm-gc.log.bz2>
IainS - Dec. 8, 2011, 5:55 p.m.
On 8 Dec 2011, at 17:24, Jack Howarth wrote:

> On Thu, Dec 08, 2011 at 05:05:12PM +0000, Iain Sandoe wrote:
>>
>> On 8 Dec 2011, at 16:58, Jack Howarth wrote:
>>
>>> On Thu, Dec 08, 2011 at 03:54:35PM +0000, Iain Sandoe wrote:
>>>>
>>>> On 8 Dec 2011, at 15:38, Jack Howarth wrote:
>>>>
>>>>> Currently the boehm-gc testsuite fails...
>>>>>
>>>>> FAIL: boehm-gc.c/gctest.c -O2 execution test
>>>>> FAIL: boehm-gc.c/leak_test.c -O2 execution test
>>>>> FAIL: boehm-gc.c/thread_leak_test.c -O2 execution test
>>>>> FAIL: boehm-gc.lib/staticrootstest.c -O2 execution test
>>>>
>>>> you have not answered these questions:
>>>>
>>>> a) "what is anything being built in these tests which is not PIC"?
>>>> b) and why is it being built that way?
>>>>
>>>> ISTM the fix below should not be required
>>>> - and the problem lies in something being built with -mdynamic-no-
>>>> pic or
>>>> similar
>>>
>>> Nothing in boehm-gc is built non-PIC (see the attached log for  
>>> boehm-
>>> gc).
>>> Likewise nothing in the testsuite is built non-PIC. For example,
>>> gctest.c
>>> at -O2 is built, according to -v, as...
>>>
>>> /sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/gcc/cc1 -quiet -v - 
>>> I /
>>> sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/x86_64-apple-
>>> darwin11.2.0/./boehm-gc/include -I /sw/src/fink.build/gcc47-4.7.0-1/
>>> gcc-4.7-20111207/boehm-gc/testsuite/../include -iprefix /sw/src/
>>> fink.build/gcc47-4.7.0-1/darwin_objdir/gcc/../lib/gcc/x86_64-apple-
>>> darwin11.2.0/4.7.0/ -isystem /sw/src/fink.build/gcc47-4.7.0-1/
>>> darwin_objdir/gcc/include -isystem /sw/src/fink.build/gcc47-4.7.0-1/
>>> darwin_objdir/gcc/include-fixed -D__DYNAMIC__ /sw/src/fink.build/
>>> gcc47-4.7.0-1/gcc-4.7-20111207/boehm-gc/testsuite/boehm-gc.c/ 
>>> gctest.c
>>> -fPIC -quiet -dumpbase gctest.c -mmacosx-version-min=10.7.2
>>> -mtune=core2 -auxbase gctest -O2 -version -o /var/tmp//ccgHCNRC.s
>>>
>>> The test is also just linked to the the libgcjgcj built in boehm- 
>>> gc...
>>>
>>> /sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/gcc/collect-ld - 
>>> dynamic
>>> -arch x86_64 -macosx_version_min 10.7.2 -weak_reference_mismatches
>>> non-weak -o ./.libs/gctest -lcrt1.10.6.o -
>>> L/sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/gcc /var/tmp//
>>> ccb3OaQl.o /sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/x86_64-
>>> apple-darwin11.2.0/./boehm-gc/.libs/libgcjgc.dylib - 
>>> no_compact_unwind
>>> -lSystem -lgcc_ext.10.5 -lgcc -lSystem -v
>>>
>>> so the build in boehm-gc appears to be self-contained.
>>
>> OK- so it appears ...
>> ... so why is ld complaining that there's non-PIC code present?
>
> Where do you see ld complaining of non-PIC code?

OK.  Different problem - I recalled that there were [PIE] issues with  
ld complaining.

.. if  PIE is fundamentally incompatible with boehm-gc (is it??) -  
then, right, we need to make sure it's off -

-  presumably it's not affecting any other target - because they don't  
do PIE unless told to ...

Perhaps it would be better to adjust the spec that you made (and has  
been applied) to ensure that -no_pie is passed to the linker  *unless*  
pie is explicitly given on the c/l?

At present, you pass it when "no-pic, no-pie" etc. are - perhaps it  
should just be the default and *only* switched on for -pie something  
like....

  %{!fpie: %{!PIE: %:version-compare(>= 10.7 mmacosx-version-min= - 
no_pie) } }

Otherwise, D11 is behaving differently from other targets for the  
whole test-suite - not just boehm-gc.

cheers
Iain
Jack Howarth - Dec. 8, 2011, 8:11 p.m.
On Thu, Dec 08, 2011 at 05:55:37PM +0000, Iain Sandoe wrote:
>
> On 8 Dec 2011, at 17:24, Jack Howarth wrote:
>
>> On Thu, Dec 08, 2011 at 05:05:12PM +0000, Iain Sandoe wrote:
>>>
>>> On 8 Dec 2011, at 16:58, Jack Howarth wrote:
>>>
>>>> On Thu, Dec 08, 2011 at 03:54:35PM +0000, Iain Sandoe wrote:
>>>>>
>>>>> On 8 Dec 2011, at 15:38, Jack Howarth wrote:
>>>>>
>>>>>> Currently the boehm-gc testsuite fails...
>>>>>>
>>>>>> FAIL: boehm-gc.c/gctest.c -O2 execution test
>>>>>> FAIL: boehm-gc.c/leak_test.c -O2 execution test
>>>>>> FAIL: boehm-gc.c/thread_leak_test.c -O2 execution test
>>>>>> FAIL: boehm-gc.lib/staticrootstest.c -O2 execution test
>>>>>
>>>>> you have not answered these questions:
>>>>>
>>>>> a) "what is anything being built in these tests which is not PIC"?
>>>>> b) and why is it being built that way?
>>>>>
>>>>> ISTM the fix below should not be required
>>>>> - and the problem lies in something being built with -mdynamic-no-
>>>>> pic or
>>>>> similar
>>>>
>>>> Nothing in boehm-gc is built non-PIC (see the attached log for  
>>>> boehm-
>>>> gc).
>>>> Likewise nothing in the testsuite is built non-PIC. For example,
>>>> gctest.c
>>>> at -O2 is built, according to -v, as...
>>>>
>>>> /sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/gcc/cc1 -quiet -v - 
>>>> I /
>>>> sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/x86_64-apple-
>>>> darwin11.2.0/./boehm-gc/include -I /sw/src/fink.build/gcc47-4.7.0-1/
>>>> gcc-4.7-20111207/boehm-gc/testsuite/../include -iprefix /sw/src/
>>>> fink.build/gcc47-4.7.0-1/darwin_objdir/gcc/../lib/gcc/x86_64-apple-
>>>> darwin11.2.0/4.7.0/ -isystem /sw/src/fink.build/gcc47-4.7.0-1/
>>>> darwin_objdir/gcc/include -isystem /sw/src/fink.build/gcc47-4.7.0-1/
>>>> darwin_objdir/gcc/include-fixed -D__DYNAMIC__ /sw/src/fink.build/
>>>> gcc47-4.7.0-1/gcc-4.7-20111207/boehm-gc/testsuite/boehm-gc.c/ 
>>>> gctest.c
>>>> -fPIC -quiet -dumpbase gctest.c -mmacosx-version-min=10.7.2
>>>> -mtune=core2 -auxbase gctest -O2 -version -o /var/tmp//ccgHCNRC.s
>>>>
>>>> The test is also just linked to the the libgcjgcj built in boehm- 
>>>> gc...
>>>>
>>>> /sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/gcc/collect-ld - 
>>>> dynamic
>>>> -arch x86_64 -macosx_version_min 10.7.2 -weak_reference_mismatches
>>>> non-weak -o ./.libs/gctest -lcrt1.10.6.o -
>>>> L/sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/gcc /var/tmp//
>>>> ccb3OaQl.o /sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/x86_64-
>>>> apple-darwin11.2.0/./boehm-gc/.libs/libgcjgc.dylib - 
>>>> no_compact_unwind
>>>> -lSystem -lgcc_ext.10.5 -lgcc -lSystem -v
>>>>
>>>> so the build in boehm-gc appears to be self-contained.
>>>
>>> OK- so it appears ...
>>> ... so why is ld complaining that there's non-PIC code present?
>>
>> Where do you see ld complaining of non-PIC code?
>
> OK.  Different problem - I recalled that there were [PIE] issues with ld 
> complaining.
>
> .. if  PIE is fundamentally incompatible with boehm-gc (is it??) - then, 
> right, we need to make sure it's off -
>
> -  presumably it's not affecting any other target - because they don't  
> do PIE unless told to ...
>
> Perhaps it would be better to adjust the spec that you made (and has  
> been applied) to ensure that -no_pie is passed to the linker  *unless*  
> pie is explicitly given on the c/l?
>

Iain,
   Isn't exactly opposite of your original preference for handling darwin11
(that we shouldn't degrade darwin11 by disabling its automatic use of PIE)?
Your suggestion would seem to do exactly that.
                Jack

> At present, you pass it when "no-pic, no-pie" etc. are - perhaps it  
> should just be the default and *only* switched on for -pie something  
> like....
>
>  %{!fpie: %{!PIE: %:version-compare(>= 10.7 mmacosx-version-min= - 
> no_pie) } }
>
> Otherwise, D11 is behaving differently from other targets for the whole 
> test-suite - not just boehm-gc.
>
> cheers
> Iain
>
Jack Howarth - Dec. 8, 2011, 8:15 p.m.
On Thu, Dec 08, 2011 at 05:55:37PM +0000, Iain Sandoe wrote:
>
> On 8 Dec 2011, at 17:24, Jack Howarth wrote:
>
>> On Thu, Dec 08, 2011 at 05:05:12PM +0000, Iain Sandoe wrote:
>>>
>>> On 8 Dec 2011, at 16:58, Jack Howarth wrote:
>>>
>>>> On Thu, Dec 08, 2011 at 03:54:35PM +0000, Iain Sandoe wrote:
>>>>>
>>>>> On 8 Dec 2011, at 15:38, Jack Howarth wrote:
>>>>>
>>>>>> Currently the boehm-gc testsuite fails...
>>>>>>
>>>>>> FAIL: boehm-gc.c/gctest.c -O2 execution test
>>>>>> FAIL: boehm-gc.c/leak_test.c -O2 execution test
>>>>>> FAIL: boehm-gc.c/thread_leak_test.c -O2 execution test
>>>>>> FAIL: boehm-gc.lib/staticrootstest.c -O2 execution test
>>>>>
>>>>> you have not answered these questions:
>>>>>
>>>>> a) "what is anything being built in these tests which is not PIC"?
>>>>> b) and why is it being built that way?
>>>>>
>>>>> ISTM the fix below should not be required
>>>>> - and the problem lies in something being built with -mdynamic-no-
>>>>> pic or
>>>>> similar
>>>>
>>>> Nothing in boehm-gc is built non-PIC (see the attached log for  
>>>> boehm-
>>>> gc).
>>>> Likewise nothing in the testsuite is built non-PIC. For example,
>>>> gctest.c
>>>> at -O2 is built, according to -v, as...
>>>>
>>>> /sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/gcc/cc1 -quiet -v - 
>>>> I /
>>>> sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/x86_64-apple-
>>>> darwin11.2.0/./boehm-gc/include -I /sw/src/fink.build/gcc47-4.7.0-1/
>>>> gcc-4.7-20111207/boehm-gc/testsuite/../include -iprefix /sw/src/
>>>> fink.build/gcc47-4.7.0-1/darwin_objdir/gcc/../lib/gcc/x86_64-apple-
>>>> darwin11.2.0/4.7.0/ -isystem /sw/src/fink.build/gcc47-4.7.0-1/
>>>> darwin_objdir/gcc/include -isystem /sw/src/fink.build/gcc47-4.7.0-1/
>>>> darwin_objdir/gcc/include-fixed -D__DYNAMIC__ /sw/src/fink.build/
>>>> gcc47-4.7.0-1/gcc-4.7-20111207/boehm-gc/testsuite/boehm-gc.c/ 
>>>> gctest.c
>>>> -fPIC -quiet -dumpbase gctest.c -mmacosx-version-min=10.7.2
>>>> -mtune=core2 -auxbase gctest -O2 -version -o /var/tmp//ccgHCNRC.s
>>>>
>>>> The test is also just linked to the the libgcjgcj built in boehm- 
>>>> gc...
>>>>
>>>> /sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/gcc/collect-ld - 
>>>> dynamic
>>>> -arch x86_64 -macosx_version_min 10.7.2 -weak_reference_mismatches
>>>> non-weak -o ./.libs/gctest -lcrt1.10.6.o -
>>>> L/sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/gcc /var/tmp//
>>>> ccb3OaQl.o /sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/x86_64-
>>>> apple-darwin11.2.0/./boehm-gc/.libs/libgcjgc.dylib - 
>>>> no_compact_unwind
>>>> -lSystem -lgcc_ext.10.5 -lgcc -lSystem -v
>>>>
>>>> so the build in boehm-gc appears to be self-contained.
>>>
>>> OK- so it appears ...
>>> ... so why is ld complaining that there's non-PIC code present?
>>
>> Where do you see ld complaining of non-PIC code?
>
> OK.  Different problem - I recalled that there were [PIE] issues with ld 
> complaining.
>
> .. if  PIE is fundamentally incompatible with boehm-gc (is it??) - then, 
> right, we need to make sure it's off -
>
> -  presumably it's not affecting any other target - because they don't  
> do PIE unless told to ...
>
> Perhaps it would be better to adjust the spec that you made (and has  
> been applied) to ensure that -no_pie is passed to the linker  *unless*  
> pie is explicitly given on the c/l?
>
> At present, you pass it when "no-pic, no-pie" etc. are - perhaps it  
> should just be the default and *only* switched on for -pie something  
> like....
>
>  %{!fpie: %{!PIE: %:version-compare(>= 10.7 mmacosx-version-min= - 
> no_pie) } }
>
> Otherwise, D11 is behaving differently from other targets for the whole 
> test-suite - not just boehm-gc.

Iain,
   One could make the alternative argument that the testing on linux is
currently incomplete because it is not done on any of the hardened linux
distros which utilize PIE such as...

http://www.gentoo.org/proj/en/hardened/

I find it very stange that there seems to be so little communication between
such projects and FSF gcc.
                  Jack
>
> cheers
> Iain
>
IainS - Dec. 8, 2011, 8:55 p.m.
On 8 Dec 2011, at 20:15, Jack Howarth wrote:
>>
>> At present, you pass it when "no-pic, no-pie" etc. are - perhaps it
>> should just be the default and *only* switched on for -pie something
>> like....
>>
>> %{!fpie: %{!PIE: %:version-compare(>= 10.7 mmacosx-version-min= -
>> no_pie) } }
>>
>> Otherwise, D11 is behaving differently from other targets for the  
>> whole
>> test-suite - not just boehm-gc.
>
> Iain,
>   One could make the alternative argument that the testing on linux is
> currently incomplete because it is not done on any of the hardened  
> linux
> distros which utilize PIE such as...
>
> http://www.gentoo.org/proj/en/hardened/
>
> I find it very stange that there seems to be so little communication  
> between
> such projects and FSF gcc.


[well the best solution would be to solve whatever problem stops boehm- 
gc working with PIE on/off-- but that's not a job for this week ;-) ]

===

So to recap ---
IMO it's better if we can do the same as the vendor's tools on the  
target system, providing that's not provably buggy.
(I think that's our general policy on Darwin, right?).

So, yes, you are correct, I would prefer not to switch PIE off ...

... but then, I guess, the test-suite makes the "assumption" that PIE  
is off by default ...

... so, perhaps a solution is to run it  RUNTESTFLAGS=".... \-fno- 
PIE ... " on Darwin11.

-====-

similarly,  the hardened linux guys could do  ... RUNTESTFLAGS="....\{- 
fPIE... "  if they want to test coverage with PIE on.

-====-

... of course, that breaks when there are specific tests that *are*  
PIE aware ...

... so the 'easy way out' is to make D11 behave as per earlier  
versions (i.e. default PIE off);

----

for a small number of tests ..  { dg-additional-options ... } would be  
more transparent than modifying
lib/something.exp

... but, I'll bow out at this juncture -
- we've established the underlying issue - which isn't likely to get  
solved with specs or test-suite options.

cheers
Iain
Jack Howarth - Dec. 8, 2011, 9:08 p.m.
On Thu, Dec 08, 2011 at 08:55:17PM +0000, Iain Sandoe wrote:
>
> On 8 Dec 2011, at 20:15, Jack Howarth wrote:
>>>
>>> At present, you pass it when "no-pic, no-pie" etc. are - perhaps it
>>> should just be the default and *only* switched on for -pie something
>>> like....
>>>
>>> %{!fpie: %{!PIE: %:version-compare(>= 10.7 mmacosx-version-min= -
>>> no_pie) } }
>>>
>>> Otherwise, D11 is behaving differently from other targets for the  
>>> whole
>>> test-suite - not just boehm-gc.
>>
>> Iain,
>>   One could make the alternative argument that the testing on linux is
>> currently incomplete because it is not done on any of the hardened  
>> linux
>> distros which utilize PIE such as...
>>
>> http://www.gentoo.org/proj/en/hardened/
>>
>> I find it very stange that there seems to be so little communication  
>> between
>> such projects and FSF gcc.
>
>
> [well the best solution would be to solve whatever problem stops boehm- 
> gc working with PIE on/off-- but that's not a job for this week ;-) ]
>
> ===
>
> So to recap ---
> IMO it's better if we can do the same as the vendor's tools on the  
> target system, providing that's not provably buggy.
> (I think that's our general policy on Darwin, right?).
>
> So, yes, you are correct, I would prefer not to switch PIE off ...
>
> ... but then, I guess, the test-suite makes the "assumption" that PIE is 
> off by default ...

Iain,
    The same argument could be made for PIC itself regarding the testsuite. 
Aren't we still the only target that defaults to PIC objects? I would think that
the fact that we test against PIE on darwin11 and later would be a bonus for
FSF gcc since they don't seem to get much feedback directly from the hardened
linux projects. Better to just turn off PIE for the few problem test cases
and retain the wider testing against PIE in order to look for potential problems
(since one really doesn't want to test the compiler in mode completely alien
to how it will be used in practice... that is with PIE linkage).
                  Jack

>
> ... so, perhaps a solution is to run it  RUNTESTFLAGS=".... \-fno-PIE ... 
> " on Darwin11.
>
> -====-
>
> similarly,  the hardened linux guys could do  ... RUNTESTFLAGS="....\{- 
> fPIE... "  if they want to test coverage with PIE on.
>
> -====-
>
> ... of course, that breaks when there are specific tests that *are* PIE 
> aware ...
>
> ... so the 'easy way out' is to make D11 behave as per earlier versions 
> (i.e. default PIE off);
>
> ----
>
> for a small number of tests ..  { dg-additional-options ... } would be  
> more transparent than modifying
> lib/something.exp
>
> ... but, I'll bow out at this juncture -
> - we've established the underlying issue - which isn't likely to get  
> solved with specs or test-suite options.
>
> cheers
> Iain
IainS - Dec. 9, 2011, 2:09 p.m.
On 8 Dec 2011, at 20:55, Iain Sandoe wrote:
> ... but, I'll bow out at this juncture -

OK, I lied :-)

The boehm-gc tests pass for m32 and m64 with "-fpie/-fPIE" on both x86  
Darwin9 (XC3.1.4) and x86_64 Darwin10 (XC3.2.5);
I'm building with XC3.2.6 to check that too.

So I think you need to debug what is actually failing on Darwin11.

Iain
Jack Howarth - Dec. 9, 2011, 3:03 p.m.
On Fri, Dec 09, 2011 at 02:09:54PM +0000, Iain Sandoe wrote:
>
> On 8 Dec 2011, at 20:55, Iain Sandoe wrote:
>> ... but, I'll bow out at this juncture -
>
> OK, I lied :-)
>
> The boehm-gc tests pass for m32 and m64 with "-fpie/-fPIE" on both x86  
> Darwin9 (XC3.1.4) and x86_64 Darwin10 (XC3.2.5);
> I'm building with XC3.2.6 to check that too.
>
> So I think you need to debug what is actually failing on Darwin11.
>
> Iain

Iain,
   I did a bit of experimentation with Xcode 4.2 on 10.6.8 and 10.7.2 with the
failing gctest test case.

1) On 10.6.8 using Xcode 4.2 and a previous gcc trunk build, if I do a 'make clean'
in /sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/x86_64-apple-darwin10.8.0/boehm-gc
after editing the Makefile there to have...

CFLAGS = -g -O2 -Wl,-pie

and then manually rebuild the gctest case with the same flags, it runs fine on darwin10
but segfaults on darwin11. Interestingly, I can get it to run without crashing on darwin11
if I run it within gdb.

2) On 10.7.2 using Xcode 4.2 and a previous gcc trunk build, if I do a 'make clean' in
/sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/x86_64-apple-darwin11.2.0/boehm-gc
after editing the Makefile there to have...

CFLAGS = -g -O2 -mmacosx-version-min=10.6 -Wl,-pie

and then manually rebuild the gctest case with the same flags, the resulting binary still crashes
on darwin11 but runs fine on darwin10. FYI, I also copied libgcjgc.1.dylib from the appropriate
build and set DYLD_LIBRARY_PATH as required in each case.
    I am assuming these observations suggest that we are seeing a new bug in the darwin11 unwinder.
I'll open a radar for this tonight with a standalone test case based on gctest that the darwin
linker developer can walk through the darwin11 unwinder.
            Jack
Rainer Orth - Dec. 9, 2011, 4:26 p.m.
Hi Jack,

>     The same argument could be made for PIC itself regarding the testsuite. 
> Aren't we still the only target that defaults to PIC objects? I would think that

certainly not: e.g. both Tru64 UNIX and IRIX are PIC by default.

	Rainer
Jack Howarth - Dec. 9, 2011, 4:54 p.m.
On Fri, Dec 09, 2011 at 05:26:47PM +0100, Rainer Orth wrote:
> Hi Jack,
> 
> >     The same argument could be made for PIC itself regarding the testsuite. 
> > Aren't we still the only target that defaults to PIC objects? I would think that
> 
> certainly not: e.g. both Tru64 UNIX and IRIX are PIC by default.
> 
> 	Rainer

Rainer,
   So that is to say that there is no expectation for linux to eventually adopt
a hardened form as the default (ie PIE)?
                 Jack

> 
> -- 
> -----------------------------------------------------------------------------
> Rainer Orth, Center for Biotechnology, Bielefeld University
Jack Howarth - Dec. 9, 2011, 5:01 p.m.
On Fri, Dec 09, 2011 at 10:03:47AM -0500, Jack Howarth wrote:
> On Fri, Dec 09, 2011 at 02:09:54PM +0000, Iain Sandoe wrote:
> >
> > On 8 Dec 2011, at 20:55, Iain Sandoe wrote:
> >> ... but, I'll bow out at this juncture -
> >
> > OK, I lied :-)
> >
> > The boehm-gc tests pass for m32 and m64 with "-fpie/-fPIE" on both x86  
> > Darwin9 (XC3.1.4) and x86_64 Darwin10 (XC3.2.5);
> > I'm building with XC3.2.6 to check that too.
> >
> > So I think you need to debug what is actually failing on Darwin11.
> >
> > Iain
> 
> Iain,
>    I did a bit of experimentation with Xcode 4.2 on 10.6.8 and 10.7.2 with the
> failing gctest test case.
> 
> 1) On 10.6.8 using Xcode 4.2 and a previous gcc trunk build, if I do a 'make clean'
> in /sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/x86_64-apple-darwin10.8.0/boehm-gc
> after editing the Makefile there to have...
> 
> CFLAGS = -g -O2 -Wl,-pie
> 
> and then manually rebuild the gctest case with the same flags, it runs fine on darwin10
> but segfaults on darwin11. Interestingly, I can get it to run without crashing on darwin11
> if I run it within gdb.
> 
> 2) On 10.7.2 using Xcode 4.2 and a previous gcc trunk build, if I do a 'make clean' in
> /sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/x86_64-apple-darwin11.2.0/boehm-gc
> after editing the Makefile there to have...
> 
> CFLAGS = -g -O2 -mmacosx-version-min=10.6 -Wl,-pie
> 
> and then manually rebuild the gctest case with the same flags, the resulting binary still crashes
> on darwin11 but runs fine on darwin10. FYI, I also copied libgcjgc.1.dylib from the appropriate
> build and set DYLD_LIBRARY_PATH as required in each case.
>     I am assuming these observations suggest that we are seeing a new bug in the darwin11 unwinder.
> I'll open a radar for this tonight with a standalone test case based on gctest that the darwin
> linker developer can walk through the darwin11 unwinder.
>             Jack

Iain,
    FYI, I checked my radar reports and I had already opened Problem ID: 9603795, "Lion linker breaks boehm-gc",
in July. The original report only compared the stock linkages on darwin10 and darwin11. I've updated the
report with a stand-alone test case built using Xcode 4.2 under darwin11 with  -mmacosx-version-min=10.6 -Wl,-pie
that crashes on darwin11 but not darwin10. This with with the observation that -mmacosx-version-min=10.6 -Wl,-pie
builds a copy under Xcode 4.2 on darwin10 that likewise fails on darwin11 but not darwin10 eliminates the linker
as the cause of the issue.
           Jack

Patch

Index: boehm-gc/testsuite/lib/boehm-gc.exp
===================================================================
--- boehm-gc/testsuite/lib/boehm-gc.exp	(revision 182117)
+++ boehm-gc/testsuite/lib/boehm-gc.exp	(working copy)
@@ -214,6 +214,11 @@  proc boehm-gc_target_compile { source de
     lappend options "additional_flags=-I${gc_include} -I${srcdir}/../include"
     lappend options "additional_flags=${threadcflags}"
 
+    # Disable -pie linker default for darwin11 and later using -fno-pie.
+    if { [istarget *-*-darwin*] } {
+	lappend options "additional_flags=-fno-pie"
+    }
+
     lappend options "libs=-Wc,-shared-libgcc"
     
     if { [file extension $dest] == ".la" } {