bfd/
2009-01-02 H.J. Lu <hongjiu.lu@intel.com> PR ld/9676 * elflink.c (elf_link_add_object_symbols): Update def_dynamic, ref_dynamic and dynamic_def fields when setting def_regular to 1. ld/testsuite/ 2009-01-02 H.J. Lu <hongjiu.lu@intel.com> PR ld/9676 * ld-elf/pr9676-1.c: New. * ld-elf/pr9676-2.c: Likewiswe. * ld-elf/pr9676-3.c: Likewiswe. * ld-elf/pr9676-4.c: Likewiswe. * ld-elf/pr9676.rd: Likewiswe. * ld-elf/shared.exp (build_tests): Add tests for libpr9676-1.a, libpr9676-2.a, libpr9676-3.so, libpr9676-4.so and libpr9676-4a.so. * lib/ld-lib.exp (ar_simple_create): New. (run_ld_link_tests): Support archive. (run_cc_link_tests): Likewiswe.
This commit is contained in:
parent
b70b5c14d5
commit
d88805311b
12 changed files with 4535 additions and 4381 deletions
3387
bfd/ChangeLog
3387
bfd/ChangeLog
File diff suppressed because it is too large
Load diff
3386
bfd/ChangeLog-2008
Normal file
3386
bfd/ChangeLog-2008
Normal file
File diff suppressed because it is too large
Load diff
|
@ -4296,7 +4296,15 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
|
||||||
h->ref_regular_nonweak = 1;
|
h->ref_regular_nonweak = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
h->def_regular = 1;
|
{
|
||||||
|
h->def_regular = 1;
|
||||||
|
if (h->def_dynamic)
|
||||||
|
{
|
||||||
|
h->def_dynamic = 0;
|
||||||
|
h->ref_dynamic = 1;
|
||||||
|
h->dynamic_def = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (! info->executable
|
if (! info->executable
|
||||||
|| h->def_dynamic
|
|| h->def_dynamic
|
||||||
|| h->ref_dynamic)
|
|| h->ref_dynamic)
|
||||||
|
|
File diff suppressed because it is too large
Load diff
1010
ld/testsuite/ChangeLog-2008
Normal file
1010
ld/testsuite/ChangeLog-2008
Normal file
File diff suppressed because it is too large
Load diff
15
ld/testsuite/ld-elf/pr9676-1.c
Normal file
15
ld/testsuite/ld-elf/pr9676-1.c
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
extern int foo (void) __attribute__((section (".gnu.linkonce.t.1"), weak));
|
||||||
|
|
||||||
|
int
|
||||||
|
foo (void)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
extern int foo2 (void);
|
||||||
|
|
||||||
|
int
|
||||||
|
bar (void)
|
||||||
|
{
|
||||||
|
return foo2 ();
|
||||||
|
}
|
14
ld/testsuite/ld-elf/pr9676-2.c
Normal file
14
ld/testsuite/ld-elf/pr9676-2.c
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
extern int foo (void) __attribute__((section (".gnu.linkonce.t.1"), weak,
|
||||||
|
__visibility__ ("hidden")));
|
||||||
|
|
||||||
|
int
|
||||||
|
foo (void)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
foo2 (void)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
7
ld/testsuite/ld-elf/pr9676-3.c
Normal file
7
ld/testsuite/ld-elf/pr9676-3.c
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
extern int foo (void) __attribute__((section (".gnu.linkonce.t.1"), weak));
|
||||||
|
|
||||||
|
int
|
||||||
|
foo (void)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
9
ld/testsuite/ld-elf/pr9676-4.c
Normal file
9
ld/testsuite/ld-elf/pr9676-4.c
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
extern int bar (void);
|
||||||
|
extern int foo (void);
|
||||||
|
|
||||||
|
int
|
||||||
|
x (void)
|
||||||
|
{
|
||||||
|
foo ();
|
||||||
|
return bar ();
|
||||||
|
}
|
5
ld/testsuite/ld-elf/pr9676.rd
Normal file
5
ld/testsuite/ld-elf/pr9676.rd
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
Symbol table '\.dynsym' contains [0-9]+ entries:
|
||||||
|
+Num: +Value +Size Type +Bind +Vis +Ndx Name
|
||||||
|
#...
|
||||||
|
+[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +FUNC +LOCAL +HIDDEN +[0-9]+ +foo
|
||||||
|
#...
|
|
@ -129,6 +129,22 @@ set build_tests {
|
||||||
{"Build libfunc1.so"
|
{"Build libfunc1.so"
|
||||||
"-shared" "-fPIC"
|
"-shared" "-fPIC"
|
||||||
{func1.c} {} "libfunc1.so"}
|
{func1.c} {} "libfunc1.so"}
|
||||||
|
{"Build libpr9676-1.a"
|
||||||
|
"" "-fPIC"
|
||||||
|
{pr9676-1.c} {} "libpr9676-1.a"}
|
||||||
|
{"Build libpr9676-2.a"
|
||||||
|
"" "-fPIC"
|
||||||
|
{pr9676-2.c} {} "libpr9676-2.a"}
|
||||||
|
{"Build libpr9676-3.so"
|
||||||
|
"-shared" "-fPIC"
|
||||||
|
{pr9676-3.c} {} "libpr9676-3.so"}
|
||||||
|
{"Build libpr9676-4.so"
|
||||||
|
"-shared" "-fPIC"
|
||||||
|
{pr9676-4.c} {} "libpr9676-4.so"}
|
||||||
|
{"Build libpr9676-4a.so"
|
||||||
|
"-shared tmpdir/pr9676-4.o -Ltmpdir -lpr9676-3 -Wl,--start-group -lpr9676-1 -lpr9676-2 -Wl,--end-group"
|
||||||
|
"-fPIC"
|
||||||
|
{dummy.c} {{readelf {-s} pr9676.rd}} "libpr9676-4a.so"}
|
||||||
}
|
}
|
||||||
|
|
||||||
set run_tests {
|
set run_tests {
|
||||||
|
|
|
@ -1093,6 +1093,22 @@ proc file_contents { filename } {
|
||||||
return $contents
|
return $contents
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Create an archive using ar
|
||||||
|
#
|
||||||
|
proc ar_simple_create { ar target objects } {
|
||||||
|
remote_file host delete $target
|
||||||
|
|
||||||
|
set exec_output [run_host_cmd "$ar" "rc $target $objects"]
|
||||||
|
set exec_output [prune_warnings $exec_output]
|
||||||
|
|
||||||
|
if [string match "" $exec_output] then {
|
||||||
|
send_log "$exec_output\n"
|
||||||
|
return 1
|
||||||
|
} else {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# List contains test-items with 3 items followed by 2 lists, one item and
|
# List contains test-items with 3 items followed by 2 lists, one item and
|
||||||
# one optional item:
|
# one optional item:
|
||||||
# 0:name 1:ld options 2:assembler options
|
# 0:name 1:ld options 2:assembler options
|
||||||
|
@ -1108,6 +1124,7 @@ proc run_ld_link_tests { ldtests } {
|
||||||
global ld
|
global ld
|
||||||
global as
|
global as
|
||||||
global nm
|
global nm
|
||||||
|
global ar
|
||||||
global objdump
|
global objdump
|
||||||
global READELF
|
global READELF
|
||||||
global srcdir
|
global srcdir
|
||||||
|
@ -1161,10 +1178,21 @@ proc run_ld_link_tests { ldtests } {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if ![ld_simple_link $ld $binfile "-L$srcdir/$subdir $ld_options $objfiles"] {
|
if [regexp ".*a$" $binfile] then {
|
||||||
|
if ![ar_simple_create $ar $binfile "$objfiles"] {
|
||||||
|
fail $testname
|
||||||
|
set failed 1
|
||||||
|
} else {
|
||||||
|
set failed 0
|
||||||
|
}
|
||||||
|
} elseif ![ld_simple_link $ld $binfile "-L$srcdir/$subdir $ld_options $objfiles"] {
|
||||||
fail $testname
|
fail $testname
|
||||||
|
set failed 1
|
||||||
} else {
|
} else {
|
||||||
set failed 0
|
set failed 0
|
||||||
|
}
|
||||||
|
|
||||||
|
if { $failed == 0 } {
|
||||||
foreach actionlist $actions {
|
foreach actionlist $actions {
|
||||||
set action [lindex $actionlist 0]
|
set action [lindex $actionlist 0]
|
||||||
set progopts [lindex $actionlist 1]
|
set progopts [lindex $actionlist 1]
|
||||||
|
@ -1429,6 +1457,7 @@ proc run_cc_link_tests { ldtests } {
|
||||||
global CXX
|
global CXX
|
||||||
global CFLAGS
|
global CFLAGS
|
||||||
global CXXFLAGS
|
global CXXFLAGS
|
||||||
|
global ar
|
||||||
|
|
||||||
foreach testitem $ldtests {
|
foreach testitem $ldtests {
|
||||||
set testname [lindex $testitem 0]
|
set testname [lindex $testitem 0]
|
||||||
|
@ -1466,10 +1495,21 @@ proc run_cc_link_tests { ldtests } {
|
||||||
set cc_cmd $CC
|
set cc_cmd $CC
|
||||||
}
|
}
|
||||||
|
|
||||||
if ![ld_simple_link $cc_cmd $binfile "-L$srcdir/$subdir $ldflags $objfiles"] {
|
if [regexp ".*a$" $binfile] then {
|
||||||
|
if ![ar_simple_create $ar $binfile "$objfiles"] {
|
||||||
|
fail $testname
|
||||||
|
set failed 1
|
||||||
|
} else {
|
||||||
|
set failed 0
|
||||||
|
}
|
||||||
|
} elseif ![ld_simple_link $cc_cmd $binfile "-L$srcdir/$subdir $ldflags $objfiles"] {
|
||||||
fail $testname
|
fail $testname
|
||||||
|
set failed 1
|
||||||
} else {
|
} else {
|
||||||
set failed 0
|
set failed 0
|
||||||
|
}
|
||||||
|
|
||||||
|
if { $failed == 0 } {
|
||||||
foreach actionlist $actions {
|
foreach actionlist $actions {
|
||||||
set action [lindex $actionlist 0]
|
set action [lindex $actionlist 0]
|
||||||
set progopts [lindex $actionlist 1]
|
set progopts [lindex $actionlist 1]
|
||||||
|
|
Loading…
Reference in a new issue