From df1f3cdab5f2617dd1249fe7b8e6b82e9df93f8b Mon Sep 17 00:00:00 2001 From: David Daney Date: Tue, 7 Nov 2006 23:55:36 +0000 Subject: gas: * config/tc-mips.c (pic_need_relax): Return true for section symbols. gas/testsuite: * gas/mips/elf-rel26.s: New test. * gas/mips/elf-rel26.d: Ditto. * gas/mips/mips.exp: Run it. --- gas/ChangeLog | 4 +++ gas/config/tc-mips.c | 3 ++ gas/testsuite/ChangeLog | 6 ++++ gas/testsuite/gas/mips/elf-rel26.d | 22 ++++++++++++++ gas/testsuite/gas/mips/elf-rel26.s | 62 ++++++++++++++++++++++++++++++++++++++ gas/testsuite/gas/mips/mips.exp | 1 + 6 files changed, 98 insertions(+) create mode 100644 gas/testsuite/gas/mips/elf-rel26.d create mode 100644 gas/testsuite/gas/mips/elf-rel26.s (limited to 'gas') diff --git a/gas/ChangeLog b/gas/ChangeLog index 118f161..dd41b91 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,7 @@ +2006-11-06 David Daney + + * config/tc-mips.c (pic_need_relax): Return true for section symbols. + 2006-11-06 Thiemo Seufer * doc/c-mips.texi (-march): Document sb1a. diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c index d3ed818..8b36f26 100644 --- a/gas/config/tc-mips.c +++ b/gas/config/tc-mips.c @@ -13153,6 +13153,9 @@ pic_need_relax (symbolS *sym, asection *segtype) sym = n; } + if (symbol_section_p (sym)) + return TRUE; + symsec = S_GET_SEGMENT (sym); /* This must duplicate the test in adjust_reloc_syms. */ diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index 30c77b3..8070499 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2006-11-06 David Daney + + * gas/mips/elf-rel26.s: New test. + * gas/mips/elf-rel26.d: Ditto. + * gas/mips/mips.exp: Run it. + 2006-11-03 Jakub Jelinek * gas/cfi/cfi-common-6.d: New test. diff --git a/gas/testsuite/gas/mips/elf-rel26.d b/gas/testsuite/gas/mips/elf-rel26.d new file mode 100644 index 0000000..d176acb --- /dev/null +++ b/gas/testsuite/gas/mips/elf-rel26.d @@ -0,0 +1,22 @@ +#as: -mips32 -EL -KPIC +#readelf: --relocs +#name: MIPS ELF reloc 26 + +Relocation section '\.rel\.pdr' .* + *Offset.* +00.* + +Relocation section '\.rel\.text\.foo' at offset .* contains 11 entries: + *Offset * Info * Type * Sym\.Value * Sym\. Name +0+000 * .+ * R_MIPS_HI16 * 0+0 * _gp_disp +0+004 * .+ * R_MIPS_LO16 * 0+0 * _gp_disp +0+014 * .+ * R_MIPS_GOT16 * 0+0 * \$LC28 +0+01c * .+ * R_MIPS_LO16 * 0+0 * \$LC28 +0+020 * .+ * R_MIPS_CALL16 * 0+0 * bar +0+030 * .+ * R_MIPS_PC16 * 0+0 * \$L846 +0+034 * .+ * R_MIPS_GOT16 * 0+0 * \$LC27 +0+038 * .+ * R_MIPS_PC16 * 0+0 * \$L848 +0+048 * .+ * R_MIPS_PC16 * 0+0 * \$L925 +0+010 * .+ * R_MIPS_GOT16 * 0+0 * \.rodata\.foo +0+05c * .+ * R_MIPS_LO16 * 0+0 * \.rodata\.foo +#pass diff --git a/gas/testsuite/gas/mips/elf-rel26.s b/gas/testsuite/gas/mips/elf-rel26.s new file mode 100644 index 0000000..ed6984a --- /dev/null +++ b/gas/testsuite/gas/mips/elf-rel26.s @@ -0,0 +1,62 @@ + .section .text.foo,"axG",@progbits,foo,comdat + .align 2 + .weak foo + .ent foo + .type foo, @function +foo: +$LFB308: + .frame $fp,136,$31 # vars= 72, regs= 10/0, args= 16, gp= 8 + .mask 0xc0ff0000,-4 + .fmask 0x00000000,0 + .set noreorder + .cpload $25 + + .set nomacro + bne $3,$0,$L924 + lw $25,%got($L874)($28) + .set macro + .set reorder + lw $5,%got($LC28)($28) + lw $4,136($fp) + addiu $5,$5,%lo($LC28) + lw $25,%call16(bar)($28) + .set noreorder + .set nomacro + jalr $25 + li $6,-1 # 0xffffffffffffffff + .set macro + .set reorder + lw $25,64($fp) + .set noreorder + .set nomacro + bne $25,$0,$L846 + lw $5,%got($LC27)($28) + b $L848 + sw $0,68($fp) + .set macro + .set reorder +$L920: + lb $3,0($18) + li $2,59 # 0x3b + .set noreorder + .set nomacro + beq $3,$2,$L925 + lw $25,76($fp) + b $L920 + addiu $18,$18,1 + .set macro + .set reorder + +$L924: + sll $2,$2,2 + addiu $25,$25,%lo($L874) + addu $2,$2,$25 + lw $3,0($2) + addu $3,$3,$28 + j $3 + .end foo + .section .rodata.foo,"aG",@progbits,foo,comdat + .align 2 + .align 2 +$L874: + .gpword $L924 diff --git a/gas/testsuite/gas/mips/mips.exp b/gas/testsuite/gas/mips/mips.exp index b6d8e7b..50c608a 100644 --- a/gas/testsuite/gas/mips/mips.exp +++ b/gas/testsuite/gas/mips/mips.exp @@ -687,6 +687,7 @@ if { [istarget mips*-*-vxworks*] } { run_dump_test "elf-rel25" run_dump_test "elf-rel25a" + run_dump_test "elf-rel26" if { !$no_mips16 } { run_dump_test "${tmips}mips${el}16-e" -- cgit v1.1