* Re: Fix ld testcases on c6x
2011-05-11 11:56 ` Alan Modra
@ 2011-05-11 12:31 ` Bernd Schmidt
0 siblings, 0 replies; 4+ messages in thread
From: Bernd Schmidt @ 2011-05-11 12:31 UTC (permalink / raw)
To: binutils, Paul Brook, Joseph S. Myers
[-- Attachment #1: Type: text/plain, Size: 718 bytes --]
On 05/11/2011 01:56 PM, Alan Modra wrote:
> On Wed, May 11, 2011 at 01:10:23PM +0200, Bernd Schmidt wrote:
>> +if { ![ld_assemble $as "$as_opt $srcdir/$subdir/tbss.s" tmpdir/tbss.o ]
>> + || ![ld_assemble $as "$as_opt $srcdir/$subdir/frame.s" tmpdir/frame.o] }
>
> Passing options like this in the "source" parameter of ld_assemble
> isn't the cleanest way.
I just followed lib/ld-lib.exp. I must say I dislike using ASFLAGS as in
ld-frv/tls.exp; it seems more error-prone since it has to be restored at
every return. So I went the other route and added a ld_assemble_flags
function. I'll give you some time to object to this version and check it
in as preapproved later today if I don't hear otherwise.
Bernd
[-- Attachment #2: as-flags.diff --]
[-- Type: text/plain, Size: 5563 bytes --]
* config/default.exp (ld_assemble): Pass flags parameter to
default_ld_assemble.
(ld_assemble_flags): New function.
* ld-elf/frame.exp: Pass -mpic and -mpid flags to the assembler on
tic6x.
* ld-elf/exclude.exp: Likewise.
* lib/ld-lib.exp (default_ld_assemble): Take extra argument in_flags
and pass it to the assembler.
Index: ld/testsuite/config/default.exp
===================================================================
RCS file: /cvs/src/src/ld/testsuite/config/default.exp,v
retrieving revision 1.15
diff -c -p -r1.15 default.exp
*** ld/testsuite/config/default.exp 2 Sep 2009 07:25:37 -0000 1.15
--- ld/testsuite/config/default.exp 11 May 2011 12:26:58 -0000
*************** proc ld_compile { cc source object } {
*** 205,211 ****
# assemble a file
#
proc ld_assemble { as source object } {
! default_ld_assemble $as $source $object
}
#
--- 205,219 ----
# assemble a file
#
proc ld_assemble { as source object } {
! default_ld_assemble $as "" $source $object
! }
!
! #
! # ld_assemble_flags
! # assemble a file with extra flags
! #
! proc ld_assemble_flags { as flags source object } {
! default_ld_assemble $as $flags $source $object
}
#
Index: ld/testsuite/ld-elf/exclude.exp
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-elf/exclude.exp,v
retrieving revision 1.7
diff -c -p -r1.7 exclude.exp
*** ld/testsuite/ld-elf/exclude.exp 2 Sep 2009 07:25:39 -0000 1.7
--- ld/testsuite/ld-elf/exclude.exp 11 May 2011 12:26:58 -0000
*************** if { [istarget "mcore-*-*"] } {
*** 31,36 ****
--- 31,44 ----
return
}
+ set as_opt ""
+
+ # This target requires extra as options when building code for shared
+ # libraries.
+ if { [istarget "tic6x-*-*"] } {
+ set as_opt "-mpic -mpid=near"
+ }
+
global ar
global as
global ld
*************** set test7 "ld exclude symbols from archi
*** 47,54 ****
set test8 "ld exclude symbols from archive - --exclude-libs foo,libexclude.a"
set test9 "ld don't exclude symbols from archive - --exclude-libs foo:bar"
! if { ![ld_assemble $as $srcdir/$subdir/exclude1.s tmpdir/exclude1.o ]
! || ![ld_assemble $as $srcdir/$subdir/exclude2.s tmpdir/exclude2.o] } {
unresolved $test1
return
}
--- 55,62 ----
set test8 "ld exclude symbols from archive - --exclude-libs foo,libexclude.a"
set test9 "ld don't exclude symbols from archive - --exclude-libs foo:bar"
! if { ![ld_assemble_flags $as $as_opt $srcdir/$subdir/exclude1.s tmpdir/exclude1.o ]
! || ![ld_assemble_flags $as $as_opt $srcdir/$subdir/exclude2.s tmpdir/exclude2.o] } {
unresolved $test1
return
}
Index: ld/testsuite/ld-elf/frame.exp
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-elf/frame.exp,v
retrieving revision 1.8
diff -c -p -r1.8 frame.exp
*** ld/testsuite/ld-elf/frame.exp 2 Sep 2009 07:25:39 -0000 1.8
--- ld/testsuite/ld-elf/frame.exp 11 May 2011 12:26:58 -0000
*************** if { [istarget "hppa64-*-*"] || [istarge
*** 44,57 ****
return
}
set test1 "read-only .eh_frame section"
set test2 "read-only .gcc_except_table section"
global as
global ld
! if { ![ld_assemble $as $srcdir/$subdir/tbss.s tmpdir/tbss.o ]
! || ![ld_assemble $as $srcdir/$subdir/frame.s tmpdir/frame.o] } {
unresolved "$test1"
return
}
--- 44,65 ----
return
}
+ set as_opt ""
+
+ # This target requires extra as options when building code for shared
+ # libraries.
+ if { [istarget "tic6x-*-*"] } {
+ set as_opt "-mpic -mpid=near"
+ }
+
set test1 "read-only .eh_frame section"
set test2 "read-only .gcc_except_table section"
global as
global ld
! if { ![ld_assemble_flags $as $as_opt $srcdir/$subdir/tbss.s tmpdir/tbss.o ]
! || ![ld_assemble_flags $as $as_opt $srcdir/$subdir/frame.s tmpdir/frame.o] } {
unresolved "$test1"
return
}
*************** if { [ld_simple_link $ld tmpdir/frame.so
*** 66,72 ****
}
}
! if ![ld_assemble $as $srcdir/$subdir/table.s tmpdir/table.o ] {
unresolved "$test2"
return
}
--- 74,80 ----
}
}
! if ![ld_assemble_flags $as $as_opt $srcdir/$subdir/table.s tmpdir/table.o ] {
unresolved "$test2"
return
}
Index: ld/testsuite/lib/ld-lib.exp
===================================================================
RCS file: /cvs/src/src/ld/testsuite/lib/ld-lib.exp,v
retrieving revision 1.80
diff -c -p -r1.80 ld-lib.exp
*** ld/testsuite/lib/ld-lib.exp 6 Apr 2011 17:09:56 -0000 1.80
--- ld/testsuite/lib/ld-lib.exp 11 May 2011 12:26:59 -0000
*************** proc default_ld_compile { cc source obje
*** 295,308 ****
# Assemble a file.
#
! proc default_ld_assemble { as source object } {
global ASFLAGS
global host_triplet
if ![info exists ASFLAGS] { set ASFLAGS "" }
set flags [big_or_little_endian]
! set exec_output [run_host_cmd "$as" "$flags $ASFLAGS -o $object $source"]
set exec_output [prune_warnings $exec_output]
if [string match "" $exec_output] then {
return 1
--- 295,308 ----
# Assemble a file.
#
! proc default_ld_assemble { as in_flags source object } {
global ASFLAGS
global host_triplet
if ![info exists ASFLAGS] { set ASFLAGS "" }
set flags [big_or_little_endian]
! set exec_output [run_host_cmd "$as" "$flags $in_flags $ASFLAGS -o $object $source"]
set exec_output [prune_warnings $exec_output]
if [string match "" $exec_output] then {
return 1
^ permalink raw reply [flat|nested] 4+ messages in thread