0004-RISC-V-Minor-cleanup-and-testcases-improvement-for-a.patch 45 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216
  1. From c7e8eb17c274e33dd718871f15ee05f1f77341c2 Mon Sep 17 00:00:00 2001
  2. From: Nelson Chu <nelson.chu@sifive.com>
  3. Date: Fri, 20 Nov 2020 14:45:32 +0800
  4. Subject: [PATCH 04/48] RISC-V: Minor cleanup and testcases improvement for
  5. arch string parser.
  6. Re-indent the related codes, unify and improve the related error messages
  7. and comments. Besies, also re-write the testcases to cover more cases.
  8. bfd/
  9. * elfxx-riscv.c: Re-indent codes, unify and improve the error
  10. messages and comments.
  11. (riscv_parse_prefixed_ext): Stop parsing the prefixed class
  12. extensions if the class is RV_ISA_CLASS_UNKNOWN, I get internal
  13. errors before adding this check for march-fail-porder* testcases.
  14. (riscv_parse_subset): Move the rv32 with q checking in front.
  15. * elfxx-riscv.h: Likewise.
  16. gas/
  17. (These are new testcases that cover more cases)
  18. * testsuite/gas/riscv/march-fail-base-01.d: The first extension must
  19. be e, i or g.
  20. * testsuite/gas/riscv/march-fail-base-01.l: Likewise.
  21. * testsuite/gas/riscv/march-fail-base-02.d: rv64e is an invalid base ISA.
  22. * testsuite/gas/riscv/march-fail-base-02.l: Likewise.
  23. * testsuite/gas/riscv/march-fail-order-std.d: Check orders of standard
  24. extensions.
  25. * testsuite/gas/riscv/march-fail-order-std.l: Likewise.
  26. * testsuite/gas/riscv/march-fail-order-x.d: Check orders of prefixed
  27. x extensions.
  28. * testsuite/gas/riscv/march-fail-order-x.l: Likewise.
  29. * testsuite/gas/riscv/march-fail-porder-x-std.d: Check orders when
  30. standard and prefixed extensions are set at the same time.
  31. * testsuite/gas/riscv/march-fail-porder-x-z.d: Likewise.
  32. * testsuite/gas/riscv/march-fail-porder-z-std.d: Likewise.
  33. * testsuite/gas/riscv/march-fail-porder.l: Likewise.
  34. * testsuite/gas/riscv/march-fail-single-char-s.d: Only standard
  35. extensions can use single char.
  36. * testsuite/gas/riscv/march-fail-single-char-x.d: Likewise.
  37. * testsuite/gas/riscv/march-fail-single-char-z.d: Likewise.
  38. * testsuite/gas/riscv/march-fail-single-char.l: Likewise.
  39. * testsuite/gas/riscv/march-fail-unknown-s.d: All extensions
  40. should be known, except the non-standard x extensions.
  41. * testsuite/gas/riscv/march-fail-unknown-std.d: Likewise.
  42. * testsuite/gas/riscv/march-fail-unknown-std.l: Likewise.
  43. * testsuite/gas/riscv/march-fail-unknown-z.d: Likewise.
  44. * testsuite/gas/riscv/march-fail-unknown.l: Likewise.
  45. * testsuite/gas/riscv/march-fail-uppercase-base.d: Do not
  46. allow any uppercase in the arch string.
  47. * testsuite/gas/riscv/march-fail-uppercase-std.d: Likewise.
  48. * testsuite/gas/riscv/march-fail-uppercase-z.d: Likewise.
  49. * testsuite/gas/riscv/march-fail-uppercase.l: Likewise.
  50. * testsuite/gas/riscv/march-fail-version-x.d: Failed to set versions.
  51. * testsuite/gas/riscv/march-fail-version-z.d: Likewise.
  52. * testsuite/gas/riscv/march-fail-version.l: Likewise.
  53. * testsuite/gas/riscv/march-fail-rv32ef.l: Updated.
  54. * testsuite/gas/riscv/march-fail-rv32id.d: Need f-ext.
  55. * testsuite/gas/riscv/march-fail-rv32iq.d: Should be rv64.
  56. * testsuite/gas/riscv/march-fail-rv32iq.l: Likewise.
  57. * testsuite/gas/riscv/march-fail-rv64iq.d: Need d-ext and f-ext.
  58. * testsuite/gas/riscv/march-fail-rv64iq.l: Likewise.
  59. (The following testcases are removed and covered by new testcases)
  60. * testsuite/gas/riscv/march-fail-rv32i.d: march-fail-uppercase-base.
  61. * testsuite/gas/riscv/march-fail-rv32i.l: Likewise.
  62. * testsuite/gas/riscv/march-fail-rv32iam.d: march-fail-order-std.
  63. * testsuite/gas/riscv/march-fail-rv32iam.l: Likewise.
  64. * testsuite/gas/riscv/march-fail-rv32ic.d: march-fail-uppercase-std.
  65. * testsuite/gas/riscv/march-fail-rv32ic.l: Likewise.
  66. * testsuite/gas/riscv/march-fail-rv32icx2p.d: march-fail-version-x.
  67. * testsuite/gas/riscv/march-fail-rv32icx2p.l: Likewise.
  68. * testsuite/gas/riscv/march-fail-rv32imc.d: march-fail-order-std.
  69. * testsuite/gas/riscv/march-fail-rv32imc.l: Likewise.
  70. * testsuite/gas/riscv/march-fail-rv64I.d: march-fail-uppercase-std.
  71. * testsuite/gas/riscv/march-fail-rv64I.l: Likewise.
  72. * testsuite/gas/riscv/march-fail-rv64e.d: march-fail-base-02.
  73. * testsuite/gas/riscv/march-fail-rv64e.l: Likewise.
  74. * testsuite/gas/riscv/march-fail-s-with-version.d: march-fail-unknown-s.
  75. * testsuite/gas/riscv/march-fail-s-with-version.l: Likewise.
  76. * testsuite/gas/riscv/march-fail-s.d: march-fail-unknown-s.
  77. * testsuite/gas/riscv/march-fail-s.l: Likewise.
  78. * testsuite/gas/riscv/march-fail-sx.d: march-fail-unknown-s.
  79. * testsuite/gas/riscv/march-fail-sx.l: Likewise.
  80. ---
  81. bfd/elfxx-riscv.c | 214 +++++++++---------
  82. bfd/elfxx-riscv.h | 27 ++-
  83. gas/testsuite/gas/riscv/march-fail-base-01.d | 3 +
  84. gas/testsuite/gas/riscv/march-fail-base-01.l | 2 +
  85. gas/testsuite/gas/riscv/march-fail-base-02.d | 3 +
  86. gas/testsuite/gas/riscv/march-fail-base-02.l | 2 +
  87. ...-fail-rv32imc.d => march-fail-order-std.d} | 2 +-
  88. .../gas/riscv/march-fail-order-std.l | 2 +
  89. gas/testsuite/gas/riscv/march-fail-order-x.d | 3 +
  90. gas/testsuite/gas/riscv/march-fail-order-x.l | 2 +
  91. .../gas/riscv/march-fail-porder-x-std.d | 3 +
  92. .../gas/riscv/march-fail-porder-x-z.d | 3 +
  93. .../gas/riscv/march-fail-porder-z-std.d | 3 +
  94. gas/testsuite/gas/riscv/march-fail-porder.l | 2 +
  95. gas/testsuite/gas/riscv/march-fail-rv32ef.l | 4 +-
  96. gas/testsuite/gas/riscv/march-fail-rv32i.d | 3 -
  97. gas/testsuite/gas/riscv/march-fail-rv32i.l | 2 -
  98. gas/testsuite/gas/riscv/march-fail-rv32iam.d | 3 -
  99. gas/testsuite/gas/riscv/march-fail-rv32iam.l | 2 -
  100. gas/testsuite/gas/riscv/march-fail-rv32ic.d | 3 -
  101. gas/testsuite/gas/riscv/march-fail-rv32ic.l | 2 -
  102. .../gas/riscv/march-fail-rv32icx2p.d | 3 -
  103. .../gas/riscv/march-fail-rv32icx2p.l | 2 -
  104. gas/testsuite/gas/riscv/march-fail-rv32id.d | 3 +
  105. gas/testsuite/gas/riscv/march-fail-rv32id.l | 2 +
  106. gas/testsuite/gas/riscv/march-fail-rv32imc.l | 2 -
  107. gas/testsuite/gas/riscv/march-fail-rv32iq.d | 3 +
  108. gas/testsuite/gas/riscv/march-fail-rv32iq.l | 2 +
  109. gas/testsuite/gas/riscv/march-fail-rv64I.d | 3 -
  110. gas/testsuite/gas/riscv/march-fail-rv64I.l | 2 -
  111. gas/testsuite/gas/riscv/march-fail-rv64e.d | 3 -
  112. gas/testsuite/gas/riscv/march-fail-rv64e.l | 2 -
  113. gas/testsuite/gas/riscv/march-fail-rv64iq.d | 3 +
  114. gas/testsuite/gas/riscv/march-fail-rv64iq.l | 2 +
  115. .../gas/riscv/march-fail-s-with-version.d | 6 -
  116. .../gas/riscv/march-fail-s-with-version.l | 2 -
  117. gas/testsuite/gas/riscv/march-fail-s.d | 6 -
  118. gas/testsuite/gas/riscv/march-fail-s.l | 2 -
  119. .../gas/riscv/march-fail-single-char-s.d | 3 +
  120. .../gas/riscv/march-fail-single-char-x.d | 3 +
  121. .../gas/riscv/march-fail-single-char-z.d | 3 +
  122. .../gas/riscv/march-fail-single-char.l | 2 +
  123. gas/testsuite/gas/riscv/march-fail-sx.d | 6 -
  124. gas/testsuite/gas/riscv/march-fail-sx.l | 2 -
  125. .../gas/riscv/march-fail-unknown-s.d | 3 +
  126. .../gas/riscv/march-fail-unknown-std.d | 3 +
  127. .../gas/riscv/march-fail-unknown-std.l | 2 +
  128. .../gas/riscv/march-fail-unknown-z.d | 3 +
  129. gas/testsuite/gas/riscv/march-fail-unknown.l | 2 +
  130. .../gas/riscv/march-fail-uppercase-base.d | 3 +
  131. .../gas/riscv/march-fail-uppercase-std.d | 3 +
  132. .../gas/riscv/march-fail-uppercase-z.d | 3 +
  133. .../gas/riscv/march-fail-uppercase.l | 2 +
  134. .../gas/riscv/march-fail-version-x.d | 3 +
  135. .../gas/riscv/march-fail-version-z.d | 3 +
  136. gas/testsuite/gas/riscv/march-fail-version.l | 2 +
  137. 56 files changed, 206 insertions(+), 183 deletions(-)
  138. create mode 100644 gas/testsuite/gas/riscv/march-fail-base-01.d
  139. create mode 100644 gas/testsuite/gas/riscv/march-fail-base-01.l
  140. create mode 100644 gas/testsuite/gas/riscv/march-fail-base-02.d
  141. create mode 100644 gas/testsuite/gas/riscv/march-fail-base-02.l
  142. rename gas/testsuite/gas/riscv/{march-fail-rv32imc.d => march-fail-order-std.d} (50%)
  143. create mode 100644 gas/testsuite/gas/riscv/march-fail-order-std.l
  144. create mode 100644 gas/testsuite/gas/riscv/march-fail-order-x.d
  145. create mode 100644 gas/testsuite/gas/riscv/march-fail-order-x.l
  146. create mode 100644 gas/testsuite/gas/riscv/march-fail-porder-x-std.d
  147. create mode 100644 gas/testsuite/gas/riscv/march-fail-porder-x-z.d
  148. create mode 100644 gas/testsuite/gas/riscv/march-fail-porder-z-std.d
  149. create mode 100644 gas/testsuite/gas/riscv/march-fail-porder.l
  150. delete mode 100644 gas/testsuite/gas/riscv/march-fail-rv32i.d
  151. delete mode 100644 gas/testsuite/gas/riscv/march-fail-rv32i.l
  152. delete mode 100644 gas/testsuite/gas/riscv/march-fail-rv32iam.d
  153. delete mode 100644 gas/testsuite/gas/riscv/march-fail-rv32iam.l
  154. delete mode 100644 gas/testsuite/gas/riscv/march-fail-rv32ic.d
  155. delete mode 100644 gas/testsuite/gas/riscv/march-fail-rv32ic.l
  156. delete mode 100644 gas/testsuite/gas/riscv/march-fail-rv32icx2p.d
  157. delete mode 100644 gas/testsuite/gas/riscv/march-fail-rv32icx2p.l
  158. create mode 100644 gas/testsuite/gas/riscv/march-fail-rv32id.d
  159. create mode 100644 gas/testsuite/gas/riscv/march-fail-rv32id.l
  160. delete mode 100644 gas/testsuite/gas/riscv/march-fail-rv32imc.l
  161. create mode 100644 gas/testsuite/gas/riscv/march-fail-rv32iq.d
  162. create mode 100644 gas/testsuite/gas/riscv/march-fail-rv32iq.l
  163. delete mode 100644 gas/testsuite/gas/riscv/march-fail-rv64I.d
  164. delete mode 100644 gas/testsuite/gas/riscv/march-fail-rv64I.l
  165. delete mode 100644 gas/testsuite/gas/riscv/march-fail-rv64e.d
  166. delete mode 100644 gas/testsuite/gas/riscv/march-fail-rv64e.l
  167. create mode 100644 gas/testsuite/gas/riscv/march-fail-rv64iq.d
  168. create mode 100644 gas/testsuite/gas/riscv/march-fail-rv64iq.l
  169. delete mode 100644 gas/testsuite/gas/riscv/march-fail-s-with-version.d
  170. delete mode 100644 gas/testsuite/gas/riscv/march-fail-s-with-version.l
  171. delete mode 100644 gas/testsuite/gas/riscv/march-fail-s.d
  172. delete mode 100644 gas/testsuite/gas/riscv/march-fail-s.l
  173. create mode 100644 gas/testsuite/gas/riscv/march-fail-single-char-s.d
  174. create mode 100644 gas/testsuite/gas/riscv/march-fail-single-char-x.d
  175. create mode 100644 gas/testsuite/gas/riscv/march-fail-single-char-z.d
  176. create mode 100644 gas/testsuite/gas/riscv/march-fail-single-char.l
  177. delete mode 100644 gas/testsuite/gas/riscv/march-fail-sx.d
  178. delete mode 100644 gas/testsuite/gas/riscv/march-fail-sx.l
  179. create mode 100644 gas/testsuite/gas/riscv/march-fail-unknown-s.d
  180. create mode 100644 gas/testsuite/gas/riscv/march-fail-unknown-std.d
  181. create mode 100644 gas/testsuite/gas/riscv/march-fail-unknown-std.l
  182. create mode 100644 gas/testsuite/gas/riscv/march-fail-unknown-z.d
  183. create mode 100644 gas/testsuite/gas/riscv/march-fail-unknown.l
  184. create mode 100644 gas/testsuite/gas/riscv/march-fail-uppercase-base.d
  185. create mode 100644 gas/testsuite/gas/riscv/march-fail-uppercase-std.d
  186. create mode 100644 gas/testsuite/gas/riscv/march-fail-uppercase-z.d
  187. create mode 100644 gas/testsuite/gas/riscv/march-fail-uppercase.l
  188. create mode 100644 gas/testsuite/gas/riscv/march-fail-version-x.d
  189. create mode 100644 gas/testsuite/gas/riscv/march-fail-version-z.d
  190. create mode 100644 gas/testsuite/gas/riscv/march-fail-version.l
  191. diff --git a/bfd/elfxx-riscv.c b/bfd/elfxx-riscv.c
  192. index cfdd867e0d..dc196e0e12 100644
  193. --- a/bfd/elfxx-riscv.c
  194. +++ b/bfd/elfxx-riscv.c
  195. @@ -1010,13 +1010,13 @@ riscv_elf_add_sub_reloc (bfd *abfd,
  196. return bfd_reloc_ok;
  197. }
  198. -/* Parsing subset version.
  199. +/* Parsing extension version.
  200. Return Value:
  201. Points to the end of version
  202. Arguments:
  203. - `rps`: Hooks and status for parsing subset.
  204. + `rps`: Hooks and status for parsing extensions.
  205. `march`: Full arch string.
  206. `p`: Curent parsing position.
  207. `major_version`: Parsing result of major version, using
  208. @@ -1060,7 +1060,7 @@ riscv_parsing_subset_version (riscv_parse_subset_t *rps,
  209. else
  210. {
  211. rps->error_handler
  212. - (_("-march=%s: Expect number after `%dp'."),
  213. + (_("-march=%s: expect number after `%dp'"),
  214. march, version);
  215. return NULL;
  216. }
  217. @@ -1104,7 +1104,7 @@ riscv_supported_std_ext (void)
  218. Points to the end of extensions.
  219. Arguments:
  220. - `rps`: Hooks and status for parsing subset.
  221. + `rps`: Hooks and status for parsing extensions.
  222. `march`: Full arch string.
  223. `p`: Curent parsing position. */
  224. @@ -1117,21 +1117,17 @@ riscv_parse_std_ext (riscv_parse_subset_t *rps,
  225. const char *std_exts = all_std_exts;
  226. unsigned major_version = 0;
  227. unsigned minor_version = 0;
  228. - char std_ext = '\0';
  229. bfd_boolean use_default_version = FALSE;
  230. + char subset[2] = {0, 0};
  231. /* First letter must start with i, e or g. */
  232. switch (*p)
  233. {
  234. case 'i':
  235. - p = riscv_parsing_subset_version (rps,
  236. - march,
  237. - ++p,
  238. + p = riscv_parsing_subset_version (rps, march, ++p,
  239. &major_version,
  240. - &minor_version,
  241. - /* std_ext_p= */TRUE,
  242. + &minor_version, TRUE,
  243. &use_default_version);
  244. -
  245. /* Find the default version if needed. */
  246. if (use_default_version
  247. && rps->get_default_version != NULL)
  248. @@ -1139,18 +1135,15 @@ riscv_parse_std_ext (riscv_parse_subset_t *rps,
  249. &major_version,
  250. &minor_version);
  251. riscv_add_subset (rps->subset_list, "i",
  252. - major_version, minor_version);
  253. + major_version,
  254. + minor_version);
  255. break;
  256. case 'e':
  257. - p = riscv_parsing_subset_version (rps,
  258. - march,
  259. - ++p,
  260. + p = riscv_parsing_subset_version (rps, march, ++p,
  261. &major_version,
  262. - &minor_version,
  263. - /* std_ext_p= */TRUE,
  264. + &minor_version, TRUE,
  265. &use_default_version);
  266. -
  267. /* Find the default version if needed. */
  268. if (use_default_version
  269. && rps->get_default_version != NULL)
  270. @@ -1158,7 +1151,8 @@ riscv_parse_std_ext (riscv_parse_subset_t *rps,
  271. &major_version,
  272. &minor_version);
  273. riscv_add_subset (rps->subset_list, "e",
  274. - major_version, minor_version);
  275. + major_version,
  276. + minor_version);
  277. /* i-ext must be enabled. */
  278. if (rps->get_default_version != NULL)
  279. @@ -1166,7 +1160,8 @@ riscv_parse_std_ext (riscv_parse_subset_t *rps,
  280. &major_version,
  281. &minor_version);
  282. riscv_add_subset (rps->subset_list, "i",
  283. - major_version, minor_version);
  284. + major_version,
  285. + minor_version);
  286. if (*rps->xlen > 32)
  287. {
  288. @@ -1180,47 +1175,41 @@ riscv_parse_std_ext (riscv_parse_subset_t *rps,
  289. case 'g':
  290. /* The g-ext shouldn't has the version, so we just
  291. skip the setting if user set a version to it. */
  292. - p = riscv_parsing_subset_version (rps,
  293. - march,
  294. - ++p,
  295. + p = riscv_parsing_subset_version (rps, march, ++p,
  296. &major_version,
  297. - &minor_version,
  298. - TRUE,
  299. + &minor_version, TRUE,
  300. &use_default_version);
  301. -
  302. /* i-ext must be enabled. */
  303. if (rps->get_default_version != NULL)
  304. rps->get_default_version ("i",
  305. &major_version,
  306. &minor_version);
  307. riscv_add_subset (rps->subset_list, "i",
  308. - major_version, minor_version);
  309. + major_version,
  310. + minor_version);
  311. for ( ; *std_exts != 'q'; std_exts++)
  312. {
  313. - const char subset[] = {*std_exts, '\0'};
  314. -
  315. + subset[0] = *std_exts;
  316. if (rps->get_default_version != NULL)
  317. rps->get_default_version (subset,
  318. &major_version,
  319. &minor_version);
  320. riscv_add_subset (rps->subset_list, subset,
  321. - major_version, minor_version);
  322. + major_version,
  323. + minor_version);
  324. }
  325. break;
  326. default:
  327. rps->error_handler
  328. - (_("-march=%s: first ISA subset must be `e', `i' or `g'"), march);
  329. + (_("-march=%s: first ISA extension must be `e', `i' or `g'"),
  330. + march);
  331. return NULL;
  332. }
  333. - /* The riscv_parsing_subset_version may set `p` to NULL, so I think we should
  334. - skip parsing the string if `p` is NULL or value of `p` is `\0`. */
  335. while (p != NULL && *p != '\0')
  336. {
  337. - char subset[2] = {0, 0};
  338. -
  339. if (*p == 'x' || *p == 's' || *p == 'z')
  340. break;
  341. @@ -1230,35 +1219,31 @@ riscv_parse_std_ext (riscv_parse_subset_t *rps,
  342. continue;
  343. }
  344. - std_ext = *p;
  345. -
  346. /* Checking canonical order. */
  347. - while (*std_exts && std_ext != *std_exts) std_exts++;
  348. + char std_ext = *p;
  349. + while (*std_exts && std_ext != *std_exts)
  350. + std_exts++;
  351. if (std_ext != *std_exts)
  352. {
  353. if (strchr (all_std_exts, std_ext) == NULL)
  354. rps->error_handler
  355. - (_("-march=%s: unsupported ISA subset `%c'"), march, *p);
  356. + (_("-march=%s: unknown standard ISA extension `%c'"),
  357. + march, std_ext);
  358. else
  359. rps->error_handler
  360. - (_("-march=%s: ISA string is not in canonical order. `%c'"),
  361. - march, *p);
  362. + (_("-march=%s: standard ISA extension `%c' is not "
  363. + "in canonical order"), march, std_ext);
  364. return NULL;
  365. }
  366. std_exts++;
  367. -
  368. use_default_version = FALSE;
  369. subset[0] = std_ext;
  370. - p = riscv_parsing_subset_version (rps,
  371. - march,
  372. - ++p,
  373. + p = riscv_parsing_subset_version (rps, march, ++p,
  374. &major_version,
  375. - &minor_version,
  376. - TRUE,
  377. + &minor_version, TRUE,
  378. &use_default_version);
  379. -
  380. /* Find the default version if needed. */
  381. if (use_default_version
  382. && rps->get_default_version != NULL)
  383. @@ -1266,8 +1251,10 @@ riscv_parse_std_ext (riscv_parse_subset_t *rps,
  384. &major_version,
  385. &minor_version);
  386. riscv_add_subset (rps->subset_list, subset,
  387. - major_version, minor_version);
  388. + major_version,
  389. + minor_version);
  390. }
  391. +
  392. return p;
  393. }
  394. @@ -1294,23 +1281,26 @@ typedef struct riscv_parse_config
  395. /* Class of the extension. */
  396. riscv_isa_ext_class_t class;
  397. - /* Lower-case prefix string for error printing
  398. - and internal parser usage, e.g. "z", "x". */
  399. + /* Prefix string for error printing and internal parser usage. */
  400. const char *prefix;
  401. - /* Predicate which is used for checking whether
  402. - this is a "known" extension. For 'x',
  403. - it always returns true (since they are by
  404. + /* Predicate which is used for checking whether this is a "known"
  405. + extension. For 'x', it always returns true since they are by
  406. definition non-standard and cannot be known. */
  407. bfd_boolean (*ext_valid_p) (const char *);
  408. } riscv_parse_config_t;
  409. -/* Parse a generic prefixed extension.
  410. - `rps`: Hooks and status for parsing subset.
  411. - `march`: The full architecture string as passed in by "-march=...".
  412. - `p`: Point from which to start parsing the -march string.
  413. - `config`: What class of extensions to parse, predicate funcs,
  414. - and strings to use in error reporting. */
  415. +/* Parsing function for prefixed extensions.
  416. +
  417. + Return Value:
  418. + Points to the end of extension.
  419. +
  420. + Arguments:
  421. + `rps`: Hooks and status for parsing extensions.
  422. + `march`: Full architecture string.
  423. + `p`: Curent parsing position.
  424. + `config`: What class and predicate function to use for the
  425. + extension. */
  426. static const char *
  427. riscv_parse_prefixed_ext (riscv_parse_subset_t *rps,
  428. @@ -1335,7 +1325,8 @@ riscv_parse_prefixed_ext (riscv_parse_subset_t *rps,
  429. /* Assert that the current extension specifier matches our parsing
  430. class. */
  431. class = riscv_get_prefix_class (p);
  432. - if (class != config->class)
  433. + if (class != config->class
  434. + || class == RV_ISA_CLASS_UNKNOWN)
  435. break;
  436. char *subset = xstrdup (p);
  437. @@ -1347,12 +1338,13 @@ riscv_parse_prefixed_ext (riscv_parse_subset_t *rps,
  438. use_default_version = FALSE;
  439. end_of_version =
  440. - riscv_parsing_subset_version (rps, march, q, &major_version,
  441. + riscv_parsing_subset_version (rps, march, q,
  442. + &major_version,
  443. &minor_version, FALSE,
  444. &use_default_version);
  445. *q = '\0';
  446. - /* Check that the name is valid.
  447. + /* Check that the prefix extension is known.
  448. For 'x', anything goes but it cannot simply be 'x'.
  449. For 's', it must be known from a list and cannot simply be 's'.
  450. For 'z', it must be known from a list and cannot simply be 'z'. */
  451. @@ -1361,30 +1353,30 @@ riscv_parse_prefixed_ext (riscv_parse_subset_t *rps,
  452. if (!config->ext_valid_p (subset))
  453. {
  454. rps->error_handler
  455. - (_("-march=%s: Invalid or unknown %s ISA extension: '%s'"),
  456. + (_("-march=%s: unknown %s ISA extension `%s'"),
  457. march, config->prefix, subset);
  458. free (subset);
  459. return NULL;
  460. }
  461. - /* Check that the last item is not the same as this. */
  462. + /* Check that the extension isn't duplicate. */
  463. last_name = rps->subset_list->tail->name;
  464. if (!strcasecmp (last_name, subset))
  465. {
  466. rps->error_handler
  467. - (_("-march=%s: Duplicate %s ISA extension: \'%s\'"),
  468. + (_("-march=%s: duplicate %s ISA extension `%s'"),
  469. march, config->prefix, subset);
  470. free (subset);
  471. return NULL;
  472. }
  473. - /* Check that we are in alphabetical order within the subset. */
  474. + /* Check that the extension is in alphabetical order. */
  475. if (!strncasecmp (last_name, config->prefix, 1)
  476. && strcasecmp (last_name, subset) > 0)
  477. {
  478. rps->error_handler
  479. - (_("\
  480. --march=%s: %s ISA extension not in alphabetical order: \'%s\' must come before \'%s\'."),
  481. + (_("-march=%s: %s ISA extension `%s' is not in alphabetical "
  482. + "order. It must come before `%s'"),
  483. march, config->prefix, subset, last_name);
  484. free (subset);
  485. return NULL;
  486. @@ -1397,15 +1389,17 @@ riscv_parse_prefixed_ext (riscv_parse_subset_t *rps,
  487. &major_version,
  488. &minor_version);
  489. riscv_add_subset (rps->subset_list, subset,
  490. - major_version, minor_version);
  491. + major_version,
  492. + minor_version);
  493. free (subset);
  494. p += end_of_version - subset;
  495. if (*p != '\0' && *p != '_')
  496. {
  497. - rps->error_handler (_("-march=%s: %s must separate with _"),
  498. - march, config->prefix);
  499. + rps->error_handler
  500. + (_("-march=%s: %s ISA extension must separate with _"),
  501. + march, config->prefix);
  502. return NULL;
  503. }
  504. }
  505. @@ -1413,30 +1407,26 @@ riscv_parse_prefixed_ext (riscv_parse_subset_t *rps,
  506. return p;
  507. }
  508. -/* List of Z-class extensions that binutils should know about.
  509. - Whether or not a particular entry is in this list will
  510. - dictate if gas/ld will accept its presence in the -march
  511. - string.
  512. +/* Lists of prefixed class extensions that binutils should know about.
  513. + Whether or not a particular entry is in these lists will dictate if
  514. + gas/ld will accept its presence in the architecture string.
  515. - Example: To add an extension called "Zbb" (bitmanip base extension),
  516. - add "zbb" string to the list (all lowercase).
  517. -
  518. - Keep this list alphabetically ordered. */
  519. + Please add the extensions to the lists in lower case. However, keep
  520. + these subsets in alphabetical order in these tables is recommended,
  521. + although there is no impact on the current implementation. */
  522. static const char * const riscv_std_z_ext_strtab[] =
  523. - {
  524. - "zicsr", NULL
  525. - };
  526. -
  527. -/* Same as `riscv_std_z_ext_strtab', but for S-class extensions. */
  528. +{
  529. + "zicsr", NULL
  530. +};
  531. static const char * const riscv_std_s_ext_strtab[] =
  532. - {
  533. - NULL
  534. - };
  535. +{
  536. + NULL
  537. +};
  538. -/* For the extension EXT, search through the list of known extensions
  539. - KNOWN_EXTS for a match, and return TRUE if found. */
  540. +/* For the extension `ext`, search through the list of known extensions
  541. + `known_exts` for a match, and return TRUE if found. */
  542. static bfd_boolean
  543. riscv_multi_letter_ext_valid_p (const char *ext,
  544. @@ -1473,7 +1463,7 @@ riscv_ext_z_valid_p (const char *arg)
  545. }
  546. /* Predicator function for 's' prefixed extensions.
  547. - Must be either literal 's', or a known s-prefixed extension. */
  548. + Only known s-extensions are permitted. */
  549. static bfd_boolean
  550. riscv_ext_s_valid_p (const char *arg)
  551. @@ -1481,14 +1471,15 @@ riscv_ext_s_valid_p (const char *arg)
  552. return riscv_multi_letter_ext_valid_p (arg, riscv_std_s_ext_strtab);
  553. }
  554. -/* Parsing order that is specified by the ISA manual. */
  555. +/* Parsing order of the prefixed extensions that is specified by
  556. + the ISA spec. */
  557. static const riscv_parse_config_t parse_config[] =
  558. {
  559. - {RV_ISA_CLASS_S, "s", riscv_ext_s_valid_p},
  560. - {RV_ISA_CLASS_Z, "z", riscv_ext_z_valid_p},
  561. - {RV_ISA_CLASS_X, "x", riscv_ext_x_valid_p},
  562. - {RV_ISA_CLASS_UNKNOWN, NULL, NULL}
  563. + {RV_ISA_CLASS_S, "s", riscv_ext_s_valid_p},
  564. + {RV_ISA_CLASS_Z, "z", riscv_ext_z_valid_p},
  565. + {RV_ISA_CLASS_X, "x", riscv_ext_x_valid_p},
  566. + {RV_ISA_CLASS_UNKNOWN, NULL, NULL}
  567. };
  568. /* Function for parsing arch string.
  569. @@ -1497,8 +1488,8 @@ static const riscv_parse_config_t parse_config[] =
  570. Return TRUE on success.
  571. Arguments:
  572. - `rps`: Hooks and status for parsing subset.
  573. - `arch`: Arch string. */
  574. + `rps`: Hooks and status for parsing extensions.
  575. + `arch`: Full arch string. */
  576. bfd_boolean
  577. riscv_parse_subset (riscv_parse_subset_t *rps,
  578. @@ -1538,12 +1529,13 @@ riscv_parse_subset (riscv_parse_subset_t *rps,
  579. return FALSE;
  580. /* Parse the different classes of extensions in the specified order. */
  581. - for (i = 0; i < ARRAY_SIZE (parse_config); ++i) {
  582. - p = riscv_parse_prefixed_ext (rps, arch, p, &parse_config[i]);
  583. + for (i = 0; i < ARRAY_SIZE (parse_config); ++i)
  584. + {
  585. + p = riscv_parse_prefixed_ext (rps, arch, p, &parse_config[i]);
  586. - if (p == NULL)
  587. - return FALSE;
  588. - }
  589. + if (p == NULL)
  590. + return FALSE;
  591. + }
  592. if (*p != '\0')
  593. {
  594. @@ -1552,6 +1544,7 @@ riscv_parse_subset (riscv_parse_subset_t *rps,
  595. return FALSE;
  596. }
  597. + /* Check the conflicts. */
  598. if (riscv_lookup_subset (rps->subset_list, "e")
  599. && riscv_lookup_subset (rps->subset_list, "f"))
  600. {
  601. @@ -1561,6 +1554,14 @@ riscv_parse_subset (riscv_parse_subset_t *rps,
  602. return FALSE;
  603. }
  604. + if (riscv_lookup_subset (rps->subset_list, "q") && *rps->xlen < 64)
  605. + {
  606. + rps->error_handler
  607. + (_("-march=%s: rv32 does not support the `q' extension"),
  608. + arch);
  609. + return FALSE;
  610. + }
  611. +
  612. if (riscv_lookup_subset (rps->subset_list, "d")
  613. && !riscv_lookup_subset (rps->subset_list, "f"))
  614. {
  615. @@ -1579,13 +1580,6 @@ riscv_parse_subset (riscv_parse_subset_t *rps,
  616. return FALSE;
  617. }
  618. - if (riscv_lookup_subset (rps->subset_list, "q") && *rps->xlen < 64)
  619. - {
  620. - rps->error_handler
  621. - (_("-march=%s: rv32 does not support the `q' extension"),
  622. - arch);
  623. - return FALSE;
  624. - }
  625. return TRUE;
  626. }
  627. diff --git a/bfd/elfxx-riscv.h b/bfd/elfxx-riscv.h
  628. index c91b169e99..b5b17d1687 100644
  629. --- a/bfd/elfxx-riscv.h
  630. +++ b/bfd/elfxx-riscv.h
  631. @@ -46,7 +46,8 @@ struct riscv_subset_t
  632. typedef struct riscv_subset_t riscv_subset_t;
  633. -typedef struct {
  634. +typedef struct
  635. +{
  636. riscv_subset_t *head;
  637. riscv_subset_t *tail;
  638. } riscv_subset_list_t;
  639. @@ -68,14 +69,15 @@ riscv_lookup_subset_version (const riscv_subset_list_t *,
  640. const char *,
  641. int, int);
  642. -typedef struct {
  643. +typedef struct
  644. +{
  645. riscv_subset_list_t *subset_list;
  646. void (*error_handler) (const char *,
  647. ...) ATTRIBUTE_PRINTF_1;
  648. unsigned *xlen;
  649. void (*get_default_version) (const char *,
  650. - unsigned int *,
  651. - unsigned int *);
  652. + unsigned int *,
  653. + unsigned int *);
  654. } riscv_parse_subset_t;
  655. extern bfd_boolean
  656. @@ -95,18 +97,15 @@ extern size_t
  657. riscv_estimate_digit (unsigned);
  658. /* ISA extension name class. E.g. "zbb" corresponds to RV_ISA_CLASS_Z,
  659. - "xargs" corresponds to RV_ISA_CLASS_X, etc. Order is important
  660. - here. */
  661. + "xargs" corresponds to RV_ISA_CLASS_X, etc. */
  662. typedef enum riscv_isa_ext_class
  663. - {
  664. - RV_ISA_CLASS_S,
  665. - RV_ISA_CLASS_Z,
  666. - RV_ISA_CLASS_X,
  667. - RV_ISA_CLASS_UNKNOWN
  668. - } riscv_isa_ext_class_t;
  669. -
  670. -/* Classify the argument 'ext' into one of riscv_isa_ext_class_t. */
  671. +{
  672. + RV_ISA_CLASS_S,
  673. + RV_ISA_CLASS_Z,
  674. + RV_ISA_CLASS_X,
  675. + RV_ISA_CLASS_UNKNOWN
  676. +} riscv_isa_ext_class_t;
  677. riscv_isa_ext_class_t
  678. riscv_get_prefix_class (const char *);
  679. diff --git a/gas/testsuite/gas/riscv/march-fail-base-01.d b/gas/testsuite/gas/riscv/march-fail-base-01.d
  680. new file mode 100644
  681. index 0000000000..68cd453111
  682. --- /dev/null
  683. +++ b/gas/testsuite/gas/riscv/march-fail-base-01.d
  684. @@ -0,0 +1,3 @@
  685. +#as: -march=rv32m
  686. +#source: empty.s
  687. +#error_output: march-fail-base-01.l
  688. diff --git a/gas/testsuite/gas/riscv/march-fail-base-01.l b/gas/testsuite/gas/riscv/march-fail-base-01.l
  689. new file mode 100644
  690. index 0000000000..9fa071f5b0
  691. --- /dev/null
  692. +++ b/gas/testsuite/gas/riscv/march-fail-base-01.l
  693. @@ -0,0 +1,2 @@
  694. +.*Assembler messages:
  695. +.*Fatal error: .*first ISA extension must be `e', `i' or `g'
  696. diff --git a/gas/testsuite/gas/riscv/march-fail-base-02.d b/gas/testsuite/gas/riscv/march-fail-base-02.d
  697. new file mode 100644
  698. index 0000000000..cfe085ab21
  699. --- /dev/null
  700. +++ b/gas/testsuite/gas/riscv/march-fail-base-02.d
  701. @@ -0,0 +1,3 @@
  702. +#as: -march=rv64e
  703. +#source: empty.s
  704. +#error_output: march-fail-base-02.l
  705. diff --git a/gas/testsuite/gas/riscv/march-fail-base-02.l b/gas/testsuite/gas/riscv/march-fail-base-02.l
  706. new file mode 100644
  707. index 0000000000..6fc4dfa7ba
  708. --- /dev/null
  709. +++ b/gas/testsuite/gas/riscv/march-fail-base-02.l
  710. @@ -0,0 +1,2 @@
  711. +.*Assembler messages:
  712. +.*Fatal error: .*rv64e is not a valid base ISA
  713. diff --git a/gas/testsuite/gas/riscv/march-fail-rv32imc.d b/gas/testsuite/gas/riscv/march-fail-order-std.d
  714. similarity index 50%
  715. rename from gas/testsuite/gas/riscv/march-fail-rv32imc.d
  716. rename to gas/testsuite/gas/riscv/march-fail-order-std.d
  717. index 1cb4d9ef0b..b9c7e09de1 100644
  718. --- a/gas/testsuite/gas/riscv/march-fail-rv32imc.d
  719. +++ b/gas/testsuite/gas/riscv/march-fail-order-std.d
  720. @@ -1,3 +1,3 @@
  721. #as: -march=rv32iamfd
  722. #source: empty.s
  723. -#error_output: march-fail-rv32imc.l
  724. +#error_output: march-fail-order-std.l
  725. diff --git a/gas/testsuite/gas/riscv/march-fail-order-std.l b/gas/testsuite/gas/riscv/march-fail-order-std.l
  726. new file mode 100644
  727. index 0000000000..666a8c0d2c
  728. --- /dev/null
  729. +++ b/gas/testsuite/gas/riscv/march-fail-order-std.l
  730. @@ -0,0 +1,2 @@
  731. +.*Assembler messages:
  732. +.*Fatal error: .*standard ISA extension `m' is not in canonical order
  733. diff --git a/gas/testsuite/gas/riscv/march-fail-order-x.d b/gas/testsuite/gas/riscv/march-fail-order-x.d
  734. new file mode 100644
  735. index 0000000000..72a821ef8e
  736. --- /dev/null
  737. +++ b/gas/testsuite/gas/riscv/march-fail-order-x.d
  738. @@ -0,0 +1,3 @@
  739. +#as: -march=rv32i_xbargle2p0_xargle2p0
  740. +#source: empty.s
  741. +#error_output: march-fail-order-x.l
  742. diff --git a/gas/testsuite/gas/riscv/march-fail-order-x.l b/gas/testsuite/gas/riscv/march-fail-order-x.l
  743. new file mode 100644
  744. index 0000000000..f7b383d855
  745. --- /dev/null
  746. +++ b/gas/testsuite/gas/riscv/march-fail-order-x.l
  747. @@ -0,0 +1,2 @@
  748. +.*Assembler messages:
  749. +.*Fatal error: .*x ISA extension `xargle' is not in alphabetical order. It must come before `xbargle'
  750. diff --git a/gas/testsuite/gas/riscv/march-fail-porder-x-std.d b/gas/testsuite/gas/riscv/march-fail-porder-x-std.d
  751. new file mode 100644
  752. index 0000000000..2bef073464
  753. --- /dev/null
  754. +++ b/gas/testsuite/gas/riscv/march-fail-porder-x-std.d
  755. @@ -0,0 +1,3 @@
  756. +#as: -march=rv32i_xargle2p0_mafd
  757. +#source: empty.s
  758. +#error_output: march-fail-porder.l
  759. diff --git a/gas/testsuite/gas/riscv/march-fail-porder-x-z.d b/gas/testsuite/gas/riscv/march-fail-porder-x-z.d
  760. new file mode 100644
  761. index 0000000000..094180ddd0
  762. --- /dev/null
  763. +++ b/gas/testsuite/gas/riscv/march-fail-porder-x-z.d
  764. @@ -0,0 +1,3 @@
  765. +#as: -march=rv32i_xargle2p0_zicsr2p0
  766. +#source: empty.s
  767. +#error_output: march-fail-porder.l
  768. diff --git a/gas/testsuite/gas/riscv/march-fail-porder-z-std.d b/gas/testsuite/gas/riscv/march-fail-porder-z-std.d
  769. new file mode 100644
  770. index 0000000000..1fa1a159f3
  771. --- /dev/null
  772. +++ b/gas/testsuite/gas/riscv/march-fail-porder-z-std.d
  773. @@ -0,0 +1,3 @@
  774. +#as: -march=rv32i_zicsr2p0_mafd
  775. +#source: empty.s
  776. +#error_output: march-fail-porder.l
  777. diff --git a/gas/testsuite/gas/riscv/march-fail-porder.l b/gas/testsuite/gas/riscv/march-fail-porder.l
  778. new file mode 100644
  779. index 0000000000..a06d586580
  780. --- /dev/null
  781. +++ b/gas/testsuite/gas/riscv/march-fail-porder.l
  782. @@ -0,0 +1,2 @@
  783. +.*Assembler messages:
  784. +.*Fatal error: .*unexpected ISA string at end:.*
  785. diff --git a/gas/testsuite/gas/riscv/march-fail-rv32ef.l b/gas/testsuite/gas/riscv/march-fail-rv32ef.l
  786. index 15e56c8bdc..d2d915d872 100644
  787. --- a/gas/testsuite/gas/riscv/march-fail-rv32ef.l
  788. +++ b/gas/testsuite/gas/riscv/march-fail-rv32ef.l
  789. @@ -1,2 +1,2 @@
  790. -Assembler messages:
  791. -Fatal error: -march=rv32ef: rv32e does not support the `f' extension
  792. +.*Assembler messages:
  793. +.*Fatal error: .*rv32e does not support the `f' extension
  794. diff --git a/gas/testsuite/gas/riscv/march-fail-rv32i.d b/gas/testsuite/gas/riscv/march-fail-rv32i.d
  795. deleted file mode 100644
  796. index 1e6e9e0868..0000000000
  797. --- a/gas/testsuite/gas/riscv/march-fail-rv32i.d
  798. +++ /dev/null
  799. @@ -1,3 +0,0 @@
  800. -#as: -march=rv32I
  801. -#source: empty.s
  802. -#error_output: march-fail-rv32i.l
  803. diff --git a/gas/testsuite/gas/riscv/march-fail-rv32i.l b/gas/testsuite/gas/riscv/march-fail-rv32i.l
  804. deleted file mode 100644
  805. index 1977aede3b..0000000000
  806. --- a/gas/testsuite/gas/riscv/march-fail-rv32i.l
  807. +++ /dev/null
  808. @@ -1,2 +0,0 @@
  809. -Assembler messages:
  810. -Fatal error: -march=rv32I: first ISA subset must be `e', `i' or `g'
  811. diff --git a/gas/testsuite/gas/riscv/march-fail-rv32iam.d b/gas/testsuite/gas/riscv/march-fail-rv32iam.d
  812. deleted file mode 100644
  813. index 054cf4d28b..0000000000
  814. --- a/gas/testsuite/gas/riscv/march-fail-rv32iam.d
  815. +++ /dev/null
  816. @@ -1,3 +0,0 @@
  817. -#as: -march=rv32iam
  818. -#source: empty.s
  819. -#error_output: march-fail-rv32iam.l
  820. diff --git a/gas/testsuite/gas/riscv/march-fail-rv32iam.l b/gas/testsuite/gas/riscv/march-fail-rv32iam.l
  821. deleted file mode 100644
  822. index c7786f82ea..0000000000
  823. --- a/gas/testsuite/gas/riscv/march-fail-rv32iam.l
  824. +++ /dev/null
  825. @@ -1,2 +0,0 @@
  826. -Assembler messages:
  827. -Fatal error: -march=rv32iam: ISA string is not in canonical order. `m'
  828. diff --git a/gas/testsuite/gas/riscv/march-fail-rv32ic.d b/gas/testsuite/gas/riscv/march-fail-rv32ic.d
  829. deleted file mode 100644
  830. index b419a654bd..0000000000
  831. --- a/gas/testsuite/gas/riscv/march-fail-rv32ic.d
  832. +++ /dev/null
  833. @@ -1,3 +0,0 @@
  834. -#as: -march=rv32iC
  835. -#source: empty.s
  836. -#error_output: march-fail-rv32ic.l
  837. diff --git a/gas/testsuite/gas/riscv/march-fail-rv32ic.l b/gas/testsuite/gas/riscv/march-fail-rv32ic.l
  838. deleted file mode 100644
  839. index d24ea2fd03..0000000000
  840. --- a/gas/testsuite/gas/riscv/march-fail-rv32ic.l
  841. +++ /dev/null
  842. @@ -1,2 +0,0 @@
  843. -Assembler messages:
  844. -Fatal error: -march=rv32iC: unsupported ISA subset `C'
  845. diff --git a/gas/testsuite/gas/riscv/march-fail-rv32icx2p.d b/gas/testsuite/gas/riscv/march-fail-rv32icx2p.d
  846. deleted file mode 100644
  847. index 51980906cd..0000000000
  848. --- a/gas/testsuite/gas/riscv/march-fail-rv32icx2p.d
  849. +++ /dev/null
  850. @@ -1,3 +0,0 @@
  851. -#as: -march=rv32icx2p
  852. -#source: empty.s
  853. -#error_output: march-fail-rv32icx2p.l
  854. diff --git a/gas/testsuite/gas/riscv/march-fail-rv32icx2p.l b/gas/testsuite/gas/riscv/march-fail-rv32icx2p.l
  855. deleted file mode 100644
  856. index 25627d4054..0000000000
  857. --- a/gas/testsuite/gas/riscv/march-fail-rv32icx2p.l
  858. +++ /dev/null
  859. @@ -1,2 +0,0 @@
  860. -Assembler messages:
  861. -Fatal error: -march=rv32icx2p: Expect number after `2p'.
  862. diff --git a/gas/testsuite/gas/riscv/march-fail-rv32id.d b/gas/testsuite/gas/riscv/march-fail-rv32id.d
  863. new file mode 100644
  864. index 0000000000..de741cbc81
  865. --- /dev/null
  866. +++ b/gas/testsuite/gas/riscv/march-fail-rv32id.d
  867. @@ -0,0 +1,3 @@
  868. +#as: -march=rv32id
  869. +#source: empty.s
  870. +#error_output: march-fail-rv32id.l
  871. diff --git a/gas/testsuite/gas/riscv/march-fail-rv32id.l b/gas/testsuite/gas/riscv/march-fail-rv32id.l
  872. new file mode 100644
  873. index 0000000000..29b2717ef7
  874. --- /dev/null
  875. +++ b/gas/testsuite/gas/riscv/march-fail-rv32id.l
  876. @@ -0,0 +1,2 @@
  877. +.*Assembler messages:
  878. +.*Fatal error: .*`d' extension requires `f' extension
  879. diff --git a/gas/testsuite/gas/riscv/march-fail-rv32imc.l b/gas/testsuite/gas/riscv/march-fail-rv32imc.l
  880. deleted file mode 100644
  881. index d922e9d348..0000000000
  882. --- a/gas/testsuite/gas/riscv/march-fail-rv32imc.l
  883. +++ /dev/null
  884. @@ -1,2 +0,0 @@
  885. -Assembler messages:
  886. -Fatal error: -march=rv32iamfd: ISA string is not in canonical order. `m'
  887. diff --git a/gas/testsuite/gas/riscv/march-fail-rv32iq.d b/gas/testsuite/gas/riscv/march-fail-rv32iq.d
  888. new file mode 100644
  889. index 0000000000..c289c695ca
  890. --- /dev/null
  891. +++ b/gas/testsuite/gas/riscv/march-fail-rv32iq.d
  892. @@ -0,0 +1,3 @@
  893. +#as: -march=rv32iq
  894. +#source: empty.s
  895. +#error_output: march-fail-rv32iq.l
  896. diff --git a/gas/testsuite/gas/riscv/march-fail-rv32iq.l b/gas/testsuite/gas/riscv/march-fail-rv32iq.l
  897. new file mode 100644
  898. index 0000000000..361c381b86
  899. --- /dev/null
  900. +++ b/gas/testsuite/gas/riscv/march-fail-rv32iq.l
  901. @@ -0,0 +1,2 @@
  902. +.*Assembler messages:
  903. +.*Fatal error: .*rv32 does not support the `q' extension
  904. diff --git a/gas/testsuite/gas/riscv/march-fail-rv64I.d b/gas/testsuite/gas/riscv/march-fail-rv64I.d
  905. deleted file mode 100644
  906. index e00a6f86eb..0000000000
  907. --- a/gas/testsuite/gas/riscv/march-fail-rv64I.d
  908. +++ /dev/null
  909. @@ -1,3 +0,0 @@
  910. -#as: -march=rv64I
  911. -#source: empty.s
  912. -#error_output: march-fail-rv64I.l
  913. diff --git a/gas/testsuite/gas/riscv/march-fail-rv64I.l b/gas/testsuite/gas/riscv/march-fail-rv64I.l
  914. deleted file mode 100644
  915. index 5b46e77d4b..0000000000
  916. --- a/gas/testsuite/gas/riscv/march-fail-rv64I.l
  917. +++ /dev/null
  918. @@ -1,2 +0,0 @@
  919. -Assembler messages:
  920. -Fatal error: -march=rv64I: first ISA subset must be `e', `i' or `g'
  921. diff --git a/gas/testsuite/gas/riscv/march-fail-rv64e.d b/gas/testsuite/gas/riscv/march-fail-rv64e.d
  922. deleted file mode 100644
  923. index 38d73db474..0000000000
  924. --- a/gas/testsuite/gas/riscv/march-fail-rv64e.d
  925. +++ /dev/null
  926. @@ -1,3 +0,0 @@
  927. -#as: -march=rv64e
  928. -#source: empty.s
  929. -#error_output: march-fail-rv64e.l
  930. diff --git a/gas/testsuite/gas/riscv/march-fail-rv64e.l b/gas/testsuite/gas/riscv/march-fail-rv64e.l
  931. deleted file mode 100644
  932. index 85f755462f..0000000000
  933. --- a/gas/testsuite/gas/riscv/march-fail-rv64e.l
  934. +++ /dev/null
  935. @@ -1,2 +0,0 @@
  936. -Assembler messages:
  937. -Fatal error: -march=rv64e: rv64e is not a valid base ISA
  938. diff --git a/gas/testsuite/gas/riscv/march-fail-rv64iq.d b/gas/testsuite/gas/riscv/march-fail-rv64iq.d
  939. new file mode 100644
  940. index 0000000000..c97a812cb3
  941. --- /dev/null
  942. +++ b/gas/testsuite/gas/riscv/march-fail-rv64iq.d
  943. @@ -0,0 +1,3 @@
  944. +#as: -march=rv64iq
  945. +#source: empty.s
  946. +#error_output: march-fail-rv64iq.l
  947. diff --git a/gas/testsuite/gas/riscv/march-fail-rv64iq.l b/gas/testsuite/gas/riscv/march-fail-rv64iq.l
  948. new file mode 100644
  949. index 0000000000..76a41043e3
  950. --- /dev/null
  951. +++ b/gas/testsuite/gas/riscv/march-fail-rv64iq.l
  952. @@ -0,0 +1,2 @@
  953. +.*Assembler messages:
  954. +.*Fatal error: .*`q' extension requires `d' extension
  955. diff --git a/gas/testsuite/gas/riscv/march-fail-s-with-version.d b/gas/testsuite/gas/riscv/march-fail-s-with-version.d
  956. deleted file mode 100644
  957. index 9881c2a0e0..0000000000
  958. --- a/gas/testsuite/gas/riscv/march-fail-s-with-version.d
  959. +++ /dev/null
  960. @@ -1,6 +0,0 @@
  961. -#as: -march=rv32isfoo3p4
  962. -#objdump: -dr
  963. -#source: empty.s
  964. -#error_output: march-fail-s-with-version.l
  965. -
  966. -.*: file format elf32-littleriscv
  967. diff --git a/gas/testsuite/gas/riscv/march-fail-s-with-version.l b/gas/testsuite/gas/riscv/march-fail-s-with-version.l
  968. deleted file mode 100644
  969. index 6b1f957276..0000000000
  970. --- a/gas/testsuite/gas/riscv/march-fail-s-with-version.l
  971. +++ /dev/null
  972. @@ -1,2 +0,0 @@
  973. -Assembler messages:
  974. -.*: Invalid or unknown s ISA extension: 'sfoo'
  975. diff --git a/gas/testsuite/gas/riscv/march-fail-s.d b/gas/testsuite/gas/riscv/march-fail-s.d
  976. deleted file mode 100644
  977. index ebc8377aaf..0000000000
  978. --- a/gas/testsuite/gas/riscv/march-fail-s.d
  979. +++ /dev/null
  980. @@ -1,6 +0,0 @@
  981. -#as: -march=rv32isfoo
  982. -#objdump: -dr
  983. -#source: empty.s
  984. -#error_output: march-fail-s.l
  985. -
  986. -.*: file format elf32-littleriscv
  987. diff --git a/gas/testsuite/gas/riscv/march-fail-s.l b/gas/testsuite/gas/riscv/march-fail-s.l
  988. deleted file mode 100644
  989. index 6b1f957276..0000000000
  990. --- a/gas/testsuite/gas/riscv/march-fail-s.l
  991. +++ /dev/null
  992. @@ -1,2 +0,0 @@
  993. -Assembler messages:
  994. -.*: Invalid or unknown s ISA extension: 'sfoo'
  995. diff --git a/gas/testsuite/gas/riscv/march-fail-single-char-s.d b/gas/testsuite/gas/riscv/march-fail-single-char-s.d
  996. new file mode 100644
  997. index 0000000000..b3aace9122
  998. --- /dev/null
  999. +++ b/gas/testsuite/gas/riscv/march-fail-single-char-s.d
  1000. @@ -0,0 +1,3 @@
  1001. +#as: -march=rv32is
  1002. +#source: empty.s
  1003. +#error_output: march-fail-single-char.l
  1004. diff --git a/gas/testsuite/gas/riscv/march-fail-single-char-x.d b/gas/testsuite/gas/riscv/march-fail-single-char-x.d
  1005. new file mode 100644
  1006. index 0000000000..585608cb82
  1007. --- /dev/null
  1008. +++ b/gas/testsuite/gas/riscv/march-fail-single-char-x.d
  1009. @@ -0,0 +1,3 @@
  1010. +#as: -march=rv32ix
  1011. +#source: empty.s
  1012. +#error_output: march-fail-single-char.l
  1013. diff --git a/gas/testsuite/gas/riscv/march-fail-single-char-z.d b/gas/testsuite/gas/riscv/march-fail-single-char-z.d
  1014. new file mode 100644
  1015. index 0000000000..daf96d2124
  1016. --- /dev/null
  1017. +++ b/gas/testsuite/gas/riscv/march-fail-single-char-z.d
  1018. @@ -0,0 +1,3 @@
  1019. +#as: -march=rv32iz
  1020. +#source: empty.s
  1021. +#error_output: march-fail-single-char.l
  1022. diff --git a/gas/testsuite/gas/riscv/march-fail-single-char.l b/gas/testsuite/gas/riscv/march-fail-single-char.l
  1023. new file mode 100644
  1024. index 0000000000..aa87a8db1a
  1025. --- /dev/null
  1026. +++ b/gas/testsuite/gas/riscv/march-fail-single-char.l
  1027. @@ -0,0 +1,2 @@
  1028. +.*Assembler messages:
  1029. +.*Fatal error: .*unknown (s|z|x) ISA extension `(s|z|x)'
  1030. diff --git a/gas/testsuite/gas/riscv/march-fail-sx.d b/gas/testsuite/gas/riscv/march-fail-sx.d
  1031. deleted file mode 100644
  1032. index 144a85c2fb..0000000000
  1033. --- a/gas/testsuite/gas/riscv/march-fail-sx.d
  1034. +++ /dev/null
  1035. @@ -1,6 +0,0 @@
  1036. -#as: -march=rv32i_sxbar
  1037. -#objdump: -dr
  1038. -#source: empty.s
  1039. -#error_output: march-fail-sx.l
  1040. -
  1041. -.*: file format elf32-littleriscv
  1042. diff --git a/gas/testsuite/gas/riscv/march-fail-sx.l b/gas/testsuite/gas/riscv/march-fail-sx.l
  1043. deleted file mode 100644
  1044. index b8ead71a3b..0000000000
  1045. --- a/gas/testsuite/gas/riscv/march-fail-sx.l
  1046. +++ /dev/null
  1047. @@ -1,2 +0,0 @@
  1048. -Assembler messages:
  1049. -.*: Invalid or unknown s ISA extension: 'sxbar'
  1050. diff --git a/gas/testsuite/gas/riscv/march-fail-unknown-s.d b/gas/testsuite/gas/riscv/march-fail-unknown-s.d
  1051. new file mode 100644
  1052. index 0000000000..93be528db8
  1053. --- /dev/null
  1054. +++ b/gas/testsuite/gas/riscv/march-fail-unknown-s.d
  1055. @@ -0,0 +1,3 @@
  1056. +#as: -march=rv32isfoo2p0
  1057. +#source: empty.s
  1058. +#error_output: march-fail-unknown.l
  1059. diff --git a/gas/testsuite/gas/riscv/march-fail-unknown-std.d b/gas/testsuite/gas/riscv/march-fail-unknown-std.d
  1060. new file mode 100644
  1061. index 0000000000..709c8f0971
  1062. --- /dev/null
  1063. +++ b/gas/testsuite/gas/riscv/march-fail-unknown-std.d
  1064. @@ -0,0 +1,3 @@
  1065. +#as: -march=rv32iy
  1066. +#source: empty.s
  1067. +#error_output: march-fail-unknown-std.l
  1068. diff --git a/gas/testsuite/gas/riscv/march-fail-unknown-std.l b/gas/testsuite/gas/riscv/march-fail-unknown-std.l
  1069. new file mode 100644
  1070. index 0000000000..cb856377b3
  1071. --- /dev/null
  1072. +++ b/gas/testsuite/gas/riscv/march-fail-unknown-std.l
  1073. @@ -0,0 +1,2 @@
  1074. +.*Assembler messages:
  1075. +.*Fatal error: .*unknown standard ISA extension `[^eimafdqiglcbjtpvn]'
  1076. diff --git a/gas/testsuite/gas/riscv/march-fail-unknown-z.d b/gas/testsuite/gas/riscv/march-fail-unknown-z.d
  1077. new file mode 100644
  1078. index 0000000000..6ea7c48c39
  1079. --- /dev/null
  1080. +++ b/gas/testsuite/gas/riscv/march-fail-unknown-z.d
  1081. @@ -0,0 +1,3 @@
  1082. +#as: -march=rv32izfoo2p0
  1083. +#source: empty.s
  1084. +#error_output: march-fail-unknown.l
  1085. diff --git a/gas/testsuite/gas/riscv/march-fail-unknown.l b/gas/testsuite/gas/riscv/march-fail-unknown.l
  1086. new file mode 100644
  1087. index 0000000000..ac22fe60eb
  1088. --- /dev/null
  1089. +++ b/gas/testsuite/gas/riscv/march-fail-unknown.l
  1090. @@ -0,0 +1,2 @@
  1091. +.*Assembler messages:
  1092. +.*Fatal error: .*unknown (s|z) ISA extension `(s|z)foo'
  1093. diff --git a/gas/testsuite/gas/riscv/march-fail-uppercase-base.d b/gas/testsuite/gas/riscv/march-fail-uppercase-base.d
  1094. new file mode 100644
  1095. index 0000000000..74b55ea165
  1096. --- /dev/null
  1097. +++ b/gas/testsuite/gas/riscv/march-fail-uppercase-base.d
  1098. @@ -0,0 +1,3 @@
  1099. +#as: -march=rv32I
  1100. +#source: empty.s
  1101. +#error_output: march-fail-base-01.l
  1102. diff --git a/gas/testsuite/gas/riscv/march-fail-uppercase-std.d b/gas/testsuite/gas/riscv/march-fail-uppercase-std.d
  1103. new file mode 100644
  1104. index 0000000000..8bad1f9c3a
  1105. --- /dev/null
  1106. +++ b/gas/testsuite/gas/riscv/march-fail-uppercase-std.d
  1107. @@ -0,0 +1,3 @@
  1108. +#as: -march=rv32iC
  1109. +#source: empty.s
  1110. +#error_output: march-fail-uppercase.l
  1111. diff --git a/gas/testsuite/gas/riscv/march-fail-uppercase-z.d b/gas/testsuite/gas/riscv/march-fail-uppercase-z.d
  1112. new file mode 100644
  1113. index 0000000000..951cc59a94
  1114. --- /dev/null
  1115. +++ b/gas/testsuite/gas/riscv/march-fail-uppercase-z.d
  1116. @@ -0,0 +1,3 @@
  1117. +#as: -march=rv32ic_ziCSR
  1118. +#source: empty.s
  1119. +#error_output: march-fail-uppercase.l
  1120. diff --git a/gas/testsuite/gas/riscv/march-fail-uppercase.l b/gas/testsuite/gas/riscv/march-fail-uppercase.l
  1121. new file mode 100644
  1122. index 0000000000..2053135922
  1123. --- /dev/null
  1124. +++ b/gas/testsuite/gas/riscv/march-fail-uppercase.l
  1125. @@ -0,0 +1,2 @@
  1126. +.*Assembler messages:
  1127. +.*Fatal error: .*unknown (standard|z) ISA extension.*
  1128. diff --git a/gas/testsuite/gas/riscv/march-fail-version-x.d b/gas/testsuite/gas/riscv/march-fail-version-x.d
  1129. new file mode 100644
  1130. index 0000000000..8e140e3d5f
  1131. --- /dev/null
  1132. +++ b/gas/testsuite/gas/riscv/march-fail-version-x.d
  1133. @@ -0,0 +1,3 @@
  1134. +#as: -march=rv32i2p_zicsr2p0_xargle2p
  1135. +#source: empty.s
  1136. +#error_output: march-fail-version.l
  1137. diff --git a/gas/testsuite/gas/riscv/march-fail-version-z.d b/gas/testsuite/gas/riscv/march-fail-version-z.d
  1138. new file mode 100644
  1139. index 0000000000..73ca5794bf
  1140. --- /dev/null
  1141. +++ b/gas/testsuite/gas/riscv/march-fail-version-z.d
  1142. @@ -0,0 +1,3 @@
  1143. +#as: -march=rv32i2p_zicsr2p
  1144. +#source: empty.s
  1145. +#error_output: march-fail-version.l
  1146. diff --git a/gas/testsuite/gas/riscv/march-fail-version.l b/gas/testsuite/gas/riscv/march-fail-version.l
  1147. new file mode 100644
  1148. index 0000000000..b5d0b91350
  1149. --- /dev/null
  1150. +++ b/gas/testsuite/gas/riscv/march-fail-version.l
  1151. @@ -0,0 +1,2 @@
  1152. +.*Assembler messages:
  1153. +.*Fatal error: .*expect number after `2p'
  1154. --
  1155. 2.33.0