From 2e73b915a9776e820c6917a426a7d35ae8fafa8f Mon Sep 17 00:00:00 2001 From: Daniel Jacobowitz Date: Tue, 6 Jan 2004 21:47:38 +0000 Subject: [PATCH] * ld-arm/arm-app.d, ld-arm/arm-app.r, ld-arm/arm-app.s, ld-arm/arm-lib.d, ld-arm/arm-lib.r, ld-arm/arm-lib.s, ld-arm/arm-lib-plt32.d, ld-arm/arm-lib-plt32.r, ld-arm/arm-lib-plt32.s, ld-arm/arm-elf.exp: New files. --- ld/testsuite/ChangeLog | 7 +++++ ld/testsuite/ld-arm/arm-app.d | 35 ++++++++++++++++++++++ ld/testsuite/ld-arm/arm-app.r | 9 ++++++ ld/testsuite/ld-arm/arm-app.s | 23 +++++++++++++++ ld/testsuite/ld-arm/arm-elf.exp | 46 +++++++++++++++++++++++++++++ ld/testsuite/ld-arm/arm-lib-plt32.d | 28 ++++++++++++++++++ ld/testsuite/ld-arm/arm-lib-plt32.r | 8 +++++ ld/testsuite/ld-arm/arm-lib-plt32.s | 17 +++++++++++ ld/testsuite/ld-arm/arm-lib.d | 17 +++++++++++ ld/testsuite/ld-arm/arm-lib.r | 8 +++++ ld/testsuite/ld-arm/arm-lib.s | 24 +++++++++++++++ 11 files changed, 222 insertions(+) create mode 100644 ld/testsuite/ld-arm/arm-app.d create mode 100644 ld/testsuite/ld-arm/arm-app.r create mode 100644 ld/testsuite/ld-arm/arm-app.s create mode 100644 ld/testsuite/ld-arm/arm-elf.exp create mode 100644 ld/testsuite/ld-arm/arm-lib-plt32.d create mode 100644 ld/testsuite/ld-arm/arm-lib-plt32.r create mode 100644 ld/testsuite/ld-arm/arm-lib-plt32.s create mode 100644 ld/testsuite/ld-arm/arm-lib.d create mode 100644 ld/testsuite/ld-arm/arm-lib.r create mode 100644 ld/testsuite/ld-arm/arm-lib.s diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index 7889ca6d68a..56416cca4f5 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2004-01-06 Daniel Jacobowitz + + * ld-arm/arm-app.d, ld-arm/arm-app.r, ld-arm/arm-app.s, + ld-arm/arm-lib.d, ld-arm/arm-lib.r, ld-arm/arm-lib.s, + ld-arm/arm-lib-plt32.d, ld-arm/arm-lib-plt32.r, + ld-arm/arm-lib-plt32.s, ld-arm/arm-elf.exp: New files. + 2004-01-06 Alexandre Oliva * ld-frv: Update .d files with correct addresses displayed for diff --git a/ld/testsuite/ld-arm/arm-app.d b/ld/testsuite/ld-arm/arm-app.d new file mode 100644 index 00000000000..ae48f53a0a5 --- /dev/null +++ b/ld/testsuite/ld-arm/arm-app.d @@ -0,0 +1,35 @@ + +tmpdir/arm-app: file format elf32-littlearm +architecture: arm, flags 0x00000112: +EXEC_P, HAS_SYMS, D_PAGED +start address 0x.* + +Disassembly of section .plt: + +.* <.plt>: + .*: e52de004 str lr, \[sp, #-4\]! + .*: e59fe004 ldr lr, \[pc, #4\] ; .* <.plt\+0x10> + .*: e08fe00e add lr, pc, lr + .*: e5bef008 ldr pc, \[lr, #8\]! + .*: .* + .*: e28fc6.* add ip, pc, #.* ; 0x.* + .*: e28cca.* add ip, ip, #.* ; 0x.* + .*: e5bcf.* ldr pc, \[ip, #.*\]! +Disassembly of section .text: + +.* <_start>: + .*: e1a0c00d mov ip, sp + .*: e92dd800 stmdb sp!, {fp, ip, lr, pc} + .*: eb000001 bl .* + .*: e89d6800 ldmia sp, {fp, sp, lr} + .*: e12fff1e bx lr + +.* : + .*: e1a0c00d mov ip, sp + .*: e92dd800 stmdb sp!, {fp, ip, lr, pc} + .*: ebfffff4 bl .* <.text-0xc> + .*: e89d6800 ldmia sp, {fp, sp, lr} + .*: e12fff1e bx lr + +.* : + .*: e12fff1e bx lr diff --git a/ld/testsuite/ld-arm/arm-app.r b/ld/testsuite/ld-arm/arm-app.r new file mode 100644 index 00000000000..f2433cee2eb --- /dev/null +++ b/ld/testsuite/ld-arm/arm-app.r @@ -0,0 +1,9 @@ + +tmpdir/arm-app: file format elf32-littlearm + +DYNAMIC RELOCATION RECORDS +OFFSET TYPE VALUE +.* R_ARM_COPY data_obj +.* R_ARM_JUMP_SLOT lib_func1 + + diff --git a/ld/testsuite/ld-arm/arm-app.s b/ld/testsuite/ld-arm/arm-app.s new file mode 100644 index 00000000000..8f6d27c32a0 --- /dev/null +++ b/ld/testsuite/ld-arm/arm-app.s @@ -0,0 +1,23 @@ + .text + .globl _start +_start: + mov ip, sp + stmdb sp!, {r11, ip, lr, pc} + bl app_func + ldmia sp, {r11, sp, lr} + bx lr + + .globl app_func +app_func: + mov ip, sp + stmdb sp!, {r11, ip, lr, pc} + bl lib_func1 + ldmia sp, {r11, sp, lr} + bx lr + + .globl app_func2 +app_func2: + bx lr + + .data + .long data_obj diff --git a/ld/testsuite/ld-arm/arm-elf.exp b/ld/testsuite/ld-arm/arm-elf.exp new file mode 100644 index 00000000000..0f9974196b5 --- /dev/null +++ b/ld/testsuite/ld-arm/arm-elf.exp @@ -0,0 +1,46 @@ +# Expect script for various ARM ELF tests. +# Copyright 2002, 2003, 2004 Free Software Foundation, Inc. +# +# This file 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 2 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# + +# Exclude non-ARM-ELF targets. + +if { ![is_elf_format] || ![istarget "arm*-*-*"] } { + return +} + +# List contains test-items with 3 items followed by 2 lists: +# 0:name 1:ld options 2:assembler options +# 3:filenames of assembler files 4: action and options. 5: name of output file + +# Actions: +# objdump: Apply objdump options on result. Compare with regex (last arg). +# nm: Apply nm options on result. Compare with regex (last arg). +# readelf: Apply readelf options on result. Compare with regex (last arg). + +set armelftests { + {"Simple non-PIC shared library" "-shared" "" {arm-lib.s} + {{objdump -fdw arm-lib.d} {objdump -Rw arm-lib.r}} + "arm-lib.so"} + {"Simple PIC shared library" "-shared" "" {arm-lib-plt32.s} + {{objdump -fdw arm-lib-plt32.d} {objdump -Rw arm-lib-plt32.r}} + "arm-lib-plt32.so"} + {"Simple dynamic application" "tmpdir/arm-lib.so" "" {arm-app.s} + {{objdump -fdw arm-app.d} {objdump -Rw arm-app.r}} + "arm-app"} +} + +run_ld_link_tests $armelftests diff --git a/ld/testsuite/ld-arm/arm-lib-plt32.d b/ld/testsuite/ld-arm/arm-lib-plt32.d new file mode 100644 index 00000000000..449b0f9c0f0 --- /dev/null +++ b/ld/testsuite/ld-arm/arm-lib-plt32.d @@ -0,0 +1,28 @@ + +tmpdir/arm-lib-plt32.so: file format elf32-littlearm +architecture: arm, flags 0x00000150: +HAS_SYMS, DYNAMIC, D_PAGED +start address 0x.* + +Disassembly of section .plt: + +.* <.plt>: + .*: e52de004 str lr, \[sp, #-4\]! + .*: e59fe004 ldr lr, \[pc, #4\] ; .* + .*: e08fe00e add lr, pc, lr + .*: e5bef008 ldr pc, \[lr, #8\]! + .*: .* + .*: e28fc6.* add ip, pc, #.* ; 0x.* + .*: e28cca.* add ip, ip, #.* ; 0x.* + .*: e5bcf.* ldr pc, \[ip, #.*\]! +Disassembly of section .text: + +.* : + .*: e1a0c00d mov ip, sp + .*: e92dd800 stmdb sp!, {fp, ip, lr, pc} + .*: ebfffff9 bl .* + .*: e89d6800 ldmia sp, {fp, sp, lr} + .*: e12fff1e bx lr + +.* : + .*: e12fff1e bx lr diff --git a/ld/testsuite/ld-arm/arm-lib-plt32.r b/ld/testsuite/ld-arm/arm-lib-plt32.r new file mode 100644 index 00000000000..2212493b173 --- /dev/null +++ b/ld/testsuite/ld-arm/arm-lib-plt32.r @@ -0,0 +1,8 @@ + +tmpdir/arm-lib-plt32.so: file format elf32-littlearm + +DYNAMIC RELOCATION RECORDS +OFFSET TYPE VALUE +.* R_ARM_JUMP_SLOT app_func2 + + diff --git a/ld/testsuite/ld-arm/arm-lib-plt32.s b/ld/testsuite/ld-arm/arm-lib-plt32.s new file mode 100644 index 00000000000..d6c4787a6dc --- /dev/null +++ b/ld/testsuite/ld-arm/arm-lib-plt32.s @@ -0,0 +1,17 @@ + .text + + .globl lib_func1 + .type lib_func1, %function +lib_func1: + mov ip, sp + stmdb sp!, {r11, ip, lr, pc} + bl app_func2(PLT) + ldmia sp, {r11, sp, lr} + bx lr + .size lib_func1, . - lib_func1 + + .globl lib_func2 + .type lib_func2, %function +lib_func2: + bx lr + .size lib_func2, . - lib_func2 diff --git a/ld/testsuite/ld-arm/arm-lib.d b/ld/testsuite/ld-arm/arm-lib.d new file mode 100644 index 00000000000..d0fb714d1b4 --- /dev/null +++ b/ld/testsuite/ld-arm/arm-lib.d @@ -0,0 +1,17 @@ + +tmpdir/arm-lib.so: file format elf32-littlearm +architecture: arm, flags 0x00000150: +HAS_SYMS, DYNAMIC, D_PAGED +start address 0x.* + +Disassembly of section .text: + +.* : + .*: e1a0c00d mov ip, sp + .*: e92dd800 stmdb sp!, {fp, ip, lr, pc} + .*: ebfffffe bl .* + .*: e89d6800 ldmia sp, {fp, sp, lr} + .*: e12fff1e bx lr + +.* : + .*: e12fff1e bx lr diff --git a/ld/testsuite/ld-arm/arm-lib.r b/ld/testsuite/ld-arm/arm-lib.r new file mode 100644 index 00000000000..33ba781fa9d --- /dev/null +++ b/ld/testsuite/ld-arm/arm-lib.r @@ -0,0 +1,8 @@ + +tmpdir/arm-lib.so: file format elf32-littlearm + +DYNAMIC RELOCATION RECORDS +OFFSET TYPE VALUE +.* R_ARM_PC24 app_func2 + + diff --git a/ld/testsuite/ld-arm/arm-lib.s b/ld/testsuite/ld-arm/arm-lib.s new file mode 100644 index 00000000000..949f61c0a28 --- /dev/null +++ b/ld/testsuite/ld-arm/arm-lib.s @@ -0,0 +1,24 @@ + .text + + .globl lib_func1 + .type lib_func1, %function +lib_func1: + mov ip, sp + stmdb sp!, {r11, ip, lr, pc} + bl app_func2 + ldmia sp, {r11, sp, lr} + bx lr + .size lib_func1, . - lib_func1 + + .globl lib_func2 + .type lib_func2, %function +lib_func2: + bx lr + .size lib_func2, . - lib_func2 + + .data + .globl data_obj + .type data_obj, %object +data_obj: + .long 0 + .size data_obj, . - data_obj -- 2.30.2