This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH, ARM]: Fix SB group relocations


In message <51F23823.5070502@arm.com>
          Richard Earnshaw <rearnsha@arm.com> wrote:

> On 26/07/13 03:10, John Tytgat wrote:
> 
> >>> --- ld/testsuite/ld-arm/group-relocs-ldrs-bad.s	15 Jun 2006 11:03:02 -0000	1.1
> >>> +++ ld/testsuite/ld-arm/group-relocs-ldrs-bad.s	14 Jul 2013 16:45:03 -0000
> >>> @@ -6,8 +6,8 @@
> >>>    	.globl _start
> >>>
> >>>    _start:
> >>> -	add	r0, r0, #:sb_g0_nc:(bar)
> >>> -	ldrd	r2, [r0, #:sb_g1:(bar)]
> >>> +	add	r0, r0, #:pc_g0_nc:(bar)
> >>> +	ldrd	r2, [r0, #:pc_g1:(bar + 4)]
> >>>
> >>>    @ We will place the section foo at 0x8000100.
> >>
> >> Why have you changed this test from SB relative to PC relative?  That
> >> means it no-longer tests the same thing.
> >
> > We originally had 4 linker groups tests : group-relocs-alu-bad,
> > group-relocs-ldc-bad, group-relocs-ldr-bad and group-relocs-ldrs-bad.
> >
> > The first two were pc-based, the last two were sb-based.  I've changed the
> > last two in pc-based as well and added 4 new sb-based tests.
> >
> > John.
> >
> 
> 
> I think the 's' in the test name (ldrs) is supposed to indicate that 
> this is sb based.

No it hints the R_ARM_LDRS_* relocation is being tested (used for
{LD,ST}R{D,H,SH} instructions).

>  I'd rather you add new tests than changed existing 
> ones.  It's not as though the gas testsuite takes a long time to run 
> (relative to the compiler at any rate).

No problem.  But note I still need to change the existing
group-relocs-ldr(s)-bad tests a little bit as they were no longer failing
because of the exact nature of this sb patch.

I recreated the patch and also corrected a problem which I found out in
the meanwhile : when using an unresolved symbol for the SB group relocation
there was an ICE as the section containing that symbol is NULL.  Hence
the added test on sym_sec in elf32_arm_final_link_relocation.
I also added a specific unresolved failure test for this.

bfd

John Tytgat  <john@bass-software.com>

	PR ld/15787
	* elf32-arm.c (elf32_arm_final_link_relocate): Use origin of output
	segment containing the relocating symbol instead of assuming 0 for
	sb group relocations.

ld/testsuite

John Tytgat  <john@bass-software.com>

	PR ld/15787
	* ld-arm/group-relocs-ldr-bad.s: Redefine bar into foo section
	beyond 16 bit offset width.
	* ld-arm/group-relocs-ldrs-bad.s: Likewise.
	* ld-arm/group-relocs-ldr-bad.d: Adjust expected result.
	* ld-arm/group-relocs-ldrs-bad.d: Likewise.
	* ld-arm/group-relocs.s: Add comments.  Move symbols used for sb
	group relocations into .data section.  Drop section zero.  Use pc/r0
	as base register when pc/sb group relocations are used.
	* ld-arm/group-relocs.d: Adjust expected result.
	* ld-arm/group-relocs-alu-bad-2.d: New test for sb group relocation.
	* ld-arm/group-relocs-ldc-bad-2.d: Likewise.
	* ld-arm/group-relocs-ldr-bad-2.d: New test for pc group relocation.
	* ld-arm/group-relocs-ldrs-bad-2.d: Likewise.
	* ld-arm/unresolved-2.d: Add sb relocation failure test.
	* ld-arm/group-relocs-alu-bad-2.s: New test source.
	* ld-arm/group-relocs-ldr-bad-2.s: Likewise.
	* ld-arm/group-relocs-ldrs-bad-2.s: Likewise.
	* ld-arm/group-relocs-ldc-bad-2.s: Likewise.
	* ld-arm/unresolved-2.s: Likewise.
	* ld-arm/arm-elf.exp: For group-relocs, drop section zero start
	definition.  Run the new tests.

John.
-- 
John Tytgat                                                             BASS
John@bass-software.com

Attachment: arm_sb_g_reloc_v2.patch
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]