This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

CMake Assembler Errors: unrecognized opcode:func_export / unsupported relocation against r3

(1) I’m getting CMake 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 within the CMake file to correct 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 <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

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 like —

extern “C” int testing(void);
//…
testing();
//…

Parents
  • Should I change the assembler being used? How do I do this with CMake? Where can I get the assembler? How do I install it? What do I do to use the new assembler?

    (1)If I test with inline assembly code,  I get assembler errors such as:

    Assembler messages:
    Error: unrecognized opcode: `movl'
    Error: unrecognized opcode: `movl'
    Error: unrecognized opcode: `addl'
    Error: unsupported relocation against r3

    (2) Question: What can I do about these errors by using a different assembler with CMake?

    My inline assembly code is the following.
     
             __asm__ ( "movl $10, %eax;"
                       "movl $20, %ebx;"
                       "addl %ebx, %eax;"
                       "li   r3, 1"
             );


    (4) If I put this assembly code in a separate file with a suffix "s" (testing.s) and add:

          extern "C" int testingt(void);

    to that same C++ file instead of using the inline assembly code, I get the same error messages plus "func_export", "func_begin" and "func_end" are also flagged as unrecognized opcodes.

        #define _ASMLANGUAGE

        func_export(testing)
        .text
        .align 2
        .long 0
        .long 1
        .globl testing
        func_begin(testing)
        movl $10, %eax;
        movl $20, %ebx;
        addl %ebx, %eax;
        li   r3, 1
        func_end(testing)

Reply
  • Should I change the assembler being used? How do I do this with CMake? Where can I get the assembler? How do I install it? What do I do to use the new assembler?

    (1)If I test with inline assembly code,  I get assembler errors such as:

    Assembler messages:
    Error: unrecognized opcode: `movl'
    Error: unrecognized opcode: `movl'
    Error: unrecognized opcode: `addl'
    Error: unsupported relocation against r3

    (2) Question: What can I do about these errors by using a different assembler with CMake?

    My inline assembly code is the following.
     
             __asm__ ( "movl $10, %eax;"
                       "movl $20, %ebx;"
                       "addl %ebx, %eax;"
                       "li   r3, 1"
             );


    (4) If I put this assembly code in a separate file with a suffix "s" (testing.s) and add:

          extern "C" int testingt(void);

    to that same C++ file instead of using the inline assembly code, I get the same error messages plus "func_export", "func_begin" and "func_end" are also flagged as unrecognized opcodes.

        #define _ASMLANGUAGE

        func_export(testing)
        .text
        .align 2
        .long 0
        .long 1
        .globl testing
        func_begin(testing)
        movl $10, %eax;
        movl $20, %ebx;
        addl %ebx, %eax;
        li   r3, 1
        func_end(testing)

Children