Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7620593
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T03:58:31+00:00 2026-05-31T03:58:31+00:00

This code compiles just fine on gcc, but when using llvm (llvm-gcc), it says

  • 0

This code compiles just fine on gcc, but when using llvm (llvm-gcc), it says "constant expression expected" on the line with ldr

The problem is the syntax: How do I specify the place where my array is? I do not want to hard-code the displacement in bytes: ldr r7, [pc, #some_shift] but to use a literal to keep the code clean and safe.

Any idea how to make it working?

.globl func_name

func_name:
     push   {r4, r5, r6, r7, r8, r9, sl, fp, ip, lr}

//[Some stripped code]

     add    r6, r6, sl, lsl #2
     sub    ip, ip, sl
     ldr    r7, =maskTable           // Here it crashes
     add    sl, sl, #4  @ 0x4

// Some stripped code here

     mov    r0, #0  @ 0x0 // return 0
     pop    {r4, r5, r6, r7, r8, r9, sl, fp, ip, pc}

     .word  0x00000000

.data
.align 5
maskTable:

    .word  0x00000000, 0x00000000, 0x00000000, 0x00000000
    .word  0x0000FFFF, 0x00000000, 0x00000000, 0x00000000
    .word  0xFFFFFFFF, 0x00000000, 0x00000000, 0x00000000
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T03:58:32+00:00Added an answer on May 31, 2026 at 3:58 am

    Try changing

    ldr r7, =maskTable
    

    to

    ldr r7, maskTable
    

    and remove

    .data
    

    section. It seems to be a bug/missing capability of gcc < 4.6 to deal with .data section

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The following code snippet compiles just fine on Mac OS X with gcc, but
I'm having a hard time using std::string::iterators in C++. This code compiles fine (still
This piece of code compiles and runs as expected on GCC 3.x and 4.x:
The following code does not compile with gcc 4.7 (20120114) , but compiles fine
I was using the topcoder C++ compiler, and although this code just run fine
The following code is crashing my application on startup. It compiles just fine but
I wrote this code that compiles on Solaris gcc it works fine too for
I have added some code which compiles cleanly and have just received this Windows
This code compiles fine: {-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies, FlexibleInstances, UndecidableInstances, FlexibleContexts, EmptyDataDecls, ScopedTypeVariables, TypeOperators,
I have non-template class with a templatized constructor. This code compiles for me. But

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.