diff options
author | mengqinggang <mengqinggang@loongson.cn> | 2024-04-07 16:34:42 +0800 |
---|---|---|
committer | liuzhensong <liuzhensong@loongson.cn> | 2024-04-20 12:10:40 +0800 |
commit | 20eee7540b9f2615f7661393756fec0bb62a1495 (patch) | |
tree | 4fab76b94a7d0a45034c7ef66d98ce14c845a99f /ld | |
parent | 02fa4bbec1974df262f44e13023071f5ae4fc9b1 (diff) | |
download | gdb-20eee7540b9f2615f7661393756fec0bb62a1495.zip gdb-20eee7540b9f2615f7661393756fec0bb62a1495.tar.gz gdb-20eee7540b9f2615f7661393756fec0bb62a1495.tar.bz2 |
LoongArch: Add -mignore-start-align option
Ignore .align at the start of a section may result in misalignment when
partial linking. Manually add -mignore-start-align option without partial
linking.
Gcc -falign-functions add .align 5 to the start of a section, it causes some
error message mismatch. Set these testcases to xfail on LoongArch target.
Diffstat (limited to 'ld')
-rw-r--r-- | ld/testsuite/ld-elf/dwarf.exp | 5 | ||||
-rw-r--r-- | ld/testsuite/ld-loongarch-elf/partial-link-align-a.s | 2 | ||||
-rw-r--r-- | ld/testsuite/ld-loongarch-elf/partial-link-align-b.s | 3 | ||||
-rw-r--r-- | ld/testsuite/ld-loongarch-elf/relax-align-ignore-start.d (renamed from ld/testsuite/ld-loongarch-elf/relax-align-first.d) | 1 | ||||
-rw-r--r-- | ld/testsuite/ld-loongarch-elf/relax-align-ignore-start.s (renamed from ld/testsuite/ld-loongarch-elf/relax-align-first.s) | 0 | ||||
-rw-r--r-- | ld/testsuite/ld-loongarch-elf/relax.exp | 32 | ||||
-rw-r--r-- | ld/testsuite/ld-undefined/undefined.exp | 2 |
7 files changed, 43 insertions, 2 deletions
diff --git a/ld/testsuite/ld-elf/dwarf.exp b/ld/testsuite/ld-elf/dwarf.exp index 6a63269..a4748a4 100644 --- a/ld/testsuite/ld-elf/dwarf.exp +++ b/ld/testsuite/ld-elf/dwarf.exp @@ -52,6 +52,9 @@ set build_tests { {"DWARF parse during linker error" "" "-fno-toplevel-reorder" {dwarf2a.c dwarf2b.c} {{error_output "dwarf2.err"}} "dwarf2.x"} +} + +set build_tests_dwarf3 { {"Handle no DWARF information" "" "-g0" {dwarf3.c} {{error_output "dwarf3.err"}} "dwarf3.x"} @@ -72,6 +75,8 @@ set run_tests { set old_CFLAGS "$CFLAGS_FOR_TARGET" append CFLAGS_FOR_TARGET " $NOSANITIZE_CFLAGS" run_cc_link_tests $build_tests +setup_xfail loongarch*-*-* +run_cc_link_tests $build_tests_dwarf3 run_ld_link_exec_tests $run_tests set CFLAGS_FOR_TARGET "$old_CFLAGS" diff --git a/ld/testsuite/ld-loongarch-elf/partial-link-align-a.s b/ld/testsuite/ld-loongarch-elf/partial-link-align-a.s new file mode 100644 index 0000000..a8b4f29 --- /dev/null +++ b/ld/testsuite/ld-loongarch-elf/partial-link-align-a.s @@ -0,0 +1,2 @@ +.text +la.local $t0, .text diff --git a/ld/testsuite/ld-loongarch-elf/partial-link-align-b.s b/ld/testsuite/ld-loongarch-elf/partial-link-align-b.s new file mode 100644 index 0000000..46fa058 --- /dev/null +++ b/ld/testsuite/ld-loongarch-elf/partial-link-align-b.s @@ -0,0 +1,3 @@ +.text +.align 4 +ret diff --git a/ld/testsuite/ld-loongarch-elf/relax-align-first.d b/ld/testsuite/ld-loongarch-elf/relax-align-ignore-start.d index 9a4fad8..939cf42 100644 --- a/ld/testsuite/ld-loongarch-elf/relax-align-first.d +++ b/ld/testsuite/ld-loongarch-elf/relax-align-ignore-start.d @@ -1,3 +1,4 @@ +#as: -mignore-start-align #ld: -e0 #objdump: -d diff --git a/ld/testsuite/ld-loongarch-elf/relax-align-first.s b/ld/testsuite/ld-loongarch-elf/relax-align-ignore-start.s index 0a9115b..0a9115b 100644 --- a/ld/testsuite/ld-loongarch-elf/relax-align-first.s +++ b/ld/testsuite/ld-loongarch-elf/relax-align-ignore-start.s diff --git a/ld/testsuite/ld-loongarch-elf/relax.exp b/ld/testsuite/ld-loongarch-elf/relax.exp index 2345214..890f139 100644 --- a/ld/testsuite/ld-loongarch-elf/relax.exp +++ b/ld/testsuite/ld-loongarch-elf/relax.exp @@ -19,10 +19,38 @@ # MA 02110-1301, USA. # -if [istarget loongarch64-*-*] { - run_dump_test "relax-align-first" +proc run_partial_linking_align_test {} { + global as + global ld + global srcdir + global subdir + global runtests + + set testname "partial-link-align" + if ![runtest_file_p $runtests $testname] then { + return + } + if { ![ld_assemble $as "$srcdir/$subdir/$testname-a.s" tmpdir/a.o] + || ![ld_assemble $as "$srcdir/$subdir/$testname-b.s" tmpdir/b.o] + || ![ld_link $ld tmpdir/$testname.os "tmpdir/a.o tmpdir/b.o -r"] + || ![ld_link $ld tmpdir/$testname "tmpdir/$testname.os -e0 -Ttext 0x1000"] } { + fail $testname + } else { + set objdump_output [run_host_cmd "objdump" "-d tmpdir/$testname"] + if { [ regexp ".*1010:\\s*4c000020\\s*jirl.*" $objdump_output ] } { + pass $testname + } else { + fail $testname + } + } +} + +if [istarget loongarch64-*-*] { if [isbuild loongarch64-*-*] { + run_dump_test "relax-align-ignore-start" + run_partial_linking_align_test + set testname "loongarch relax .exe build" set pre_builds [list \ [list \ diff --git a/ld/testsuite/ld-undefined/undefined.exp b/ld/testsuite/ld-undefined/undefined.exp index 6f7ea00..2cc67fe 100644 --- a/ld/testsuite/ld-undefined/undefined.exp +++ b/ld/testsuite/ld-undefined/undefined.exp @@ -74,6 +74,7 @@ if { ![check_compiler_available] } { # in a literal pool outside the function, so that both the # "undefined function" and "undefined line" tests fail. setup_xfail xtensa*-*-linux* + setup_xfail loongarch*-*-* set mf "tmpdir/undefined.o* in function `function':" checkund $mf $testfn @@ -154,6 +155,7 @@ if { ![check_compiler_available] } { # eBPF doesn't support dwarf yet. setup_xfail bpf-*-* + setup_xfail loongarch*-*-* checkund $ml $testline } |