(1) I'm getting CMake ARM assembler errors such as:
testing.s:137: Error: unrecognized opcode: 'func_export(testing)'
testing.s:146: Error: unrecognized opcode: 'func_begin(testing)'
testing.s:217: Error: unrecognized opcode: 'func_end(testing)'
testing.s:149: Error: unsupported relocation against r3
testing.s:162: Error: unsupported relocation against r4
testing.s:187: Error: unsupported relocation against r5
(2) Question: What can I do about these errors?
My assembly code (in file testing.s) looks something like the following code. I've removed a lot of it and am trying to be concise.
#define _ASMLANGUAGE
#include "vxWorks.h"
#include <asm.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
FUNC_END(testing)
(3) My CMakeLists.txt looks something like:
cmake_minimum_required (VERSION 2.6)
project(testing LANGUAGES CXX ASM)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -g -std=c++0x -Wextra -Wpedantic")
set(dir3 .../.../.../util/dir3)
add_executable(testing
${dir3}/one.cpp
${dir3}/testing.s
)
(4) File one.cpp looks something such as:
extern "C" int testing(void);
//...
testing();
//...
Thank you,
Mike,
I am sorry but this forum is a MASM forum that only deal with x86 and x86-64 assemblers.
Quote from: Mike090 on March 03, 2020, 12:12:07 AM
(1) I'm getting CMake ARM assembler errors such as:
testing.s:137: Error: unrecognized opcode: 'func_export(testing)'
testing.s:146: Error: unrecognized opcode: 'func_begin(testing)'
testing.s:217: Error: unrecognized opcode: 'func_end(testing)'
testing.s:149: Error: unsupported relocation against r3
testing.s:162: Error: unsupported relocation against r4
testing.s:187: Error: unsupported relocation against r5
(2) Question: What can I do about these errors?
My assembly code (in file testing.s) looks something like the following code. I've removed a lot of it and am trying to be concise.
#define _ASMLANGUAGE
#include "vxWorks.h"
#include <asm.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
FUNC_END(testing)
(3) My CMakeLists.txt looks something like:
cmake_minimum_required (VERSION 2.6)
project(testing LANGUAGES CXX ASM)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -g -std=c++0x -Wextra -Wpedantic")
set(dir3 .../.../.../util/dir3)
add_executable(testing
${dir3}/one.cpp
${dir3}/testing.s
)
(4) File one.cpp looks something such as:
extern "C" int testing(void);
//...
testing();
//...
Thank you,
Hi Mike090,
the FASMARM package is a free ARM cross-assembler add-on for FASM - http://arm.flatassembler.net/ (http://arm.flatassembler.net/)
Runs under Win32 (9x/NT/2K/XP/Vista/7/8/8.1/10) and LINUX. Plus a linkable object file for UNIX/LibC
FASMARM currently supports the full range of instructions for all 64-bit and 32-bit ARM processors and coprocessors up to v8.
FASMARM v1.43 - Cross assembler for ARM CPUs Forum - https://board.flatassembler.net/topic.php?t=4191 (https://board.flatassembler.net/topic.php?t=4191)
You can create a topic on the forum https://board.flatassembler.net/ (https://board.flatassembler.net/) :thumbsup:
FYI: I just found out that I'm not working with ARM assembly. What I posted is the "intel" dialect of x86 assembly. Since I have to remove the assembler errors, I have to convert this "intel" dialect code to the x86 "att" dialect.
Question: Does anyone have any ideas on how to do this, statement by statement?
I tried adding "-s masm=att" to my CMake file but it did not work. These options came from: https://stackoverflow.com/questions/199966/how-do-you-use-gcc-to-generate-assembly-code-in-intel-syntax (https://stackoverflow.com/questions/199966/how-do-you-use-gcc-to-generate-assembly-code-in-intel-syntax)
The following program is similar to my program. The below code does nothing. It's just a sequence of statements to show statements to convert to the "att" dialect of x86.
#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:
Is there a program on the Internet that converts from the "intel" style to the "AT&T" style? Does it have a detailed/good user manual that states how instructions are converted?
Quote from: Mike090 on March 04, 2020, 03:25:40 AM
FYI: I just found out that I'm not working with ARM assembly. What I posted is the "intel" dialect of x86 assembly. Since I have to remove the assembler errors, I have to convert this "intel" dialect code to the x86 "att" dialect.
Question: Does anyone have any ideas on how to do this, statement by statement?
I tried adding "-s masm=att" to my CMake file but it did not work. These options came from: https://stackoverflow.com/questions/199966/how-do-you-use-gcc-to-generate-assembly-code-in-intel-syntax (https://stackoverflow.com/questions/199966/how-do-you-use-gcc-to-generate-assembly-code-in-intel-syntax)
The following program is similar to my program. The below code does nothing. It's just a sequence of statements to show statements to convert to the "att" dialect of x86.
#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:
Is there a program on the Internet that converts from the "intel" style to the "AT&T" style? Does it have a detailed/good user manual that states how instructions are converted?
:tongue: This is PowerPC assembler, but not x86
vasm A portable and retargetable assembler - http://sun.hasenbraten.de/vasm/ (http://sun.hasenbraten.de/vasm/)
GNU
powerpc-gcc someprog.c -static