--- /dev/null
+; Check that invalid PIC reloc and instruction size combinations are
+; recognized. Note that sizes of byte operands are not error-checked for
+; not being in 16-bit range, so no error is recognized for a 16-bit operand.
+
+; { dg-do assemble { target cris-*-* } }
+; { dg-options "--pic --no-underscore --em=criself" }
+
+ .syntax no_register_prefix
+ .text
+start:
+ move.b extsym:GOTPLT16,r4 ; { dg-error "PIC relocation size does not match" "" { xfail *-*-* } }
+ move.b extsym12:GOTPLT,r5 ; { dg-error "PIC relocation size does not match" }
+ move.w extsym2:GOTPLT,r5 ; { dg-error "PIC relocation size does not match" }
+ move.d extsym3:GOTPLT16,r6 ; { dg-error "PIC relocation size does not match" }
+ move extsym4:GOTPLT16,srp ; { dg-error "PIC relocation size does not match" }
+ move.b extsym5:GOT16,r4 ; { dg-error "PIC relocation size does not match" "" { xfail *-*-* } }
+ move.b extsym15:GOT,r7 ; { dg-error "PIC relocation size does not match" }
+ move.w extsym6:GOT,r5 ; { dg-error "PIC relocation size does not match" }
+ move.d extsym7:GOT16,r6 ; { dg-error "PIC relocation size does not match" }
+ move extsym8:GOT16,srp ; { dg-error "PIC relocation size does not match" }
--- /dev/null
+#objdump: -dr
+#as: --em=criself --pic
+#name: PIC relocs.
+
+.*: file format .*-cris
+
+Disassembly of section \.text:
+
+00000000 <start>:
+[ ]+0:[ ]+af1e 0000 0000[ ]+sub\.d 0 <start>,r1
+[ ]+2:[ ]+R_CRIS_32_GOTREL \.text
+[ ]+6:[ ]+6f3d 0000 0000 6aaa[ ]+move\.d \[r3\+0 <start>\],r10
+[ ]+8:[ ]+R_CRIS_32_GOT extsym
+[ ]+e:[ ]+2f9e 0000 0000[ ]+add\.d 0 <start>,r9
+[ ]+10:[ ]+R_CRIS_32_GOTREL extsym2
+[ ]+14:[ ]+6f8e 0000 0000[ ]+move\.d 0 <start>,r8
+[ ]+16:[ ]+R_CRIS_32_PLT_PCREL extsym5
+[ ]+1a:[ ]+6f8e 0000 0000[ ]+move\.d 0 <start>,r8
+[ ]+1c:[ ]+R_CRIS_32_PLT_GOTREL[ ]+extsym9
+[ ]+20:[ ]+6f3d 0000 0000 6aaa[ ]+move\.d \[r3\+0 <start>\],r10
+[ ]+22:[ ]+R_CRIS_32_GOTPLT extsym
+[ ]+28:[ ]+5fdd 0000 6aaa[ ]+move\.d \[r13\+0\],r10
+[ ]+2a:[ ]+R_CRIS_16_GOT extsym13
+[ ]+2e:[ ]+5fae 0000[ ]+move\.w 0x0,r10
+[ ]+30:[ ]+R_CRIS_16_GOTPLT extsym14
+[ ]+32:[ ]+6f3d 0000 0000 aa4a[ ]+sub\.d \[r3\+0 <start>\],r4,r10
+[ ]+34:[ ]+R_CRIS_32_GOT extsym3
+[ ]+3a:[ ]+af9e 0000 0000[ ]+sub\.d 0 <start>,r9
+[ ]+3c:[ ]+R_CRIS_32_GOTREL extsym4\+0x2a
+[ ]+40:[ ]+af3e 0000 0000[ ]+sub\.d 0 <start>,r3
+[ ]+42:[ ]+R_CRIS_32_GOTREL extsym4\+0xffffffa0
+[ ]+46:[ ]+6fad 0000 0000 287a[ ]+add\.d \[r10\+0 <start>\],r7,r8
+[ ]+48:[ ]+R_CRIS_32_GOT extsym3\+0x38
+[ ]+4e:[ ]+6f5d 0000 0000 611a[ ]+move\.d \[r5\+0 <start>\],r1
+[ ]+50:[ ]+R_CRIS_32_GOT extsym6\+0xa
+[ ]+56:[ ]+6fad 0000 0000 284a[ ]+add\.d \[r10\+0 <start>\],r4,r8
+[ ]+58:[ ]+R_CRIS_32_GOT extsym3\+0xfffffdd0
+[ ]+5e:[ ]+6f5d 0000 0000 6cca[ ]+move\.d \[r5\+0 <start>\],r12
+[ ]+60:[ ]+R_CRIS_32_GOT extsym6\+0xffffff92
+[ ]+66:[ ]+6f5d 0000 0000 69ce[ ]+move\.d \[r9=r5\+0 <start>\],r12
+[ ]+68:[ ]+R_CRIS_32_GOT extsym6\+0xffffff24
+[ ]+6e:[ ]+6f3d 0000 0000 67de[ ]+move\.d \[r7=r3\+0 <start>\],r13
+[ ]+70:[ ]+R_CRIS_32_GOTREL extsym10\+0xfffffeb6
+[ ]+76:[ ]+6f5e 0000 0000[ ]+move\.d 0 <start>,r5
+[ ]+78:[ ]+R_CRIS_32_PLT_PCREL extsym7\+0x4
+[ ]+7c:[ ]+6f9e 0000 0000[ ]+move\.d 0 <start>,r9
+[ ]+7e:[ ]+R_CRIS_32_PLT_PCREL extsym7\+0xffffffd8
+[ ]+82:[ ]+6f5e 0000 0000[ ]+move\.d 0 <start>,r5
+[ ]+84:[ ]+R_CRIS_32_PLT_GOTREL extsym11\+0x10
+[ ]+88:[ ]+6f9e 0000 0000[ ]+move\.d 0 <start>,r9
+[ ]+8a:[ ]+R_CRIS_32_PLT_GOTREL extsym12\+0xffffffc4
+[ ]+8e:[ ]+5fcd 0000 a89a[ ]+sub\.d \[r12\+0\],r9,r8
+[ ]+90:[ ]+R_CRIS_16_GOT extsym3\+0xffffff64
+[ ]+94:[ ]+5fbd 0000 699a[ ]+move\.d \[r11\+0\],r9
+[ ]+96:[ ]+R_CRIS_16_GOTPLT extsym14\+0xffffff00
+[ ]+9a:[ ]+6fad 0000 0000 287a[ ]+add\.d \[r10\+0 <start>\],r7,r8
+[ ]+9c:[ ]+R_CRIS_32_GOTPLT extsym3\+0x38
+[ ]+\.\.\.
--- /dev/null
+; Check that PIC operands get their right relocation type.
+; First some expected uses, similar to what GCC will emit.
+
+ .text
+start:
+ sub.d .:GOTOFF,r1
+ move.d [r3+extsym:GOT],r10
+ add.d extsym2:GOTOFF,r9
+ move.d extsym5:PLT,r8
+ move.d extsym9:PLTG,r8
+ move.d [r3+extsym:GOTPLT],r10
+ move.d [r13+extsym13:GOT16],r10
+ move.w extsym14:GOTPLT16,r10
+
+; Other for GAS valid operands (some with questionable PIC semantics).
+ sub.d [r3+extsym3:GOT],r4,r10
+ sub.d extsym4:GOTOFF+42,r9
+ sub.d extsym4:GOTOFF-96,r3
+ add.d [r10+extsym3:GOT+56],r7,r8
+ move.d [r5+extsym6:GOT+10],r1
+ add.d [r10+extsym3:GOT-560],r4,r8
+ move.d [r5+extsym6:GOT-110],r12
+ move.d [r9=r5+extsym6:GOT-220],r12
+ move.d [r7=r3+extsym10:GOTOFF-330],r13
+ move.d extsym7:PLT+4,r5
+ move.d extsym7:PLT-40,r9
+ move.d extsym11:PLTG+16,r5
+ move.d extsym12:PLTG-60,r9
+ sub.d [r12+extsym3:GOT16-156],r9,r8
+ move.d [r11+extsym14:GOTPLT16-256],r9
+ add.d [r10+extsym3:GOTPLT+56],r7,r8
+