flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
revolution 02 Mar 2020, 14:50
I don't know anything about your CMake, but something that stands out from your error report is that "func_export" != "FUNC_EXPORT". Perhaps you need to match the lower/upper case.
Also, your sample code doesn't have enough lines (only 15 lines) because your error report shows line numbers greater than that. |
|||
![]() |
|
Mike090 02 Mar 2020, 15:03
revolution wrote: I don't know anything about your CMake, but something that stands out from your error report is that "func_export" != "FUNC_EXPORT". Perhaps you need to match the lower/upper case. In the assembly code, I changed the case of FUNC_EXPORT to lower case, but I got the same assembler error: Error: unrecognized opcode: 'func_export(testing)'. Yes, my sample program has 15 lines and the real program has many more lines to it. I did this to indicate that what I posted to the group was indeed a summary of the real program. So, what was posted was never assembled. I simply tried to summarize the real program as best I could. Anyway, the owner of the real program won't let me post it. It's a trivial program, but he said "nope." The posted program uses assembly instructions that were grabbed from different parts of the real program. I just wanted to show the use of the registers. So, there is no real logic in the posted program. It's not meant to do anything of substance. |
|||
![]() |
|
Mike090 02 Mar 2020, 15:10
When I searched the Internet to see what other people had done, I found only this. It didn't help me.
Subject: “Error: unsupported relocation against <register>” error with inline PPC assembly code in .c file https://stackoverflow.com/questions/30253742/error-unsupported-relocation-against-register-error-with-inline-ppc-assembl |
|||
![]() |
|
revolution 02 Mar 2020, 15:14
We don't know how you have defined your stuff. Perhaps your includes have done something weird.
Please make some minimal sample that you run through CMake and then show the errors for that file. Try not to use #include unless you can also post the included file. |
|||
![]() |
|
Mike090 02 Mar 2020, 15:33
As you requested, the error messages followed by the ARM assembly program without the includes is.
Code: testing.s: Assembler messages: testing.s:3: Error: unrecognized opcode: `func_export(testing)' testing.s:9: Error: unrecognized opcode: `func_begin(testing)' testing.s:13: Error: unrecognized opcode: `func_end(testing)' testing.s:10: Error: unsupported relocation against r3 testing.s:11: Error: unsupported relocation against r4 testing.s:11: Error: unsupported relocation against r4 testing.s:12: Error: unsupported relocation against r4 testing.s:12: Error: unsupported relocation against r4 testing.s:12: Error: unsupported relocation against r5 Code: #define _ASMLANGUAGE func_export(testing) .text .align 2 .long 0 .long 1 .globl testing func_begin(testing) li r3, 1 ori r4, r4, 0x1000 srw r4, r4, r5 func_end(testing) |
|||
![]() |
|
Mike090 02 Mar 2020, 15:45
The case of the registers doesn't remove the error. For example, if I change "r3" to "R3" throughout the assembly code I get the assembler error message:
Code:
Error: unsupported relocation against R3.
|
|||
![]() |
|
Mike090 02 Mar 2020, 16:17
What would the inline assembly look like for this program in c++?
|
|||
![]() |
|
Mike090 02 Mar 2020, 16:33
Mike090 wrote: What would the inline assembly look like for this program in c++? When I put the following code in the C++ source code, Code: __asm__ ( "movl $10, %eax;" "movl $20, %ebx;" "addl %ebx, %eax;" "li r3, 1" ); I get the following: Assembler messages: Error: unrecognized opcode: `movl' Error: unrecognized opcode: `movl' Error: unrecognized opcode: `addl' Error: unsupported relocation against r3 Last edited by Mike090 on 02 Mar 2020, 16:41; edited 1 time in total |
|||
![]() |
|
Mike090 02 Mar 2020, 16:37
This program is being run on Linux.
|
|||
![]() |
|
Mike090 02 Mar 2020, 17:06
When I compile using the "-v" option, I see that the compiler is GNU C++11 (version 8.2.0) and GNU assembler version 2.31.1 is the assembler. I obtained this information using the "-v" compiler option.
|
|||
![]() |
|
revolution 02 Mar 2020, 21:13
I can only offer generic advice because I have no idea what your CMake is.
'func_export' isn't an instruction. So I think the error message is accurate there. Is it a macro defined somewhere else? ARM doesn't have instructions movl or addl. So the error message is telling you that. The registers might be needed to be supplied as numbers, as is indicated by the SO page you linked above. Try starting with just a single instruction that has no parameters to make sure you can compile things. Then move up to gradually adding more things. Is there some example code in the docs? |
|||
![]() |
|
Mike090 03 Mar 2020, 13:31
Thank you for the information, someone else gave me additional useful information.
I was given the following two links: gcc.gnu.org/onlinedocs/gcc/Extended-Asm.htm stackoverflow.com/questions/199966/how-do-you-use-gcc-to-generate-assembly-code-in-intel-syntax So, I have to convert nonsense code similar to the following code from the "intel" dialect to the "att" dialect. Code: #define _ASMLANGUAGE #include “vxWorks.h” #include <ash.h> FUNC_EXPORT(testing) .text .align 2 .long 0 .long 1 .globl testing FUNC_BEGIN(testing) li r3, 1 ori r4, r4, 0x6789 srw r4, r4, r5 add r4, r4, r3 subi r3, r3, 2 cmplw r4, r5 bne GOIT FUNC_END(testing) GOIT: Question: Do you see any problems in converting these instructions to the "att" dialect? |
|||
![]() |
|
revolution 04 Mar 2020, 16:36
I'm not aware of any AT&T syntax defined for ARM code.
AFAIK there is only the ARM syntax. AT&T and Intel have never had any say about the ARM instructions. |
|||
![]() |
|
Mike090 04 Mar 2020, 18:44
I just put a percent sign in front of every register and it assembled without any errors.
|
|||
![]() |
|
revolution 05 Mar 2020, 06:32
Mike090 wrote: I just put a percent sign in front of every register and it assembled without any errors. But how did that fix the "Error: unrecognized opcode: ‘func_export(testing)’"? |
|||
![]() |
|
Mike090 05 Mar 2020, 12:36
That was completely deleted.
|
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.