Skip to content

Commit 7553c86

Browse files
committed
Teach a few targets to resolve BFD_RELOC_8
and tidy "forward" test. I've removed some checks in d30v md_apply_fix that have no business being there. Any symbol problems will be caught later in tc_gen_reloc, and overflow checking is done in gas/write.c. * config/tc-d10v.c (md_apply_fix): Apply BFD_RELOC_8. * config/tc-pdp11.c (md_apply_fix): Likewise. * config/tc-d30v.c (md_apply_fix): Don't emit errors for BFD_RELOC_8, BFD_RELOC_16, and BFD_RELOC_64. * testsuite/gas/all/gas.exp: Move target exclusions for forward test, but not cr16, to.. * testsuite/gas/all/forward.d: ..here, with explanation. Remove d10v, d30v, and pdp11 xfails.
1 parent 3b6c196 commit 7553c86

File tree

6 files changed

+38
-46
lines changed

6 files changed

+38
-46
lines changed

gas/ChangeLog

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
2019-03-21 Alan Modra <amodra@gmail.com>
2+
3+
* config/tc-d10v.c (md_apply_fix): Apply BFD_RELOC_8.
4+
* config/tc-pdp11.c (md_apply_fix): Likewise.
5+
* config/tc-d30v.c (md_apply_fix): Don't emit errors for BFD_RELOC_8,
6+
BFD_RELOC_16, and BFD_RELOC_64.
7+
* testsuite/gas/all/gas.exp: Move target exclusions for forward
8+
test, but not cr16, to..
9+
* testsuite/gas/all/forward.d: ..here, with explanation. Remove
10+
d10v, d30v, and pdp11 xfails.
11+
112
2019-03-19 H.J. Lu <hongjiu.lu@intel.com>
213

314
* config/tc-i386.c (optimize_encoding): Don't check AVX for

gas/config/tc-d10v.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1580,6 +1580,9 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
15801580
case BFD_RELOC_16:
15811581
bfd_putb16 ((bfd_vma) value, (unsigned char *) where);
15821582
break;
1583+
case BFD_RELOC_8:
1584+
*where = value;
1585+
break;
15831586

15841587
case BFD_RELOC_VTABLE_INHERIT:
15851588
case BFD_RELOC_VTABLE_ENTRY:

gas/config/tc-d30v.c

Lines changed: 7 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1918,37 +1918,17 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
19181918

19191919
switch (fixP->fx_r_type)
19201920
{
1921-
case BFD_RELOC_8: /* Check for a bad .byte directive. */
1922-
if (fixP->fx_addsy != NULL)
1923-
as_bad (_("line %d: unable to place address of symbol '%s' into a byte"),
1924-
fixP->fx_line, S_GET_NAME (fixP->fx_addsy));
1925-
else if (((unsigned)value) > 0xff)
1926-
as_bad (_("line %d: unable to place value %lx into a byte"),
1927-
fixP->fx_line, value);
1928-
else
1929-
*(unsigned char *) where = value;
1921+
case BFD_RELOC_8:
1922+
*(unsigned char *) where = value;
19301923
break;
19311924

1932-
case BFD_RELOC_16: /* Check for a bad .short directive. */
1933-
if (fixP->fx_addsy != NULL)
1934-
as_bad (_("line %d: unable to place address of symbol '%s' into a short"),
1935-
fixP->fx_line, S_GET_NAME (fixP->fx_addsy));
1936-
else if (((unsigned)value) > 0xffff)
1937-
as_bad (_("line %d: unable to place value %lx into a short"),
1938-
fixP->fx_line, value);
1939-
else
1940-
bfd_putb16 ((bfd_vma) value, (unsigned char *) where);
1925+
case BFD_RELOC_16:
1926+
bfd_putb16 ((bfd_vma) value, (unsigned char *) where);
19411927
break;
19421928

1943-
case BFD_RELOC_64: /* Check for a bad .quad directive. */
1944-
if (fixP->fx_addsy != NULL)
1945-
as_bad (_("line %d: unable to place address of symbol '%s' into a quad"),
1946-
fixP->fx_line, S_GET_NAME (fixP->fx_addsy));
1947-
else
1948-
{
1949-
bfd_putb32 ((bfd_vma) value, (unsigned char *) where);
1950-
bfd_putb32 (0, ((unsigned char *) where) + 4);
1951-
}
1929+
case BFD_RELOC_64:
1930+
bfd_putb32 ((bfd_vma) value, (unsigned char *) where);
1931+
bfd_putb32 (0, ((unsigned char *) where) + 4);
19521932
break;
19531933

19541934
case BFD_RELOC_D30V_6:

gas/config/tc-pdp11.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,10 @@ md_apply_fix (fixS *fixP,
248248

249249
switch (fixP->fx_r_type)
250250
{
251+
case BFD_RELOC_8:
252+
mask = 0xff;
253+
shift = 0;
254+
break;
251255
case BFD_RELOC_16:
252256
case BFD_RELOC_16_PCREL:
253257
mask = 0xffff;

gas/testsuite/gas/all/forward.d

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
11
#objdump: -s -j .data
22
#name: forward references
3-
# Some targets don't manage to resolve BFD_RELOC_8 for constants.
4-
#xfail: *c30-*-* *c4x-*-* d10v-*-* d30v-*-* pdp11-*-*
3+
# tic30 and tic4x have 4 octets per byte, tic54x has 2 octets per byte
4+
#notarget: *c30-*-* *c4x-*-* *c54x-*-*
5+
# hppa uses non-standard .equ syntax
6+
#notarget: hppa*-*-*
7+
# linkrelax targets should really resolve the relocs in this test but some
8+
# choose to emit them even though the relocs are in .data, leading to
9+
# "redefined symbol cannot be used on reloc".
10+
#xfail: am33*-*-* crx*-*-* h8300*-*-* mn10200*-*-* mn10300*-*-*
11+
# mep and microblaze use complex relocs and don't resolve the relocs.
12+
# one of the relocs references minus_one, which is a bug, but no one
13+
# seems bothered enough to fix this.
14+
#xfail: mep-*-* microblaze-*-*
515

616
.*: .*
717

gas/testsuite/gas/all/gas.exp

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -99,23 +99,7 @@ if { ![istarget "bfin-*-*"] } then {
9999
gas_test_error "assign-bad.s" "" "== assignment for symbol already set"
100100

101101
run_dump_test simple-forward
102-
103-
# .equ works differently on some targets.
104-
# linkrelax-ing prevents most forward references from working.
105-
case $target_triplet in {
106-
{ am3*-*-* } { }
107-
{ *c54x*-*-* } { }
108-
{ cr16*-*-* } { }
109-
{ crx*-*-* } { }
110-
{ h8300*-*-* } { }
111-
{ hppa*-*-* } { }
112-
{ mep-*-* } { }
113-
{ microblaze-*-* } { }
114-
{ mn10\[23\]00*-*-* } { }
115-
default {
116-
run_dump_test forward
117-
}
118-
}
102+
run_dump_test forward
119103

120104
# aout relocs are often weird, so is mep. don't bother testing
121105
# som doesn't use a .text section

0 commit comments

Comments
 (0)