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

  • SEARCH
  • Home
  • 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 215669
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T18:29:32+00:00 2026-05-11T18:29:32+00:00

relocation truncated to fit: R_X86_64_PC32 against `.bss’ I’m getting this linker error in g++

  • 0

relocation truncated to fit: R_X86_64_PC32 against `.bss’

I’m getting this linker error in g++ when compiling:

The rest of the code isn’t material since this definition breaks my compilation. The time function is found in sys/time.h. Compiled on 64-Bit RHEL.

 long ntime() {

     struct timeval tp;

     gettimeofday(&tp, (struct timezone *)0);
     return (tp.tv_sec*1000 + tp.tv_usec / 1000);
 }

Tell me why this is wrong?

Thanks in advance.

  • 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-11T18:29:32+00:00Added an answer on May 11, 2026 at 6:29 pm

    Not sure why the linker error is occuring, but is there any particular reason for making the struct timeval static? Making it local is just as fast and makes your function threadsafe, while conserving heap (well, bss) space.

    Edit: Here’s the problem. You’ve exceeded 2GB in static heap space. Make some of that dynamically allocated, or change the memory model. In gcc this can be done by passing -mcmodel=medium and must be used on all object files. This may increase overhead somewhat, however.

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

Sidebar

Related Questions

ld: foo.o: relocation R_X86_64_PC32 against undefined symbol `bar' can not be used when making
Here is the error that I get: /usr/bin/ld: /usr/local/lib/libavcodec.a(avpacket.o): relocation R_X86_64_32S against `av_destruct_packet' can
I'm sort of stumped. This is the error I'm getting from gcc gcc -lm
I am trying to automate android app(Relocation services)using robotium. In this app there are
I've gotten this error message in Job History of merge replication job : Executed
I recently received a: ...relocation R_X86_64_32 against `a local symbol' can not be used
when compiling shared library which links boost and python libraries I receive error: /usr/bin/ld:
In relation to this stackoverflow question , how would I go about creating my
In relation to this question ( Efficient hashCode() implementation ) I have one more
My question is in relation this this answer. https://stackoverflow.com/a/8773953/1297775 I have read at many

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.