bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug gas/29004] various bugs in RISCV version of as


From: nelsonc1225 at sourceware dot org
Subject: [Bug gas/29004] various bugs in RISCV version of as
Date: Mon, 05 Sep 2022 08:50:52 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=29004

Nelson Chu <nelsonc1225 at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nelsonc1225 at sourceware dot 
org

--- Comment #2 from Nelson Chu <nelsonc1225 at sourceware dot org> ---
(In reply to Mark Manning from comment #0)
> The following macro has worked perfectly for decades with numerous versions
> of the GNU assembler for countless processors but fails with riscv.
> 
> .macro _header_ name, cfa
>   .section .data            // assemble into head space
>   .quad _thread
>   .set _thread, .
> 8:                          // address to link next word header against
>   hstring "\name"
>   .set lex, 0
>   .quad \cfa                // point header at new words cfa
>   .previous                 // assemble into list space
> .endm
> 
> 
> the .set _thread . is where it fails.  This was originally a highly critical
> bug for me as not having this macro in a working state killed my project but
> I found a workaround
> 
> ...
> .set _thread, 9f
> 9:
> ...

Not sure what's . fails mean.  I can get the same symbol value 8 for _thread,
when using . and 9f:

% cat tmp.s
.macro _header_ name, cfa
  .section .data            # assemble into head space
  .quad _thread
  .set _thread, .
8:                          # address to link next word header against
  .string "\name"
  .set lex, 0
  .quad \cfa                # point header at new words cfa
  .previous                 # assemble into list space
.endm

_header_ A, B
% riscv64-unknown-elf-as -mno-arch-attr tmp.s -o tmp.o
% riscv64-unknown-elf-readelf -Ws tmp.o   

Symbol table '.symtab' contains 7 entries:
   Num:    Value          Size Type    Bind   Vis      Ndx Name
     0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND 
     1: 0000000000000000     0 SECTION LOCAL  DEFAULT    1 .text
     2: 0000000000000000     0 SECTION LOCAL  DEFAULT    2 .data
     3: 0000000000000000     0 SECTION LOCAL  DEFAULT    4 .bss
     4: 0000000000000008     0 NOTYPE  LOCAL  DEFAULT    2 _thread
     5: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  ABS lex
     6: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND B

> Second problem,  the RISCV version of the GNU assembler does not allow me to
> alias register names so now i have to remember that x29 is my floating point
> stack pointer, x28 is my return stack pointer, x27 is my parameter stack
> pointer, x26 is my interpretive pointer and x25 and x24 are my w1 and w2
> working registers respectively.

Could you please share which directive or which method that you expect to alias
register names?  Thanks.

> Last bug,  for some reason I cannot do .ascii "abcd;efgh" because the
> semicolon throws things off... i cant even explain the error here it
> literally makes no sense based on the text of the source...
> 
> compile.s:207: Error: junk at end of line, first unrecognized character is
> `:'

I don't get error for this...

% cat tmp.s
.ascii "abcd;efgh"
% riscv64-unknown-elf-as -mno-arch-attr tmp.s -o tmp.o
% riscv64-unknown-elf-objdump -sj .text tmp.o         

tmp.o:     file format elf64-littleriscv

Contents of section .text:
 0000 61626364 3b656667 68000000           abcd;efgh... 

> 
> where line 207 is...
> .colon "(;)", p_semi
> 
> and this is the macros it invokes which works flawlessly if there is no ; in
> the word name....
> 
> .macro .colon name, cfa
>   .header "\name", \cfa
> \cfa:
>   jal x25, nest
> .endm

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]