summaryrefslogtreecommitdiffstats
path: root/binutils-2.21/ld/testsuite/ld-elf
diff options
context:
space:
mode:
Diffstat (limited to 'binutils-2.21/ld/testsuite/ld-elf')
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/audit.exp65
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/audit.rd3
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/begin.c5
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/beginwarn.c9
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/binutils.exp154
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/comm1.c17
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/commonpage1.d9
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/commonpage2.d9
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/compress.exp59
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/compress1.s216
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/compress1a.d10
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/compress1b.d9
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/compress1c.d10
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/data1.c6
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/data1.h9
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/del.cc29
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/depaudit.rd3
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/depaudit2.rd3
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/discard.ld3
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/discard1.d9
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/discard1.s11
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/discard2.d9
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/discard2.s12
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/discard3.d11
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/dl1.c10
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/dl1.list6
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/dl1.out1
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/dl1main.c33
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/dl2.c16
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/dl2.list3
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/dl2a.list3
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/dl2a.out3
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/dl2b.out3
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/dl2main.c22
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/dl2xxx.c7
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/dl2xxx.list3
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/dl3.cc7
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/dl3.list6
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/dl3a.out1
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/dl3b.out1
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/dl3header.h5
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/dl3main.cc25
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/dl4.c24
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/dl4.list4
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/dl4a.out6
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/dl4b.out6
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/dl4main.c34
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/dl4xxx.c13
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/dl4xxx.list4
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/dl5.cc61
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/dl5.out1
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/dl6.c14
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/dl6a.out1
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/dl6amain.c33
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/dl6b.out1
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/dl6bmain.c33
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/dl6cmain.c33
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/dl6dmain.c33
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/dummy.c1
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/dwarf.exp114
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/dwarf1.c10
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/dwarf1.h6
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/dwarf1.out1
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/dwarf1main.c10
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/dynbss1.c20
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/dynsym1.d8
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/eh-frame-hdr.d7
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/eh-frame-hdr.s6
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/eh-group.exp72
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/eh-group1.s6
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/eh-group2.s15
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/eh1.d33
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/eh1.s47
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/eh1a.s3
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/eh2.d33
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/eh2a.s3
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/eh3.d33
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/eh3.s48
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/eh3a.s3
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/eh4.d32
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/eh4.s92
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/eh4a.s3
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/eh5.d162
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/eh5.s29
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/eh5a.s27
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/eh5b.s35
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/eh6.d17
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/eh6.s17
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/elf.exp84
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/empty.d7
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/empty.s16
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/empty2.d11
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/empty2.s18
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/end.c7
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/endhidden.c8
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/endprotected.c8
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/exclude.exp140
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/exclude1.s4
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/exclude2.s4
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/exclude3.s16
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/exclude3a.d10
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/exclude3b.d9
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/exclude3c.d7
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/exclude3d.d9
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/expr1.d2
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/expr1.s4
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/expr1.t6
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/extract-symbol-1.ld18
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/extract-symbol-1.s15
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/extract-symbol-1sec.d14
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/extract-symbol-1sym.d17
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/fini.c34
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/fini.out3
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/flags1.d22
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/flags1.ld12
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/flags1.s5
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/foo.c11
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/foo.map4
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/frame.exp82
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/frame.s2
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/func1.c2
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/group.ld6
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/group1.d12
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/group10.d11
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/group10.s14
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/group1a.s4
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/group1b.s6
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/group2.d20
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/group3a.d8
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/group3a.s5
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/group3b.d11
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/group3b.s6
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/group4.d20
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/group5.d20
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/group6.d20
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/group7.d31
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/group8.s10
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/group8a.d13
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/group8b.d13
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/group9.s15
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/group9a.d14
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/group9b.d18
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/hash.d17
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/header.d5
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/header.s8
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/header.t8
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/hidden.out3
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/init-fini-arrays.d12
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/init-fini-arrays.s6
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/init.c34
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/init.out3
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/linkonce1.d12
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/linkonce1a.s3
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/linkonce1b.s17
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/linkonce2.d14
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/linkoncerdiff.d6
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/linkoncerdiff1.s7
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/linkoncerdiff2.s22
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/lma.lnk6
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/lma.s4
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/loadaddr.s20
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/loadaddr.t10
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/loadaddr1.d10
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/loadaddr1.t7
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/loadaddr2.d10
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/loadaddr2.t7
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/loadaddr3.t16
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/loadaddr3a.d9
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/loadaddr3b.d13
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/local1.d7
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/local1.map6
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/local1.s6
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/main.c8
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/maxpage1.d9
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/maxpage1.s13
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/maxpage2.d9
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/maxpage3.t7
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/maxpage3a.d11
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/maxpage3b.d10
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/maxpage3c.d12
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/maxpage4.d9
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/maxpage4.t9
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/merge.d17
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/merge.ld7
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/merge.s14
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/merge2.d17
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/merge2.s58
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/multibss1.d11
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/multibss1.s11
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/new.cc48
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/nobits-1.d9
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/nobits-1.s6
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/nobits-1.t13
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/noload-1.d7
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/noload-1.s2
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/noload-1.t8
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/noload-2.d8
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/noload-3.d7
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/noload-3.s6
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/noload-3.t7
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/normal.out3
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/note-1.d10
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/note-1.s6
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/note-1.t14
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/note-2.d17
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/note-2.s8
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/note-2.t13
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/orphan-region.d21
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/orphan-region.ld11
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/orphan-region.s8
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/orphan.d16
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/orphan.ld8
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/orphan.s10
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/orphan2.d11
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/orphan2.s4
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/orphan3.d21
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/orphan3a.s12
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/orphan3b.s2
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/orphan3c.s2
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/orphan3d.s2
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/orphan3e.s2
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/orphan3f.s2
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/orphan4.d7
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/orphan4.ld13
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/orphan4.s4
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/overlay.d12
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/overlay.s6
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/overlay.t10
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/pass.out1
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/pr11138-1.c13
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/pr11138-1.map4
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/pr11138-2.c17
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/pr11138-2.map4
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/pr11138.out2
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/pr11304.d11
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/pr11304a.s4
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/pr11304b.s4
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/pr349-1.s2
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/pr349-2.s2
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/pr349.d13
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/pr9676-1.c15
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/pr9676-2.c14
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/pr9676-3.c7
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/pr9676-4.c9
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/pr9676.rd5
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/pr9679-1.c5
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/pr9679-2.c13
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/pr9679.rd5
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/preinit.c34
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/preinit.out3
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/relocatable.d10
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/relocatable.t8
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/relro1.s14
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/relro2.s5
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/sec-to-seg-script-adjoining-pages.t11
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/sec-to-seg-script-disjoint-pages.t11
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/sec-to-seg-script-same-page.t10
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/sec-to-seg.exp102
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/sec-to-seg1.s9
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/sec-to-seg2.s13
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/sec64k.exp206
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/seg.d21
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/seg.s6
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/seg.t16
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/shared.exp330
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/simple.s4
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/stab.d14
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/start.s10
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/symbol1ref.s3
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/symbol1w.s10
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/symbol2ref.s3
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/symbol2w.s6
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/table.s1
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/tbss.s15
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/tbss1.s24
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/tbss2.s16
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/tdata1.s24
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/tdata2.s16
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/textaddr1.d8
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/textaddr2.d8
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/textaddr3.d4
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/textaddr4.d8
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/textaddr5.d4
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/textaddr6.d8
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/textaddr7.d8
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/tls_common.exp72
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/tls_common.s11
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/tls_gc.s16
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/unknown.d7
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/unknown2.d8
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/unknown2.s6
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/warn.out3
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/warn1.d15
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/warn2.d17
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/weak-dyn-1.ld8
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/weak-dyn-1.rd3
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/weak-dyn-1a.s13
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/weak-dyn-1b.s2
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/wrap.exp57
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/wrap1.c8
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/wrap1.out3
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/wrap1a.c6
-rw-r--r--binutils-2.21/ld/testsuite/ld-elf/wrap1b.c16
303 files changed, 5257 insertions, 0 deletions
diff --git a/binutils-2.21/ld/testsuite/ld-elf/audit.exp b/binutils-2.21/ld/testsuite/ld-elf/audit.exp
new file mode 100644
index 0000000..407c61a
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/audit.exp
@@ -0,0 +1,65 @@
+# Expect script for various ELF tests.
+# Copyright 2009 Free Software Foundation, Inc.
+#
+# This file is part of the GNU Binutils.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+
+# Exclude non-ELF targets.
+
+if ![is_elf_format] {
+ return
+}
+
+# The following tests require running the executable generated by ld.
+if ![isnative] {
+ return
+}
+
+# Check if compiler works
+if { [which $CC] == 0 } {
+ return
+}
+
+set build_tests {
+ {"Run with -paudit.so"
+ "-Wl,--audit=tmpdir/audit.so" ""
+ {main.c} {{"readelf" {-d} "audit.rd"}} "audit.out"}
+ {"Run with -Paudit.so"
+ "-Wl,-Ptmpdir/audit.so" ""
+ {main.c} {{"readelf" {-d} "depaudit.rd"}} "depaudit.out"}
+ {"Run with --depaudit=audit.so"
+ "-Wl,--depaudit=tmpdir/audit.so" ""
+ {main.c} {{"readelf" {-d} "depaudit.rd"}} "depaudit2.out"}
+ {"Run with shared with --audit"
+ "-shared -Wl,--audit=tmpdir/audit.so" "-fPIC"
+ {main.c} {} "libusesaudit.so"}
+ {"Run with shared with --audit"
+ "-shared -Wl,--audit=tmpdir/audit.so -Wl,--audit=tmpdir/audit2.so \
+ -Wl,--audit=tmpdir/audit3.so"
+ "-fPIC"
+ {main.c} {} "libusesaudit2.so"}
+ {"Run with -lusesaudit"
+ "-Ltmpdir/ -lusesaudit" ""
+ {main.c} {{"readelf" {-d} "depaudit.rd"}} "useslibusesaudit.out"}
+ {"Run with -lusesaudit -lusesaudit2"
+ "-Ltmpdir/ -lusesaudit -lusesaudit2" ""
+ {main.c} {{"readelf" {-d} "depaudit2.rd"}} "useslibusesaudit2.out"}
+}
+
+run_cc_link_tests $build_tests
+
diff --git a/binutils-2.21/ld/testsuite/ld-elf/audit.rd b/binutils-2.21/ld/testsuite/ld-elf/audit.rd
new file mode 100644
index 0000000..fd3b941
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/audit.rd
@@ -0,0 +1,3 @@
+#...
+.*Audit library: \[tmpdir/audit.so\].*
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-elf/begin.c b/binutils-2.21/ld/testsuite/ld-elf/begin.c
new file mode 100644
index 0000000..ccc47d4
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/begin.c
@@ -0,0 +1,5 @@
+extern void foo (void);
+
+static void (*const init_array []) (void)
+ __attribute__ ((used, section (".init_array"), aligned (sizeof (void *))))
+ = { foo };
diff --git a/binutils-2.21/ld/testsuite/ld-elf/beginwarn.c b/binutils-2.21/ld/testsuite/ld-elf/beginwarn.c
new file mode 100644
index 0000000..ebe2819
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/beginwarn.c
@@ -0,0 +1,9 @@
+static const char _evoke_link_warning_foo []
+ __attribute__ ((used, section (".gnu.warning.foo")))
+ = "function foo is deprecated";
+
+extern void foo (void);
+
+static void (*const init_array []) (void)
+ __attribute__ ((used, section (".init_array"), aligned (sizeof (void *))))
+ = { foo };
diff --git a/binutils-2.21/ld/testsuite/ld-elf/binutils.exp b/binutils-2.21/ld/testsuite/ld-elf/binutils.exp
new file mode 100644
index 0000000..422c5d7
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/binutils.exp
@@ -0,0 +1,154 @@
+# Expect script for binutils tests
+# Copyright 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+#
+# This file is part of the GNU Binutils.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+# Written by H.J. Lu (hongjiu.lu@intel.com)
+#
+
+# Make sure that binutils can correctly handle ld output in ELF.
+
+# Run on Linux only.
+if { ![istarget *-*-linux*] } {
+ return
+}
+
+if { [istarget *-*-linux*aout*]
+ || [istarget *-*-linux*oldld*] } {
+ return
+}
+
+proc binutils_test { prog_name ld_options test } {
+ global as
+ global ld
+ global READELF
+ global objcopy
+ global strip
+ global srcdir
+ global subdir
+ global link_output
+
+ eval set prog \$$prog_name
+ set test_name "$prog_name $ld_options ($test)"
+
+ if { ![ld_assemble $as $srcdir/$subdir/$test.s tmpdir/$test.o ] } {
+ unresolved "$test_name"
+ return
+ }
+
+ if { ![ld_simple_link $ld tmpdir/$test "$ld_options tmpdir/$test.o"] } {
+ if { [string match "*not supported*" $link_output]
+ || [string match "*unrecognized option*" $link_output] } {
+ unsupported "$ld_options is not supported by this target"
+ } else {
+ unresolved "$test_name"
+ }
+ return
+ }
+
+ send_log "$READELF -l --wide tmpdir/$test > tmpdir/$test.exp\n"
+ set got [remote_exec host "$READELF -l --wide tmpdir/$test" "" "/dev/null" "tmpdir/$test.exp"]
+ if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
+ send_log "$got\n"
+ unresolved "$test_name"
+ return
+ }
+
+ send_log "$prog tmpdir/$test\n"
+ set got [remote_exec host "$prog tmpdir/$test"]
+ if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
+ send_log "$got\n"
+ fail "$test_name"
+ return
+ }
+
+ send_log "$READELF -l --wide tmpdir/$test > tmpdir/$test.out\n"
+ set got [remote_exec host "$READELF -l --wide tmpdir/$test" "" "/dev/null" "tmpdir/$test.out"]
+ if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
+ send_log "$got\n"
+ unresolved "$test_name"
+ return
+ }
+
+ if { [catch {exec cmp tmpdir/$test.exp tmpdir/$test.out}] } then {
+ send_log "tmpdir/$test.exp tmpdir/$test.out differ.\n"
+ fail "$test_name"
+ return
+ }
+
+ pass "$test_name"
+}
+
+binutils_test strip "-z max-page-size=0x200000" maxpage1
+binutils_test strip "-z max-page-size=0x200000 -z common-page-size=0x100000" maxpage1
+binutils_test strip "-z max-page-size=0x100000" maxpage1
+binutils_test strip "-z max-page-size=0x100000 -z common-page-size=0x1000" maxpage1
+
+binutils_test strip "" maxpage1
+binutils_test strip "-shared" maxpage1
+binutils_test objcopy "" maxpage1
+binutils_test objcopy "-shared" maxpage1
+
+binutils_test strip "-z relro" relro1
+binutils_test strip "-z relro -shared" relro1
+binutils_test objcopy "-z relro" relro1
+binutils_test objcopy "-z relro -shared" relro1
+if { ([istarget "i?86-*-elf*"]
+ || ([istarget "i?86-*-linux*"]
+ && ![istarget "*-*-*aout*"]
+ && ![istarget "*-*-*oldld*"])
+ || [istarget "x86_64-*-linux*"]
+ || [istarget "amd64-*-linux*"]) } {
+ binutils_test strip "-z relro -shared" relro2
+ binutils_test objcopy "-z relro -shared" relro2
+}
+
+binutils_test strip "-T ${srcdir}/${subdir}/lma.lnk" lma
+
+# hppa64 has its own .tbss section, with different flags.
+if { ![istarget "hppa64-*-*"] } {
+ binutils_test objcopy "" tbss1
+ binutils_test objcopy "-z relro" tbss1
+ binutils_test objcopy "-shared" tbss1
+ binutils_test objcopy "-shared -z relro" tbss1
+ binutils_test objcopy "-z max-page-size=0x100000" tbss1
+ binutils_test objcopy "-z max-page-size=0x100000 -z common-page-size=0x1000" tbss1
+}
+
+binutils_test objcopy "" tdata1
+binutils_test objcopy "-z relro" tdata1
+binutils_test objcopy "-shared" tdata1
+binutils_test objcopy "-shared -z relro" tdata1
+binutils_test objcopy "-z max-page-size=0x100000" tdata1
+binutils_test objcopy "-z max-page-size=0x100000 -z common-page-size=0x1000" tdata1
+
+if { ![istarget "hppa64-*-*"] } {
+ binutils_test objcopy "" tbss2
+ binutils_test objcopy "-z relro" tbss2
+ binutils_test objcopy "-shared" tbss2
+ binutils_test objcopy "-shared -z relro" tbss2
+ binutils_test objcopy "-z max-page-size=0x100000" tbss2
+ binutils_test objcopy "-z max-page-size=0x100000 -z common-page-size=0x1000" tbss2
+}
+
+binutils_test objcopy "" tdata2
+binutils_test objcopy "-z relro" tdata2
+binutils_test objcopy "-shared" tdata2
+binutils_test objcopy "-shared -z relro" tdata2
+binutils_test objcopy "-z max-page-size=0x100000" tdata2
+binutils_test objcopy "-z max-page-size=0x100000 -z common-page-size=0x1000" tdata2
diff --git a/binutils-2.21/ld/testsuite/ld-elf/comm1.c b/binutils-2.21/ld/testsuite/ld-elf/comm1.c
new file mode 100644
index 0000000..c553d86
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/comm1.c
@@ -0,0 +1,17 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+int foo;
+void bar (void);
+
+int
+main ()
+{
+ if (foo != 0)
+ abort ();
+ foo = 200;
+ bar ();
+ if (foo == 200)
+ printf ("PASS\n");
+ return 0;
+}
diff --git a/binutils-2.21/ld/testsuite/ld-elf/commonpage1.d b/binutils-2.21/ld/testsuite/ld-elf/commonpage1.d
new file mode 100644
index 0000000..76dc056
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/commonpage1.d
@@ -0,0 +1,9 @@
+#source: maxpage1.s
+#ld: -z max-page-size=0x200000 -z common-page-size=0x100000
+#readelf: -l --wide
+#target: *-*-linux*
+
+#...
+ LOAD+.*0x200000
+ LOAD+.*0x200000
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-elf/commonpage2.d b/binutils-2.21/ld/testsuite/ld-elf/commonpage2.d
new file mode 100644
index 0000000..e4d582b
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/commonpage2.d
@@ -0,0 +1,9 @@
+#source: maxpage1.s
+#as: --32
+#ld: -z max-page-size=0x200000 -z common-page-size=0x100000 -T maxpage4.t
+#readelf: -l --wide
+#target: x86_64-*-linux*
+
+#...
+ LOAD+.*0x200000
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-elf/compress.exp b/binutils-2.21/ld/testsuite/ld-elf/compress.exp
new file mode 100644
index 0000000..1e13394
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/compress.exp
@@ -0,0 +1,59 @@
+# Expect script for ELF compressed debug section tests.
+# Copyright 2010 Free Software Foundation, Inc.
+#
+# This file is part of the GNU Binutils.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+
+# Exclude non-ELF targets.
+
+if ![is_elf_format] {
+ return
+}
+
+# The following tests require running the executable generated by ld.
+if ![isnative] {
+ return
+}
+
+# Check if compiler works
+if { [which $CC] == 0 } {
+ return
+}
+
+global as
+if { ![ld_assemble $as "--compress-debug-sections $srcdir/$subdir/empty.s" tmpdir/empty.o ] } {
+ unsupported "linker compressed debug sections"
+}
+
+set build_tests {
+ {"Build libfoo.so with compressed debug sections"
+ "-shared" "-fPIC -g -Wa,--compress-debug-sections"
+ {foo.c} {} "libfoo.so"}
+ {"Build libbar.so with compressed debug sections"
+ "-shared" "-fPIC -g -Wa,--compress-debug-sections"
+ {begin.c end.c} {} "libbar.so"}
+}
+
+set run_tests {
+ {"Run normal with libfoo.so with compressed debug sections"
+ "tmpdir/begin.o tmpdir/libfoo.so tmpdir/end.o" "-Wa,--compress-debug-sections"
+ {main.c} "normal" "normal.out"}
+}
+
+run_cc_link_tests $build_tests
+run_ld_link_exec_tests [] $run_tests
diff --git a/binutils-2.21/ld/testsuite/ld-elf/compress1.s b/binutils-2.21/ld/testsuite/ld-elf/compress1.s
new file mode 100644
index 0000000..8ef0a15
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/compress1.s
@@ -0,0 +1,216 @@
+/* This testcase is derived from a similar test in GDB.
+
+ Copyright 2008, 2009, 2010 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* Dummy function to provide debug information for. */
+
+ .text
+.Lbegin_text1:
+ .globl func_cu2
+ .type func_cu2, %function
+func_cu2:
+.Lbegin_func_cu2:
+ .int 0
+.Lend_func_cu2:
+ .size func_cu2, .-func_cu2
+.Lend_text1:
+
+/* Debug information */
+
+ .section .debug_info
+.Lcu1_begin:
+ /* CU header */
+ .4byte .Lcu1_end - .Lcu1_start /* Length of Compilation Unit */
+.Lcu1_start:
+ .2byte 2 /* DWARF Version */
+ .4byte .Labbrev1_begin /* Offset into abbrev section */
+ .byte 4 /* Pointer size */
+
+ /* CU die */
+ .uleb128 1 /* Abbrev: DW_TAG_compile_unit */
+ .4byte .Lline1_begin /* DW_AT_stmt_list */
+ .4byte .Lend_text1 /* DW_AT_high_pc */
+ .4byte .Lbegin_text1 /* DW_AT_low_pc */
+ .ascii "file1.txt\0" /* DW_AT_name */
+ .ascii "GNU C 3.3.3\0" /* DW_AT_producer */
+ .byte 1 /* DW_AT_language (C) */
+
+ /* func_cu2 */
+ .uleb128 2 /* Abbrev: DW_TAG_subprogram */
+ .byte 1 /* DW_AT_external */
+ .byte 1 /* DW_AT_decl_file */
+ .byte 2 /* DW_AT_decl_line */
+ .ascii "func_cu2\0" /* DW_AT_name */
+ .4byte .Ltype_int-.Lcu1_begin /* DW_AT_type */
+ .4byte .Lbegin_func_cu2 /* DW_AT_low_pc */
+ .4byte .Lend_func_cu2 /* DW_AT_high_pc */
+ .byte 1 /* DW_AT_frame_base: length */
+ .byte 0x55 /* DW_AT_frame_base: DW_OP_reg5 */
+
+.Ltype_int:
+ .uleb128 3 /* Abbrev: DW_TAG_base_type */
+ .ascii "int\0" /* DW_AT_name */
+ .byte 4 /* DW_AT_byte_size */
+ .byte 5 /* DW_AT_encoding */
+
+ .byte 0 /* End of children of CU */
+
+.Lcu1_end:
+
+/* Line table */
+ .section .debug_line
+.Lline1_begin:
+ .4byte .Lline1_end - .Lline1_start /* Initial length */
+.Lline1_start:
+ .2byte 2 /* Version */
+ .4byte .Lline1_lines - .Lline1_hdr /* header_length */
+.Lline1_hdr:
+ .byte 1 /* Minimum insn length */
+ .byte 1 /* default_is_stmt */
+ .byte 1 /* line_base */
+ .byte 1 /* line_range */
+ .byte 0x10 /* opcode_base */
+
+ /* Standard lengths */
+ .byte 0
+ .byte 1
+ .byte 1
+ .byte 1
+ .byte 1
+ .byte 0
+ .byte 0
+ .byte 0
+ .byte 1
+ .byte 0
+ .byte 0
+ .byte 1
+ .byte 0
+ .byte 0
+ .byte 0
+
+ /* Include directories */
+ .byte 0
+
+ /* File names */
+ .ascii "file1.txt\0"
+ .uleb128 0
+ .uleb128 0
+ .uleb128 0
+
+ .byte 0
+
+.Lline1_lines:
+ .byte 0 /* DW_LNE_set_address */
+ .uleb128 5
+ .byte 2
+ .4byte .Lbegin_func_cu2
+
+ .byte 3 /* DW_LNS_advance_line */
+ .sleb128 3 /* ... to 4 */
+
+ .byte 1 /* DW_LNS_copy */
+
+ .byte 1 /* DW_LNS_copy (second time as an end-of-prologue marker) */
+
+ .byte 0 /* DW_LNE_set_address */
+ .uleb128 5
+ .byte 2
+ .4byte .Lend_func_cu2
+
+ .byte 0 /* DW_LNE_end_of_sequence */
+ .uleb128 1
+ .byte 1
+
+.Lline1_end:
+
+/* Abbrev table */
+ .section .debug_abbrev
+.Labbrev1_begin:
+ .uleb128 1 /* Abbrev code */
+ .uleb128 0x11 /* DW_TAG_compile_unit */
+ .byte 1 /* has_children */
+ .uleb128 0x10 /* DW_AT_stmt_list */
+ .uleb128 0x6 /* DW_FORM_data4 */
+ .uleb128 0x12 /* DW_AT_high_pc */
+ .uleb128 0x1 /* DW_FORM_addr */
+ .uleb128 0x11 /* DW_AT_low_pc */
+ .uleb128 0x1 /* DW_FORM_addr */
+ .uleb128 0x3 /* DW_AT_name */
+ .uleb128 0x8 /* DW_FORM_string */
+ .uleb128 0x25 /* DW_AT_producer */
+ .uleb128 0x8 /* DW_FORM_string */
+ .uleb128 0x13 /* DW_AT_language */
+ .uleb128 0xb /* DW_FORM_data1 */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+
+ .uleb128 2 /* Abbrev code */
+ .uleb128 0x2e /* DW_TAG_subprogram */
+ .byte 0 /* has_children */
+ .uleb128 0x3f /* DW_AT_external */
+ .uleb128 0xc /* DW_FORM_flag */
+ .uleb128 0x3a /* DW_AT_decl_file */
+ .uleb128 0xb /* DW_FORM_data1 */
+ .uleb128 0x3b /* DW_AT_decl_line */
+ .uleb128 0xb /* DW_FORM_data1 */
+ .uleb128 0x3 /* DW_AT_name */
+ .uleb128 0x8 /* DW_FORM_string */
+ .uleb128 0x49 /* DW_AT_type */
+ .uleb128 0x13 /* DW_FORM_ref4 */
+ .uleb128 0x11 /* DW_AT_low_pc */
+ .uleb128 0x1 /* DW_FORM_addr */
+ .uleb128 0x12 /* DW_AT_high_pc */
+ .uleb128 0x1 /* DW_FORM_addr */
+ .uleb128 0x40 /* DW_AT_frame_base */
+ .uleb128 0xa /* DW_FORM_block1 */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+
+ .uleb128 3 /* Abbrev code */
+ .uleb128 0x24 /* DW_TAG_base_type */
+ .byte 0 /* has_children */
+ .uleb128 0x3 /* DW_AT_name */
+ .uleb128 0x8 /* DW_FORM_string */
+ .uleb128 0xb /* DW_AT_byte_size */
+ .uleb128 0xb /* DW_FORM_data1 */
+ .uleb128 0x3e /* DW_AT_encoding */
+ .uleb128 0xb /* DW_FORM_data1 */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+
+ .section .debug_pubnames,"",%progbits
+ .4byte 0x19
+ .2byte 0x2
+ .4byte .Lcu1_begin
+ .4byte 0x43
+ .4byte 0x25
+ .string "func_cu2"
+ .4byte 0x0
+ .section .debug_aranges,"",%progbits
+ .4byte 0x1c
+ .2byte 0x2
+ .4byte .Lcu1_begin
+ .byte 0x4
+ .byte 0x0
+ .2byte 0x0
+ .2byte 0x0
+ .4byte .Lbegin_text1
+ .4byte .Lbegin_text1-.Lend_text1
+ .4byte 0x0
+ .4byte 0x0
diff --git a/binutils-2.21/ld/testsuite/ld-elf/compress1a.d b/binutils-2.21/ld/testsuite/ld-elf/compress1a.d
new file mode 100644
index 0000000..a8eac40
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/compress1a.d
@@ -0,0 +1,10 @@
+#source: compress1.s
+#as: --compress-debug-sections
+#ld: -e func_cu2
+#readelf: -S --wide
+#notarget: alpha-*
+
+#failif
+#...
+ \[[ 0-9]+\] \.zdebug_.*[ ]+(PROGBITS|MIPS_DWARF)[ 0-9a-z]+ .*
+#...
diff --git a/binutils-2.21/ld/testsuite/ld-elf/compress1b.d b/binutils-2.21/ld/testsuite/ld-elf/compress1b.d
new file mode 100644
index 0000000..f3428d4
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/compress1b.d
@@ -0,0 +1,9 @@
+#source: compress1.s
+#as: --compress-debug-sections
+#ld: -r
+#readelf: -S --wide
+
+#failif
+#...
+ \[[ 0-9]+\] \.zdebug_.*[ ]+(PROGBITS|MIPS_DWARF)[ 0-9a-z]+ .*
+#...
diff --git a/binutils-2.21/ld/testsuite/ld-elf/compress1c.d b/binutils-2.21/ld/testsuite/ld-elf/compress1c.d
new file mode 100644
index 0000000..5042694
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/compress1c.d
@@ -0,0 +1,10 @@
+#source: compress1.s
+#as: --compress-debug-sections
+#ld: -shared
+#readelf: -S --wide
+#target: *-*-linux*
+
+#failif
+#...
+ \[[ 0-9]+\] \.zdebug_.*[ ]+(PROGBITS|MIPS_DWARF)[ 0-9a-z]+ .*
+#...
diff --git a/binutils-2.21/ld/testsuite/ld-elf/data1.c b/binutils-2.21/ld/testsuite/ld-elf/data1.c
new file mode 100644
index 0000000..c205f82
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/data1.c
@@ -0,0 +1,6 @@
+#include "data1.h"
+
+char a1[1] __attribute__ ((aligned (ALIGNMENT1))) = { 10 };
+char a2[2] __attribute__ ((aligned (ALIGNMENT2)));
+char a3[3] __attribute__ ((aligned (ALIGNMENT3)));
+char a4[4] __attribute__ ((aligned (ALIGNMENT4)));
diff --git a/binutils-2.21/ld/testsuite/ld-elf/data1.h b/binutils-2.21/ld/testsuite/ld-elf/data1.h
new file mode 100644
index 0000000..529ee4b
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/data1.h
@@ -0,0 +1,9 @@
+#define ALIGNMENT1 0x800
+#define ALIGNMENT2 0x400
+#define ALIGNMENT3 0x200
+#define ALIGNMENT4 0x100
+
+extern char a1[1];
+extern char a2[2];
+extern char a3[3];
+extern char a4[4];
diff --git a/binutils-2.21/ld/testsuite/ld-elf/del.cc b/binutils-2.21/ld/testsuite/ld-elf/del.cc
new file mode 100644
index 0000000..4e2cc60
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/del.cc
@@ -0,0 +1,29 @@
+#include <new>
+
+extern "C" void free (void *);
+
+void
+operator delete (void *ptr, const std::nothrow_t&) throw ()
+{
+ if (ptr)
+ free (ptr);
+}
+
+void
+operator delete (void *ptr) throw ()
+{
+ if (ptr)
+ free (ptr);
+}
+
+void
+operator delete[] (void *ptr) throw ()
+{
+ ::operator delete (ptr);
+}
+
+void
+operator delete[] (void *ptr, const std::nothrow_t&) throw ()
+{
+ ::operator delete (ptr);
+}
diff --git a/binutils-2.21/ld/testsuite/ld-elf/depaudit.rd b/binutils-2.21/ld/testsuite/ld-elf/depaudit.rd
new file mode 100644
index 0000000..98a2692
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/depaudit.rd
@@ -0,0 +1,3 @@
+#...
+.*Dependency audit library: \[tmpdir/audit.so\].*
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-elf/depaudit2.rd b/binutils-2.21/ld/testsuite/ld-elf/depaudit2.rd
new file mode 100644
index 0000000..3554416
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/depaudit2.rd
@@ -0,0 +1,3 @@
+#...
+.*Dependency audit library: \[tmpdir/audit.so:tmpdir/audit2.so:tmpdir/audit3.so\].*
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-elf/discard.ld b/binutils-2.21/ld/testsuite/ld-elf/discard.ld
new file mode 100644
index 0000000..bd094f2
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/discard.ld
@@ -0,0 +1,3 @@
+SECTIONS {
+ /DISCARD/ : { *(.discard) }
+}
diff --git a/binutils-2.21/ld/testsuite/ld-elf/discard1.d b/binutils-2.21/ld/testsuite/ld-elf/discard1.d
new file mode 100644
index 0000000..b80fbf0
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/discard1.d
@@ -0,0 +1,9 @@
+#source: discard1.s
+#ld: -r -T discard.ld
+#readelf: -r
+#target: x86_64-*-linux-gnu i?86-*-linux-gnu
+
+Relocation section '.rel.*.debug_info' at offset 0x[0-9a-z]+ contains 1 entries:
+[ \t]+Offset[ \t]+Info[ \t]+Type[ \t]+Sym.*
+[0-9a-f]+[ \t]+[0-9a-f]+[ \t]+R_.*[ \t]+[0-9a-f]+[ \t]+bar.*
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-elf/discard1.s b/binutils-2.21/ld/testsuite/ld-elf/discard1.s
new file mode 100644
index 0000000..ac3b92f
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/discard1.s
@@ -0,0 +1,11 @@
+ .globl bar
+ .data
+bar:
+ .long 1
+ .section .discard,"aw",%progbits
+ .align 4
+there:
+ .long 2
+ .section .debug_info,"",%progbits
+ .long bar
+ .long there
diff --git a/binutils-2.21/ld/testsuite/ld-elf/discard2.d b/binutils-2.21/ld/testsuite/ld-elf/discard2.d
new file mode 100644
index 0000000..65a3abe
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/discard2.d
@@ -0,0 +1,9 @@
+#source: discard2.s
+#ld: -r -T discard.ld
+#readelf: -r
+#target: x86_64-*-linux-gnu i?86-*-linux-gnu
+
+Relocation section '.rel.*.debug_info' at offset 0x[0-9a-z]+ contains 1 entries:
+[ \t]+Offset[ \t]+Info[ \t]+Type[ \t]+Sym.*
+[0-9a-f]+[ \t]+[0-9a-f]+[ \t]+R_.*[ \t]+[0-9a-f]+[ \t]+here.*
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-elf/discard2.s b/binutils-2.21/ld/testsuite/ld-elf/discard2.s
new file mode 100644
index 0000000..27b66f4
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/discard2.s
@@ -0,0 +1,12 @@
+ .globl here
+ .data
+here:
+ .long 1
+ .globl there
+ .section .discard,"aw",%progbits
+ .align 4
+there:
+ .long 2
+ .section .debug_info,"",%progbits
+ .long here
+ .long there
diff --git a/binutils-2.21/ld/testsuite/ld-elf/discard3.d b/binutils-2.21/ld/testsuite/ld-elf/discard3.d
new file mode 100644
index 0000000..07962b5
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/discard3.d
@@ -0,0 +1,11 @@
+#source: discard1.s
+#source: discard2.s
+#ld: -r -T discard.ld
+#readelf: -r
+#target: x86_64-*-linux-gnu i?86-*-linux-gnu
+
+Relocation section '.rel.*.debug_info' at offset 0x[0-9a-z]+ contains 2 entries:
+[ \t]+Offset[ \t]+Info[ \t]+Type[ \t]+Sym.*
+[0-9a-f]+[ \t]+[0-9a-f]+[ \t]+R_.*[ \t]+[0-9a-f]+[ \t]+bar.*
+[0-9a-f]+[ \t]+[0-9a-f]+[ \t]+R_.*[ \t]+[0-9a-f]+[ \t]+here.*
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-elf/dl1.c b/binutils-2.21/ld/testsuite/ld-elf/dl1.c
new file mode 100644
index 0000000..09426f3
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/dl1.c
@@ -0,0 +1,10 @@
+#include <stdio.h>
+
+extern int bar;
+
+void
+foo (void)
+{
+ if (bar == -20)
+ printf ("OK\n");
+}
diff --git a/binutils-2.21/ld/testsuite/ld-elf/dl1.list b/binutils-2.21/ld/testsuite/ld-elf/dl1.list
new file mode 100644
index 0000000..9ffada0
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/dl1.list
@@ -0,0 +1,6 @@
+{
+ extern "C"
+ {
+ bar;
+ };
+};
diff --git a/binutils-2.21/ld/testsuite/ld-elf/dl1.out b/binutils-2.21/ld/testsuite/ld-elf/dl1.out
new file mode 100644
index 0000000..d86bac9
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/dl1.out
@@ -0,0 +1 @@
+OK
diff --git a/binutils-2.21/ld/testsuite/ld-elf/dl1main.c b/binutils-2.21/ld/testsuite/ld-elf/dl1main.c
new file mode 100644
index 0000000..f224e12
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/dl1main.c
@@ -0,0 +1,33 @@
+#include <stdio.h>
+#include <dlfcn.h>
+
+int bar = -20;
+
+int
+main (void)
+{
+ int ret = 0;
+ void *handle;
+ void (*fcn) (void);
+
+ handle = dlopen("./tmpdir/libdl1.so", RTLD_GLOBAL|RTLD_LAZY);
+ if (!handle)
+ {
+ printf("dlopen ./tmpdir/libdl1.so: %s\n", dlerror ());
+ return 1;
+ }
+
+ fcn = (void (*)(void)) dlsym(handle, "foo");
+ if (!fcn)
+ {
+ printf("dlsym foo: %s\n", dlerror ());
+ ret += 1;
+ }
+ else
+ {
+ (*fcn) ();
+ }
+
+ dlclose (handle);
+ return ret;
+}
diff --git a/binutils-2.21/ld/testsuite/ld-elf/dl2.c b/binutils-2.21/ld/testsuite/ld-elf/dl2.c
new file mode 100644
index 0000000..b5cd927
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/dl2.c
@@ -0,0 +1,16 @@
+#include <stdio.h>
+
+int foo;
+
+extern void xxx (void);
+
+void
+bar (int x)
+{
+ if (foo == 1)
+ printf ("OK1\n");
+ else if (foo == 0)
+ printf ("OK2\n");
+ foo = -1;
+ xxx ();
+}
diff --git a/binutils-2.21/ld/testsuite/ld-elf/dl2.list b/binutils-2.21/ld/testsuite/ld-elf/dl2.list
new file mode 100644
index 0000000..e985dcf
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/dl2.list
@@ -0,0 +1,3 @@
+{
+ foo;
+};
diff --git a/binutils-2.21/ld/testsuite/ld-elf/dl2a.list b/binutils-2.21/ld/testsuite/ld-elf/dl2a.list
new file mode 100644
index 0000000..989646e
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/dl2a.list
@@ -0,0 +1,3 @@
+{
+ "foo";
+};
diff --git a/binutils-2.21/ld/testsuite/ld-elf/dl2a.out b/binutils-2.21/ld/testsuite/ld-elf/dl2a.out
new file mode 100644
index 0000000..f3d5b9f
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/dl2a.out
@@ -0,0 +1,3 @@
+OK1
+DSO
+OK1
diff --git a/binutils-2.21/ld/testsuite/ld-elf/dl2b.out b/binutils-2.21/ld/testsuite/ld-elf/dl2b.out
new file mode 100644
index 0000000..f30cead
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/dl2b.out
@@ -0,0 +1,3 @@
+OK1
+MAIN
+OK1
diff --git a/binutils-2.21/ld/testsuite/ld-elf/dl2main.c b/binutils-2.21/ld/testsuite/ld-elf/dl2main.c
new file mode 100644
index 0000000..ddf677f
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/dl2main.c
@@ -0,0 +1,22 @@
+#include <stdio.h>
+
+extern int foo;
+extern void bar (void);
+
+void
+xxx (void)
+{
+ printf ("MAIN\n");
+}
+
+int
+main (void)
+{
+ foo = 1;
+ bar ();
+ if (foo == -1)
+ printf ("OK1\n");
+ else if (foo == 1)
+ printf ("OK2\n");
+ return 0;
+}
diff --git a/binutils-2.21/ld/testsuite/ld-elf/dl2xxx.c b/binutils-2.21/ld/testsuite/ld-elf/dl2xxx.c
new file mode 100644
index 0000000..cf3a1d0
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/dl2xxx.c
@@ -0,0 +1,7 @@
+#include <stdio.h>
+
+void
+xxx (void)
+{
+ printf ("DSO\n");
+}
diff --git a/binutils-2.21/ld/testsuite/ld-elf/dl2xxx.list b/binutils-2.21/ld/testsuite/ld-elf/dl2xxx.list
new file mode 100644
index 0000000..9388cda
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/dl2xxx.list
@@ -0,0 +1,3 @@
+{
+ xxx;
+};
diff --git a/binutils-2.21/ld/testsuite/ld-elf/dl3.cc b/binutils-2.21/ld/testsuite/ld-elf/dl3.cc
new file mode 100644
index 0000000..558e49f
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/dl3.cc
@@ -0,0 +1,7 @@
+#include "dl3header.h"
+
+void
+f (void)
+{
+ throw (A (42));
+}
diff --git a/binutils-2.21/ld/testsuite/ld-elf/dl3.list b/binutils-2.21/ld/testsuite/ld-elf/dl3.list
new file mode 100644
index 0000000..0b347ea
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/dl3.list
@@ -0,0 +1,6 @@
+{
+ extern "C++"
+ {
+ typeinfo*;
+ };
+};
diff --git a/binutils-2.21/ld/testsuite/ld-elf/dl3a.out b/binutils-2.21/ld/testsuite/ld-elf/dl3a.out
new file mode 100644
index 0000000..d86bac9
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/dl3a.out
@@ -0,0 +1 @@
+OK
diff --git a/binutils-2.21/ld/testsuite/ld-elf/dl3b.out b/binutils-2.21/ld/testsuite/ld-elf/dl3b.out
new file mode 100644
index 0000000..8a15044
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/dl3b.out
@@ -0,0 +1 @@
+BAD2
diff --git a/binutils-2.21/ld/testsuite/ld-elf/dl3header.h b/binutils-2.21/ld/testsuite/ld-elf/dl3header.h
new file mode 100644
index 0000000..66f7d46
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/dl3header.h
@@ -0,0 +1,5 @@
+struct A
+{
+ int i;
+ A (int i): i(i) {}
+};
diff --git a/binutils-2.21/ld/testsuite/ld-elf/dl3main.cc b/binutils-2.21/ld/testsuite/ld-elf/dl3main.cc
new file mode 100644
index 0000000..977f9bb
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/dl3main.cc
@@ -0,0 +1,25 @@
+#include <stdio.h>
+#include "dl3header.h"
+
+extern void f (void);
+
+int
+main (void)
+{
+ try
+ {
+ f();
+ }
+ catch (A a)
+ {
+ if (a.i == 42)
+ printf ("OK\n");
+ else
+ printf ("BAD1\n");
+ }
+ catch (...)
+ {
+ printf ("BAD2\n");
+ }
+ return 0;
+}
diff --git a/binutils-2.21/ld/testsuite/ld-elf/dl4.c b/binutils-2.21/ld/testsuite/ld-elf/dl4.c
new file mode 100644
index 0000000..bf6f070
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/dl4.c
@@ -0,0 +1,24 @@
+#include <stdio.h>
+
+int foo1;
+int foo2;
+
+extern void xxx1 (void);
+extern void xxx2 (void);
+
+void
+bar (int x)
+{
+ if (foo1 == 1)
+ printf ("bar OK1\n");
+ else if (foo1 == 0)
+ printf ("bar OK2\n");
+ if (foo2 == 1)
+ printf ("bar OK3\n");
+ else if (foo2 == 0)
+ printf ("bar OK4\n");
+ foo1 = -1;
+ foo2 = -1;
+ xxx1 ();
+ xxx2 ();
+}
diff --git a/binutils-2.21/ld/testsuite/ld-elf/dl4.list b/binutils-2.21/ld/testsuite/ld-elf/dl4.list
new file mode 100644
index 0000000..e932e23
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/dl4.list
@@ -0,0 +1,4 @@
+{
+ foo1;
+ foo2;
+};
diff --git a/binutils-2.21/ld/testsuite/ld-elf/dl4a.out b/binutils-2.21/ld/testsuite/ld-elf/dl4a.out
new file mode 100644
index 0000000..871c5be
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/dl4a.out
@@ -0,0 +1,6 @@
+bar OK1
+bar OK3
+DSO1
+DSO2
+OK1
+OK3
diff --git a/binutils-2.21/ld/testsuite/ld-elf/dl4b.out b/binutils-2.21/ld/testsuite/ld-elf/dl4b.out
new file mode 100644
index 0000000..b838f5b
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/dl4b.out
@@ -0,0 +1,6 @@
+bar OK1
+bar OK3
+MAIN1
+MAIN2
+OK1
+OK3
diff --git a/binutils-2.21/ld/testsuite/ld-elf/dl4main.c b/binutils-2.21/ld/testsuite/ld-elf/dl4main.c
new file mode 100644
index 0000000..173450d
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/dl4main.c
@@ -0,0 +1,34 @@
+#include <stdio.h>
+
+extern int foo1;
+extern int foo2;
+extern void bar (void);
+
+void
+xxx1 (void)
+{
+ printf ("MAIN1\n");
+}
+
+void
+xxx2 (void)
+{
+ printf ("MAIN2\n");
+}
+
+int
+main (void)
+{
+ foo1 = 1;
+ foo2 = 1;
+ bar ();
+ if (foo1 == -1)
+ printf ("OK1\n");
+ else if (foo1 == 1)
+ printf ("OK2\n");
+ if (foo2 == -1)
+ printf ("OK3\n");
+ else if (foo2 == 1)
+ printf ("OK4\n");
+ return 0;
+}
diff --git a/binutils-2.21/ld/testsuite/ld-elf/dl4xxx.c b/binutils-2.21/ld/testsuite/ld-elf/dl4xxx.c
new file mode 100644
index 0000000..8180eb1
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/dl4xxx.c
@@ -0,0 +1,13 @@
+#include <stdio.h>
+
+void
+xxx1 (void)
+{
+ printf ("DSO1\n");
+}
+
+void
+xxx2 (void)
+{
+ printf ("DSO2\n");
+}
diff --git a/binutils-2.21/ld/testsuite/ld-elf/dl4xxx.list b/binutils-2.21/ld/testsuite/ld-elf/dl4xxx.list
new file mode 100644
index 0000000..f39ce14
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/dl4xxx.list
@@ -0,0 +1,4 @@
+{
+ xxx1;
+ xxx2;
+};
diff --git a/binutils-2.21/ld/testsuite/ld-elf/dl5.cc b/binutils-2.21/ld/testsuite/ld-elf/dl5.cc
new file mode 100644
index 0000000..cc40455
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/dl5.cc
@@ -0,0 +1,61 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <new>
+
+int pass = 0;
+
+void *
+operator new (size_t sz, const std::nothrow_t&) throw ()
+{
+ void *p;
+ pass++;
+ p = malloc(sz);
+ return p;
+}
+
+void *
+operator new (size_t sz) throw (std::bad_alloc)
+{
+ void *p;
+ pass++;
+ p = malloc(sz);
+ return p;
+}
+
+void
+operator delete (void *ptr) throw ()
+{
+ pass++;
+ if (ptr)
+ free (ptr);
+}
+
+class A
+{
+public:
+ A() {}
+ ~A() { }
+ int a;
+ int b;
+};
+
+
+int
+main (void)
+{
+ A *bb = new A[10];
+ delete [] bb;
+ bb = new (std::nothrow) A [10];
+ delete [] bb;
+
+ if (pass == 4)
+ {
+ printf ("PASS\n");
+ return 0;
+ }
+ else
+ {
+ printf ("FAIL\n");
+ return 1;
+ }
+}
diff --git a/binutils-2.21/ld/testsuite/ld-elf/dl5.out b/binutils-2.21/ld/testsuite/ld-elf/dl5.out
new file mode 100644
index 0000000..7ef22e9
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/dl5.out
@@ -0,0 +1 @@
+PASS
diff --git a/binutils-2.21/ld/testsuite/ld-elf/dl6.c b/binutils-2.21/ld/testsuite/ld-elf/dl6.c
new file mode 100644
index 0000000..f655ca6
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/dl6.c
@@ -0,0 +1,14 @@
+#include <stdio.h>
+
+int bar = 10;
+
+void
+foo (void)
+{
+ if (bar == 10)
+ printf ("bar is in DSO.\n");
+ else if (bar == -20)
+ printf ("bar is in main.\n");
+ else
+ printf ("FAIL\n");
+}
diff --git a/binutils-2.21/ld/testsuite/ld-elf/dl6a.out b/binutils-2.21/ld/testsuite/ld-elf/dl6a.out
new file mode 100644
index 0000000..186e848
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/dl6a.out
@@ -0,0 +1 @@
+bar is in main.
diff --git a/binutils-2.21/ld/testsuite/ld-elf/dl6amain.c b/binutils-2.21/ld/testsuite/ld-elf/dl6amain.c
new file mode 100644
index 0000000..9824224
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/dl6amain.c
@@ -0,0 +1,33 @@
+#include <stdio.h>
+#include <dlfcn.h>
+
+int bar = -20;
+
+int
+main (void)
+{
+ int ret = 0;
+ void *handle;
+ void (*fcn) (void);
+
+ handle = dlopen("./tmpdir/libdl6a.so", RTLD_GLOBAL|RTLD_LAZY);
+ if (!handle)
+ {
+ printf("dlopen ./tmpdir/libdl6a.so: %s\n", dlerror ());
+ return 1;
+ }
+
+ fcn = (void (*)(void)) dlsym(handle, "foo");
+ if (!fcn)
+ {
+ printf("dlsym foo: %s\n", dlerror ());
+ ret += 1;
+ }
+ else
+ {
+ (*fcn) ();
+ }
+
+ dlclose (handle);
+ return ret;
+}
diff --git a/binutils-2.21/ld/testsuite/ld-elf/dl6b.out b/binutils-2.21/ld/testsuite/ld-elf/dl6b.out
new file mode 100644
index 0000000..8cc87f5
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/dl6b.out
@@ -0,0 +1 @@
+bar is in DSO.
diff --git a/binutils-2.21/ld/testsuite/ld-elf/dl6bmain.c b/binutils-2.21/ld/testsuite/ld-elf/dl6bmain.c
new file mode 100644
index 0000000..df9dbcc
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/dl6bmain.c
@@ -0,0 +1,33 @@
+#include <stdio.h>
+#include <dlfcn.h>
+
+int bar = -20;
+
+int
+main (void)
+{
+ int ret = 0;
+ void *handle;
+ void (*fcn) (void);
+
+ handle = dlopen("./tmpdir/libdl6b.so", RTLD_GLOBAL|RTLD_LAZY);
+ if (!handle)
+ {
+ printf("dlopen ./tmpdir/libdl6b.so: %s\n", dlerror ());
+ return 1;
+ }
+
+ fcn = (void (*)(void)) dlsym(handle, "foo");
+ if (!fcn)
+ {
+ printf("dlsym foo: %s\n", dlerror ());
+ ret += 1;
+ }
+ else
+ {
+ (*fcn) ();
+ }
+
+ dlclose (handle);
+ return ret;
+}
diff --git a/binutils-2.21/ld/testsuite/ld-elf/dl6cmain.c b/binutils-2.21/ld/testsuite/ld-elf/dl6cmain.c
new file mode 100644
index 0000000..f6c285c
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/dl6cmain.c
@@ -0,0 +1,33 @@
+#include <stdio.h>
+#include <dlfcn.h>
+
+int bar = -20;
+
+int
+main (void)
+{
+ int ret = 0;
+ void *handle;
+ void (*fcn) (void);
+
+ handle = dlopen("./tmpdir/libdl6c.so", RTLD_GLOBAL|RTLD_LAZY);
+ if (!handle)
+ {
+ printf("dlopen ./tmpdir/libdl6c.so: %s\n", dlerror ());
+ return 1;
+ }
+
+ fcn = (void (*)(void)) dlsym(handle, "foo");
+ if (!fcn)
+ {
+ printf("dlsym foo: %s\n", dlerror ());
+ ret += 1;
+ }
+ else
+ {
+ (*fcn) ();
+ }
+
+ dlclose (handle);
+ return ret;
+}
diff --git a/binutils-2.21/ld/testsuite/ld-elf/dl6dmain.c b/binutils-2.21/ld/testsuite/ld-elf/dl6dmain.c
new file mode 100644
index 0000000..2e57eb7
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/dl6dmain.c
@@ -0,0 +1,33 @@
+#include <stdio.h>
+#include <dlfcn.h>
+
+int bar = -20;
+
+int
+main (void)
+{
+ int ret = 0;
+ void *handle;
+ void (*fcn) (void);
+
+ handle = dlopen("./tmpdir/libdl6d.so", RTLD_GLOBAL|RTLD_LAZY);
+ if (!handle)
+ {
+ printf("dlopen ./tmpdir/libdl6d.so: %s\n", dlerror ());
+ return 1;
+ }
+
+ fcn = (void (*)(void)) dlsym(handle, "foo");
+ if (!fcn)
+ {
+ printf("dlsym foo: %s\n", dlerror ());
+ ret += 1;
+ }
+ else
+ {
+ (*fcn) ();
+ }
+
+ dlclose (handle);
+ return ret;
+}
diff --git a/binutils-2.21/ld/testsuite/ld-elf/dummy.c b/binutils-2.21/ld/testsuite/ld-elf/dummy.c
new file mode 100644
index 0000000..5c03287
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/dummy.c
@@ -0,0 +1 @@
+/* An empty file. */
diff --git a/binutils-2.21/ld/testsuite/ld-elf/dwarf.exp b/binutils-2.21/ld/testsuite/ld-elf/dwarf.exp
new file mode 100644
index 0000000..c313236
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/dwarf.exp
@@ -0,0 +1,114 @@
+# Expect script for various DWARF tests.
+# Copyright 2006, 2007 Free Software Foundation, Inc.
+#
+# This file is part of the GNU Binutils.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+
+#
+# Written by H.J. Lu (hongjiu.lu@intel.com)
+#
+
+# Exclude non-ELF targets.
+
+if ![is_elf_format] {
+ return
+}
+
+# The following tests require running the executable generated by ld.
+if ![isnative] {
+ return
+}
+
+# Check if compiler works
+if { [which $CC] == 0 } {
+ return
+}
+
+# Skip if -feliminate-dwarf2-dups isn't supported.
+if ![ld_compile "$CC -g -feliminate-dwarf2-dups" $srcdir/$subdir/dummy.c tmpdir/dummy.o] {
+ return
+}
+
+set build_tests {
+ {"Build libdwarf1.so"
+ "-s -shared" "-fPIC -g -feliminate-dwarf2-dups"
+ {dwarf1.c} {} "libdwarf1.so"}
+}
+
+set run_tests {
+ {"Run with libdwarf1.so first"
+ "tmpdir/libdwarf1.so" ""
+ {dwarf1main.c} "dwarf1a" "dwarf1.out"
+ "-g -feliminate-dwarf2-dups"}
+ {"Run with libdwarf1.so last"
+ "tmpdir/dwarf1main.o tmpdir/libdwarf1.so" ""
+ {dummy.c} "dwarf1b" "dwarf1.out"
+ "-g -feliminate-dwarf2-dups"}
+}
+
+run_cc_link_tests $build_tests
+run_ld_link_exec_tests [] $run_tests
+
+proc strip_test {} {
+ global ld
+ global strip
+ global NM
+
+ set test "libdwarf1c.so"
+ set test_name "Strip -s $test"
+ set prog $strip
+
+ if ![ld_simple_link $ld tmpdir/$test "-shared tmpdir/dwarf1.o"] {
+ unresolved "$test_name"
+ return
+ }
+
+ send_log "$NM -D tmpdir/$test > tmpdir/$test.exp\n"
+ catch "exec $NM -D tmpdir/$test > tmpdir/$test.exp" got
+ if ![string match "" $got] then {
+ send_log "$got\n"
+ unresolved "$test_name"
+ return
+ }
+
+ send_log "$prog -s tmpdir/$test\n"
+ catch "exec $prog -s tmpdir/$test" got
+ if ![string match "" $got] then {
+ send_log "$got\n"
+ fail "$test_name"
+ return
+ }
+
+ send_log "$NM -D tmpdir/$test > tmpdir/$test.out\n"
+ catch "exec $NM -D tmpdir/$test > tmpdir/$test.out" got
+ if ![string match "" $got] then {
+ send_log "$got\n"
+ unresolved "$test_name"
+ return
+ }
+
+ if { [catch {exec cmp tmpdir/$test.exp tmpdir/$test.out}] } then {
+ send_log "tmpdir/$test.exp tmpdir/$test.out differ.\n"
+ fail "$test_name"
+ return
+ }
+
+ pass "$test_name"
+}
+
+strip_test
diff --git a/binutils-2.21/ld/testsuite/ld-elf/dwarf1.c b/binutils-2.21/ld/testsuite/ld-elf/dwarf1.c
new file mode 100644
index 0000000..2895d4c
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/dwarf1.c
@@ -0,0 +1,10 @@
+#include <stdio.h>
+#include "dwarf1.h"
+
+struct foo_s foo;
+
+void
+doprintf (void)
+{
+ printf ("OK\n");
+}
diff --git a/binutils-2.21/ld/testsuite/ld-elf/dwarf1.h b/binutils-2.21/ld/testsuite/ld-elf/dwarf1.h
new file mode 100644
index 0000000..3cd7918
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/dwarf1.h
@@ -0,0 +1,6 @@
+struct foo_s
+{
+ int foo;
+};
+
+extern void doprintf (void);
diff --git a/binutils-2.21/ld/testsuite/ld-elf/dwarf1.out b/binutils-2.21/ld/testsuite/ld-elf/dwarf1.out
new file mode 100644
index 0000000..d86bac9
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/dwarf1.out
@@ -0,0 +1 @@
+OK
diff --git a/binutils-2.21/ld/testsuite/ld-elf/dwarf1main.c b/binutils-2.21/ld/testsuite/ld-elf/dwarf1main.c
new file mode 100644
index 0000000..9045198
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/dwarf1main.c
@@ -0,0 +1,10 @@
+#include "dwarf1.h"
+
+struct foo_s foo;
+
+int
+main (void)
+{
+ doprintf ();
+ return 0;
+}
diff --git a/binutils-2.21/ld/testsuite/ld-elf/dynbss1.c b/binutils-2.21/ld/testsuite/ld-elf/dynbss1.c
new file mode 100644
index 0000000..eb5f067
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/dynbss1.c
@@ -0,0 +1,20 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include "data1.h"
+
+int
+main (void)
+{
+ if ((((long) (&a1)) & (ALIGNMENT1 - 1)))
+ abort ();
+ if ((((long) (&a2)) & (ALIGNMENT2 - 1)))
+ abort ();
+ if ((((long) (&a2)) & (ALIGNMENT3 - 1)))
+ abort ();
+ if ((((long) (&a3)) & (ALIGNMENT4 - 1)))
+ abort ();
+
+ printf ("PASS\n");
+
+ return(0) ;
+}
diff --git a/binutils-2.21/ld/testsuite/ld-elf/dynsym1.d b/binutils-2.21/ld/testsuite/ld-elf/dynsym1.d
new file mode 100644
index 0000000..88037ef
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/dynsym1.d
@@ -0,0 +1,8 @@
+#source: empty.s
+#ld: -shared
+#readelf: --dyn-syms
+#target: *-*-linux*
+
+#...
+ +[0-9]+: +[0-9a-f]+ +[0-9]+ +FUNC +GLOBAL +DEFAULT +[1-9] _start
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-elf/eh-frame-hdr.d b/binutils-2.21/ld/testsuite/ld-elf/eh-frame-hdr.d
new file mode 100644
index 0000000..af8ae04
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/eh-frame-hdr.d
@@ -0,0 +1,7 @@
+#source: eh-frame-hdr.s
+#ld: -e _start --eh-frame-hdr
+#objdump: -hw
+#target: cfi
+#...
+ [0-9] .eh_frame_hdr 0*[12][048c] .*
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-elf/eh-frame-hdr.s b/binutils-2.21/ld/testsuite/ld-elf/eh-frame-hdr.s
new file mode 100644
index 0000000..e5d3318
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/eh-frame-hdr.s
@@ -0,0 +1,6 @@
+ .text
+ .global _start
+_start:
+ .cfi_startproc
+ .skip 16
+ .cfi_endproc
diff --git a/binutils-2.21/ld/testsuite/ld-elf/eh-group.exp b/binutils-2.21/ld/testsuite/ld-elf/eh-group.exp
new file mode 100644
index 0000000..6de3ecb
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/eh-group.exp
@@ -0,0 +1,72 @@
+# Expect script for .eh_frame entries to a removed section.
+# Copyright 2008, 2009 Free Software Foundation, Inc.
+#
+# This file is part of the GNU Binutils.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+
+#
+# Written by Jan Kratochvil (jan.kratochvil@redhat.com)
+#
+# .eh_frame with relocations to a removed (group) section did result to:
+# error in tmpdir/eh-group.o(.eh_frame); no .eh_frame_hdr table will be created.
+# The purpose of this test is to merge two .o files with -r and then link this
+# merged file (containing a discarded R_X86_64_NONE relocation) to the final
+# executable trying to create .eh_frame_hdr. It needs a separate .exp file due
+# to the requirement of two `ld' runs.
+
+# Exclude non-CFI (such as ia64) targets.
+
+if {![check_as_cfi]} {
+ return
+}
+
+# The test uses ELF .section directive
+if ![is_elf_format] {
+ return
+}
+
+# alpha-linux-gnu does not support 64-bit relocations:
+# relocation truncated to fit: REFLONG against `.gcc_except_table'
+# arm-eabi does not support 64-bit relocations:
+# bad relocation fixup type (1)
+set testname "Guess the target size from eh-group1size.o"
+if [ld_assemble $as "$srcdir/$subdir/eh-group1.s" "tmpdir/eh-group1size.o"] {
+ pass $testname
+} else {
+ fail $testname
+}
+
+set as_options ""
+if [is_elf64 "tmpdir/eh-group1size.o"] {
+ set as_options "$as_options --defsym ELF64=1"
+}
+
+set build_tests_ld [list \
+ [list "Build eh-group1.o" \
+ "-r" "$as_options" \
+ {eh-group1.s eh-group2.s} {} "eh-group.o"] \
+]
+
+run_ld_link_tests $build_tests_ld
+
+set testname "Link eh-group.o to eh-group"
+if [ld_simple_link $ld "tmpdir/eh-group" "-e _start tmpdir/eh-group.o"] {
+ pass $testname
+} else {
+ fail $testname
+}
diff --git a/binutils-2.21/ld/testsuite/ld-elf/eh-group1.s b/binutils-2.21/ld/testsuite/ld-elf/eh-group1.s
new file mode 100644
index 0000000..d6fdb88
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/eh-group1.s
@@ -0,0 +1,6 @@
+ .section sect, "axG", %progbits, sectgroup, comdat
+ .global _start
+_start:
+ .cfi_startproc
+ .skip 16
+ .cfi_endproc
diff --git a/binutils-2.21/ld/testsuite/ld-elf/eh-group2.s b/binutils-2.21/ld/testsuite/ld-elf/eh-group2.s
new file mode 100644
index 0000000..49b59de
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/eh-group2.s
@@ -0,0 +1,15 @@
+ .section sect, "axG", %progbits, sectgroup, comdat
+ .cfi_startproc
+# Test intention is that LSDA must be provided by the discarded FDE.
+# DW_EH_PE_udata8 = 4
+# DW_EH_PE_udata4 = 3
+ .ifdef ELF64
+ .cfi_lsda 4, lsda
+ .else
+ .cfi_lsda 3, lsda
+ .endif
+ .skip 16
+ .cfi_endproc
+
+ .section .gcc_except_table, "a", %progbits
+lsda:
diff --git a/binutils-2.21/ld/testsuite/ld-elf/eh1.d b/binutils-2.21/ld/testsuite/ld-elf/eh1.d
new file mode 100644
index 0000000..f0874f7
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/eh1.d
@@ -0,0 +1,33 @@
+#source: eh1.s
+#source: eh1a.s
+#ld:
+#readelf: -wf
+#target: x86_64-*-*
+
+Contents of the .eh_frame section:
+
+00000000 00000014 00000000 CIE
+ Version: 1
+ Augmentation: ""
+ Code alignment factor: 1
+ Data alignment factor: -8
+ Return address column: 16
+
+ DW_CFA_def_cfa: r7 \(rsp\) ofs 8
+ DW_CFA_offset: r16 \(rip\) at cfa-8
+ DW_CFA_nop
+ DW_CFA_nop
+ DW_CFA_nop
+ DW_CFA_nop
+ DW_CFA_nop
+ DW_CFA_nop
+
+00000018 0000001c 0000001c FDE cie=00000000 pc=00400078..00400078
+ DW_CFA_advance_loc: 0 to 00400078
+ DW_CFA_def_cfa_offset: 16
+ DW_CFA_offset: r6 \(rbp\) at cfa-16
+ DW_CFA_advance_loc: 0 to 00400078
+ DW_CFA_def_cfa_register: r6 \(rbp\)
+
+00000038 ZERO terminator
+
diff --git a/binutils-2.21/ld/testsuite/ld-elf/eh1.s b/binutils-2.21/ld/testsuite/ld-elf/eh1.s
new file mode 100644
index 0000000..a605209
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/eh1.s
@@ -0,0 +1,47 @@
+ .text
+.globl _start
+ .type _start, %function
+_start:
+.LFB2:
+.LCFI0:
+.LCFI1:
+.LFE2:
+ .size _start, .-_start
+ .section .eh_frame,"a",%progbits
+.Lframe1:
+ .long .LECIE1-.LSCIE1
+.LSCIE1:
+ .long 0x0
+ .byte 0x1
+ .string ""
+ .uleb128 0x1
+ .sleb128 -8
+ .byte 0x10
+ .byte 0xc
+ .uleb128 0x7
+ .uleb128 0x8
+ .byte 0x90
+ .uleb128 0x1
+ .align 8
+.LECIE1:
+.LSFDE1:
+ .long .LEFDE1-.LASFDE1
+.LASFDE1:
+ .long .LASFDE1-.Lframe1
+ .quad .LFB2
+ .quad .LFE2-.LFB2
+ .byte 0x4
+ .long .LCFI0-.LFB2
+ .byte 0xe
+ .uleb128 0x10
+ .byte 0x86
+ .uleb128 0x2
+ .byte 0x4
+ .long .LCFI1-.LCFI0
+ .byte 0xd
+ .uleb128 0x6
+ .byte 0x0
+ .byte 0x0
+ .byte 0x0
+ .byte 0x0
+.LEFDE1:
diff --git a/binutils-2.21/ld/testsuite/ld-elf/eh1a.s b/binutils-2.21/ld/testsuite/ld-elf/eh1a.s
new file mode 100644
index 0000000..c644014
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/eh1a.s
@@ -0,0 +1,3 @@
+ .section .eh_frame,"a",%progbits
+ .align 8
+ .zero 4
diff --git a/binutils-2.21/ld/testsuite/ld-elf/eh2.d b/binutils-2.21/ld/testsuite/ld-elf/eh2.d
new file mode 100644
index 0000000..1a05d7f
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/eh2.d
@@ -0,0 +1,33 @@
+#source: eh1.s
+#source: eh2a.s
+#ld:
+#readelf: -wf
+#target: x86_64-*-*
+
+Contents of the .eh_frame section:
+
+00000000 00000014 00000000 CIE
+ Version: 1
+ Augmentation: ""
+ Code alignment factor: 1
+ Data alignment factor: -8
+ Return address column: 16
+
+ DW_CFA_def_cfa: r7 \(rsp\) ofs 8
+ DW_CFA_offset: r16 \(rip\) at cfa-8
+ DW_CFA_nop
+ DW_CFA_nop
+ DW_CFA_nop
+ DW_CFA_nop
+ DW_CFA_nop
+ DW_CFA_nop
+
+00000018 0000001c 0000001c FDE cie=00000000 pc=00400078..00400078
+ DW_CFA_advance_loc: 0 to 00400078
+ DW_CFA_def_cfa_offset: 16
+ DW_CFA_offset: r6 \(rbp\) at cfa-16
+ DW_CFA_advance_loc: 0 to 00400078
+ DW_CFA_def_cfa_register: r6 \(rbp\)
+
+00000038 ZERO terminator
+
diff --git a/binutils-2.21/ld/testsuite/ld-elf/eh2a.s b/binutils-2.21/ld/testsuite/ld-elf/eh2a.s
new file mode 100644
index 0000000..2c024f8
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/eh2a.s
@@ -0,0 +1,3 @@
+ .section .eh_frame,"a",%progbits
+ .align 4
+ .zero 4
diff --git a/binutils-2.21/ld/testsuite/ld-elf/eh3.d b/binutils-2.21/ld/testsuite/ld-elf/eh3.d
new file mode 100644
index 0000000..1f76b8c
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/eh3.d
@@ -0,0 +1,33 @@
+#source: eh3.s
+#source: eh3a.s
+#ld:
+#readelf: -wf
+#target: x86_64-*-*
+
+Contents of the .eh_frame section:
+
+00000000 00000014 00000000 CIE
+ Version: 1
+ Augmentation: ""
+ Code alignment factor: 1
+ Data alignment factor: -8
+ Return address column: 16
+
+ DW_CFA_def_cfa: r7 \(rsp\) ofs 8
+ DW_CFA_offset: r16 \(rip\) at cfa-8
+ DW_CFA_nop
+ DW_CFA_nop
+ DW_CFA_nop
+ DW_CFA_nop
+ DW_CFA_nop
+ DW_CFA_nop
+
+00000018 0000001c 0000001c FDE cie=00000000 pc=00400078..00400078
+ DW_CFA_advance_loc: 0 to 00400078
+ DW_CFA_def_cfa_offset: 16
+ DW_CFA_offset: r6 \(rbp\) at cfa-16
+ DW_CFA_advance_loc: 0 to 00400078
+ DW_CFA_def_cfa_register: r6 \(rbp\)
+
+00000038 ZERO terminator
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-elf/eh3.s b/binutils-2.21/ld/testsuite/ld-elf/eh3.s
new file mode 100644
index 0000000..24bd90d
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/eh3.s
@@ -0,0 +1,48 @@
+ .text
+.globl _start
+ .type _start, %function
+_start:
+.LFB2:
+.LCFI0:
+.LCFI1:
+.LFE2:
+ .size _start, .-_start
+ .section .eh_frame,"a",%progbits
+ .align 16
+.Lframe1:
+ .long .LECIE1-.LSCIE1
+.LSCIE1:
+ .long 0x0
+ .byte 0x1
+ .string ""
+ .uleb128 0x1
+ .sleb128 -8
+ .byte 0x10
+ .byte 0xc
+ .uleb128 0x7
+ .uleb128 0x8
+ .byte 0x90
+ .uleb128 0x1
+ .align 8
+.LECIE1:
+.LSFDE1:
+ .long .LEFDE1-.LASFDE1
+.LASFDE1:
+ .long .LASFDE1-.Lframe1
+ .quad .LFB2
+ .quad .LFE2-.LFB2
+ .byte 0x4
+ .long .LCFI0-.LFB2
+ .byte 0xe
+ .uleb128 0x10
+ .byte 0x86
+ .uleb128 0x2
+ .byte 0x4
+ .long .LCFI1-.LCFI0
+ .byte 0xd
+ .uleb128 0x6
+ .byte 0x0
+ .byte 0x0
+ .byte 0x0
+ .byte 0x0
+.LEFDE1:
diff --git a/binutils-2.21/ld/testsuite/ld-elf/eh3a.s b/binutils-2.21/ld/testsuite/ld-elf/eh3a.s
new file mode 100644
index 0000000..c245871
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/eh3a.s
@@ -0,0 +1,3 @@
+ .section .eh_frame,"a",%progbits
+ .align 8
+ .zero 8
diff --git a/binutils-2.21/ld/testsuite/ld-elf/eh4.d b/binutils-2.21/ld/testsuite/ld-elf/eh4.d
new file mode 100644
index 0000000..b8f9865
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/eh4.d
@@ -0,0 +1,32 @@
+#source: eh4.s
+#source: eh4a.s
+#ld: -shared
+#readelf: -wf
+#target: x86_64-*-*
+
+Contents of the .eh_frame section:
+
+00000000 00000014 00000000 CIE
+ Version: 1
+ Augmentation: "zR"
+ Code alignment factor: 1
+ Data alignment factor: -8
+ Return address column: 16
+ Augmentation data: 1b
+
+ DW_CFA_def_cfa: r7 \(rsp\) ofs 8
+ DW_CFA_offset: r16 \(rip\) at cfa-8
+ DW_CFA_nop
+ DW_CFA_nop
+
+00000018 00000014 0000001c FDE cie=00000000 pc=00000400..00000413
+ DW_CFA_set_loc: 00000404
+ DW_CFA_def_cfa_offset: 80
+
+00000030 00000014 00000034 FDE cie=00000000 pc=00000413..00000426
+ DW_CFA_set_loc: 00000417
+ DW_CFA_def_cfa_offset: 80
+
+00000048 ZERO terminator
+#pass
+
diff --git a/binutils-2.21/ld/testsuite/ld-elf/eh4.s b/binutils-2.21/ld/testsuite/ld-elf/eh4.s
new file mode 100644
index 0000000..2714ad6
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/eh4.s
@@ -0,0 +1,92 @@
+ .text
+ .align 512
+ .globl foo
+ .type foo, @function
+foo:
+.LFB1:
+ subq $72, %rsp
+.LCFI1:
+ xorl %eax, %eax
+ movq %rsp, %rdi
+ call bar@PLT
+ addq $72, %rsp
+ ret
+.LFE1:
+ .size foo, .-foo
+ .globl bar
+ .type bar, @function
+bar:
+.LFB2:
+ subq $72, %rsp
+.LCFI2:
+ xorl %eax, %eax
+ movq %rsp, %rdi
+ call bar@PLT
+ addq $72, %rsp
+ ret
+.LFE2:
+ .size bar, .-bar
+ .section .eh_frame,"a",@progbits
+.Lframe1:
+ .long .LECIE1-.LSCIE1 # Length of Common Information Entry
+.LSCIE1:
+ .long 0x0 # CIE Identifier Tag
+ .byte 0x1 # CIE Version
+ .ascii "zR\0" # CIE Augmentation
+ .uleb128 0x1 # CIE Code Alignment Factor
+ .sleb128 -8 # CIE Data Alignment Factor
+ .byte 0x10 # CIE RA Column
+ .uleb128 0x1 # Augmentation size
+ .byte 0x1b # FDE Encoding (pcrel sdata4)
+ .byte 0xc # DW_CFA_def_cfa
+ .uleb128 0x7
+ .uleb128 0x8
+ .byte 0x90 # DW_CFA_offset, column 0x10
+ .uleb128 0x1
+ .align 8
+.LECIE1:
+.LSFDE1:
+ .long .LEFDE1-.LASFDE1 # FDE Length
+.LASFDE1:
+ .long .LASFDE1-.Lframe1 # FDE CIE offset
+ .long .LFB1-. # FDE initial location
+ .long .LFE1-.LFB1 # FDE address range
+ .uleb128 0x0 # Augmentation size
+ .byte 0x1 # DW_CFA_set_loc
+ .long .LCFI1-.
+ .byte 0xe # DW_CFA_def_cfa_offset
+ .uleb128 0x50
+ .align 8
+.LEFDE1:
+.Lframe2:
+ .long .LECIE2-.LSCIE2 # Length of Common Information Entry
+.LSCIE2:
+ .long 0x0 # CIE Identifier Tag
+ .byte 0x1 # CIE Version
+ .ascii "zR\0" # CIE Augmentation
+ .uleb128 0x1 # CIE Code Alignment Factor
+ .sleb128 -8 # CIE Data Alignment Factor
+ .byte 0x10 # CIE RA Column
+ .uleb128 0x1 # Augmentation size
+ .byte 0x1b # FDE Encoding (pcrel sdata4)
+ .byte 0xc # DW_CFA_def_cfa
+ .uleb128 0x7
+ .uleb128 0x8
+ .byte 0x90 # DW_CFA_offset, column 0x10
+ .uleb128 0x1
+ .align 8
+.LECIE2:
+.LSFDE2:
+ .long .LEFDE2-.LASFDE2 # FDE Length
+.LASFDE2:
+ .long .LASFDE2-.Lframe2 # FDE CIE offset
+ .long .LFB2-. # FDE initial location
+ .long .LFE2-.LFB2 # FDE address range
+ .uleb128 0x0 # Augmentation size
+ .byte 0x1 # DW_CFA_set_loc
+ .long .LCFI2-.
+ .byte 0xe # DW_CFA_def_cfa_offset
+ .uleb128 0x50
+ .align 8
+.LEFDE2:
+ .section .note.GNU-stack,"",@progbits
diff --git a/binutils-2.21/ld/testsuite/ld-elf/eh4a.s b/binutils-2.21/ld/testsuite/ld-elf/eh4a.s
new file mode 100644
index 0000000..c245871
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/eh4a.s
@@ -0,0 +1,3 @@
+ .section .eh_frame,"a",%progbits
+ .align 8
+ .zero 8
diff --git a/binutils-2.21/ld/testsuite/ld-elf/eh5.d b/binutils-2.21/ld/testsuite/ld-elf/eh5.d
new file mode 100644
index 0000000..bc25639
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/eh5.d
@@ -0,0 +1,162 @@
+#source: eh5.s
+#source: eh5a.s
+#source: eh5b.s
+#ld:
+#readelf: -wf
+#target: cfi
+#notarget: alpha* hppa64*
+
+Contents of the .eh_frame section:
+
+00000000 0000001[04] 00000000 CIE
+ Version: 1
+ Augmentation: "zR"
+ Code alignment factor: .*
+ Data alignment factor: .*
+ Return address column: .*
+ Augmentation data: (0b|1b)
+
+ DW_CFA_nop
+ DW_CFA_nop
+ DW_CFA_nop
+#...
+0000001[48] 00000014 0000001[8c] FDE cie=00000000 pc=.*
+ DW_CFA_advance_loc: 4 to .*
+ DW_CFA_def_cfa: r0( \([er]ax\)|) ofs 16
+ DW_CFA_nop
+ DW_CFA_nop
+ DW_CFA_nop
+
+000000(2c|30) 00000014 00000000 CIE
+ Version: 1
+ Augmentation: "zPR"
+ Code alignment factor: .*
+ Data alignment factor: .*
+ Return address column: .*
+ Augmentation data: 03 .. .. .. .. (0b|1b)
+
+ DW_CFA_nop
+
+0000004[48] 00000014 0000001c FDE cie=000000(2c|30) pc=.*
+ DW_CFA_advance_loc: 4 to .*
+ DW_CFA_def_cfa: r0( \([er]ax\)|) ofs 16
+ DW_CFA_nop
+ DW_CFA_nop
+ DW_CFA_nop
+
+000000(5c|60) 00000014 0000006[04] FDE cie=00000000 pc=.*
+ DW_CFA_advance_loc: 4 to .*
+ DW_CFA_def_cfa: r0( \([er]ax\)|) ofs 16
+ DW_CFA_nop
+ DW_CFA_nop
+ DW_CFA_nop
+
+0000007[48] 0000001[8c] 00000000 CIE
+ Version: 1
+ Augmentation: "zPLR"
+ Code alignment factor: .*
+ Data alignment factor: .*
+ Return address column: .*
+ Augmentation data: 03 .. .. .. .. 0c (0b|1b)
+
+ DW_CFA_nop
+ DW_CFA_nop
+ DW_CFA_nop
+#...
+0000009[08] 0000001c 0000002[04] FDE cie=0000007[48] pc=.*
+ Augmentation data: (ef be ad de 00 00 00 00|00 00 00 00 de ad be ef)
+
+ DW_CFA_advance_loc: 4 to .*
+ DW_CFA_def_cfa: r0( \([er]ax\)|) ofs 16
+ DW_CFA_nop
+ DW_CFA_nop
+ DW_CFA_nop
+
+000000b[08] 0000001[04] 00000000 CIE
+ Version: 1
+ Augmentation: "zR"
+ Code alignment factor: .*
+ Data alignment factor: .*
+ Return address column: .*
+ Augmentation data: (0b|1b)
+
+ DW_CFA_def_cfa: r0( \([er]ax\)|) ofs 16
+#...
+000000(c4|d0) 0000001[04] 0000001[8c] FDE cie=000000b[08] pc=.*
+ DW_CFA_nop
+ DW_CFA_nop
+ DW_CFA_nop
+#...
+000000[de]8 00000014 00000000 CIE
+ Version: 1
+ Augmentation: "zPR"
+ Code alignment factor: .*
+ Data alignment factor: .*
+ Return address column: .*
+ Augmentation data: 03 .. .. .. .. (0b|1b)
+
+ DW_CFA_nop
+
+00000(0f|10)0 00000014 0000001c FDE cie=000000[de]8 pc=.*
+ DW_CFA_advance_loc: 4 to .*
+ DW_CFA_def_cfa: r0( \([er]ax\)|) ofs 16
+ DW_CFA_nop
+ DW_CFA_nop
+ DW_CFA_nop
+
+000001[01]8 0000001[04] 000000(5c|64) FDE cie=000000b[08] pc=.*
+ DW_CFA_nop
+ DW_CFA_nop
+ DW_CFA_nop
+#...
+000001(1c|30) 0000001[8c] 00000000 CIE
+ Version: 1
+ Augmentation: "zPLR"
+ Code alignment factor: .*
+ Data alignment factor: .*
+ Return address column: .*
+ Augmentation data: 03 .. .. .. .. 0c (0b|1b)
+
+ DW_CFA_nop
+ DW_CFA_nop
+ DW_CFA_nop
+#...
+000001(38|50) 0000001c 0000002[04] FDE cie=000001(1c|30) pc=.*
+ Augmentation data: (ef be ad de 00 00 00 00|00 00 00 00 de ad be ef)
+
+ DW_CFA_advance_loc: 4 to .*
+ DW_CFA_def_cfa: r0( \([er]ax\)|) ofs 16
+ DW_CFA_nop
+ DW_CFA_nop
+ DW_CFA_nop
+
+000001(58|70) 00000014 000001(5c|74) FDE cie=00000000 pc=.*
+ DW_CFA_advance_loc: 4 to .*
+ DW_CFA_def_cfa: r0( \([er]ax\)|) ofs 16
+ DW_CFA_nop
+ DW_CFA_nop
+ DW_CFA_nop
+#...
+000001(70|88) 00000014 00000(01c|148|15c) FDE cie=00000(02c|030|170) pc=.*
+ DW_CFA_advance_loc: 4 to .*
+ DW_CFA_def_cfa: r0( \([er]ax\)|) ofs 16
+ DW_CFA_nop
+ DW_CFA_nop
+ DW_CFA_nop
+
+000001(88|a0) 00000014 000001(8c|a4) FDE cie=00000000 pc=.*
+ DW_CFA_advance_loc: 4 to .*
+ DW_CFA_def_cfa: r0( \([er]ax\)|) ofs 16
+ DW_CFA_nop
+ DW_CFA_nop
+ DW_CFA_nop
+#...
+000001(a0|b8|d4) 0000001c 00000(020|130|144) FDE cie=00000(074|078|1b8) pc=.*
+ Augmentation data: (ef be ad de 00 00 00 00|00 00 00 00 de ad be ef)
+
+ DW_CFA_advance_loc: 4 to .*
+ DW_CFA_def_cfa: r0( \([er]ax\)|) ofs 16
+ DW_CFA_nop
+ DW_CFA_nop
+ DW_CFA_nop
+
diff --git a/binutils-2.21/ld/testsuite/ld-elf/eh5.s b/binutils-2.21/ld/testsuite/ld-elf/eh5.s
new file mode 100644
index 0000000..6af48c2
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/eh5.s
@@ -0,0 +1,29 @@
+ .text
+ .cfi_startproc simple
+ .long 0
+ .cfi_def_cfa 0, 16
+ .long 0
+ .cfi_endproc
+
+ .cfi_startproc simple
+ .cfi_personality 3, my_personality_v0
+ .long 0
+ .cfi_def_cfa 0, 16
+ .cfi_endproc
+
+ .cfi_startproc simple
+ .long 0
+ .cfi_def_cfa 0, 16
+ .long 0
+ .cfi_endproc
+
+ .cfi_startproc simple
+ .cfi_personality 3, my_personality_v0
+ .cfi_lsda 12, 0xdeadbeef
+ .long 0
+ .cfi_def_cfa 0, 16
+ .cfi_endproc
+
+ .globl my_personality_v0
+my_personality_v0:
+ .long 0
diff --git a/binutils-2.21/ld/testsuite/ld-elf/eh5a.s b/binutils-2.21/ld/testsuite/ld-elf/eh5a.s
new file mode 100644
index 0000000..a74b2cc
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/eh5a.s
@@ -0,0 +1,27 @@
+ .text
+ .cfi_startproc simple
+ .cfi_def_cfa 0, 16
+ .long 0
+ .cfi_endproc
+
+ .cfi_startproc simple
+ .cfi_personality 3, my_personality_v1
+ .long 0
+ .cfi_def_cfa 0, 16
+ .cfi_endproc
+
+ .cfi_startproc simple
+ .cfi_def_cfa 0, 16
+ .long 0
+ .cfi_endproc
+
+ .cfi_startproc simple
+ .cfi_personality 3, my_personality_v1
+ .cfi_lsda 12, 0xdeadbeef
+ .long 0
+ .cfi_def_cfa 0, 16
+ .cfi_endproc
+
+ .globl my_personality_v1
+my_personality_v1:
+ .long 0
diff --git a/binutils-2.21/ld/testsuite/ld-elf/eh5b.s b/binutils-2.21/ld/testsuite/ld-elf/eh5b.s
new file mode 100644
index 0000000..fa27edd
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/eh5b.s
@@ -0,0 +1,35 @@
+ .text
+ .cfi_startproc simple
+ .long 0
+ .cfi_def_cfa 0, 16
+ .long 0
+ .cfi_endproc
+
+ .cfi_startproc simple
+ .cfi_personality 3, my_personality_v0
+ .long 0
+ .cfi_def_cfa 0, 16
+ .cfi_endproc
+
+ .cfi_startproc simple
+ .long 0
+ .cfi_def_cfa 0, 16
+ .long 0
+ .cfi_endproc
+
+ .cfi_startproc simple
+ .cfi_personality 3, my_personality_v0
+ .cfi_lsda 12, 0xdeadbeef
+ .long 0
+ .cfi_def_cfa 0, 16
+ .cfi_endproc
+
+ .globl main
+ .globl start
+ .globl _start
+ .globl __start
+main:
+start:
+_start:
+__start:
+ .long 0
diff --git a/binutils-2.21/ld/testsuite/ld-elf/eh6.d b/binutils-2.21/ld/testsuite/ld-elf/eh6.d
new file mode 100644
index 0000000..75eb54b
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/eh6.d
@@ -0,0 +1,17 @@
+#source: eh6.s
+#ld: --gc-sections -shared
+#readelf: -wf
+#target: x86_64-*-linux-gnu i?86-*-linux-gnu
+
+Contents of the .eh_frame section:
+
+00000000 0000001[4c] 00000000 CIE
+ Version: 1
+ Augmentation: "zPR"
+ Code alignment factor: 1
+ Data alignment factor: .*
+ Return address column: .*
+ Augmentation data: 9[bc] .* 1b
+
+ DW_CFA_nop
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-elf/eh6.s b/binutils-2.21/ld/testsuite/ld-elf/eh6.s
new file mode 100644
index 0000000..bdc7dd1
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/eh6.s
@@ -0,0 +1,17 @@
+ .section .text.foo, "ax", @progbits
+ .globl foo
+ .type foo, @function
+foo:
+ .cfi_startproc simple
+ .cfi_personality 0x80, indirect_ptr
+ ret
+ .cfi_endproc
+ .size foo, . - foo
+
+ .section .data.rel.ro, "a", @progbits
+indirect_ptr:
+ .long my_personality_v0
+
+ .globl my_personality_v0
+my_personality_v0:
+ .long 0
diff --git a/binutils-2.21/ld/testsuite/ld-elf/elf.exp b/binutils-2.21/ld/testsuite/ld-elf/elf.exp
new file mode 100644
index 0000000..1e1f738
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/elf.exp
@@ -0,0 +1,84 @@
+# Expect script for various ELF tests.
+# Copyright 2002, 2003, 2005, 2007, 2009 Free Software Foundation, Inc.
+#
+# This file is part of the GNU Binutils.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+
+# Exclude non-ELF targets.
+
+if ![is_elf_format] {
+ return
+}
+
+set old_ldflags $LDFLAGS
+if { [istarget spu*-*-*] } {
+ set LDFLAGS "$LDFLAGS --local-store 0:0"
+}
+
+if { [is_remote host] } then {
+ remote_download host merge.ld
+}
+
+set test_list [lsort [glob -nocomplain $srcdir/$subdir/*.d]]
+foreach t $test_list {
+ # We need to strip the ".d", but can leave the dirname.
+ verbose [file rootname $t]
+ run_dump_test [file rootname $t]
+}
+
+if { [istarget *-*-linux*] } {
+ run_ld_link_tests {
+ {"Weak symbols in dynamic objects 1 (support)"
+ "-shared" "" {weak-dyn-1a.s}
+ {}
+ "libweakdyn1a.so"}
+ {"Weak symbols in dynamic objects 1 (main test)"
+ "-shared tmpdir/libweakdyn1a.so -Tweak-dyn-1.ld" "" {weak-dyn-1b.s}
+ {{readelf {--relocs --wide} weak-dyn-1.rd}}
+ "libweakdyn1b.so"}
+ }
+}
+
+#v850 gas complains about .tbss.var section attributes.
+if { [check_gc_sections_available] && ![istarget "v850-*-*"] } {
+ run_ld_link_tests {
+ {"--gc-sections on tls variable"
+ "--gc-section" "" {tls_gc.s} {} "tls_gc"}
+ }
+}
+
+set LDFLAGS $old_ldflags
+
+# The following tests require running the executable generated by ld.
+if ![isnative] {
+ return
+}
+
+set array_tests {
+ {"preinit array" "" "" {preinit.c} "preinit" "preinit.out"}
+ {"static preinit array" "-static" "" {preinit.c} "preinit" "preinit.out"}
+ {"init array" "" "" {init.c} "init" "init.out"}
+ {"static init array" "-static" "" {init.c} "init" "init.out"}
+ {"fini array" "" "" {fini.c} "fini" "fini.out"}
+ {"static fini array" "-static" "" {fini.c} "fini" "fini.out"}
+}
+
+# NetBSD ELF systems do not currently support the .*_array sections.
+run_ld_link_exec_tests [list "*-*-netbsdelf*"] $array_tests
+
+catch "exec rm -f tmpdir/preinit tmpdir/init tmpdir/fini" status
diff --git a/binutils-2.21/ld/testsuite/ld-elf/empty.d b/binutils-2.21/ld/testsuite/ld-elf/empty.d
new file mode 100644
index 0000000..836206e
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/empty.d
@@ -0,0 +1,7 @@
+#source: empty.s
+#ld:
+#readelf: -s
+
+#...
+ +[0-9]+: +[0-9a-f]+ +[0-9]+ +FUNC +GLOBAL +DEFAULT +[1-9] _start
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-elf/empty.s b/binutils-2.21/ld/testsuite/ld-elf/empty.s
new file mode 100644
index 0000000..8c2d0e6
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/empty.s
@@ -0,0 +1,16 @@
+ .section .bss
+bar:
+ .text
+ .type start,"function"
+ .global start
+start:
+ .type _start,"function"
+ .global _start
+_start:
+ .type __start,"function"
+ .global __start
+__start:
+ .type main,"function"
+ .global main
+main:
+ .long 0
diff --git a/binutils-2.21/ld/testsuite/ld-elf/empty2.d b/binutils-2.21/ld/testsuite/ld-elf/empty2.d
new file mode 100644
index 0000000..d91569e
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/empty2.d
@@ -0,0 +1,11 @@
+#source: empty2.s
+#ld:
+#readelf: -s
+
+#...
+[ ]+[0-9]+:[ ]+0+[ ]+0[ ]+FILE[ ]+LOCAL[ ]+DEFAULT[ ]+ABS empty2.s
+#...
+[ ]+[0-9]+:[ ]+0*12345678[ ]+0[ ]+NOTYPE[ ]+LOCAL[ ]+DEFAULT[ ]+ABS constant
+#...
+[ ]+[0-9]+:[ ]+[0-9a-f]+[ ]+[0-9]+[ ]+FUNC[ ]+GLOBAL[ ]+DEFAULT[ ]+[1-9] _start
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-elf/empty2.s b/binutils-2.21/ld/testsuite/ld-elf/empty2.s
new file mode 100644
index 0000000..deed318
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/empty2.s
@@ -0,0 +1,18 @@
+ .file "empty2.s"
+ .equiv constant, 0x12345678
+ .section .bss
+bar:
+ .text
+ .type start,"function"
+ .global start
+start:
+ .type _start,"function"
+ .global _start
+_start:
+ .type __start,"function"
+ .global __start
+__start:
+ .type main,"function"
+ .global main
+main:
+ .long constant
diff --git a/binutils-2.21/ld/testsuite/ld-elf/end.c b/binutils-2.21/ld/testsuite/ld-elf/end.c
new file mode 100644
index 0000000..f7b681a
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/end.c
@@ -0,0 +1,7 @@
+#include <stdio.h>
+
+void
+foo ()
+{
+ printf ("TEST1\n");
+}
diff --git a/binutils-2.21/ld/testsuite/ld-elf/endhidden.c b/binutils-2.21/ld/testsuite/ld-elf/endhidden.c
new file mode 100644
index 0000000..2cab97a
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/endhidden.c
@@ -0,0 +1,8 @@
+#include <stdio.h>
+
+__attribute__ ((visibility ("hidden")))
+void
+foo ()
+{
+ printf ("TEST1\n");
+}
diff --git a/binutils-2.21/ld/testsuite/ld-elf/endprotected.c b/binutils-2.21/ld/testsuite/ld-elf/endprotected.c
new file mode 100644
index 0000000..b6b39ea
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/endprotected.c
@@ -0,0 +1,8 @@
+#include <stdio.h>
+
+__attribute__ ((visibility ("protected")))
+void
+foo ()
+{
+ printf ("TEST1\n");
+}
diff --git a/binutils-2.21/ld/testsuite/ld-elf/exclude.exp b/binutils-2.21/ld/testsuite/ld-elf/exclude.exp
new file mode 100644
index 0000000..124549f
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/exclude.exp
@@ -0,0 +1,140 @@
+# Expect script for --exclude-libs tests
+# Copyright 2004, 2005, 2007 Free Software Foundation, Inc.
+#
+# This file is part of the GNU Binutils.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+# MA 02110-1301, USA.
+
+# Make sure that ld can hide symbols from libraries when building a shared
+# library.
+
+# This test can only be run on ELF platforms.
+if ![is_elf_format] {
+ return
+}
+
+# No shared lib support on this target.
+if { [istarget "mcore-*-*"] } {
+ return
+}
+
+global ar
+global as
+global ld
+global nm
+global nm_output
+
+set test1 "ld link shared library"
+set test2 "ld export symbols from archive"
+set test3 "ld link shared library with --exclude-libs"
+set test4 "ld exclude symbols from archive - --exclude-libs libexclude"
+set test5 "ld exclude symbols from archive - --exclude-libs libexclude.a"
+set test6 "ld exclude symbols from archive - --exclude-libs ALL"
+set test7 "ld exclude symbols from archive - --exclude-libs foo:libexclude.a"
+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
+}
+
+remote_file host delete "tmpdir/libexclude.a"
+set catch_output [run_host_cmd "$ar" "cq tmpdir/libexclude.a tmpdir/exclude2.o"]
+if {![string match "" $catch_output]} {
+ unresolved $test1
+ return
+}
+
+# Test that the symbol is normally exported.
+
+if { [ld_simple_link $ld tmpdir/exclude.so "--shared tmpdir/exclude1.o -Ltmpdir -lexclude"] } {
+ pass $test1
+} else {
+ if [string match "*shared not supported*" $link_output] {
+ unsupported "$test1 - -shared is not supported by this target"
+ } else {
+ fail $test1
+ }
+ return
+}
+
+if ![ld_nm $nm "-D" tmpdir/exclude.so] {
+ unresolved $test2
+} elseif { [info exists nm_output(exclude_sym)] } {
+ pass $test2
+} else {
+ fail $test2
+}
+
+# Test --exclude-libs libexclude
+
+if { [ld_simple_link $ld tmpdir/exclude.so "--exclude-libs libexclude --shared tmpdir/exclude1.o -Ltmpdir -lexclude"] } {
+ pass $test3
+} else {
+ fail $test3
+}
+
+if ![ld_nm $nm "-D" tmpdir/exclude.so] {
+ unresolved $test4
+} elseif { ! [info exists nm_output(exclude_sym)] } {
+ pass $test4
+} else {
+ fail $test4
+}
+
+# Test alternate spellings of --exclude-libs
+
+if { [ld_simple_link $ld tmpdir/exclude.so "--exclude-libs libexclude.a --shared tmpdir/exclude1.o -Ltmpdir -lexclude"]
+ && [ld_nm $nm "-D" tmpdir/exclude.so]
+ && ! [info exists nm_output(exclude_sym)] } {
+ pass $test5
+} else {
+ fail $test5
+}
+
+if { [ld_simple_link $ld tmpdir/exclude.so "--exclude-libs ALL --shared tmpdir/exclude1.o -Ltmpdir -lexclude"]
+ && [ld_nm $nm "-D" tmpdir/exclude.so]
+ && ! [info exists nm_output(exclude_sym)] } {
+ pass $test6
+} else {
+ fail $test6
+}
+
+if { [ld_simple_link $ld tmpdir/exclude.so "--exclude-libs foo:libexclude.a --shared tmpdir/exclude1.o -Ltmpdir -lexclude"]
+ && [ld_nm $nm "-D" tmpdir/exclude.so]
+ && ! [info exists nm_output(exclude_sym)] } {
+ pass $test7
+} else {
+ fail $test7
+}
+
+if { [ld_simple_link $ld tmpdir/exclude.so "--exclude-libs foo,libexclude.a --shared tmpdir/exclude1.o -Ltmpdir -lexclude"]
+ && [ld_nm $nm "-D" tmpdir/exclude.so]
+ && ! [info exists nm_output(exclude_sym)] } {
+ pass $test8
+} else {
+ fail $test8
+}
+
+if { [ld_simple_link $ld tmpdir/exclude.so "--exclude-libs foo:bar --shared tmpdir/exclude1.o -Ltmpdir -lexclude"]
+ && [ld_nm $nm "-D" tmpdir/exclude.so]
+ && [info exists nm_output(exclude_sym)] } {
+ pass $test9
+} else {
+ fail $test9
+}
diff --git a/binutils-2.21/ld/testsuite/ld-elf/exclude1.s b/binutils-2.21/ld/testsuite/ld-elf/exclude1.s
new file mode 100644
index 0000000..99efc7e
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/exclude1.s
@@ -0,0 +1,4 @@
+ .globl include_sym
+ .data
+include_sym:
+ .dc.a exclude_sym
diff --git a/binutils-2.21/ld/testsuite/ld-elf/exclude2.s b/binutils-2.21/ld/testsuite/ld-elf/exclude2.s
new file mode 100644
index 0000000..e9b5819
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/exclude2.s
@@ -0,0 +1,4 @@
+ .globl exclude_sym
+ .data
+exclude_sym:
+ .long 0
diff --git a/binutils-2.21/ld/testsuite/ld-elf/exclude3.s b/binutils-2.21/ld/testsuite/ld-elf/exclude3.s
new file mode 100644
index 0000000..475088f
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/exclude3.s
@@ -0,0 +1,16 @@
+ .text
+ .type start,"function"
+ .global start
+start:
+ .type _start,"function"
+ .global _start
+_start:
+ .type __start,"function"
+ .global __start
+__start:
+ .type main,"function"
+ .global main
+main:
+ .long 0
+ .section .foo1,"e", %progbits
+ .byte 0,0,0,0
diff --git a/binutils-2.21/ld/testsuite/ld-elf/exclude3a.d b/binutils-2.21/ld/testsuite/ld-elf/exclude3a.d
new file mode 100644
index 0000000..7343e45
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/exclude3a.d
@@ -0,0 +1,10 @@
+#source: exclude3.s
+#ld:
+#readelf: -S --wide
+#target: x86_64-*-* i?86-*-* ia64-*-*
+
+#...
+[ ]*\[.*\][ ]+NULL.*
+[ ]*\[.*\][ ]+\.text[ ]+PROGBITS.*
+[ ]*\[.*\][ ]+.*STRTAB.*
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-elf/exclude3b.d b/binutils-2.21/ld/testsuite/ld-elf/exclude3b.d
new file mode 100644
index 0000000..8d8a43f
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/exclude3b.d
@@ -0,0 +1,9 @@
+#source: exclude3.s
+#ld: --shared
+#readelf: -S --wide
+#target: x86_64-*-* i?86-*-*
+
+#...
+[ ]*\[.*\][ ]+\.dynamic[ ]+DYNAMIC.*
+[ ]*\[.*\][ ]+.*STRTAB.*
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-elf/exclude3c.d b/binutils-2.21/ld/testsuite/ld-elf/exclude3c.d
new file mode 100644
index 0000000..57311c8
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/exclude3c.d
@@ -0,0 +1,7 @@
+#source: exclude3.s
+#ld: -r
+#readelf: -S --wide
+
+#...
+[ ]*\[.*\][ ]+\.foo1[ ]+PROGBITS.*[ ]+E[ ]+.*
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-elf/exclude3d.d b/binutils-2.21/ld/testsuite/ld-elf/exclude3d.d
new file mode 100644
index 0000000..0d487f5
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/exclude3d.d
@@ -0,0 +1,9 @@
+#source: exclude3.s
+#ld: --shared
+#readelf: -S --wide
+#target: ia64-*-*
+
+#...
+[ ]*\[.*\][ ]+\.got.*[ ]+PROGBITS.*
+[ ]*\[.*\][ ]+.*STRTAB.*
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-elf/expr1.d b/binutils-2.21/ld/testsuite/ld-elf/expr1.d
new file mode 100644
index 0000000..7bf5d22
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/expr1.d
@@ -0,0 +1,2 @@
+# ld: -T expr1.t
+# error: expr1.t:3: nonconstant expression for load base
diff --git a/binutils-2.21/ld/testsuite/ld-elf/expr1.s b/binutils-2.21/ld/testsuite/ld-elf/expr1.s
new file mode 100644
index 0000000..998bbc0
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/expr1.s
@@ -0,0 +1,4 @@
+ .section .bar,"ax","progbits"
+ .byte 0
+ .section .foo,"aw","progbits"
+ .byte 0
diff --git a/binutils-2.21/ld/testsuite/ld-elf/expr1.t b/binutils-2.21/ld/testsuite/ld-elf/expr1.t
new file mode 100644
index 0000000..9670e25
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/expr1.t
@@ -0,0 +1,6 @@
+SECTIONS
+{
+ .bar : AT ((ADDR(.foo) + 4095) & ~(4095)) { *(.bar) }
+ .foo : { *(.foo) }
+ /DISCARD/ : { *(.*) }
+}
diff --git a/binutils-2.21/ld/testsuite/ld-elf/extract-symbol-1.ld b/binutils-2.21/ld/testsuite/ld-elf/extract-symbol-1.ld
new file mode 100644
index 0000000..53e95c6
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/extract-symbol-1.ld
@@ -0,0 +1,18 @@
+ENTRY(_entry)
+PHDRS
+{
+ data PT_LOAD AT (0);
+}
+SECTIONS
+{
+ . = 0x10000;
+ .foo : { *(.foo) } :data
+
+ . = 0x20000;
+ .bar : { *(.bar) } :data
+
+ /DISCARD/ : { *(*) }
+
+ _entry = 0x30000;
+ linker_symbol = 0x40000;
+}
diff --git a/binutils-2.21/ld/testsuite/ld-elf/extract-symbol-1.s b/binutils-2.21/ld/testsuite/ld-elf/extract-symbol-1.s
new file mode 100644
index 0000000..0971500
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/extract-symbol-1.s
@@ -0,0 +1,15 @@
+ .globl B
+ .globl C
+
+ .section .foo,"awx",%progbits
+ .4byte 1,2,3,4
+B:
+ .4byte 5,6,7
+
+ .section .bar,"ax",%nobits
+ .space 0x123
+C:
+ .space 0x302
+
+ .globl D
+ .equ D,0x12345678
diff --git a/binutils-2.21/ld/testsuite/ld-elf/extract-symbol-1sec.d b/binutils-2.21/ld/testsuite/ld-elf/extract-symbol-1sec.d
new file mode 100644
index 0000000..57a5662
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/extract-symbol-1sec.d
@@ -0,0 +1,14 @@
+#name: --extract-symbol test 1 (sections)
+#source: extract-symbol-1.s
+#ld: -Textract-symbol-1.ld
+#objcopy_linked_file: --extract-symbol
+#objdump: --headers
+#xfail: "hppa*-*-*" "rx-*-*"
+# FAILS on the RX because the linker has to set LMA == VMA for the Renesas loader.
+#...
+Sections:
+ *Idx +Name +Size +VMA +LMA .*
+ *0 +\.foo +0+ +0+10000 +0+10000 .*
+ *CONTENTS, ALLOC, LOAD, CODE
+ *1 +\.bar +0+ +0+20000 +0+10000 .*
+ *ALLOC, READONLY, CODE
diff --git a/binutils-2.21/ld/testsuite/ld-elf/extract-symbol-1sym.d b/binutils-2.21/ld/testsuite/ld-elf/extract-symbol-1sym.d
new file mode 100644
index 0000000..4069191
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/extract-symbol-1sym.d
@@ -0,0 +1,17 @@
+#name: --extract-symbol test 1 (symbols)
+#source: extract-symbol-1.s
+#ld: -Textract-symbol-1.ld
+#objcopy_linked_file: --extract-symbol
+#nm: -n
+#xfail: "hppa*-*-*"
+#...
+0*00010010 T B
+#...
+0*00020123 T C
+#...
+0*00030000 A _entry
+#...
+0*00040000 A linker_symbol
+#...
+0*12345678 A D
+#pass \ No newline at end of file
diff --git a/binutils-2.21/ld/testsuite/ld-elf/fini.c b/binutils-2.21/ld/testsuite/ld-elf/fini.c
new file mode 100644
index 0000000..cb60655
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/fini.c
@@ -0,0 +1,34 @@
+#include <stdio.h>
+
+static void
+fini_0 (void)
+{
+ printf ("fini array 0\n");
+}
+
+static void
+fini_1 (void)
+{
+ printf ("fini array 1\n");
+}
+
+static void
+fini_2 (void)
+{
+ printf ("fini array 2\n");
+}
+
+void (*const fini_array []) (void)
+ __attribute__ ((section (".fini_array"),
+ aligned (sizeof (void *)))) =
+{
+ &fini_0,
+ &fini_1,
+ &fini_2
+};
+
+int
+main (void)
+{
+ return 0;
+}
diff --git a/binutils-2.21/ld/testsuite/ld-elf/fini.out b/binutils-2.21/ld/testsuite/ld-elf/fini.out
new file mode 100644
index 0000000..2bab6e6
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/fini.out
@@ -0,0 +1,3 @@
+fini array 2
+fini array 1
+fini array 0
diff --git a/binutils-2.21/ld/testsuite/ld-elf/flags1.d b/binutils-2.21/ld/testsuite/ld-elf/flags1.d
new file mode 100644
index 0000000..2053de0
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/flags1.d
@@ -0,0 +1,22 @@
+#name: --set-section-flags test 1 (sections)
+#ld: -Tflags1.ld
+#objcopy_linked_file: --set-section-flags .post_text_reserve=contents,alloc,load,readonly,code
+#readelf: -l --wide
+#xfail: "avr-*-*" "dlx-*-*" "h8300-*-*" "i960-*-*" "ip2k-*-*" "m32r-*-*"
+#xfail: "moxie-*-*" "mt-*-*" "msp430-*-*" "tic6x-*-*"
+#xfail: "*-*-hpux*" "hppa*64*-*-*"
+# Fails on the AVR, DLX, H8300, I960, IP2K, M32R, MOXIE, MT, MSP430 and
+# TI C6X because the two sections are not merged into one segment.
+# (There is no good reason why they have to be).
+# Fails on HPUX systems because the .type pseudo-op behaves differently.
+# Fails on hppa64 because a PHDR is always added.
+
+#...
+Program Headers:
+ Type.*
+ LOAD +0x[0-9a-f]+ 0x0*0 0x0*0 0x0*01(6[1-9a-f]|70) 0x0*01(6[1-9a-f]|70) RWE 0x[0-9a-f]+
+
+#...
+ Segment Sections...
+ 00[ \t]+.text .post_text_reserve[ \t]*
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-elf/flags1.ld b/binutils-2.21/ld/testsuite/ld-elf/flags1.ld
new file mode 100644
index 0000000..a94cbe8
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/flags1.ld
@@ -0,0 +1,12 @@
+SECTIONS
+{
+ .text :
+ {
+ *(.text)
+ } =0
+ .post_text_reserve :
+ {
+ . += 0x160;
+ }
+ /DISCARD/ : { *(.*) }
+}
diff --git a/binutils-2.21/ld/testsuite/ld-elf/flags1.s b/binutils-2.21/ld/testsuite/ld-elf/flags1.s
new file mode 100644
index 0000000..bb47536
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/flags1.s
@@ -0,0 +1,5 @@
+ .text
+ .globl start
+ .type start, %function
+start:
+ .byte 0
diff --git a/binutils-2.21/ld/testsuite/ld-elf/foo.c b/binutils-2.21/ld/testsuite/ld-elf/foo.c
new file mode 100644
index 0000000..c84baee
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/foo.c
@@ -0,0 +1,11 @@
+#include <stdio.h>
+
+void
+foo (void)
+{
+ printf ("TEST2\n");
+}
+
+static void (*const init_array []) (void)
+ __attribute__ ((used, section (".init_array"), aligned (sizeof (void *))))
+ = { foo };
diff --git a/binutils-2.21/ld/testsuite/ld-elf/foo.map b/binutils-2.21/ld/testsuite/ld-elf/foo.map
new file mode 100644
index 0000000..6b993de
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/foo.map
@@ -0,0 +1,4 @@
+FOO {
+ global: foo;
+ local: *;
+};
diff --git a/binutils-2.21/ld/testsuite/ld-elf/frame.exp b/binutils-2.21/ld/testsuite/ld-elf/frame.exp
new file mode 100644
index 0000000..0a69024
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/frame.exp
@@ -0,0 +1,82 @@
+# Expect script for frame section tests
+# Copyright 2004, 2005, 2007 Free Software Foundation, Inc.
+#
+# This file is part of the GNU Binutils.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+# Written by H.J. Lu (hongjiu.lu@intel.com)
+#
+
+# Make sure that ld correctly handles frame sections in ELF.
+
+# This test can only be run on ELF platforms.
+if ![is_elf_format] {
+ return
+}
+
+# No shared lib support on this target.
+if { [istarget "mcore-*-*"] } {
+ return
+}
+
+# Too small MAXPAGESIZE on this target.
+if { [istarget "sh*-*-elf*"] } {
+ return
+}
+
+# ??? These targets have their own .tbss section, with different meaning
+# to the usual ELF .tbss.
+if { [istarget "hppa64-*-*"] || [istarget "v850-*-*"] } {
+ 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
+}
+
+if { [ld_simple_link $ld tmpdir/frame.so "--shared tmpdir/frame.o tmpdir/tbss.o"] } {
+ pass "$test1"
+} else {
+ if [string match "*shared not supported*" $link_output] {
+ unsupported "-shared is not supported by this target"
+ } else {
+ fail "$test1"
+ }
+}
+
+if ![ld_assemble $as $srcdir/$subdir/table.s tmpdir/table.o ] {
+ unresolved "$test2"
+ return
+}
+
+if { [ld_simple_link $ld tmpdir/table.so "--shared tmpdir/table.o tmpdir/tbss.o"] } {
+ pass "$test2"
+} else {
+ if [string match "*shared not supported*" $link_output] {
+ unsupported "-shared is not supported by this target"
+ } else {
+ fail "$test2"
+ }
+}
diff --git a/binutils-2.21/ld/testsuite/ld-elf/frame.s b/binutils-2.21/ld/testsuite/ld-elf/frame.s
new file mode 100644
index 0000000..c752263
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/frame.s
@@ -0,0 +1,2 @@
+ .section .eh_frame,"a",%progbits
+ .4byte 0
diff --git a/binutils-2.21/ld/testsuite/ld-elf/func1.c b/binutils-2.21/ld/testsuite/ld-elf/func1.c
new file mode 100644
index 0000000..99443e4
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/func1.c
@@ -0,0 +1,2 @@
+void foo (void) { }
+void bar (void) { }
diff --git a/binutils-2.21/ld/testsuite/ld-elf/group.ld b/binutils-2.21/ld/testsuite/ld-elf/group.ld
new file mode 100644
index 0000000..123ab26
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/group.ld
@@ -0,0 +1,6 @@
+SECTIONS
+{
+ . = 0x1000;
+ .text : { *(.text) *(.rodata.brlt) }
+ /DISCARD/ : { *(.dropme) *(.reginfo) }
+}
diff --git a/binutils-2.21/ld/testsuite/ld-elf/group1.d b/binutils-2.21/ld/testsuite/ld-elf/group1.d
new file mode 100644
index 0000000..6ee74cb
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/group1.d
@@ -0,0 +1,12 @@
+#source: group1a.s
+#source: group1b.s
+#ld: -T group.ld
+#readelf: -s
+#xfail: arc-*-* d30v-*-* dlx-*-* i960-*-* or32-*-* pj*-*-*
+# generic linker targets don't comply with all symbol merging rules
+
+Symbol table '.symtab' contains .* entries:
+#...
+.*: 0+1000 +0 +(NOTYPE|OBJECT) +WEAK +DEFAULT +. foo
+.*: 0+0000 +0 +(NOTYPE|OBJECT) +GLOBAL +DEFAULT +UND bar
+#...
diff --git a/binutils-2.21/ld/testsuite/ld-elf/group10.d b/binutils-2.21/ld/testsuite/ld-elf/group10.d
new file mode 100644
index 0000000..6fcf83f
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/group10.d
@@ -0,0 +1,11 @@
+#source: group10.s
+#ld: -r -T group.ld
+#readelf: -Sg --wide
+
+#...
+group section \[[ 0-9]+\] `\.group' \[foo_group\] contains 4 sections:
+ \[Index\] Name
+ \[[ 0-9]+\] \.text.*
+ \[[ 0-9]+\] \.rodata\.str.*
+ \[[ 0-9]+\] \.data.*
+ \[[ 0-9]+\] \.keepme.*
diff --git a/binutils-2.21/ld/testsuite/ld-elf/group10.s b/binutils-2.21/ld/testsuite/ld-elf/group10.s
new file mode 100644
index 0000000..57704b4
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/group10.s
@@ -0,0 +1,14 @@
+ .section .text.foo,"axG",%progbits,foo_group
+ .word 0
+
+ .section .rodata.str.1,"aMSG",%progbits,1,foo_group
+ .asciz "abc"
+
+ .section .data.foo,"waG",%progbits,foo_group
+ .word 1
+
+ .section .dropme,"G",%progbits,foo_group
+ .word 2
+
+ .section .keepme,"G",%progbits,foo_group
+ .word 3
diff --git a/binutils-2.21/ld/testsuite/ld-elf/group1a.s b/binutils-2.21/ld/testsuite/ld-elf/group1a.s
new file mode 100644
index 0000000..296e76e
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/group1a.s
@@ -0,0 +1,4 @@
+ .section .text,"axG",%progbits,foo_group,comdat
+ .weak foo
+foo:
+ .word 0
diff --git a/binutils-2.21/ld/testsuite/ld-elf/group1b.s b/binutils-2.21/ld/testsuite/ld-elf/group1b.s
new file mode 100644
index 0000000..b66cba9
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/group1b.s
@@ -0,0 +1,6 @@
+ .section .text,"axG",%progbits,foo_group,comdat
+ .global foo
+ .global bar
+foo:
+ .word 0
+bar:
diff --git a/binutils-2.21/ld/testsuite/ld-elf/group2.d b/binutils-2.21/ld/testsuite/ld-elf/group2.d
new file mode 100644
index 0000000..664c49a
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/group2.d
@@ -0,0 +1,20 @@
+#source: ../../../binutils/testsuite/binutils-all/group.s
+#ld: -r
+#readelf: -Sg --wide
+#xfail: cr16-*-* crx-*-* xstormy*-*-*
+# cr16 and crx use non-standard scripts with memory regions, which don't play
+# well with unique group sections under ld -r.
+# xstormy also uses a non-standard script, putting .data before .text.
+
+#...
+ \[[ 0-9]+\] \.group[ \t]+GROUP[ \t]+.*
+#...
+ \[[ 0-9]+\] \.text.*[ \t]+PROGBITS[ \t0-9a-f]+AXG.*
+#...
+ \[[ 0-9]+\] \.data.*[ \t]+PROGBITS[ \t0-9a-f]+WAG.*
+#...
+COMDAT group section \[[ 0-9]+\] `\.group' \[foo_group\] contains 2 sections:
+ \[Index\] Name
+ \[[ 0-9]+\] .text.*
+ \[[ 0-9]+\] .data.*
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-elf/group3a.d b/binutils-2.21/ld/testsuite/ld-elf/group3a.d
new file mode 100644
index 0000000..10c0cf2
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/group3a.d
@@ -0,0 +1,8 @@
+#source: group3a.s
+#source: group3b.s
+#ld: -T group.ld
+#readelf: -s
+Symbol table '.symtab' contains .* entries:
+#...
+.*: 0+1000 +0 +OBJECT +GLOBAL +HIDDEN +. foo
+#...
diff --git a/binutils-2.21/ld/testsuite/ld-elf/group3a.s b/binutils-2.21/ld/testsuite/ld-elf/group3a.s
new file mode 100644
index 0000000..5e6a686
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/group3a.s
@@ -0,0 +1,5 @@
+ .section .data,"awG",%progbits,foo_group,comdat
+ .globl foo
+ .type foo,%object
+foo:
+ .word 0
diff --git a/binutils-2.21/ld/testsuite/ld-elf/group3b.d b/binutils-2.21/ld/testsuite/ld-elf/group3b.d
new file mode 100644
index 0000000..1b8a2a2
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/group3b.d
@@ -0,0 +1,11 @@
+#source: group3b.s
+#source: group3a.s
+#ld: -T group.ld
+#readelf: -s
+#xfail: arc-*-* d30v-*-* dlx-*-* i960-*-* or32-*-* pj*-*-*
+# generic linker targets don't comply with all symbol merging rules
+
+Symbol table '.symtab' contains .* entries:
+#...
+.*: 0+1000 +0 +OBJECT +GLOBAL +HIDDEN +. foo
+#...
diff --git a/binutils-2.21/ld/testsuite/ld-elf/group3b.s b/binutils-2.21/ld/testsuite/ld-elf/group3b.s
new file mode 100644
index 0000000..6c101bc
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/group3b.s
@@ -0,0 +1,6 @@
+ .section .data,"awG",%progbits,foo_group,comdat
+ .hidden foo
+ .globl foo
+ .type foo,%object
+foo:
+ .word 0
diff --git a/binutils-2.21/ld/testsuite/ld-elf/group4.d b/binutils-2.21/ld/testsuite/ld-elf/group4.d
new file mode 100644
index 0000000..af4ca4d
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/group4.d
@@ -0,0 +1,20 @@
+#source: ../../../binutils/testsuite/binutils-all/group-2.s
+#ld: -r
+#readelf: -Sg --wide
+#xfail: cr16-*-* crx-*-* xstormy*-*-*
+# cr16 and crx use non-standard scripts with memory regions, which don't play
+# well with unique group sections under ld -r.
+# xstormy also uses a non-standard script, putting .data before .text.
+
+#...
+ \[[ 0-9]+\] .group[ \t]+GROUP[ \t]+.*
+#...
+ \[[ 0-9]+\] \.text.*[ \t]+PROGBITS[ \t0-9a-f]+AXG[ \t]+.*
+#...
+ \[[ 0-9]+\] \.data.*[ \t]+PROGBITS[ \t0-9a-f]+WAG[ \t]+.*
+#...
+COMDAT group section \[[ 0-9]+\] `.group' \[.text.foo\] contains 2 sections:
+ \[Index\] Name
+ \[[ 0-9]+\] .text.*
+ \[[ 0-9]+\] .data.*
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-elf/group5.d b/binutils-2.21/ld/testsuite/ld-elf/group5.d
new file mode 100644
index 0000000..5102f81
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/group5.d
@@ -0,0 +1,20 @@
+#source: ../../../binutils/testsuite/binutils-all/group-3.s
+#ld: -r
+#readelf: -Sg --wide
+#xfail: cr16-*-* crx-*-* xstormy*-*-*
+# cr16 and crx use non-standard scripts with memory regions, which don't play
+# well with unique group sections under ld -r.
+# xstormy also uses a non-standard script, putting .data before .text.
+
+#...
+ \[[ 0-9]+\] .group[ \t]+GROUP[ \t]+.*
+#...
+ \[[ 0-9]+\] \.text.*[ \t]+PROGBITS[ \t0-9a-f]+AXG[ \t]+.*
+#...
+ \[[ 0-9]+\] \.data.*[ \t]+PROGBITS[ \t0-9a-f]+WAG[ \t]+.*
+#...
+COMDAT group section \[[ 0-9]+\] `.group' \[foo3\] contains 2 sections:
+ \[Index\] Name
+ \[[ 0-9]+\] .text.*
+ \[[ 0-9]+\] .data.*
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-elf/group6.d b/binutils-2.21/ld/testsuite/ld-elf/group6.d
new file mode 100644
index 0000000..0e8441f
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/group6.d
@@ -0,0 +1,20 @@
+#source: ../../../binutils/testsuite/binutils-all/group-4.s
+#ld: -r
+#readelf: -Sg --wide
+#xfail: cr16-*-* crx-*-* xstormy*-*-*
+# cr16 and crx use non-standard scripts with memory regions, which don't play
+# well with unique group sections under ld -r.
+# xstormy also uses a non-standard script, putting .data before .text.
+
+#...
+ \[[ 0-9]+\] .group[ \t]+GROUP[ \t]+.*
+#...
+ \[[ 0-9]+\] \.text.*[ \t]+PROGBITS[ \t0-9a-f]+AXG[ \t]+.*
+#...
+ \[[ 0-9]+\] \.data.*[ \t]+PROGBITS[ \t0-9a-f]+WAG[ \t]+.*
+#...
+COMDAT group section \[[ 0-9]+\] `.group' \[foo4\] contains 2 sections:
+ \[Index\] Name
+ \[[ 0-9]+\] .text.*
+ \[[ 0-9]+\] .data.*
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-elf/group7.d b/binutils-2.21/ld/testsuite/ld-elf/group7.d
new file mode 100644
index 0000000..602a4c8
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/group7.d
@@ -0,0 +1,31 @@
+#source: ../../../binutils/testsuite/binutils-all/group.s
+#source: ../../../binutils/testsuite/binutils-all/group-2.s
+#source: ../../../binutils/testsuite/binutils-all/group-3.s
+#source: ../../../binutils/testsuite/binutils-all/group-4.s
+#ld: -r
+#readelf: -g --wide
+#xfail: cr16-*-* crx-*-*
+# cr16 and crx use non-standard scripts with memory regions, which don't play
+# well with unique group sections under ld -r.
+
+#...
+COMDAT group section \[[ 0-9]+\] `\.group' \[foo_group\] contains 2 sections:
+ \[Index\] Name
+ \[[ 0-9]+\] .text.foo
+ \[[ 0-9]+\] .data.foo
+#...
+COMDAT group section \[[ 0-9]+\] `.group' \[.text.foo\] contains 2 sections:
+ \[Index\] Name
+ \[[ 0-9]+\] .text.foo
+ \[[ 0-9]+\] .data.bar
+#...
+COMDAT group section \[[ 0-9]+\] `.group' \[foo3\] contains 2 sections:
+ \[Index\] Name
+ \[[ 0-9]+\] .text.foo3
+ \[[ 0-9]+\] .data.bar3
+#...
+COMDAT group section \[[ 0-9]+\] `.group' \[foo4\] contains 2 sections:
+ \[Index\] Name
+ \[[ 0-9]+\] .text.foo4
+ \[[ 0-9]+\] .data.foo4
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-elf/group8.s b/binutils-2.21/ld/testsuite/ld-elf/group8.s
new file mode 100644
index 0000000..7766c6c
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/group8.s
@@ -0,0 +1,10 @@
+ .section .text.foo,"axG",%progbits,foo,comdat
+ .globl foo
+ .type foo,%function
+foo:
+ .byte 0
+ .section .text.bar,"axG",%progbits,bar,comdat
+ .globl bar
+ .type bar,%function
+bar:
+ .byte 0
diff --git a/binutils-2.21/ld/testsuite/ld-elf/group8a.d b/binutils-2.21/ld/testsuite/ld-elf/group8a.d
new file mode 100644
index 0000000..ce40a38
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/group8a.d
@@ -0,0 +1,13 @@
+#source: group8.s
+#ld: -r --gc-sections --entry foo
+#readelf: -g --wide
+#notarget: arc-*-* d30v-*-* dlx-*-* i960-*-* or32-*-* pj*-*-*
+#notarget: alpha-*-* hppa64-*-* i370-*-* i860-*-* ia64-*-* mep-*-* mn10200-*-*
+#xfail: cr16-*-* crx-*-*
+# generic linker targets don't support --gc-sections, nor do a bunch of others
+# cr16 and crx use non-standard scripts with memory regions, which don't play
+# well with unique group sections under ld -r.
+
+COMDAT group section \[[ 0-9]+\] `.group' \[foo\] contains 1 sections:
+ \[Index\] Name
+ \[[ 0-9]+\] .text.foo
diff --git a/binutils-2.21/ld/testsuite/ld-elf/group8b.d b/binutils-2.21/ld/testsuite/ld-elf/group8b.d
new file mode 100644
index 0000000..bb928c5
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/group8b.d
@@ -0,0 +1,13 @@
+#source: group8.s
+#ld: -r --gc-sections --entry bar
+#readelf: -g --wide
+#notarget: arc-*-* d30v-*-* dlx-*-* i960-*-* or32-*-* pj*-*-*
+#notarget: alpha-*-* hppa64-*-* i370-*-* i860-*-* ia64-*-* mep-*-* mn10200-*-*
+#xfail: cr16-*-* crx-*-*
+# generic linker targets don't support --gc-sections, nor do a bunch of others
+# cr16 and crx use non-standard scripts with memory regions, which don't play
+# well with unique group sections under ld -r.
+
+COMDAT group section \[[ 0-9]+\] `.group' \[bar\] contains 1 sections:
+ \[Index\] Name
+ \[[ 0-9]+\] .text.bar
diff --git a/binutils-2.21/ld/testsuite/ld-elf/group9.s b/binutils-2.21/ld/testsuite/ld-elf/group9.s
new file mode 100644
index 0000000..933c9f9
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/group9.s
@@ -0,0 +1,15 @@
+ .section .text.foo,"axG",%progbits,foo,comdat
+ .globl foo
+ .type foo,%function
+foo:
+ .byte 0
+ .section .data.foo,"axG",%progbits,foo,comdat
+ .globl foo.data
+ .type foo,%object
+foo.data:
+ .byte 0
+ .section .text.bar,"axG",%progbits,bar,comdat
+ .globl bar
+ .type bar,%function
+bar:
+ .long foo.data
diff --git a/binutils-2.21/ld/testsuite/ld-elf/group9a.d b/binutils-2.21/ld/testsuite/ld-elf/group9a.d
new file mode 100644
index 0000000..fd04c48
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/group9a.d
@@ -0,0 +1,14 @@
+#source: group9.s
+#ld: -r --gc-sections --entry foo
+#readelf: -g --wide
+#notarget: arc-*-* d30v-*-* dlx-*-* i960-*-* or32-*-* pj*-*-*
+#notarget: alpha-*-* hppa64-*-* i370-*-* i860-*-* ia64-*-* mep-*-* mn10200-*-*
+#xfail: cr16-*-* crx-*-*
+# generic linker targets don't support --gc-sections, nor do a bunch of others
+# cr16 and crx use non-standard scripts with memory regions, which don't play
+# well with unique group sections under ld -r.
+
+COMDAT group section \[[ 0-9]+\] `.group' \[foo\] contains 2 sections:
+ \[Index\] Name
+ \[[ 0-9]+\] .text.foo
+ \[[ 0-9]+\] .data.foo
diff --git a/binutils-2.21/ld/testsuite/ld-elf/group9b.d b/binutils-2.21/ld/testsuite/ld-elf/group9b.d
new file mode 100644
index 0000000..3f19fd6
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/group9b.d
@@ -0,0 +1,18 @@
+#source: group9.s
+#ld: -r --gc-sections --entry bar
+#readelf: -g --wide
+#notarget: arc-*-* d30v-*-* dlx-*-* i960-*-* or32-*-* pj*-*-*
+#notarget: alpha-*-* hppa64-*-* i370-*-* i860-*-* ia64-*-* mep-*-* mn10200-*-*
+#xfail: cr16-*-* crx-*-*
+# generic linker targets don't support --gc-sections, nor do a bunch of others
+# cr16 and crx use non-standard scripts with memory regions, which don't play
+# well with unique group sections under ld -r.
+
+COMDAT group section \[[ 0-9]+\] `.group' \[foo\] contains 2 sections:
+ \[Index\] Name
+ \[[ 0-9]+\] .text.foo
+ \[[ 0-9]+\] .data.foo
+
+COMDAT group section \[[ 0-9]+\] `.group' \[bar\] contains 1 sections:
+ \[Index\] Name
+ \[[ 0-9]+\] .text.bar
diff --git a/binutils-2.21/ld/testsuite/ld-elf/hash.d b/binutils-2.21/ld/testsuite/ld-elf/hash.d
new file mode 100644
index 0000000..9bcd9a9
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/hash.d
@@ -0,0 +1,17 @@
+#source: start.s
+#readelf: -d -s -D
+#ld: -shared --hash-style=gnu
+#target: *-*-linux*
+#notarget: mips*-*-*
+
+#...
+ +0x[0-9a-z]+ +\(GNU_HASH\) +0x[0-9a-z]+
+#...
+ +[0-9]+ +[0-9]+: +[0-9a-f]+ +[0-9]+ +NOTYPE +GLOBAL +DEFAULT +[1-9] _start
+#...
+ +[0-9]+ +[0-9]+: +[0-9a-f]+ +[0-9]+ +NOTYPE +GLOBAL +DEFAULT +[1-9] main
+#...
+ +[0-9]+ +[0-9]+: +[0-9a-f]+ +[0-9]+ +NOTYPE +GLOBAL +DEFAULT +[1-9] start
+#...
+ +[0-9]+ +[0-9]+: +[0-9a-f]+ +[0-9]+ +NOTYPE +GLOBAL +DEFAULT +[1-9] __start
+#...
diff --git a/binutils-2.21/ld/testsuite/ld-elf/header.d b/binutils-2.21/ld/testsuite/ld-elf/header.d
new file mode 100644
index 0000000..d438832
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/header.d
@@ -0,0 +1,5 @@
+# target: *-*-linux* *-*-vxworks
+# ld: -T header.t -z max-page-size=0x100
+# objdump: -hpw
+
+#...
diff --git a/binutils-2.21/ld/testsuite/ld-elf/header.s b/binutils-2.21/ld/testsuite/ld-elf/header.s
new file mode 100644
index 0000000..38f2228
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/header.s
@@ -0,0 +1,8 @@
+ .text
+ .globl main
+main:
+ .rept 0x40 - 0x15
+ .long 0xfedcba98
+ .endr
+ .data
+ .long 0x76543210
diff --git a/binutils-2.21/ld/testsuite/ld-elf/header.t b/binutils-2.21/ld/testsuite/ld-elf/header.t
new file mode 100644
index 0000000..c378fbe
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/header.t
@@ -0,0 +1,8 @@
+ENTRY(main)
+
+SECTIONS
+{
+ . = 0x100 + SIZEOF_HEADERS;
+ .text : { *(.text) }
+ .data : { *(.data) }
+}
diff --git a/binutils-2.21/ld/testsuite/ld-elf/hidden.out b/binutils-2.21/ld/testsuite/ld-elf/hidden.out
new file mode 100644
index 0000000..7ad7cbe
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/hidden.out
@@ -0,0 +1,3 @@
+TEST2
+TEST1
+MAIN
diff --git a/binutils-2.21/ld/testsuite/ld-elf/init-fini-arrays.d b/binutils-2.21/ld/testsuite/ld-elf/init-fini-arrays.d
new file mode 100644
index 0000000..1b182b9
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/init-fini-arrays.d
@@ -0,0 +1,12 @@
+#source: init-fini-arrays.s
+#ld: -r
+#readelf: -S --wide
+#xfail: cr16-*-* crx-*-*
+# cr16 and crx use non-standard scripts with memory regions, which don't play
+# well with unique group sections under ld -r.
+
+#...
+ \[[ 0-9]+\] \.init_array\.01000[ \t]+PROGBITS[ \t0-9a-f]+WA?.*
+#...
+ \[[ 0-9]+\] \.fini_array\.01000[ \t]+PROGBITS[ \t0-9a-f]+WA?.*
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-elf/init-fini-arrays.s b/binutils-2.21/ld/testsuite/ld-elf/init-fini-arrays.s
new file mode 100644
index 0000000..8f7a3f7
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/init-fini-arrays.s
@@ -0,0 +1,6 @@
+ .section .init_array.01000,"aw",%progbits
+ .align 4
+ .word 0
+ .section .fini_array.01000,"aw",%progbits
+ .align 4
+ .word 0
diff --git a/binutils-2.21/ld/testsuite/ld-elf/init.c b/binutils-2.21/ld/testsuite/ld-elf/init.c
new file mode 100644
index 0000000..3b1ffb1
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/init.c
@@ -0,0 +1,34 @@
+#include <stdio.h>
+
+static void
+init_0 (void)
+{
+ printf ("init array 0\n");
+}
+
+static void
+init_1 (void)
+{
+ printf ("init array 1\n");
+}
+
+static void
+init_2 (void)
+{
+ printf ("init array 2\n");
+}
+
+void (*const init_array []) (void)
+ __attribute__ ((section (".init_array"),
+ aligned (sizeof (void *)))) =
+{
+ &init_0,
+ &init_1,
+ &init_2
+};
+
+int
+main (void)
+{
+ return 0;
+}
diff --git a/binutils-2.21/ld/testsuite/ld-elf/init.out b/binutils-2.21/ld/testsuite/ld-elf/init.out
new file mode 100644
index 0000000..f988b84
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/init.out
@@ -0,0 +1,3 @@
+init array 0
+init array 1
+init array 2
diff --git a/binutils-2.21/ld/testsuite/ld-elf/linkonce1.d b/binutils-2.21/ld/testsuite/ld-elf/linkonce1.d
new file mode 100644
index 0000000..c0e331f
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/linkonce1.d
@@ -0,0 +1,12 @@
+#source: linkonce1a.s
+#source: linkonce1b.s
+#ld: -r
+#objdump: -r
+
+.*: file format .*
+
+RELOCATION RECORDS FOR \[.debug_frame\]:
+OFFSET[ ]+TYPE[ ]+VALUE[ ]*
+.*(NONE|unused|UNUSED).*\*ABS\*
+
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-elf/linkonce1a.s b/binutils-2.21/ld/testsuite/ld-elf/linkonce1a.s
new file mode 100644
index 0000000..5c2d8c2
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/linkonce1a.s
@@ -0,0 +1,3 @@
+ .section .gnu.linkonce.d.dummy,"aw"
+bar:
+ .long 0
diff --git a/binutils-2.21/ld/testsuite/ld-elf/linkonce1b.s b/binutils-2.21/ld/testsuite/ld-elf/linkonce1b.s
new file mode 100644
index 0000000..fd45cec
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/linkonce1b.s
@@ -0,0 +1,17 @@
+ .globl main
+ .globl start
+ .globl _start
+ .globl __start
+ .text
+main:
+start:
+_start:
+__start:
+ .long 0
+
+ .section .gnu.linkonce.d.dummy,"aw"
+ .long 0
+foo:
+ .long 0
+ .section .debug_frame,"",%progbits
+ .long foo
diff --git a/binutils-2.21/ld/testsuite/ld-elf/linkonce2.d b/binutils-2.21/ld/testsuite/ld-elf/linkonce2.d
new file mode 100644
index 0000000..0cbb3ad
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/linkonce2.d
@@ -0,0 +1,14 @@
+#source: linkonce1a.s
+#source: linkonce1b.s
+#ld: -emit-relocs
+#objdump: -r
+#notarget: arc-*-* d30v-*-* dlx-*-* i960-*-* or32-*-* pj*-*-*
+# generic elf targets don't emit relocs
+
+.*: file format .*
+
+RELOCATION RECORDS FOR \[.debug_frame\]:
+OFFSET[ ]+TYPE[ ]+VALUE[ ]*
+.*(NONE|unused|UNUSED).*\*ABS\*
+
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-elf/linkoncerdiff.d b/binutils-2.21/ld/testsuite/ld-elf/linkoncerdiff.d
new file mode 100644
index 0000000..8eec3d2
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/linkoncerdiff.d
@@ -0,0 +1,6 @@
+#source: linkoncerdiff1.s
+#source: linkoncerdiff2.s
+#ld: -r
+#readelf: -r
+There are no relocations in this file.
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-elf/linkoncerdiff1.s b/binutils-2.21/ld/testsuite/ld-elf/linkoncerdiff1.s
new file mode 100644
index 0000000..9e8e17e
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/linkoncerdiff1.s
@@ -0,0 +1,7 @@
+ .section .gnu.linkonce.t.foo, "a", %progbits
+ .globl symfoo
+symfoo:
+
+ .section .gnu.linkonce.t.bar, "a", %progbits
+ .globl symbar
+symbar:
diff --git a/binutils-2.21/ld/testsuite/ld-elf/linkoncerdiff2.s b/binutils-2.21/ld/testsuite/ld-elf/linkoncerdiff2.s
new file mode 100644
index 0000000..1e8c2ba
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/linkoncerdiff2.s
@@ -0,0 +1,22 @@
+ .section .gnu.linkonce.t.foo, "a", %progbits
+1:
+ .globl symfoo
+symfoo:
+ .long 0
+
+ .section .gnu.linkonce.t.bar, "a", %progbits
+2:
+ .globl symbar
+symbar:
+ .long 0
+
+ .section .gnu.linkonce.r.foo, "a", %progbits
+ .long 1b
+ .long symfoo
+/* ld currently incorrectly silently discards this relocation. Just such
+ relocations are never produced by g++-3.4 so this suppressed error message
+ is not a problem:
+ #error: `.gnu.linkonce.t.bar' referenced in section `.gnu.linkonce.r.foo' of tmpdir/dump1.o: defined in discarded section `.gnu.linkonce.t.bar' of tmpdir/dump1.o
+ */
+ .long 2b
+ .long symbar
diff --git a/binutils-2.21/ld/testsuite/ld-elf/lma.lnk b/binutils-2.21/ld/testsuite/ld-elf/lma.lnk
new file mode 100644
index 0000000..7aac6d0
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/lma.lnk
@@ -0,0 +1,6 @@
+SECTIONS
+{
+ . = -0x100000;
+ .text : AT(ADDR(.text) + 0x100000) { *(.text) }
+ /DISCARD/ : { *(*) }
+}
diff --git a/binutils-2.21/ld/testsuite/ld-elf/lma.s b/binutils-2.21/ld/testsuite/ld-elf/lma.s
new file mode 100644
index 0000000..039d26b
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/lma.s
@@ -0,0 +1,4 @@
+ .text
+ .global _start
+_start:
+ .long 0
diff --git a/binutils-2.21/ld/testsuite/ld-elf/loadaddr.s b/binutils-2.21/ld/testsuite/ld-elf/loadaddr.s
new file mode 100644
index 0000000..0a14169
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/loadaddr.s
@@ -0,0 +1,20 @@
+ .text
+ .globl main
+ .globl start
+ .globl _start
+ .globl __start
+main:
+start:
+_start:
+__start:
+ .byte 0,0,0,0,0,0,0,0
+ .byte 0,0,0,0,0,0,0,0
+ .section .bar,"ax","progbits"
+ .byte 0,0,0,0,0,0,0,0
+ .byte 0,0,0,0,0,0,0,0
+ .section .foo,"aw","progbits"
+ .byte 0,0,0,0,0,0,0,0
+ .byte 0,0,0,0,0,0,0,0
+ .data
+ .byte 0,0,0,0,0,0,0,0
+ .byte 0,0,0,0,0,0,0,0
diff --git a/binutils-2.21/ld/testsuite/ld-elf/loadaddr.t b/binutils-2.21/ld/testsuite/ld-elf/loadaddr.t
new file mode 100644
index 0000000..91e9ef2
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/loadaddr.t
@@ -0,0 +1,10 @@
+SECTIONS
+{
+ . = -0x7ff00000;
+ .text : {*(.text .text.*)}
+ . = ALIGN(64);
+ .foo : { *(.foo) }
+ . = ALIGN(8192);
+ .data : AT (ADDR(.data)) { *(.data) }
+ /DISCARD/ : { *(.*) }
+}
diff --git a/binutils-2.21/ld/testsuite/ld-elf/loadaddr1.d b/binutils-2.21/ld/testsuite/ld-elf/loadaddr1.d
new file mode 100644
index 0000000..2d3469b
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/loadaddr1.d
@@ -0,0 +1,10 @@
+#source: loadaddr.s
+#ld: -T loadaddr1.t -T loadaddr.t -z max-page-size=0x200000
+#readelf: -l --wide
+#target: *-*-linux*
+
+#...
+ LOAD +0x000000 0xf*80000000 0xf*80000000 0x100050 0x100050 RWE 0x200000
+ LOAD +0x200000 0xf*ff600000 0xf*80101000 0x0*10 0x0*10 R E 0x200000
+ LOAD +0x302000 0xf*80102000 0xf*80102000 0x0*10 0x0*10 RW 0x200000
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-elf/loadaddr1.t b/binutils-2.21/ld/testsuite/ld-elf/loadaddr1.t
new file mode 100644
index 0000000..5037b4f
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/loadaddr1.t
@@ -0,0 +1,7 @@
+SECTIONS
+{
+ .bar -0xa00000 : AT ((LOADADDR(.foo) + SIZEOF(.foo) + 4095) & ~(4095))
+ { *(.bar) }
+ . = LOADADDR(.bar) + 4096;
+}
+INSERT AFTER .foo;
diff --git a/binutils-2.21/ld/testsuite/ld-elf/loadaddr2.d b/binutils-2.21/ld/testsuite/ld-elf/loadaddr2.d
new file mode 100644
index 0000000..e447e38
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/loadaddr2.d
@@ -0,0 +1,10 @@
+#source: loadaddr.s
+#ld: -T loadaddr2.t -T loadaddr.t -z max-page-size=0x200000
+#readelf: -l --wide
+#target: *-*-linux*
+
+#...
+ LOAD +0x000000 0xf*80000000 0xf*80000000 0x100050 0x100050 RWE 0x200000
+ LOAD +0x110000 0xf*80110000 0xf*80101000 0x0*10 0x0*10 R E 0x200000
+ LOAD +0x302000 0xf*80302000 0xf*80302000 0x0*10 0x0*10 RW 0x200000
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-elf/loadaddr2.t b/binutils-2.21/ld/testsuite/ld-elf/loadaddr2.t
new file mode 100644
index 0000000..0ad16df
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/loadaddr2.t
@@ -0,0 +1,7 @@
+SECTIONS
+{
+ .bar -0x7fef0000 : AT ((LOADADDR(.foo) + SIZEOF(.foo) + 4095) & ~(4095))
+ { *(.bar) }
+ . = LOADADDR(.bar) + 0x200000;
+}
+INSERT BEFORE .data;
diff --git a/binutils-2.21/ld/testsuite/ld-elf/loadaddr3.t b/binutils-2.21/ld/testsuite/ld-elf/loadaddr3.t
new file mode 100644
index 0000000..789f61e
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/loadaddr3.t
@@ -0,0 +1,16 @@
+
+MEMORY
+{
+ rom (rx) : ORIGIN = 0x100, LENGTH = 0x100
+ ram (rwx) : ORIGIN = 0x200, LENGTH = 0x100
+
+}
+
+SECTIONS
+{
+ .text : {*(.text .text.*)} >rom
+ .data : {data_load = LOADADDR (.data);
+ data_start = ADDR (.data);
+ *(.data .data.*)} >ram AT>rom
+ /DISCARD/ : { *(.*) }
+}
diff --git a/binutils-2.21/ld/testsuite/ld-elf/loadaddr3a.d b/binutils-2.21/ld/testsuite/ld-elf/loadaddr3a.d
new file mode 100644
index 0000000..b2ace66
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/loadaddr3a.d
@@ -0,0 +1,9 @@
+#source: loadaddr.s
+#ld: -T loadaddr3.t -z max-page-size=0x200000
+#readelf: -l --wide
+#target: *-*-linux*
+
+#...
+ LOAD +0x000000 0x0*00000000 0x0*00000000 0x0*0110 0x0*0110 R E 0x.*
+ LOAD +0x000200 0x0*00000200 0x0*00000110 0x0*0010 0x0*0010 RW 0x.*
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-elf/loadaddr3b.d b/binutils-2.21/ld/testsuite/ld-elf/loadaddr3b.d
new file mode 100644
index 0000000..af7e6e4
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/loadaddr3b.d
@@ -0,0 +1,13 @@
+#source: loadaddr.s
+#ld: -T loadaddr3.t -z max-page-size=0x200000
+#objdump: -t
+#target: *-*-linux*
+
+#...
+0+0000100 l d .text 0+0000000 .text
+0+0000200 l d .data 0+0000000 .data
+#...
+0+0000110 g \*ABS\* 0+0000000 data_load
+#...
+0+0000200 g .data 0+0000000 data_start
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-elf/local1.d b/binutils-2.21/ld/testsuite/ld-elf/local1.d
new file mode 100644
index 0000000..5957d8f
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/local1.d
@@ -0,0 +1,7 @@
+#ld: -shared --version-script local1.map
+#readelf: -s --wide
+#target: *-*-linux*
+
+#...
+ .*: [0-9a-f]* +[0-9a-f]+ +OBJECT +LOCAL +DEFAULT +[0-9] +foo
+#...
diff --git a/binutils-2.21/ld/testsuite/ld-elf/local1.map b/binutils-2.21/ld/testsuite/ld-elf/local1.map
new file mode 100644
index 0000000..1e2aa8c
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/local1.map
@@ -0,0 +1,6 @@
+{
+global:
+ *;
+local:
+ foo;
+};
diff --git a/binutils-2.21/ld/testsuite/ld-elf/local1.s b/binutils-2.21/ld/testsuite/ld-elf/local1.s
new file mode 100644
index 0000000..0122efa
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/local1.s
@@ -0,0 +1,6 @@
+ .globl foo
+ .protected foo
+ .type foo,%object
+ .data
+foo:
+ .long 0
diff --git a/binutils-2.21/ld/testsuite/ld-elf/main.c b/binutils-2.21/ld/testsuite/ld-elf/main.c
new file mode 100644
index 0000000..24f9dcc
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/main.c
@@ -0,0 +1,8 @@
+#include <stdio.h>
+
+int
+main (void)
+{
+ printf ("MAIN\n");
+ return 0;
+}
diff --git a/binutils-2.21/ld/testsuite/ld-elf/maxpage1.d b/binutils-2.21/ld/testsuite/ld-elf/maxpage1.d
new file mode 100644
index 0000000..57acda0
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/maxpage1.d
@@ -0,0 +1,9 @@
+#source: maxpage1.s
+#ld: -z max-page-size=0x200000
+#readelf: -l --wide
+#target: *-*-linux*
+
+#...
+ LOAD+.*0x200000
+ LOAD+.*0x200000
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-elf/maxpage1.s b/binutils-2.21/ld/testsuite/ld-elf/maxpage1.s
new file mode 100644
index 0000000..1a7735a
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/maxpage1.s
@@ -0,0 +1,13 @@
+ .globl main
+ .globl start
+ .globl _start
+ .globl __start
+ .text
+main:
+start:
+_start:
+__start:
+ .long 0
+
+ .data
+ .long 0
diff --git a/binutils-2.21/ld/testsuite/ld-elf/maxpage2.d b/binutils-2.21/ld/testsuite/ld-elf/maxpage2.d
new file mode 100644
index 0000000..7fe9379
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/maxpage2.d
@@ -0,0 +1,9 @@
+#source: maxpage1.s
+#ld: -z max-page-size=0x100000
+#readelf: -l --wide
+#target: *-*-linux*
+
+#...
+ LOAD+.*0x100000
+ LOAD+.*0x100000
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-elf/maxpage3.t b/binutils-2.21/ld/testsuite/ld-elf/maxpage3.t
new file mode 100644
index 0000000..556dcd5
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/maxpage3.t
@@ -0,0 +1,7 @@
+SECTIONS
+{
+ .text : {*(.text)}
+ . = ALIGN(CONSTANT (MAXPAGESIZE));
+ .data : {*(.data)}
+ /DISCARD/ : {*(*)}
+}
diff --git a/binutils-2.21/ld/testsuite/ld-elf/maxpage3a.d b/binutils-2.21/ld/testsuite/ld-elf/maxpage3a.d
new file mode 100644
index 0000000..0e46b6b
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/maxpage3a.d
@@ -0,0 +1,11 @@
+#source: maxpage1.s
+#ld: -z max-page-size=0x10000000 -T maxpage3.t
+#readelf: -lS --wide
+#target: *-*-linux*
+
+#...
+ \[[ 0-9]+\] \.data[ \t]+PROGBITS[ \t]+0*10000000[ \t]+[ \t0-9a-f]+WA?.*
+#...
+ LOAD+.*0x10000000
+ LOAD+.*0x10000000
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-elf/maxpage3b.d b/binutils-2.21/ld/testsuite/ld-elf/maxpage3b.d
new file mode 100644
index 0000000..4bee0ec
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/maxpage3b.d
@@ -0,0 +1,10 @@
+#source: maxpage1.s
+#ld: -T maxpage3.t -z max-page-size=0x10000000
+#readelf: -lS --wide
+#target: x86_64-*-linux*
+
+#...
+ \[[ 0-9]+\] \.data[ \t]+PROGBITS[ \t]+0*200000[ \t]+[ \t0-9a-f]+WA?.*
+#...
+ LOAD+.*0x10000000
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-elf/maxpage3c.d b/binutils-2.21/ld/testsuite/ld-elf/maxpage3c.d
new file mode 100644
index 0000000..cdc3eaf
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/maxpage3c.d
@@ -0,0 +1,12 @@
+#source: maxpage1.s
+#as: --32
+#ld: -m elf_i386 -z max-page-size=0x10000000 -T maxpage3.t
+#readelf: -lS --wide
+#target: x86_64-*-linux*
+
+#...
+ \[[ 0-9]+\] \.data[ \t]+PROGBITS[ \t]+0*10000000[ \t]+[ \t0-9a-f]+WA?.*
+#...
+ LOAD+.*0x10000000
+ LOAD+.*0x10000000
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-elf/maxpage4.d b/binutils-2.21/ld/testsuite/ld-elf/maxpage4.d
new file mode 100644
index 0000000..a7cc17b
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/maxpage4.d
@@ -0,0 +1,9 @@
+#source: maxpage1.s
+#as: --32
+#ld: -z max-page-size=0x200000 -T maxpage4.t
+#readelf: -l --wide
+#target: x86_64-*-linux*
+
+#...
+ LOAD+.*0x200000
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-elf/maxpage4.t b/binutils-2.21/ld/testsuite/ld-elf/maxpage4.t
new file mode 100644
index 0000000..42089e3
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/maxpage4.t
@@ -0,0 +1,9 @@
+OUTPUT_FORMAT("elf32-i386")
+OUTPUT_ARCH(i386)
+ENTRY(_start)
+SECTIONS
+{
+ .text : {*(.text)}
+ .data : {*(.data)}
+ /DISCARD/ : {*(*)}
+}
diff --git a/binutils-2.21/ld/testsuite/ld-elf/merge.d b/binutils-2.21/ld/testsuite/ld-elf/merge.d
new file mode 100644
index 0000000..83b5698
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/merge.d
@@ -0,0 +1,17 @@
+#source: merge.s
+#ld: -T merge.ld
+#objdump: -s
+#xfail: "arc-*-*" "avr-*-*" "bfin-*-*" "cr16-*-*" "cris*-*-*" "crx-*-*" "d10v-*-*" "d30v-*-*"
+#xfail: "dlx-*-*" "fr30-*-*" "frv-*-*" "hppa*64*-*-*" "h8300-*-*" "score-*-*"
+#xfail: "i370-*-*" "i860-*-*" "i960-*-*" "ip2k-*-*" "iq2000-*-*" "lm32-*-*"
+#xfail: "mcore-*-*" "mn102*-*-*" "mips*-*-*" "ms1-*-*" "msp430-*-*" "mep-*-*"
+#xfail: "or32-*-*" "pj-*-*" "sparc*-*-*" "tic6x-*-*" "vax-*-*" "xstormy16-*-*"
+#xfail: "xtensa*-*-*"
+
+.*: file format .*elf.*
+
+Contents of section .text:
+ 1000 (1010)?0000(1010)? (1210)?0000(1012)? (0c)?000000(0c)? (0e)?000000(0e)? .*
+Contents of section .rodata:
+ 1010 61626300 .*
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-elf/merge.ld b/binutils-2.21/ld/testsuite/ld-elf/merge.ld
new file mode 100644
index 0000000..dce91bb
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/merge.ld
@@ -0,0 +1,7 @@
+SECTIONS
+{
+ . = 0x1000;
+ .text : { *(.text .text.* .gnu.linkonce.t.*) }
+ .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
+ .junk : { *(*) }
+}
diff --git a/binutils-2.21/ld/testsuite/ld-elf/merge.s b/binutils-2.21/ld/testsuite/ld-elf/merge.s
new file mode 100644
index 0000000..1e6e0e3
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/merge.s
@@ -0,0 +1,14 @@
+ .section .rodata.str,"aMS","progbits",1
+.LC0:
+ .asciz "abc"
+.LC1:
+ .asciz "c"
+
+ .text
+ .global _start
+_start:
+ .long .LC0
+.LT0:
+ .long .LC1
+ .long .LC0-.LT0
+ .long .LC1-.LT0
diff --git a/binutils-2.21/ld/testsuite/ld-elf/merge2.d b/binutils-2.21/ld/testsuite/ld-elf/merge2.d
new file mode 100644
index 0000000..4770621
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/merge2.d
@@ -0,0 +1,17 @@
+#source: merge2.s
+#ld: -T merge.ld
+#objdump: -s
+#xfail: "arc-*-*" "d30v-*-*" "dlx-*-*" "hppa64-*-*"
+#xfail: "i960-*-*" "ip2k-*-*" "or32-*-*" "pj-*-*"
+
+.*: file format .*elf.*
+
+Contents of section .text:
+ 1000 (3010)?0000(1030)? (3210)?0000(1032)? (3110)?0000(1031)? (3410)?0000(1034)? .*
+ 1010 (4010)?0000(1040)? (3810)?0000(1038)? (4810)?0000(1048)? (3c10)?0000(103c)? .*
+ 1020 (5010)?0000(1050)? (5410)?0000(1054)? (5810)?0000(1058)? (5010)?0000(1050)? .*
+Contents of section .rodata:
+ 1030 61626300 62000000 (78563412|12345678) 99999999 .*
+ 1040 (78563412|12345678) 00000000 99999999 00000000 .*
+ 1050 (78563412|12345678) 99999999 00000000 .*
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-elf/merge2.s b/binutils-2.21/ld/testsuite/ld-elf/merge2.s
new file mode 100644
index 0000000..41d066a
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/merge2.s
@@ -0,0 +1,58 @@
+ .section .rodata.str,"aMS","progbits",1
+.LC0:
+ .asciz "abc"
+.LC1:
+ .asciz "c"
+.LC2:
+ .asciz "bc"
+.LC3:
+ .asciz "b"
+
+
+ .section .rodata.str2,"aMS","progbits",4
+ .p2align 2
+.LC4:
+ .long 0x12345678
+ .long 0
+.LC5:
+ .long 0x12345678
+ .long 0x99999999
+ .long 0x12345678
+ .long 0
+.LC6:
+ .long 0x99999999
+ .long 0
+.LC7:
+ .long 0x99999999
+ .long 0x12345678
+ .long 0
+
+
+ .section .rodata.m,"aM","progbits",4
+ .p2align 2
+.LC8:
+ .long 0x12345678
+.LC9:
+ .long 0x99999999
+.LC10:
+ .long 0
+.LC11:
+ .long 0x12345678
+
+
+ .text
+ .global _start
+_start:
+ .long .LC0
+.LT0:
+ .long .LC1
+ .long .LC2
+ .long .LC3
+ .long .LC4
+ .long .LC5
+ .long .LC6
+ .long .LC7
+ .long .LC8
+ .long .LC9
+ .long .LC10
+ .long .LC11
diff --git a/binutils-2.21/ld/testsuite/ld-elf/multibss1.d b/binutils-2.21/ld/testsuite/ld-elf/multibss1.d
new file mode 100644
index 0000000..a6fd9b3
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/multibss1.d
@@ -0,0 +1,11 @@
+#source: multibss1.s
+#ld: -e 0
+#readelf: -l --wide
+#target: *-*-linux*
+#xfail: hppa64-*-*
+# hppa64 default script add 16 bytes at start of .data giving 0x500010 p_memsz
+
+#...
+ +LOAD +0x[^ ]+ +0x[^ ]+ +0x[^ ]+ +0x[^ ]+ +0x500000 .*
+# p_offset p_vaddr p_paddr p_filesz
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-elf/multibss1.s b/binutils-2.21/ld/testsuite/ld-elf/multibss1.s
new file mode 100644
index 0000000..94b84f9
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/multibss1.s
@@ -0,0 +1,11 @@
+ .macro makebss
+ .section .bss_\@,"aw",%nobits
+ .space 0x10000
+ .endm
+
+ .rept 80
+ makebss
+ .endr
+
+ .text
+ .space 0x10
diff --git a/binutils-2.21/ld/testsuite/ld-elf/new.cc b/binutils-2.21/ld/testsuite/ld-elf/new.cc
new file mode 100644
index 0000000..b4c8882
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/new.cc
@@ -0,0 +1,48 @@
+#include <new>
+#include <exception_defines.h>
+
+using std::bad_alloc;
+
+extern "C" void *malloc (std::size_t);
+extern "C" void abort (void);
+
+void *
+operator new (std::size_t sz, const std::nothrow_t&) throw()
+{
+ void *p;
+
+ /* malloc (0) is unpredictable; avoid it. */
+ if (sz == 0)
+ sz = 1;
+ p = (void *) malloc (sz);
+ return p;
+}
+
+void *
+operator new (std::size_t sz) throw (std::bad_alloc)
+{
+ void *p;
+
+ /* malloc (0) is unpredictable; avoid it. */
+ if (sz == 0)
+ sz = 1;
+ p = (void *) malloc (sz);
+ while (p == 0)
+ {
+ ::abort();
+ }
+
+ return p;
+}
+
+void*
+operator new[] (std::size_t sz) throw (std::bad_alloc)
+{
+ return ::operator new(sz);
+}
+
+void *
+operator new[] (std::size_t sz, const std::nothrow_t& nothrow) throw()
+{
+ return ::operator new(sz, nothrow);
+}
diff --git a/binutils-2.21/ld/testsuite/ld-elf/nobits-1.d b/binutils-2.21/ld/testsuite/ld-elf/nobits-1.d
new file mode 100644
index 0000000..89f0e10
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/nobits-1.d
@@ -0,0 +1,9 @@
+#ld: -Tnobits-1.t
+#readelf: -l --wide
+#xfail: hppa64-*-*
+# hppa64 adds PHDR
+
+#...
+ Section to Segment mapping:
+ Segment Sections...
+ 00 .foo .bar
diff --git a/binutils-2.21/ld/testsuite/ld-elf/nobits-1.s b/binutils-2.21/ld/testsuite/ld-elf/nobits-1.s
new file mode 100644
index 0000000..8fb1365
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/nobits-1.s
@@ -0,0 +1,6 @@
+ .globl _entry
+ .section .foo,"awx",%progbits
+_entry:
+ .byte 0
+ .section .bar,"ax",%nobits
+ .byte 0
diff --git a/binutils-2.21/ld/testsuite/ld-elf/nobits-1.t b/binutils-2.21/ld/testsuite/ld-elf/nobits-1.t
new file mode 100644
index 0000000..2004330
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/nobits-1.t
@@ -0,0 +1,13 @@
+ENTRY(_entry)
+PHDRS
+{
+ data PT_LOAD;
+}
+SECTIONS
+{
+ . = 0x1000000;
+ .foo : { *(.foo) } :data
+ . = 0x2000000;
+ .bar : { *(.bar) } :data
+ /DISCARD/ : { *(*) }
+}
diff --git a/binutils-2.21/ld/testsuite/ld-elf/noload-1.d b/binutils-2.21/ld/testsuite/ld-elf/noload-1.d
new file mode 100644
index 0000000..7cae479
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/noload-1.d
@@ -0,0 +1,7 @@
+#source: noload-1.s
+#ld: -T noload-1.t
+#readelf: -S --wide
+
+#...
+ \[[ 0-9]+\] TEST[ \t]+NOBITS[ \t0-9a-f]+WA.*
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-elf/noload-1.s b/binutils-2.21/ld/testsuite/ld-elf/noload-1.s
new file mode 100644
index 0000000..ad0479e
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/noload-1.s
@@ -0,0 +1,2 @@
+ .section TEST,"aw",%progbits
+ .byte 0
diff --git a/binutils-2.21/ld/testsuite/ld-elf/noload-1.t b/binutils-2.21/ld/testsuite/ld-elf/noload-1.t
new file mode 100644
index 0000000..1efd06c
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/noload-1.t
@@ -0,0 +1,8 @@
+SECTIONS
+{
+ TEST (NOLOAD) :
+ {
+ *(TEST)
+ }
+ /DISCARD/ : { *(.*) }
+}
diff --git a/binutils-2.21/ld/testsuite/ld-elf/noload-2.d b/binutils-2.21/ld/testsuite/ld-elf/noload-2.d
new file mode 100644
index 0000000..633bf45
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/noload-2.d
@@ -0,0 +1,8 @@
+#source: noload-1.s
+#ld: -T noload-1.t -z max-page-size=0x200000
+#readelf: -Sl --wide
+#target: *-*-linux*
+
+#...
+ +LOAD +0x200000 +0x0+ +0x0+ +0x0+ +0x0+1 +RW +0x200000
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-elf/noload-3.d b/binutils-2.21/ld/testsuite/ld-elf/noload-3.d
new file mode 100644
index 0000000..84b27d7
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/noload-3.d
@@ -0,0 +1,7 @@
+#ld: -T noload-3.t
+#objdump: -s -j .foo1
+
+#...
+Contents of section .foo1:
+ [0-9a-f]+ [0-9a-f]+ [0-9a-f]+ [0-9a-f]+ [0-9a-f]+[ \t]+This is a test.*
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-elf/noload-3.s b/binutils-2.21/ld/testsuite/ld-elf/noload-3.s
new file mode 100644
index 0000000..84aa2e2
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/noload-3.s
@@ -0,0 +1,6 @@
+ .section .foo2,"aw",%progbits
+ .byte 1
+ .section .foo1,"w",%progbits
+ .string "This is a test."
+ .section .foo,"aw",%progbits
+ .space 16
diff --git a/binutils-2.21/ld/testsuite/ld-elf/noload-3.t b/binutils-2.21/ld/testsuite/ld-elf/noload-3.t
new file mode 100644
index 0000000..fbb5166
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/noload-3.t
@@ -0,0 +1,7 @@
+SECTIONS
+{
+ .foo2 : { *(.foo2) }
+ .foo1 : { *(.foo1) }
+ .foo (NOLOAD) : { *(.foo) }
+ /DISCARD/ : { *(*) }
+}
diff --git a/binutils-2.21/ld/testsuite/ld-elf/normal.out b/binutils-2.21/ld/testsuite/ld-elf/normal.out
new file mode 100644
index 0000000..3b721f0
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/normal.out
@@ -0,0 +1,3 @@
+TEST1
+TEST1
+MAIN
diff --git a/binutils-2.21/ld/testsuite/ld-elf/note-1.d b/binutils-2.21/ld/testsuite/ld-elf/note-1.d
new file mode 100644
index 0000000..345a2bb
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/note-1.d
@@ -0,0 +1,10 @@
+#ld: -Tnote-1.t
+#readelf: -l --wide
+#xfail: hppa64-*-*
+# hppa64 adds PHDR
+
+#...
+ Section to Segment mapping:
+ Segment Sections...
+ 00 .foo
+ 01 .note
diff --git a/binutils-2.21/ld/testsuite/ld-elf/note-1.s b/binutils-2.21/ld/testsuite/ld-elf/note-1.s
new file mode 100644
index 0000000..844188b
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/note-1.s
@@ -0,0 +1,6 @@
+ .globl _entry
+ .section .foo,"awx",%progbits
+_entry:
+ .byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+ .section .note,"",%note
+ .byte 0
diff --git a/binutils-2.21/ld/testsuite/ld-elf/note-1.t b/binutils-2.21/ld/testsuite/ld-elf/note-1.t
new file mode 100644
index 0000000..031fe82
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/note-1.t
@@ -0,0 +1,14 @@
+ENTRY(_entry)
+PHDRS
+{
+ data PT_LOAD;
+ note PT_NOTE;
+}
+SECTIONS
+{
+ . = 0x1000000;
+ .foo : { *(.foo) } :data
+ . = 0x2000000;
+ .note : { *(.note) } :note
+ /DISCARD/ : { *(*) }
+}
diff --git a/binutils-2.21/ld/testsuite/ld-elf/note-2.d b/binutils-2.21/ld/testsuite/ld-elf/note-2.d
new file mode 100644
index 0000000..289134e
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/note-2.d
@@ -0,0 +1,17 @@
+#ld: -Tnote-2.t
+#objcopy_linked_file: -R .foo
+#readelf: -l --wide
+#xfail: hppa64-*-*
+# hppa64 adds PHDR
+
+#...
+Program Headers:
+ Type.*
+ LOAD +0x[0-9a-f]+ .*
+ NOTE +0x[0-9a-f]+ .*
+
+#...
+ Segment Sections...
+ 00[ \t]+.text *
+ 01[ \t]+.note *
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-elf/note-2.s b/binutils-2.21/ld/testsuite/ld-elf/note-2.s
new file mode 100644
index 0000000..93d6b36
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/note-2.s
@@ -0,0 +1,8 @@
+ .globl _entry
+ .text
+_entry:
+ .byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+ .section .foo,"awx",%progbits
+ .byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+ .section .note,"",%note
+ .byte 0
diff --git a/binutils-2.21/ld/testsuite/ld-elf/note-2.t b/binutils-2.21/ld/testsuite/ld-elf/note-2.t
new file mode 100644
index 0000000..a507da9
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/note-2.t
@@ -0,0 +1,13 @@
+ENTRY(_entry)
+PHDRS
+{
+ data PT_LOAD;
+ note PT_NOTE;
+}
+SECTIONS
+{
+ .text : { *(.text) } :data
+ .foo : { *(.foo) } :data
+ .note : { *(.note) } :note
+ /DISCARD/ : { *(*) }
+}
diff --git a/binutils-2.21/ld/testsuite/ld-elf/orphan-region.d b/binutils-2.21/ld/testsuite/ld-elf/orphan-region.d
new file mode 100644
index 0000000..9d6c90c
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/orphan-region.d
@@ -0,0 +1,21 @@
+#source: orphan-region.s
+#ld: -T orphan-region.ld -N
+#readelf: -S -l --wide
+#xfail: arc-*-* d30v-*-* dlx-*-* fr30-*-* frv-*-elf i860-*-* i960-*-*
+#xfail: iq*-*-* mn10200-*-* moxie-*-* msp*-*-* mt-*-* or32-*-* pj*-*-*
+#xfail: spu-*-* hppa*64*-*-* frv-*-*
+# if not using elf32.em, you don't get fancy orphan handling
+# spu twiddles LOAD range, hppa64 adds PHDR, frv-linux adds GNU_STACK
+
+#...
+ \[[ 0-9]+\] \.text[ \t]+PROGBITS[ \t]+0*40000000[ \t]+.*
+ \[[ 0-9]+\] \.rodata[ \t]+PROGBITS[ \t]+0*400000[0-9a-f]+[ \t]+.*
+ \[[ 0-9]+\] \.moredata[ \t]+PROGBITS[ \t]+0*400000[0-9a-f]+[ \t]+.*
+#...
+Program Headers:
+ Type.*
+ LOAD[ \t]+0x[0-9a-f]+ 0x0*40000000 0x0*40000000 0x[0-9a-f]+ 0x[0-9a-f]+ RWE 0x[0-9a-f]+
+
+ Section to Segment mapping:
+ Segment Sections...
+ 00 .text .rodata .moredata *
diff --git a/binutils-2.21/ld/testsuite/ld-elf/orphan-region.ld b/binutils-2.21/ld/testsuite/ld-elf/orphan-region.ld
new file mode 100644
index 0000000..b7dfdba
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/orphan-region.ld
@@ -0,0 +1,11 @@
+MEMORY
+{
+ region : ORIGIN = 0x40000000, LENGTH = 8M
+}
+
+SECTIONS
+{
+ .text : ALIGN (4) { *(.text) } > region
+ .rodata : ALIGN (4) { *(.rodata) } > region
+ /DISCARD/ : { *(.reginfo) *(.trampolines) }
+}
diff --git a/binutils-2.21/ld/testsuite/ld-elf/orphan-region.s b/binutils-2.21/ld/testsuite/ld-elf/orphan-region.s
new file mode 100644
index 0000000..0268686
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/orphan-region.s
@@ -0,0 +1,8 @@
+ .text
+ .long 0
+ .section ".rodata", "a", %progbits
+ .long 0
+ .section ".moredata", "a", %progbits
+ .long 0
+ .section ".notdata", "", %progbits
+ .long 0
diff --git a/binutils-2.21/ld/testsuite/ld-elf/orphan.d b/binutils-2.21/ld/testsuite/ld-elf/orphan.d
new file mode 100644
index 0000000..7955c8b
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/orphan.d
@@ -0,0 +1,16 @@
+#source: orphan.s
+#ld: -T orphan.ld
+#readelf: -S --wide
+#xfail: arc-*-* d30v-*-* dlx-*-* fr30-*-* frv-*-elf i860-*-* i960-*-*
+#xfail: iq*-*-* mn10200-*-* moxie-*-* msp*-*-* mt-*-* or32-*-* pj*-*-*
+# if not using elf32.em, you don't get fancy orphan handling
+
+#...
+ \[[ 0-9]+\] \.(text|notbad)[ \t]+PROGBITS[ \t0-9a-f]+AX?.*
+#...
+ \[[ 0-9]+\] \.(text|notbad)[ \t]+PROGBITS[ \t0-9a-f]+AX?.*
+ \[[ 0-9]+\] \.data[ \t]+PROGBITS[ \t0-9a-f]+WA.*
+#...
+ \[[ 0-9]+\] \.note[ \t]+NOTE[ \t0-9a-f]+A.*
+ \[[ 0-9]+\] \.note.bar[ \t]+NOTE[ \t0-9a-f]+A.*
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-elf/orphan.ld b/binutils-2.21/ld/testsuite/ld-elf/orphan.ld
new file mode 100644
index 0000000..d23222b
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/orphan.ld
@@ -0,0 +1,8 @@
+SECTIONS
+{
+ .text : { *(.text) }
+ .data : { *(.data) }
+ .bss : { *(.bss) *(COMMON) }
+ .note : { *(.note) }
+ /DISCARD/ : { *(.reginfo) *(.trampolines) }
+}
diff --git a/binutils-2.21/ld/testsuite/ld-elf/orphan.s b/binutils-2.21/ld/testsuite/ld-elf/orphan.s
new file mode 100644
index 0000000..d46f21d
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/orphan.s
@@ -0,0 +1,10 @@
+ .text
+ .long 0
+ .data
+ .long 0
+ .section .note,"a","note"
+ .long 0
+ .section .notbad,"a","progbits"
+ .long 0
+ .section .note.bar,"a","note"
+ .long 0
diff --git a/binutils-2.21/ld/testsuite/ld-elf/orphan2.d b/binutils-2.21/ld/testsuite/ld-elf/orphan2.d
new file mode 100644
index 0000000..ddf69c7
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/orphan2.d
@@ -0,0 +1,11 @@
+#source: orphan2.s
+#ld: -r
+#readelf: -S --wide
+#xfail: xstormy*-*-*
+# xstormy uses a non-standard script, resulting is unexpected section order
+
+#...
+ \[[ 0-9]+\] \.text[ \t]+PROGBITS[ \t0-9a-f]+AX?.*
+#...
+ \[[ 0-9]+\] \.modinfo[ \t]+PROGBITS[ \t0-9a-f]+A.*
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-elf/orphan2.s b/binutils-2.21/ld/testsuite/ld-elf/orphan2.s
new file mode 100644
index 0000000..bed8dcd
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/orphan2.s
@@ -0,0 +1,4 @@
+ .text
+ .long 0
+ .section .modinfo,"a","progbits"
+ .long 0
diff --git a/binutils-2.21/ld/testsuite/ld-elf/orphan3.d b/binutils-2.21/ld/testsuite/ld-elf/orphan3.d
new file mode 100644
index 0000000..ea600d3
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/orphan3.d
@@ -0,0 +1,21 @@
+#source: orphan3a.s
+#source: orphan3b.s
+#source: orphan3c.s
+#source: orphan3d.s
+#source: orphan3e.s
+#source: orphan3f.s
+#ld:
+#readelf: -S --wide
+#xfail: "arc-*-*" "d30v-*-*" "dlx-*-*" "fr30-*-*" "frv-*-elf"
+#xfail: "i860-*-*" "i960-*-*" "iq2000-*-*" "mn10200-*-*" "msp430-*-*" "mt-*-*"
+#xfail: "or32-*-*" "pj-*-*"
+#xfail: "xstormy16-*-*"
+
+#...
+ \[[ 0-9]+\] \.foo +PROGBITS +[0-9a-f]+ +[0-9a-f]+ +0+20 +0+ +A +0 +0 +[0-9]+
+#...
+ \[[ 0-9]+\] \.foo +NOBITS +[0-9a-f]+ +[0-9a-f]+ +0+20 +0+ +A +0 +0 +[0-9]+
+#...
+ \[[ 0-9]+\] \.foo +PROGBITS +0+ +[0-9a-f]+ +0+20 +0+ +0 +0 +[0-9]+
+ \[[ 0-9]+\] [._][^f].*
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-elf/orphan3a.s b/binutils-2.21/ld/testsuite/ld-elf/orphan3a.s
new file mode 100644
index 0000000..bc3023b
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/orphan3a.s
@@ -0,0 +1,12 @@
+ .globl main
+ .globl start
+ .globl _start
+ .globl __start
+ .text
+main:
+start:
+_start:
+__start:
+
+ .section .foo,"a",%nobits
+ .space 16
diff --git a/binutils-2.21/ld/testsuite/ld-elf/orphan3b.s b/binutils-2.21/ld/testsuite/ld-elf/orphan3b.s
new file mode 100644
index 0000000..c475eb1
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/orphan3b.s
@@ -0,0 +1,2 @@
+ .section .foo,"a",%progbits
+ .long 1,1,1,1
diff --git a/binutils-2.21/ld/testsuite/ld-elf/orphan3c.s b/binutils-2.21/ld/testsuite/ld-elf/orphan3c.s
new file mode 100644
index 0000000..209570c
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/orphan3c.s
@@ -0,0 +1,2 @@
+ .section .foo,"",%progbits
+ .long 2,2,2,2
diff --git a/binutils-2.21/ld/testsuite/ld-elf/orphan3d.s b/binutils-2.21/ld/testsuite/ld-elf/orphan3d.s
new file mode 100644
index 0000000..7f57443
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/orphan3d.s
@@ -0,0 +1,2 @@
+ .section .foo,"a",%nobits
+ .space 16
diff --git a/binutils-2.21/ld/testsuite/ld-elf/orphan3e.s b/binutils-2.21/ld/testsuite/ld-elf/orphan3e.s
new file mode 100644
index 0000000..405d9e2
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/orphan3e.s
@@ -0,0 +1,2 @@
+ .section .foo,"a",%progbits
+ .long 4,4,4,4
diff --git a/binutils-2.21/ld/testsuite/ld-elf/orphan3f.s b/binutils-2.21/ld/testsuite/ld-elf/orphan3f.s
new file mode 100644
index 0000000..3ef1b9e
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/orphan3f.s
@@ -0,0 +1,2 @@
+ .section .foo,"",%progbits
+ .long 5,5,5,5
diff --git a/binutils-2.21/ld/testsuite/ld-elf/orphan4.d b/binutils-2.21/ld/testsuite/ld-elf/orphan4.d
new file mode 100644
index 0000000..72d77d6
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/orphan4.d
@@ -0,0 +1,7 @@
+#source: orphan4.s
+#ld: -T orphan4.ld
+#objdump: -h
+
+#...
+ . \.foo 0+1 0+1000 0+1000 .* 2\*\*0
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-elf/orphan4.ld b/binutils-2.21/ld/testsuite/ld-elf/orphan4.ld
new file mode 100644
index 0000000..ab9bc9c
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/orphan4.ld
@@ -0,0 +1,13 @@
+/* The .foo section doesn't specify *any* objects, but the object
+ we're linking has sections named ".foo". Make sure these sections
+ are linked into the .foo output section anyway. The bug that was
+ fixed was that a new .foo output section would be created at
+ address 0. */
+
+SECTIONS {
+ .foo 0x00001000 : {
+ }
+ .text 0x00002000 : {
+ *(.text);
+ }
+}
diff --git a/binutils-2.21/ld/testsuite/ld-elf/orphan4.s b/binutils-2.21/ld/testsuite/ld-elf/orphan4.s
new file mode 100644
index 0000000..1f07646
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/orphan4.s
@@ -0,0 +1,4 @@
+ .section ".foo", "ax"
+ .byte 45
+ .text
+ .byte 15
diff --git a/binutils-2.21/ld/testsuite/ld-elf/overlay.d b/binutils-2.21/ld/testsuite/ld-elf/overlay.d
new file mode 100644
index 0000000..00d25d5
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/overlay.d
@@ -0,0 +1,12 @@
+# ld: -T overlay.t -u __load_start_text1 -u __load_start_text2 -u __load_stop_text1 -u __load_stop_text2
+#readelf: -s
+
+#...
+[ ]+[0-9]+:[ ]+0*4000[ ]+0[ ]+NOTYPE[ ]+GLOBAL[ ]+DEFAULT[ ]+ABS __load_start_text1
+#...
+[ ]+[0-9]+:[ ]+0*4010[ ]+0[ ]+NOTYPE[ ]+GLOBAL[ ]+DEFAULT[ ]+ABS __load_start_text2
+#...
+[ ]+[0-9]+:[ ]+0*4030[ ]+0[ ]+NOTYPE[ ]+GLOBAL[ ]+DEFAULT[ ]+ABS __load_stop_text2
+#...
+[ ]+[0-9]+:[ ]+0*4010[ ]+0[ ]+NOTYPE[ ]+GLOBAL[ ]+DEFAULT[ ]+ABS __load_stop_text1
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-elf/overlay.s b/binutils-2.21/ld/testsuite/ld-elf/overlay.s
new file mode 100644
index 0000000..f153044
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/overlay.s
@@ -0,0 +1,6 @@
+ .section .text1,"ax",%progbits
+ .space 0x10
+ .section .text2,"ax",%progbits
+ .space 0x20
+ .text
+ .space 0x30
diff --git a/binutils-2.21/ld/testsuite/ld-elf/overlay.t b/binutils-2.21/ld/testsuite/ld-elf/overlay.t
new file mode 100644
index 0000000..bdb33c8
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/overlay.t
@@ -0,0 +1,10 @@
+SECTIONS
+{
+ .text : { *(.text) }
+ OVERLAY 0x1000 : AT (0x4000)
+ {
+ .text1 {*(.text1)}
+ .text2 {*(.text2)}
+ }
+ /DISCARD/ : { *(.*) }
+}
diff --git a/binutils-2.21/ld/testsuite/ld-elf/pass.out b/binutils-2.21/ld/testsuite/ld-elf/pass.out
new file mode 100644
index 0000000..7ef22e9
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/pass.out
@@ -0,0 +1 @@
+PASS
diff --git a/binutils-2.21/ld/testsuite/ld-elf/pr11138-1.c b/binutils-2.21/ld/testsuite/ld-elf/pr11138-1.c
new file mode 100644
index 0000000..2aab815
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/pr11138-1.c
@@ -0,0 +1,13 @@
+#include <stdio.h>
+
+void
+bar (void)
+{
+ printf ("DSO bar\n");
+}
+
+void
+foo (void)
+{
+ bar ();
+}
diff --git a/binutils-2.21/ld/testsuite/ld-elf/pr11138-1.map b/binutils-2.21/ld/testsuite/ld-elf/pr11138-1.map
new file mode 100644
index 0000000..8676b1f
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/pr11138-1.map
@@ -0,0 +1,4 @@
+VERS_1 {
+ global: bar; foo;
+ local: *;
+};
diff --git a/binutils-2.21/ld/testsuite/ld-elf/pr11138-2.c b/binutils-2.21/ld/testsuite/ld-elf/pr11138-2.c
new file mode 100644
index 0000000..ccca280
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/pr11138-2.c
@@ -0,0 +1,17 @@
+#include <stdio.h>
+
+extern void foo (void);
+
+void
+bar (void)
+{
+ printf ("MAIN bar\n");
+}
+
+int
+main (void)
+{
+ bar ();
+ foo ();
+ return 0;
+}
diff --git a/binutils-2.21/ld/testsuite/ld-elf/pr11138-2.map b/binutils-2.21/ld/testsuite/ld-elf/pr11138-2.map
new file mode 100644
index 0000000..1f8fb15
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/pr11138-2.map
@@ -0,0 +1,4 @@
+{
+ global: main;
+ local: *;
+};
diff --git a/binutils-2.21/ld/testsuite/ld-elf/pr11138.out b/binutils-2.21/ld/testsuite/ld-elf/pr11138.out
new file mode 100644
index 0000000..6dbdc49
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/pr11138.out
@@ -0,0 +1,2 @@
+MAIN bar
+DSO bar
diff --git a/binutils-2.21/ld/testsuite/ld-elf/pr11304.d b/binutils-2.21/ld/testsuite/ld-elf/pr11304.d
new file mode 100644
index 0000000..d0b8408
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/pr11304.d
@@ -0,0 +1,11 @@
+#source: pr11304a.s
+#source: pr11304b.s
+#ld: -e 0 --section-start .zzz=0x800000
+#readelf: -S --wide
+
+#failif
+#...
+ \[[ 0-9]+\] \.zzz[ \t]+PROGBITS[ \t0-9a-f]+AX?.*
+#...
+ \[[ 0-9]+\] \.zzz[ \t]+PROGBITS[ \t0-9a-f]+AX?.*
+#...
diff --git a/binutils-2.21/ld/testsuite/ld-elf/pr11304a.s b/binutils-2.21/ld/testsuite/ld-elf/pr11304a.s
new file mode 100644
index 0000000..22fbbee
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/pr11304a.s
@@ -0,0 +1,4 @@
+.section .zzz,"ax",%progbits
+.long 0
+.text
+.long 0
diff --git a/binutils-2.21/ld/testsuite/ld-elf/pr11304b.s b/binutils-2.21/ld/testsuite/ld-elf/pr11304b.s
new file mode 100644
index 0000000..22fbbee
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/pr11304b.s
@@ -0,0 +1,4 @@
+.section .zzz,"ax",%progbits
+.long 0
+.text
+.long 0
diff --git a/binutils-2.21/ld/testsuite/ld-elf/pr349-1.s b/binutils-2.21/ld/testsuite/ld-elf/pr349-1.s
new file mode 100644
index 0000000..a205905
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/pr349-1.s
@@ -0,0 +1,2 @@
+ .section ".abcxyz","ax",%progbits
+ .long 1
diff --git a/binutils-2.21/ld/testsuite/ld-elf/pr349-2.s b/binutils-2.21/ld/testsuite/ld-elf/pr349-2.s
new file mode 100644
index 0000000..85f36ca
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/pr349-2.s
@@ -0,0 +1,2 @@
+ .section ".abcxyz","",%progbits
+ .long 2
diff --git a/binutils-2.21/ld/testsuite/ld-elf/pr349.d b/binutils-2.21/ld/testsuite/ld-elf/pr349.d
new file mode 100644
index 0000000..48e3256
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/pr349.d
@@ -0,0 +1,13 @@
+#source: pr349-1.s
+#source: pr349-2.s
+#ld: -r
+#readelf: -S
+#xfail: arc-*-* d30v-*-* dlx-*-* fr30-*-* frv-*-elf i860-*-* i960-*-*
+#xfail: iq*-*-* mn10200-*-* moxie-*-* msp*-*-* mt-*-* or32-*-* pj*-*-*
+# if not using elf32.em, you don't get fancy section handling
+
+#...
+.* .abcxyz .*
+#...
+.* .abcxyz .*
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-elf/pr9676-1.c b/binutils-2.21/ld/testsuite/ld-elf/pr9676-1.c
new file mode 100644
index 0000000..f8459c7
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/pr9676-1.c
@@ -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 ();
+}
diff --git a/binutils-2.21/ld/testsuite/ld-elf/pr9676-2.c b/binutils-2.21/ld/testsuite/ld-elf/pr9676-2.c
new file mode 100644
index 0000000..e2a3404
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/pr9676-2.c
@@ -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;
+}
diff --git a/binutils-2.21/ld/testsuite/ld-elf/pr9676-3.c b/binutils-2.21/ld/testsuite/ld-elf/pr9676-3.c
new file mode 100644
index 0000000..e5985df
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/pr9676-3.c
@@ -0,0 +1,7 @@
+extern int foo (void) __attribute__((section (".gnu.linkonce.t.1"), weak));
+
+int
+foo (void)
+{
+ return 1;
+}
diff --git a/binutils-2.21/ld/testsuite/ld-elf/pr9676-4.c b/binutils-2.21/ld/testsuite/ld-elf/pr9676-4.c
new file mode 100644
index 0000000..d5013c7
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/pr9676-4.c
@@ -0,0 +1,9 @@
+extern int bar (void);
+extern int foo (void);
+
+int
+x (void)
+{
+ foo ();
+ return bar ();
+}
diff --git a/binutils-2.21/ld/testsuite/ld-elf/pr9676.rd b/binutils-2.21/ld/testsuite/ld-elf/pr9676.rd
new file mode 100644
index 0000000..44a11ce
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/pr9676.rd
@@ -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 +DEFAULT +[0-9]+ +foo
+#...
diff --git a/binutils-2.21/ld/testsuite/ld-elf/pr9679-1.c b/binutils-2.21/ld/testsuite/ld-elf/pr9679-1.c
new file mode 100644
index 0000000..cf7abbb
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/pr9679-1.c
@@ -0,0 +1,5 @@
+int
+foo (void)
+{
+ return 1;
+}
diff --git a/binutils-2.21/ld/testsuite/ld-elf/pr9679-2.c b/binutils-2.21/ld/testsuite/ld-elf/pr9679-2.c
new file mode 100644
index 0000000..e125a6b
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/pr9679-2.c
@@ -0,0 +1,13 @@
+extern int foo (void) __attribute__((weak,__visibility__ ("hidden")));
+
+int
+foo (void)
+{
+ return 1;
+}
+
+int
+bar (void)
+{
+ return foo ();
+}
diff --git a/binutils-2.21/ld/testsuite/ld-elf/pr9679.rd b/binutils-2.21/ld/testsuite/ld-elf/pr9679.rd
new file mode 100644
index 0000000..44a11ce
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/pr9679.rd
@@ -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 +DEFAULT +[0-9]+ +foo
+#...
diff --git a/binutils-2.21/ld/testsuite/ld-elf/preinit.c b/binutils-2.21/ld/testsuite/ld-elf/preinit.c
new file mode 100644
index 0000000..9ef2a89
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/preinit.c
@@ -0,0 +1,34 @@
+#include <stdio.h>
+
+static void
+preinit_0 (void)
+{
+ printf ("preinit array 0\n");
+}
+
+static void
+preinit_1 (void)
+{
+ printf ("preinit array 1\n");
+}
+
+static void
+preinit_2 (void)
+{
+ printf ("preinit array 2\n");
+}
+
+void (*const preinit_array []) (void)
+ __attribute__ ((section (".preinit_array"),
+ aligned (sizeof (void *)))) =
+{
+ &preinit_0,
+ &preinit_1,
+ &preinit_2
+};
+
+int
+main (void)
+{
+ return 0;
+}
diff --git a/binutils-2.21/ld/testsuite/ld-elf/preinit.out b/binutils-2.21/ld/testsuite/ld-elf/preinit.out
new file mode 100644
index 0000000..6a30bc6
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/preinit.out
@@ -0,0 +1,3 @@
+preinit array 0
+preinit array 1
+preinit array 2
diff --git a/binutils-2.21/ld/testsuite/ld-elf/relocatable.d b/binutils-2.21/ld/testsuite/ld-elf/relocatable.d
new file mode 100644
index 0000000..458244a
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/relocatable.d
@@ -0,0 +1,10 @@
+#name: relocatable with script
+#source: simple.s
+#ld: -r -T relocatable.t
+#readelf: -S --wide
+#xfail: hppa-*-*
+
+#...
+ \[[ 0-9]+\] \.text.*[ \t]+PROGBITS[ \t]+0+800000[ \t0-9a-f]+AX.*
+ \[[ 0-9]+\] \.data.*[ \t]+PROGBITS[ \t]+0+900000[ \t0-9a-f]+WA.*
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-elf/relocatable.t b/binutils-2.21/ld/testsuite/ld-elf/relocatable.t
new file mode 100644
index 0000000..2ec056a
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/relocatable.t
@@ -0,0 +1,8 @@
+SECTIONS
+{
+ . = 0x800000;
+ .text : { *(.text) }
+ . = 0x900000;
+ .data : { *(.data) }
+ /DISCARD/ : { *(.*) }
+}
diff --git a/binutils-2.21/ld/testsuite/ld-elf/relro1.s b/binutils-2.21/ld/testsuite/ld-elf/relro1.s
new file mode 100644
index 0000000..76c956d
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/relro1.s
@@ -0,0 +1,14 @@
+ .globl main
+ .globl start
+ .globl _start
+ .globl __start
+ .text
+main:
+start:
+_start:
+__start:
+ .long 0
+ .data
+ .long 0
+ .section .data.rel.ro,"aw",%progbits
+ .long 0
diff --git a/binutils-2.21/ld/testsuite/ld-elf/relro2.s b/binutils-2.21/ld/testsuite/ld-elf/relro2.s
new file mode 100644
index 0000000..0bbf366
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/relro2.s
@@ -0,0 +1,5 @@
+ .text
+ .globl x
+ .type x, @function
+x:
+ jmp foo@PLT
diff --git a/binutils-2.21/ld/testsuite/ld-elf/sec-to-seg-script-adjoining-pages.t b/binutils-2.21/ld/testsuite/ld-elf/sec-to-seg-script-adjoining-pages.t
new file mode 100644
index 0000000..763fcb7
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/sec-to-seg-script-adjoining-pages.t
@@ -0,0 +1,11 @@
+SECTIONS
+{
+ . = 0x1000;
+ .sec1 : { *sec-to-seg1.o(.rodata) }
+ . += CONSTANT(MAXPAGESIZE);
+ .sec2 : { *sec-to-seg2.o(.rodata) }
+
+ .data : { *(.data) } /* For hppa64. */
+
+ /DISCARD/ : {*(*) }
+}
diff --git a/binutils-2.21/ld/testsuite/ld-elf/sec-to-seg-script-disjoint-pages.t b/binutils-2.21/ld/testsuite/ld-elf/sec-to-seg-script-disjoint-pages.t
new file mode 100644
index 0000000..25023cc
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/sec-to-seg-script-disjoint-pages.t
@@ -0,0 +1,11 @@
+SECTIONS
+{
+ . = 0x1000;
+ .sec1 : { *sec-to-seg1.o(.rodata) }
+ . += CONSTANT(MAXPAGESIZE) * 2;
+ .sec2 : { *sec-to-seg2.o(.rodata) }
+
+ .data : { *(.data) } /* For hppa64. */
+
+ /DISCARD/ : {*(*) }
+}
diff --git a/binutils-2.21/ld/testsuite/ld-elf/sec-to-seg-script-same-page.t b/binutils-2.21/ld/testsuite/ld-elf/sec-to-seg-script-same-page.t
new file mode 100644
index 0000000..2b50f7e
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/sec-to-seg-script-same-page.t
@@ -0,0 +1,10 @@
+SECTIONS
+{
+ . = 0x1000;
+ .sec1 : { *sec-to-seg1.o(.rodata) }
+ .sec2 : { *sec-to-seg2.o(.rodata) }
+
+ .data : { *(.data) } /* For hppa64. */
+
+ /DISCARD/ : {*(*) }
+}
diff --git a/binutils-2.21/ld/testsuite/ld-elf/sec-to-seg.exp b/binutils-2.21/ld/testsuite/ld-elf/sec-to-seg.exp
new file mode 100644
index 0000000..cd32e68
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/sec-to-seg.exp
@@ -0,0 +1,102 @@
+# Test the assigment of sections to segments.
+#
+# Copyright 2008, 2010 Free Software Foundation, Inc.
+# Contributed by Red Hat.
+#
+# This file is part of the GNU Binutils.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+# MA 02110-1301, USA.
+
+set testname "assignment of ELF sections to segments"
+
+if {! [is_elf_format] } {
+ unsupported $testname
+ return
+}
+
+if { ! [ld_assemble $as $srcdir/$subdir/sec-to-seg1.s tmpdir/sec-to-seg1.o]
+ || ! [ld_assemble $as $srcdir/$subdir/sec-to-seg2.s tmpdir/sec-to-seg2.o]} then {
+ unresolved $testname
+ return
+}
+
+proc sec_to_seg_test { testname scriptname same_seg } {
+ global srcdir
+ global subdir
+ global ld
+ global exec_output
+ global READELF
+
+ if {! [ld_simple_link $ld tmpdir/sec-to-seg "-T $srcdir/$subdir/$scriptname tmpdir/sec-to-seg1.o tmpdir/sec-to-seg2.o"] } then {
+ fail $testname
+ return 0
+ }
+
+ send_log "$READELF --program-headers --section-headers tmpdir/sec-to-seg\n"
+ set exec_output [run_host_cmd "$READELF" "--program-headers --section-headers tmpdir/sec-to-seg"]
+
+ if { $same_seg == 1 } {
+ if {! [regexp ".*.sec1 .sec2" $exec_output] } {
+ fail $testname
+ return 0
+ }
+ } else {
+ if { [regexp ".*.sec1 .sec2" $exec_output] } {
+ fail $testname
+ return 0
+ }
+ }
+
+ pass $testname
+ return 1
+}
+
+# Assuming a pagesize of 0x1000 then:
+#
+# Test Sec1 End Sec 2 Start Expected Result
+# ---- -------- ----------- ---------------
+# A 00001042 00001043 Both sections on same page: assign to same segment.
+# B 00001042 00002044 Sections on adjacent pages: assign to same segment.
+# C 00001042 00003044 Sections on disjoint pages: assign to separate segments.
+
+# These targets have a pagesize of 1, so they will always end up
+# placing the two sections in separate segments in the B test.
+if { [istarget avr-*-*]
+ || [istarget cr16-*-*]
+ || [istarget crx-*-*]
+ || [istarget dlx-*-*]
+ || [istarget h8300-*-*]
+ || [istarget i960-*-*]
+ || [istarget ip2k-*-*]
+ || [istarget m32r-*-*]
+ || [istarget m88k-*-*]
+ || [istarget microblaze-*-*]
+ || [istarget moxie-*-*]
+ || [istarget msp430-*-*]
+ || [istarget mt-*-*]
+ || [istarget tic6x-*-*]
+ } {
+ set B_test_same_seg 0
+} else {
+ set B_test_same_seg 1
+}
+
+sec_to_seg_test "assignment of ELF sections to segments (same page)" "sec-to-seg-script-same-page.t" 1
+sec_to_seg_test "assignment of ELF sections to segments (adjacent pages)" "sec-to-seg-script-adjoining-pages.t" $B_test_same_seg
+sec_to_seg_test "assignment of ELF sections to segments (disjoint pages)" "sec-to-seg-script-disjoint-pages.t" 0
+
+
+# FIXME: Add more tests to check other rules of section to segment assignment.
diff --git a/binutils-2.21/ld/testsuite/ld-elf/sec-to-seg1.s b/binutils-2.21/ld/testsuite/ld-elf/sec-to-seg1.s
new file mode 100644
index 0000000..1e8e2bb
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/sec-to-seg1.s
@@ -0,0 +1,9 @@
+ .file "sec-to-seg1.s"
+
+ .section .rodata
+ .align 2
+ .ascii "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\000"
+ .align 2
+ .ascii "0000000000000000000000000000000\000"
+
+
diff --git a/binutils-2.21/ld/testsuite/ld-elf/sec-to-seg2.s b/binutils-2.21/ld/testsuite/ld-elf/sec-to-seg2.s
new file mode 100644
index 0000000..b1dd078
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/sec-to-seg2.s
@@ -0,0 +1,13 @@
+ .file "sec-to-seg2.s"
+
+ .section .rodata
+ .align 2
+ .ascii "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\000"
+ .align 2
+ .ascii "55555555555555555555555555555555\000"
+ .align 2
+ .ascii "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\000"
+ .align 2
+ .ascii "99999999999999999999999999999999\000"
+
+
diff --git a/binutils-2.21/ld/testsuite/ld-elf/sec64k.exp b/binutils-2.21/ld/testsuite/ld-elf/sec64k.exp
new file mode 100644
index 0000000..7c04c9b
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/sec64k.exp
@@ -0,0 +1,206 @@
+# Expect script for tests for >64k sections
+# Copyright 2002, 2003, 2005, 2006, 2007, 2008
+# Free Software Foundation, Inc.
+#
+# This file is part of the GNU Binutils.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+# Written by Hans-Peter Nilsson (hp@axis.com)
+#
+
+# Exclude non-ELF targets.
+
+if ![is_elf_format] {
+ return
+}
+
+# Targets using the generic linker backend don't sort section symbols
+# before local symbols, so don't bother testing them.
+if { [istarget "arc-*-*"]
+ || [istarget "d30v-*-*"]
+ || [istarget "dlx-*-*"]
+ || [istarget "i960-*-*"]
+ || [istarget "or32-*-*"]
+ || [istarget "pj*-*-*"]
+ || [istarget "m32r-*-*"] } {
+ return
+}
+
+# Test >64k sections, with and without -r. First, create the assembly
+# files. Have a relocation to another section and one within the local
+# section.
+
+set test1 "64ksec-r"
+set test2 "64ksec"
+
+if { ![runtest_file_p $runtests $test1] \
+ && ![runtest_file_p $runtests $test2] } {
+ return
+}
+
+set sfiles {}
+set max_sec 66000
+set secs_per_file 1000
+for { set i 0 } { $i < $max_sec / $secs_per_file } { incr i } {
+ set sfile "$objdir/tmpdir/sec64-$i.s"
+ lappend sfiles $sfile
+ if [catch { set ofd [open $sfile w] } x] {
+ perror "$x"
+ unresolved $test1
+ unresolved $test2
+ return
+ }
+
+ if { $i == 0 } {
+ puts $ofd " .global start"
+ puts $ofd "start:"
+ puts $ofd " .global _start"
+ puts $ofd "_start:"
+ puts $ofd " .global __start"
+ puts $ofd "__start:"
+ puts $ofd " .global main"
+ puts $ofd "main:"
+ puts $ofd " .global foo_0"
+ puts $ofd "foo_0: .dc.a 0"
+ }
+
+ # Make sure the used section is not covered by common linker scripts.
+ # They should get separate section entries even without -r.
+ puts $ofd " .altmacro"
+ puts $ofd " .macro sec secn, secp"
+ if {![istarget "frv-*-*linux*"]} then {
+ puts $ofd " .section .foo.\\secn,\"ax\""
+ } else {
+ puts $ofd " .section .foo.\\secn,\"aw\""
+ }
+ puts $ofd " .global foo_\\secn"
+ puts $ofd "foo_\\secn:"
+ puts $ofd " .dc.a foo_\\secp"
+ puts $ofd "bar_\\secn:"
+ puts $ofd " .dc.a bar_\\secn"
+ puts $ofd " .endm"
+ if {![istarget "bfin-*-*"]} then {
+ puts $ofd " secn = [expr $i * $secs_per_file]"
+ } else {
+ puts $ofd " .set secn, [expr $i * $secs_per_file]"
+ }
+ puts $ofd " .rept $secs_per_file"
+ if {![istarget "bfin-*-*"]} then {
+ puts $ofd " secn = secn + 1"
+ } else {
+ puts $ofd " .set secn, secn + 1"
+ }
+ puts $ofd " sec %(secn), %(secn-1)"
+ puts $ofd " .endr"
+
+ close $ofd
+}
+
+if [catch { set ofd [open "tmpdir/$test1.d" w] } x] {
+ perror "$x"
+ unresolved $test1
+ unresolved $test2
+ return
+}
+
+# The ld-r linked file will contain relocation-sections too, so make it
+# half the size in order to try and keep the test-time down.
+
+# The m32r target generates both REL and RELA relocs (for historical
+# reasons) so the expected number of sections will be much more than
+# 68000, which throws this particular test right off.
+if { ![istarget "m32r-*-*"] } then {
+ foreach sfile [lrange $sfiles 0 [expr [llength $sfiles] / 2]] {
+ puts $ofd "#source: $sfile"
+ }
+ puts $ofd "#ld: -r"
+ puts $ofd "#readelf: -W -Ss"
+ puts $ofd "There are 680.. section headers.*:"
+ puts $ofd "#..."
+ puts $ofd " \\\[ 0\\\] .* 680\[0-9\]\[0-9\]\[ \]+0\[ \]+0"
+ puts $ofd "#..."
+ puts $ofd " \\\[ \[0-9\]\\\] \.foo\.1\[ \]+PROGBITS\[ \]+.*"
+ puts $ofd "#..."
+ puts $ofd " \\\[65279\\\] (.rel\[a\]?)?\\.foo\\.\[0-9\]+ .*"
+ puts $ofd " \\\[65280\\\] (.rel\[a\]?)?\\.foo\\.\[0-9\]+ .*"
+ puts $ofd "#..."
+ puts $ofd " 340..: 0+\[ \]+0\[ \]+SECTION\[ \]+LOCAL\[ \]+DEFAULT\[ \]+68... "
+ puts $ofd "#..."
+ puts $ofd " 340..: 0+(2|4|8)\[ \]+0\[ \]+NOTYPE\[ \]+LOCAL\[ \]+DEFAULT\[ \]+\[2-5\] bar_1$"
+ puts $ofd "#..."
+ puts $ofd ".* bar_34000$"
+ puts $ofd "#..."
+ # Global symbols are not in "alphanumeric" order, so we just check
+ # that the first and the last are present in any order (assuming no
+ # duplicates).
+ puts $ofd ".* (\[0-9\] foo_1|68... foo_34000)$"
+ puts $ofd "#..."
+ puts $ofd ".* (\[0-9\] foo_1|68... foo_34000)$"
+ puts $ofd "#pass"
+ close $ofd
+ run_dump_test "tmpdir/$test1"
+}
+
+if [catch { set ofd [open "tmpdir/$test2.d" w] } x] {
+ perror "$x"
+ unresolved $test2
+ return
+}
+
+# too big for d10v and msp
+# lack of fancy orphan section handling causes overlap on fr30 and iq2000
+if { ![istarget "d10v-*-*"]
+ && ![istarget "msp*-*-*"]
+ && ![istarget "fr30-*-*"]
+ && ![istarget "iq2000-*-*"] } {
+ foreach sfile $sfiles { puts $ofd "#source: $sfile" }
+ if { [istarget "avr-*-*"] } then {
+ puts $ofd "#as: -mmcu=avr6"
+ puts $ofd "#ld: -mavr6"
+ } elseif { [istarget spu*-*-*] } {
+ puts $ofd "#ld: --local-store 0:0"
+ } else {
+ puts $ofd "#ld:"
+ }
+ puts $ofd "#readelf: -W -Ss"
+ puts $ofd "There are 660.. section headers.*:"
+ puts $ofd "#..."
+ puts $ofd " \\\[ 0\\\] .* 660..\[ \]+0\[ \]+0"
+ puts $ofd "#..."
+ puts $ofd " \\\[65279\\\] \\.foo\\.\[0-9\]+ .*"
+ puts $ofd " \\\[65280\\\] \\.foo\\.\[0-9\]+ .*"
+ puts $ofd "#..."
+ puts $ofd " 660..: \[0-9a-f\]+\[ \]+0\[ \]+SECTION\[ \]+LOCAL\[ \]+DEFAULT\[ \]+660.. "
+ puts $ofd "#..."
+ puts $ofd " 660..: \[0-9a-f\]+\[ \]+0\[ \]+NOTYPE\[ \]+LOCAL\[ \]+DEFAULT\[ \]+\[0-9\] bar_1$"
+ puts $ofd "#..."
+ puts $ofd ".* bar_66000$"
+ puts $ofd "#..."
+ # Global symbols are not in "alphanumeric" order, so we just check
+ # that the first and the last are present in any order (assuming no
+ # duplicates).
+ puts $ofd ".* (\[0-9\] foo_1|66... foo_66000)$"
+ puts $ofd "#..."
+ puts $ofd ".* (\[0-9\] foo_1|66... foo_66000)$"
+ puts $ofd "#pass"
+ close $ofd
+ run_dump_test "tmpdir/$test2"
+}
+
+for { set i 1 } { $i < $max_sec / $secs_per_file } { incr i } {
+ catch "exec rm -f tmpdir/dump$i.o" status
+}
diff --git a/binutils-2.21/ld/testsuite/ld-elf/seg.d b/binutils-2.21/ld/testsuite/ld-elf/seg.d
new file mode 100644
index 0000000..d9436ae
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/seg.d
@@ -0,0 +1,21 @@
+#target: *-*-linux* *-*-vxworks
+#source: seg.s
+#ld: -T seg.t -z max-page-size=0x1000
+#readelf: -l --wide
+
+#...
+Program Headers:
+ Type Offset VirtAddr.*
+# On MIPS, the first segment is for .reginfo.
+#...
+ LOAD .*
+ LOAD 0x0*001000 0xf*fffff000 0xf*fffff000 0x0*1000 0x0*1000 .*
+# FRV adds a PT_GNU_STACK header
+#...
+ Section to Segment mapping:
+ Segment Sections...
+ 00 .*
+# On MIPS, the first segment is for .reginfo.
+#...
+ 0. reset boot
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-elf/seg.s b/binutils-2.21/ld/testsuite/ld-elf/seg.s
new file mode 100644
index 0000000..24ec567
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/seg.s
@@ -0,0 +1,6 @@
+ .section boot,"ax"
+ .4byte 0x76543210
+ .section reset,"ax"
+ .4byte 0xfedcba98
+ .text
+ .4byte 0x12345678
diff --git a/binutils-2.21/ld/testsuite/ld-elf/seg.t b/binutils-2.21/ld/testsuite/ld-elf/seg.t
new file mode 100644
index 0000000..2f86acf
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/seg.t
@@ -0,0 +1,16 @@
+
+SECTIONS
+{
+ reset - 4 :
+ {
+ *(reset)
+ }
+ boot - 0x1000 :
+ {
+ *(boot)
+ } = 0xffff
+ . = + SIZEOF_HEADERS;
+ .text : { *(.text) }
+ .data : { *(.data) }
+ .bss : { *(.bss) }
+}
diff --git a/binutils-2.21/ld/testsuite/ld-elf/shared.exp b/binutils-2.21/ld/testsuite/ld-elf/shared.exp
new file mode 100644
index 0000000..d0c3478
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/shared.exp
@@ -0,0 +1,330 @@
+# Expect script for various ELF tests.
+# Copyright 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+#
+# This file is part of the GNU Binutils.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+
+# Exclude non-ELF targets.
+
+if ![is_elf_format] {
+ return
+}
+
+# The following tests require running the executable generated by ld.
+if ![isnative] {
+ return
+}
+
+# Check if compiler works
+if { [which $CC] == 0 } {
+ return
+}
+
+set build_tests {
+ {"Build libfoo.so"
+ "-shared" "-fPIC"
+ {foo.c} {} "libfoo.so"}
+ {"Build versioned libfoo.so"
+ "-shared -Wl,--version-script=foo.map" "-fPIC"
+ {foo.c} {} "libfoov.so"}
+ {"Build libbar.so"
+ "-shared" "-fPIC"
+ {begin.c end.c} {} "libbar.so"}
+ {"Build warn libbar.so"
+ "-shared" "-fPIC"
+ {beginwarn.c end.c} {} "libbarw.so"}
+ {"Build hidden libbar.so"
+ "-shared" "-fPIC"
+ {begin.c endhidden.c} {} "libbarh.so"}
+ {"Build protected libbar.so"
+ "-shared" "-fPIC"
+ {begin.c endprotected.c} {} "libbarp.so"}
+ {"Build libbar.so with libfoo.so"
+ "-shared tmpdir/begin.o tmpdir/libfoo.so" "-fPIC"
+ {end.c} {} "libbarfoo.so"}
+ {"Build libar.so with versioned libfoo.so"
+ "-shared tmpdir/begin.o tmpdir/libfoov.so" "-fPIC"
+ {end.c} {} "libbarfoov.so"}
+ {"Build hidden libbar.so with libfoo.so"
+ "-shared tmpdir/begin.o tmpdir/libfoo.so" "-fPIC"
+ {endhidden.c} {} "libbarhfoo.so"}
+ {"Build hidden libar.so with versioned libfoo.so"
+ "-shared tmpdir/begin.o tmpdir/libfoov.so" "-fPIC"
+ {endhidden.c} {} "libbarhfoov.so"}
+ {"Build protected libbar.so with libfoo.so"
+ "-shared tmpdir/begin.o tmpdir/libfoo.so" "-fPIC"
+ {endprotected.c} {} "libbarpfoo.so"}
+ {"Build protected libbar.so with versioned libfoo.so"
+ "-shared tmpdir/begin.o tmpdir/libfoov.so" "-fPIC"
+ {endprotected.c} {} "libbarpfoov.so"}
+ {"Build libdl1.so"
+ "-shared" "-fPIC"
+ {dl1.c} {} "libdl1.so"}
+ {"Build libdl2a.so with --dynamic-list=dl2.list"
+ "-shared -Wl,--dynamic-list=dl2.list" "-fPIC"
+ {dl2.c dl2xxx.c} {} "libdl2a.so"}
+ {"Build libdl2a.so with --dynamic-list=dl2a.list"
+ "-shared -Wl,--dynamic-list=dl2a.list" "-fPIC"
+ {dl2.c dl2xxx.c} {} "libdl2a.so"}
+ {"Build libdl2a.so with --dynamic-list-data"
+ "-shared -Wl,--dynamic-list-data" "-fPIC"
+ {dl2.c dl2xxx.c} {} "libdl2a.so"}
+ {"Build libdl2b.so with --dynamic-list=dl2.list and dl2xxx.list"
+ "-shared -Wl,--dynamic-list=dl2.list,--dynamic-list=dl2xxx.list" "-fPIC"
+ {dl2.c dl2xxx.c} {} "libdl2b.so"}
+ {"Build libdl2c.so with --dynamic-list-data and dl2xxx.list"
+ "-shared -Wl,--dynamic-list-data,--dynamic-list=dl2xxx.list" "-fPIC"
+ {dl2.c dl2xxx.c} {} "libdl2c.so"}
+ {"Build libdl4a.so with --dynamic-list=dl4.list"
+ "-shared -Wl,--dynamic-list=dl4.list" "-fPIC"
+ {dl4.c dl4xxx.c} {} "libdl4a.so"}
+ {"Build libdl4b.so with --dynamic-list-data"
+ "-shared -Wl,--dynamic-list-data" "-fPIC"
+ {dl4.c dl4xxx.c} {} "libdl4b.so"}
+ {"Build libdl4c.so with --dynamic-list=dl4.list and dl4xxx.list"
+ "-shared -Wl,--dynamic-list=dl4.list,--dynamic-list=dl4xxx.list" "-fPIC"
+ {dl4.c dl4xxx.c} {} "libdl4c.so"}
+ {"Build libdl4d.so with --dynamic-list-data and dl4xxx.list"
+ "-shared -Wl,--dynamic-list-data,--dynamic-list=dl4xxx.list" "-fPIC"
+ {dl4.c dl4xxx.c} {} "libdl4d.so"}
+ {"Build libdl4e.so with -Bsymbolic-functions --dynamic-list-cpp-new"
+ "-shared -Wl,-Bsymbolic-functions,--dynamic-list-cpp-new" "-fPIC"
+ {dl4.c dl4xxx.c} {} "libdl4e.so"}
+ {"Build libdl4f.so with --dynamic-list-cpp-new -Bsymbolic-functions"
+ "-shared -Wl,--dynamic-list-cpp-new,-Bsymbolic-functions" "-fPIC"
+ {dl4.c dl4xxx.c} {} "libdl4f.so"}
+ {"Build libdl6a.so"
+ "-shared" "-fPIC"
+ {dl6.c} {} "libdl6a.so"}
+ {"Build libdl6b.so with -Bsymbolic --dynamic-list-data"
+ "-shared -Wl,-Bsymbolic,--dynamic-list-data" "-fPIC"
+ {dl6.c} {} "libdl6b.so"}
+ {"Build libdl6c.so with -Bsymbolic"
+ "-shared -Wl,-Bsymbolic" "-fPIC"
+ {dl6.c} {} "libdl6c.so"}
+ {"Build libdl6d.so with --dynamic-list-data -Bsymbolic"
+ "-shared -Wl,--dynamic-list-data,-Bsymbolic" "-fPIC"
+ {dl6.c} {} "libdl6d.so"}
+ {"Build libdata1.so"
+ "-shared" "-fPIC"
+ {data1.c} {} "libdata1.so"}
+ {"Build libcomm1.o"
+ "-r -nostdlib" ""
+ {comm1.c} {} "libcomm1.o"}
+ {"Build libfunc1.so"
+ "-shared" "-fPIC"
+ {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"}
+ {"Build libpr9679.so"
+ "-shared" "-fPIC -O0"
+ {pr9679-1.c pr9679-2.c} {{readelf {-s} pr9679.rd}} "libpr9679.so"}
+ {"Build libpr11138-1.so"
+ "-shared -Wl,--version-script=pr11138-1.map" "-fPIC"
+ {pr11138-1.c} {} "libpr11138-1.so"}
+ {"Build libpr11138-2.o"
+ "-r -nostdlib" ""
+ {pr11138-2.c} {} "libpr11138-2.o"}
+}
+
+set run_tests {
+ {"Run normal with libfoo.so"
+ "tmpdir/begin.o tmpdir/libfoo.so tmpdir/end.o" ""
+ {main.c} "normal" "normal.out"}
+ {"Run protected with libfoo.so"
+ "tmpdir/begin.o tmpdir/libfoo.so tmpdir/endprotected.o" ""
+ {main.c} "protected" "normal.out"}
+ {"Run hidden with libfoo.so"
+ "tmpdir/begin.o tmpdir/libfoo.so tmpdir/endhidden.o" ""
+ {main.c} "hidden" "hidden.out"}
+ {"Run normal with versioned libfoo.so"
+ "tmpdir/begin.o tmpdir/libfoov.so tmpdir/end.o" ""
+ {main.c} "normalv" "normal.out"}
+ {"Run warn with versioned libfoo.so"
+ "tmpdir/beginwarn.o tmpdir/libfoov.so" ""
+ {main.c} "warn" "warn.out"
+ "" "" "^.*\\\): warning: function foo is deprecated$"}
+ {"Run protected with versioned libfoo.so"
+ "tmpdir/begin.o tmpdir/libfoov.so tmpdir/endprotected.o" ""
+ {main.c} "protected" "normal.out"}
+ {"Run hidden with versioned libfoo.so"
+ "tmpdir/begin.o tmpdir/libfoov.so tmpdir/endhidden.o" ""
+ {main.c} "hiddenv" "hidden.out"}
+ {"Run normal libbar.so with libfoo.so"
+ "tmpdir/libbarfoo.so tmpdir/libfoo.so" ""
+ {main.c} "normal" "normal.out"}
+ {"Run protected libbar.so with libfoo.so"
+ "tmpdir/libbarpfoo.so tmpdir/libfoo.so" ""
+ {main.c} "protected" "normal.out"}
+ {"Run hidden libbar.so with libfoo.so"
+ "tmpdir/libbarhfoo.so tmpdir/libfoo.so" ""
+ {main.c} "hidden" "hidden.out"}
+ {"Run normal libbar.so with versioned libfoo.so"
+ "tmpdir/libbarfoov.so tmpdir/libfoov.so" ""
+ {main.c} "normal" "normal.out"}
+ {"Run protected libbar.so with versioned libfoo.so"
+ "tmpdir/libbarpfoov.so tmpdir/libfoov.so" ""
+ {main.c} "protected" "normal.out"}
+ {"Run hidden libbar.so with versioned libfoo.so"
+ "tmpdir/libbarhfoov.so tmpdir/libfoov.so" ""
+ {main.c} "hidden" "hidden.out"}
+ {"Run dl1a with --dynamic-list=dl1.list and dlopen on libdl1.so"
+ "--dynamic-list=dl1.list -ldl" ""
+ {dl1main.c} "dl1a" "dl1.out"}
+ {"Run dl1b with --dynamic-list-data and dlopen on libdl1.so"
+ "--dynamic-list-data -ldl" ""
+ {dl1main.c} "dl1b" "dl1.out"}
+ {"Run with libdl2a.so"
+ "tmpdir/libdl2a.so" ""
+ {dl2main.c} "dl2a" "dl2a.out"}
+ {"Run with libdl2b.so"
+ "tmpdir/libdl2b.so" ""
+ {dl2main.c} "dl2b" "dl2b.out"}
+ {"Run with libdl2c.so"
+ "tmpdir/libdl2c.so" ""
+ {dl2main.c} "dl2c" "dl2b.out"}
+ {"Run with libdl4a.so"
+ "tmpdir/libdl4a.so" ""
+ {dl4main.c} "dl4a" "dl4a.out"}
+ {"Run with libdl4b.so"
+ "tmpdir/libdl4b.so" ""
+ {dl4main.c} "dl4b" "dl4a.out"}
+ {"Run with libdl4c.so"
+ "tmpdir/libdl4c.so" ""
+ {dl4main.c} "dl4c" "dl4b.out"}
+ {"Run with libdl4d.so"
+ "tmpdir/libdl4d.so" ""
+ {dl4main.c} "dl4d" "dl4b.out"}
+ {"Run with libdl4e.so"
+ "tmpdir/libdl4e.so" ""
+ {dl4main.c} "dl4e" "dl4a.out"}
+ {"Run with libdl4f.so"
+ "tmpdir/libdl4f.so" ""
+ {dl4main.c} "dl4f" "dl4a.out"}
+ {"Run dl6a1 with --dynamic-list-data and dlopen on libdl6a.so"
+ "--dynamic-list-data -ldl" ""
+ {dl6amain.c} "dl6a1" "dl6a.out"}
+ {"Run dl6a2 with -Bsymbolic-functions and dlopen on libdl6a.so"
+ "-Bsymbolic-functions -ldl" ""
+ {dl6amain.c} "dl6a2" "dl6b.out"}
+ {"Run dl6a3 with -Bsymbolic and dlopen on libdl6a.so"
+ "-Bsymbolic -ldl" ""
+ {dl6amain.c} "dl6a3" "dl6b.out"}
+ {"Run dl6a4 with -Bsymbolic --dynamic-list-data and dlopen on libdl6a.so"
+ "-Bsymbolic --dynamic-list-data -ldl" ""
+ {dl6amain.c} "dl6a4" "dl6a.out"}
+ {"Run dl6a5 with -Bsymbolic-functions --dynamic-list-cpp-new and dlopen on libdl6a.so"
+ "-Bsymbolic-functions --dynamic-list-cpp-new -ldl" ""
+ {dl6amain.c} "dl6a5" "dl6b.out"}
+ {"Run dl6a6 with --dynamic-list-cpp-new -Bsymbolic-functions and dlopen on libdl6a.so"
+ "--dynamic-list-cpp-new -Bsymbolic-functions -ldl" ""
+ {dl6amain.c} "dl6a6" "dl6b.out"}
+ {"Run dl6a7 with --dynamic-list-data -Bsymbolic and dlopen on libdl6a.so"
+ "--dynamic-list-data -Bsymbolic -ldl" ""
+ {dl6amain.c} "dl6a7" "dl6a.out"}
+ {"Run dl6b1 with --dynamic-list-data and dlopen on libdl6b.so"
+ "--dynamic-list-data -ldl" ""
+ {dl6bmain.c} "dl6b1" "dl6a.out"}
+ {"Run dl6b2 with dlopen on libdl6b.so"
+ "-ldl" ""
+ {dl6bmain.c} "dl6b2" "dl6b.out"}
+ {"Run dl6c1 with --dynamic-list-data and dlopen on libdl6c.so"
+ "--dynamic-list-data -ldl" ""
+ {dl6cmain.c} "dl6c1" "dl6b.out"}
+ {"Run dl6d1 with --dynamic-list-data and dlopen on libdl6d.so"
+ "--dynamic-list-data -ldl" ""
+ {dl6dmain.c} "dl6d1" "dl6b.out"}
+ {"Run with libdata1.so"
+ "tmpdir/libdata1.so" ""
+ {dynbss1.c} "dynbss1" "pass.out"}
+ {"Run with libfunc1.so comm1.o"
+ "tmpdir/libfunc1.so tmpdir/comm1.o" ""
+ {dummy.c} "comm1" "pass.out"}
+ {"Run with comm1.o libfunc1.so"
+ "tmpdir/comm1.o tmpdir/libfunc1.so" ""
+ {dummy.c} "comm1" "pass.out"}
+ {"Run with pr11138-2.c libpr11138-1.so"
+ "--version-script=pr11138-2.map tmpdir/pr11138-2.o tmpdir/libpr11138-1.so" ""
+ {dummy.c} "pr11138a" "pr11138.out"}
+ {"Run with libpr11138-1.so pr11138-2.c"
+ "--version-script=pr11138-2.map tmpdir/libpr11138-1.so tmpdir/pr11138-2.o" ""
+ {dummy.c} "pr11138b" "pr11138.out"}
+}
+
+run_cc_link_tests $build_tests
+# NetBSD ELF systems do not currently support the .*_array sections.
+run_ld_link_exec_tests [list "*-*-netbsdelf*"] $run_tests
+
+# Check if compiler works
+if { [which $CXX] == 0 } {
+ return
+}
+
+set build_cxx_tests {
+ {"Build libdl3a.so with --dynamic-list=dl3.list"
+ "-shared -Wl,--dynamic-list=dl3.list" "-fPIC"
+ {dl3.cc} {} "libdl3a.so" "c++"}
+ {"Build libdl3b.so with -Bsymbolic"
+ "-shared -Wl,-Bsymbolic" "-fPIC"
+ {dl3.cc} {} "libdl3b.so" "c++"}
+ {"Build libdl3a.so with --dynamic-list-cpp-typeinfo"
+ "-shared -Wl,--dynamic-list-cpp-typeinfo" "-fPIC"
+ {dl3.cc} {} "libdl3c.so" "c++"}
+ {"Build libdnew1a.so with --Bsymbolic-functions --dynamic-list-cpp-new"
+ "-shared -Wl,-Bsymbolic-functions,--dynamic-list-cpp-new" "-fPIC"
+ {del.cc new.cc} {} "libnew1a.so" "c++"}
+ {"Build libdnew1b.so with --dynamic-list-data --dynamic-list-cpp-new"
+ "-shared -Wl,--dynamic-list-data,--dynamic-list-cpp-new" "-fPIC"
+ {del.cc new.cc} {} "libnew1b.so" "c++"}
+}
+
+set run_cxx_tests {
+ {"Run with libdl3a.so"
+ "tmpdir/libdl3a.so" ""
+ {dl3main.cc} "dl3a" "dl3a.out" "" "c++"}
+# "-shared -Bsymbolic" only works with gcc 4.5.0 and newer.
+# {"Run with libdl3b.so"
+# "tmpdir/libdl3b.so" ""
+# {dl3main.cc} "dl3b" "dl3b.out" "" "c++"}
+ {"Run with libdl3c.so"
+ "tmpdir/libdl3c.so" ""
+ {dl3main.cc} "dl3c" "dl3a.out" "" "c++"}
+ {"Run with libnew1a.so"
+ "tmpdir/libnew1a.so" ""
+ {dl5.cc} "dl5a" "dl5.out" "" "c++"}
+ {"Run with libnew1b.so"
+ "tmpdir/libnew1b.so" ""
+ {dl5.cc} "dl5b" "dl5.out" "" "c++"}
+}
+
+run_cc_link_tests $build_cxx_tests
+run_ld_link_exec_tests [] $run_cxx_tests
diff --git a/binutils-2.21/ld/testsuite/ld-elf/simple.s b/binutils-2.21/ld/testsuite/ld-elf/simple.s
new file mode 100644
index 0000000..2834182
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/simple.s
@@ -0,0 +1,4 @@
+ .text
+ .long 1
+ .data
+ .long 2
diff --git a/binutils-2.21/ld/testsuite/ld-elf/stab.d b/binutils-2.21/ld/testsuite/ld-elf/stab.d
new file mode 100644
index 0000000..346640d
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/stab.d
@@ -0,0 +1,14 @@
+#source: start.s
+#as: -gstabs
+#readelf: -S --wide
+#ld:
+#notarget: "ia64-*-*" "alpha*"
+
+# Disabled on alpha because the entry point may be above 4GB but the stabs
+# value on 32 bits.
+
+#...
+ \[[0-9 ][0-9]\] \.stab +PROGBITS +0+ [0-9a-f]+ [0-9a-f]+ [0-9a-f]+ +[1-9]+ +0.*
+#...
+ \[[0-9 ][0-9]\] \.stabstr +STRTAB +0+ [0-9a-f]+ [0-9a-f]+ 00 +0 +0.*
+#...
diff --git a/binutils-2.21/ld/testsuite/ld-elf/start.s b/binutils-2.21/ld/testsuite/ld-elf/start.s
new file mode 100644
index 0000000..d8655be
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/start.s
@@ -0,0 +1,10 @@
+ .text
+ .global start /* Used by SH targets. */
+start:
+ .global _start
+_start:
+ .global __start
+__start:
+ .global main /* Used by HPPA targets. */
+main:
+ .dc.a 0
diff --git a/binutils-2.21/ld/testsuite/ld-elf/symbol1ref.s b/binutils-2.21/ld/testsuite/ld-elf/symbol1ref.s
new file mode 100644
index 0000000..99df499
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/symbol1ref.s
@@ -0,0 +1,3 @@
+ .data
+ .dc.a symbol1
+
diff --git a/binutils-2.21/ld/testsuite/ld-elf/symbol1w.s b/binutils-2.21/ld/testsuite/ld-elf/symbol1w.s
new file mode 100644
index 0000000..38778d3
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/symbol1w.s
@@ -0,0 +1,10 @@
+ .section .gnu.warning.symbol1
+ .asciz "witty one-liner"
+ .text
+ .type symbol1,"function"
+ .global symbol1
+symbol1:
+.L1:
+ .long 0
+.L0:
+ .size symbol1,.L0-.L1
diff --git a/binutils-2.21/ld/testsuite/ld-elf/symbol2ref.s b/binutils-2.21/ld/testsuite/ld-elf/symbol2ref.s
new file mode 100644
index 0000000..0a1a9eb
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/symbol2ref.s
@@ -0,0 +1,3 @@
+ .data
+ .dc.a Foo
+
diff --git a/binutils-2.21/ld/testsuite/ld-elf/symbol2w.s b/binutils-2.21/ld/testsuite/ld-elf/symbol2w.s
new file mode 100644
index 0000000..794a753
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/symbol2w.s
@@ -0,0 +1,6 @@
+ .section .gnu.warning,"a",%progbits
+ .global Foo
+ .type Foo, %object
+ .size Foo, 20
+Foo:
+ .string "function 'Foo' used"
diff --git a/binutils-2.21/ld/testsuite/ld-elf/table.s b/binutils-2.21/ld/testsuite/ld-elf/table.s
new file mode 100644
index 0000000..2b13f70
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/table.s
@@ -0,0 +1 @@
+ .section .gcc_except_table,"a",%progbits
diff --git a/binutils-2.21/ld/testsuite/ld-elf/tbss.s b/binutils-2.21/ld/testsuite/ld-elf/tbss.s
new file mode 100644
index 0000000..cc43340
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/tbss.s
@@ -0,0 +1,15 @@
+ .file "x.c"
+ .globl bss
+ .section .bss,"aw",%nobits
+ .p2align 12
+ .type bss,%object
+ .size bss,4096
+bss:
+ .zero 4096
+ .globl tbss
+ .section .tbss,"awT",%nobits
+ .p2align 12
+ .type tbss,%object
+ .size tbss,4096
+tbss:
+ .zero 4096
diff --git a/binutils-2.21/ld/testsuite/ld-elf/tbss1.s b/binutils-2.21/ld/testsuite/ld-elf/tbss1.s
new file mode 100644
index 0000000..4f1631f
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/tbss1.s
@@ -0,0 +1,24 @@
+ .globl main
+ .globl start
+ .globl _start
+ .globl __start
+ .text
+main:
+start:
+_start:
+__start:
+ .byte 0
+ .globl bss
+ .section .bss,"aw",%nobits
+ .p2align 12
+ .type bss,%object
+ .size bss,4096
+bss:
+ .zero 4096
+ .globl tbss
+ .section .tbss,"awT",%nobits
+ .p2align 12
+ .type tbss,%object
+ .size tbss,4096
+tbss:
+ .zero 4096
diff --git a/binutils-2.21/ld/testsuite/ld-elf/tbss2.s b/binutils-2.21/ld/testsuite/ld-elf/tbss2.s
new file mode 100644
index 0000000..b980925
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/tbss2.s
@@ -0,0 +1,16 @@
+ .globl main
+ .globl start
+ .globl _start
+ .globl __start
+ .text
+main:
+start:
+_start:
+__start:
+ .byte 0
+ .globl tbss
+ .section .tbss,"awT",%nobits
+ .type tbss,%object
+ .size tbss,1
+tbss:
+ .zero 1
diff --git a/binutils-2.21/ld/testsuite/ld-elf/tdata1.s b/binutils-2.21/ld/testsuite/ld-elf/tdata1.s
new file mode 100644
index 0000000..6ea57b6
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/tdata1.s
@@ -0,0 +1,24 @@
+ .globl main
+ .globl start
+ .globl _start
+ .globl __start
+ .text
+main:
+start:
+_start:
+__start:
+ .byte 0
+ .globl data
+ .section .data,"aw",%progbits
+ .p2align 4
+ .type data,%object
+ .size data,4096
+data:
+ .zero 4096
+ .globl tdata
+ .section .tdata,"awT",%progbits
+ .p2align 4
+ .type tdata,%object
+ .size tdata,4096
+tdata:
+ .zero 4096
diff --git a/binutils-2.21/ld/testsuite/ld-elf/tdata2.s b/binutils-2.21/ld/testsuite/ld-elf/tdata2.s
new file mode 100644
index 0000000..1da459f
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/tdata2.s
@@ -0,0 +1,16 @@
+ .globl main
+ .globl start
+ .globl _start
+ .globl __start
+ .text
+main:
+start:
+_start:
+__start:
+ .byte 0
+ .globl tdata
+ .section .tdata,"awT",%progbits
+ .type tdata,%object
+ .size tdata,1
+tdata:
+ .byte 0
diff --git a/binutils-2.21/ld/testsuite/ld-elf/textaddr1.d b/binutils-2.21/ld/testsuite/ld-elf/textaddr1.d
new file mode 100644
index 0000000..f7a3ad9
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/textaddr1.d
@@ -0,0 +1,8 @@
+#source: maxpage1.s
+#ld: -Ttext-segment 0x7000000 -z max-page-size=0x200000
+#readelf: -l --wide
+#target: *-*-linux-gnu
+
+#...
+ LOAD +0x0+ 0x0*7000000 0x0*7000000 0x0*[0-9a-f][0-9a-f][0-9a-f] 0x0*[0-9a-f][0-9a-f][0-9a-f] R E 0x200000
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-elf/textaddr2.d b/binutils-2.21/ld/testsuite/ld-elf/textaddr2.d
new file mode 100644
index 0000000..9d1b0e5
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/textaddr2.d
@@ -0,0 +1,8 @@
+#source: maxpage1.s
+#ld: -shared -Ttext-segment 0x7000000 -z max-page-size=0x200000
+#readelf: -l --wide
+#target: *-*-linux-gnu
+
+#...
+ LOAD +0x0+ 0x0*7000000 0x0*7000000 0x0*[0-9a-f][0-9a-f][0-9a-f] 0x0*[0-9a-f][0-9a-f][0-9a-f] R E 0x200000
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-elf/textaddr3.d b/binutils-2.21/ld/testsuite/ld-elf/textaddr3.d
new file mode 100644
index 0000000..d533e24
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/textaddr3.d
@@ -0,0 +1,4 @@
+#source: maxpage1.s
+#ld: -Ttext-segment 0x10000 -z max-page-size=0x200000
+#target: *-*-linux-gnu
+#warning: .*address of `text-segment' isn't multiple of maximum page size
diff --git a/binutils-2.21/ld/testsuite/ld-elf/textaddr4.d b/binutils-2.21/ld/testsuite/ld-elf/textaddr4.d
new file mode 100644
index 0000000..bfd7630
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/textaddr4.d
@@ -0,0 +1,8 @@
+#source: maxpage1.s
+#ld: -z max-page-size=0x10000 -Ttext-segment 0x10000
+#readelf: -l --wide
+#target: *-*-linux-gnu
+
+#...
+ LOAD +0x0+ 0x0*10000 0x0*10000 0x0*[0-9a-f][0-9a-f][0-9a-f] 0x0*[0-9a-f][0-9a-f][0-9a-f] R E 0x10000
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-elf/textaddr5.d b/binutils-2.21/ld/testsuite/ld-elf/textaddr5.d
new file mode 100644
index 0000000..5fe41d0
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/textaddr5.d
@@ -0,0 +1,4 @@
+#source: maxpage1.s
+#ld: -shared -z max-page-size=0x200000 -Ttext-segment 0x10000
+#target: *-*-linux-gnu
+#warning: .*address of `text-segment' isn't multiple of maximum page size
diff --git a/binutils-2.21/ld/testsuite/ld-elf/textaddr6.d b/binutils-2.21/ld/testsuite/ld-elf/textaddr6.d
new file mode 100644
index 0000000..b3b9f84
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/textaddr6.d
@@ -0,0 +1,8 @@
+#source: maxpage1.s
+#ld: -shared -z max-page-size=0x10000 -Ttext-segment 0x10000
+#readelf: -l --wide
+#target: *-*-linux-gnu
+
+#...
+ LOAD +0x0+ 0x0*10000 0x0*10000 0x0*[0-9a-f][0-9a-f][0-9a-f] 0x0*[0-9a-f][0-9a-f][0-9a-f] R E 0x10000
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-elf/textaddr7.d b/binutils-2.21/ld/testsuite/ld-elf/textaddr7.d
new file mode 100644
index 0000000..54a571f
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/textaddr7.d
@@ -0,0 +1,8 @@
+#source: maxpage1.s
+#ld: -n -z max-page-size=0x200000 -Ttext-segment 0x10000
+#readelf: -l --wide
+#target: *-*-linux-gnu
+
+#...
+ LOAD .*
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-elf/tls_common.exp b/binutils-2.21/ld/testsuite/ld-elf/tls_common.exp
new file mode 100644
index 0000000..66a550c
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/tls_common.exp
@@ -0,0 +1,72 @@
+# Expect script for .tls_common tests
+# Copyright 2006, 2007 Free Software Foundation, Inc.
+#
+# This file is part of the GNU Binutils.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+# Written by Jakub Jelinek (jakub@redhat.com)
+#
+
+# Make sure that binutils can correctly handle ld output in ELF.
+
+# Run on Linux only.
+if { ![istarget *-*-linux*] } {
+ return
+}
+
+if { [istarget *-*-linux*aout*]
+ || [istarget *-*-linux*oldld*] } {
+ return
+}
+
+global as
+global ld
+global READELF
+global srcdir
+global subdir
+global link_output
+
+if { ![ld_assemble $as $srcdir/$subdir/tls_common.s tmpdir/tls_common.o ] } {
+ unresolved "tls_common"
+ return
+}
+
+if { ![ld_simple_link $ld tmpdir/tls_common1.o "-r tmpdir/tls_common.o"] } {
+ fail "tls_common"
+ return
+}
+
+if { ![ld_simple_link $ld tmpdir/tls_common "tmpdir/tls_common1.o"] } {
+ if { [string match "*not supported*" $link_output]
+ || [string match "*unrecognized option*" $link_output] } {
+ unsupported "$ld_options is not supported by this target"
+ } elseif { [string match "*Warning*alignment*of common symbol*" $link_output] } {
+ fail "tls_common"
+ } else {
+ unresolved "tls_common"
+ }
+ return
+}
+
+set readelf_output [run_host_cmd "$READELF" "-l --wide tmpdir/tls_common"]
+if ![regexp ".*TLS.*0x0+ 0x0+4 R .*" $readelf_output] then {
+ send_log "$readelf_output\n"
+ fail "tls_common"
+ return
+}
+
+pass "tls_common"
diff --git a/binutils-2.21/ld/testsuite/ld-elf/tls_common.s b/binutils-2.21/ld/testsuite/ld-elf/tls_common.s
new file mode 100644
index 0000000..502d8f3
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/tls_common.s
@@ -0,0 +1,11 @@
+ .globl main
+ .globl start
+ .globl _start
+ .globl __start
+ .text
+main:
+start:
+_start:
+__start:
+ .byte 0
+ .tls_common foo,4,4
diff --git a/binutils-2.21/ld/testsuite/ld-elf/tls_gc.s b/binutils-2.21/ld/testsuite/ld-elf/tls_gc.s
new file mode 100644
index 0000000..db93eba
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/tls_gc.s
@@ -0,0 +1,16 @@
+ .globl main
+ .globl start
+ .globl _start
+ .globl __start
+ .text
+main:
+start:
+_start:
+__start:
+ .byte 0
+ .globl var
+ .section .tbss.var,"awT",%nobits
+ .type var,%object
+ .size var,1
+var:
+ .zero 1
diff --git a/binutils-2.21/ld/testsuite/ld-elf/unknown.d b/binutils-2.21/ld/testsuite/ld-elf/unknown.d
new file mode 100644
index 0000000..636e6c7
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/unknown.d
@@ -0,0 +1,7 @@
+#source: ../../../binutils/testsuite/binutils-all/unknown.s
+#ld: -r
+#readelf: -S
+
+#...
+ \[[ 0-9]+\] \.foo[ \t]+NOTE[ \t]+.*
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-elf/unknown2.d b/binutils-2.21/ld/testsuite/ld-elf/unknown2.d
new file mode 100644
index 0000000..467d5d3
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/unknown2.d
@@ -0,0 +1,8 @@
+#source: unknown2.s
+#ld: -shared
+#readelf: -S
+#target: *-*-linux*
+
+#...
+ \[[ 0-9]+\] \.note.foo[ \t]+NOTE[ \t]+.*
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-elf/unknown2.s b/binutils-2.21/ld/testsuite/ld-elf/unknown2.s
new file mode 100644
index 0000000..8592820
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/unknown2.s
@@ -0,0 +1,6 @@
+ .section .note.foo,"a","note"
+ .space 16
+ .section .data,"aw"
+ .space 3800
+ .section .rodata,"a"
+ .space 4
diff --git a/binutils-2.21/ld/testsuite/ld-elf/warn.out b/binutils-2.21/ld/testsuite/ld-elf/warn.out
new file mode 100644
index 0000000..ba836ce
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/warn.out
@@ -0,0 +1,3 @@
+TEST2
+TEST2
+MAIN
diff --git a/binutils-2.21/ld/testsuite/ld-elf/warn1.d b/binutils-2.21/ld/testsuite/ld-elf/warn1.d
new file mode 100644
index 0000000..3ef5032
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/warn1.d
@@ -0,0 +1,15 @@
+#source: start.s
+#source: symbol1ref.s
+#source: symbol1w.s
+#ld: -T group.ld
+#warning: ^[^\\n]*\): warning: witty one-liner$
+#readelf: -s
+#notarget: "sparc64-*-solaris2*" "sparcv9-*-solaris2*"
+#xfail: "arc-*-*" "d30v-*-*" "dlx-*-*" "i960-*-*" "or32-*-*" "pj-*-*"
+
+# Check that warnings are generated for the .gnu.warning.SYMBOL
+# construct and that the symbol still appears as expected.
+
+#...
+ +[0-9]+: +[0-9a-f]+ +[48] +FUNC +GLOBAL +DEFAULT +[1-9] symbol1
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-elf/warn2.d b/binutils-2.21/ld/testsuite/ld-elf/warn2.d
new file mode 100644
index 0000000..95b7ef4
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/warn2.d
@@ -0,0 +1,17 @@
+#source: start.s
+#source: symbol2ref.s
+#source: symbol2w.s
+#ld: -T group.ld
+#warning: ^[^\\n]*\.[obj]+: warning: function 'Foo' used$
+#readelf: -s
+#notarget: "sparc64-*-solaris2*" "sparcv9-*-solaris2*"
+#xfail: arc-*-* d30v-*-* dlx-*-* fr30-*-* frv-*-elf i860-*-* i960-*-*
+#xfail: iq*-*-* mn10200-*-* moxie-*-* msp*-*-* mt-*-* or32-*-* pj*-*-*
+# if not using elf32.em, you don't get fancy section handling
+
+# Check that warnings are generated for the symbols in .gnu.warning
+# construct and that the symbol still appears as expected.
+
+#...
+ +[0-9]+: +[0-9a-f]+ +20 +OBJECT +GLOBAL +DEFAULT +[1-9] Foo
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-elf/weak-dyn-1.ld b/binutils-2.21/ld/testsuite/ld-elf/weak-dyn-1.ld
new file mode 100644
index 0000000..495b712
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/weak-dyn-1.ld
@@ -0,0 +1,8 @@
+SECTIONS
+{
+ . = 0x800000;
+ PROVIDE (bar = .);
+ .data : {
+ *(.data)
+ }
+}
diff --git a/binutils-2.21/ld/testsuite/ld-elf/weak-dyn-1.rd b/binutils-2.21/ld/testsuite/ld-elf/weak-dyn-1.rd
new file mode 100644
index 0000000..ab5e0ba
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/weak-dyn-1.rd
@@ -0,0 +1,3 @@
+#...
+.* foo.*
+#pass
diff --git a/binutils-2.21/ld/testsuite/ld-elf/weak-dyn-1a.s b/binutils-2.21/ld/testsuite/ld-elf/weak-dyn-1a.s
new file mode 100644
index 0000000..bb81d3a
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/weak-dyn-1a.s
@@ -0,0 +1,13 @@
+ .globl foo
+ .weak foo
+ .type foo,%object
+ .size foo,1
+
+ .globl bar
+ .type bar,%object
+ .size bar,1
+
+ .data
+foo:
+bar:
+ .byte 1
diff --git a/binutils-2.21/ld/testsuite/ld-elf/weak-dyn-1b.s b/binutils-2.21/ld/testsuite/ld-elf/weak-dyn-1b.s
new file mode 100644
index 0000000..23f187a
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/weak-dyn-1b.s
@@ -0,0 +1,2 @@
+ .data
+ .dc.a foo
diff --git a/binutils-2.21/ld/testsuite/ld-elf/wrap.exp b/binutils-2.21/ld/testsuite/ld-elf/wrap.exp
new file mode 100644
index 0000000..70e433d
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/wrap.exp
@@ -0,0 +1,57 @@
+# Expect script for wrap ELF tests.
+# Copyright 2006, 2007 Free Software Foundation, Inc.
+#
+# This file is part of the GNU Binutils.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+
+# Exclude non-ELF targets.
+
+if ![is_elf_format] {
+ return
+}
+
+# The following tests require running the executable generated by ld.
+if ![isnative] {
+ return
+}
+
+# Check if compiler works
+if { [which $CC] == 0 } {
+ return
+}
+
+set build_tests {
+ {"Build libwrap1a.so"
+ "-shared" "-fPIC"
+ {wrap1a.c} {} "libwrap1a.so"}
+ {"Build libwrap1b.so"
+ "-shared tmpdir/libwrap1a.so" "-fPIC"
+ {wrap1b.c} {} "libwrap1b.so"}
+}
+
+set run_tests {
+ {"Run with libwrap1a.so and libwrap1b.so"
+ "--wrap par tmpdir/libwrap1a.so tmpdir/libwrap1b.so" ""
+ {wrap1.c} "wrap1" "wrap1.out"}
+ {"Run with libwrap1b.so and libwrap1a.so"
+ "--wrap par tmpdir/libwrap1b.so tmpdir/libwrap1a.so" ""
+ {wrap1.c} "wrap1" "wrap1.out"}
+}
+
+run_cc_link_tests $build_tests
+run_ld_link_exec_tests [] $run_tests
diff --git a/binutils-2.21/ld/testsuite/ld-elf/wrap1.c b/binutils-2.21/ld/testsuite/ld-elf/wrap1.c
new file mode 100644
index 0000000..1ff250e
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/wrap1.c
@@ -0,0 +1,8 @@
+extern void par (void);
+
+int
+main (void)
+{
+ par ();
+ return 0;
+}
diff --git a/binutils-2.21/ld/testsuite/ld-elf/wrap1.out b/binutils-2.21/ld/testsuite/ld-elf/wrap1.out
new file mode 100644
index 0000000..7c1938f
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/wrap1.out
@@ -0,0 +1,3 @@
+__wrap_par
+__real_par
+par
diff --git a/binutils-2.21/ld/testsuite/ld-elf/wrap1a.c b/binutils-2.21/ld/testsuite/ld-elf/wrap1a.c
new file mode 100644
index 0000000..75c94e0
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/wrap1a.c
@@ -0,0 +1,6 @@
+#include <stdio.h>
+
+void par (void)
+{
+ printf ("par\n");
+}
diff --git a/binutils-2.21/ld/testsuite/ld-elf/wrap1b.c b/binutils-2.21/ld/testsuite/ld-elf/wrap1b.c
new file mode 100644
index 0000000..abd39aa
--- /dev/null
+++ b/binutils-2.21/ld/testsuite/ld-elf/wrap1b.c
@@ -0,0 +1,16 @@
+#include <stdio.h>
+
+extern void par (void);
+
+void __real_par (void)
+{
+ printf ("__real_par \n");
+ par ();
+}
+
+void
+__wrap_par (void)
+{
+ printf ("__wrap_par \n");
+ __real_par ();
+}