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 179961

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T14:30:01+00:00 2026-05-11T14:30:01+00:00

We are using a legacy compiler, based on gcc 2.6.0, to cross compile for

  • 0

We are using a legacy compiler, based on gcc 2.6.0, to cross compile for an old imbedded processor we are still using (yes, it is still in use since 1994!). The engineer that did the gcc port for this chip has long since moved on. Although we might be able to recover the gcc 2.6.0 source from somewhere on the web, the change set for this chip has disappeared in the halls of corporate history. We have muddled along until recently as the compiler still ran and produced workable executables, but as of linux kernel 2.6.25 (and also 2.6.26) it fails with the message gcc: virtual memory exhausted… even when run with no parameters or with only -v. I have rebooted my development system (from 2.6.26) using the 2.6.24 kernel and the compiler works again (rebooting with 2.6.25 does not).

We have one system that we are keeping at 2.6.24 just for the purpose of doing builds for this chip, but are feeling a bit exposed in case the linux world moves on to the point that we cannot any longer rebuild a system that will run the compiler (i.e. our 2.6.24 system dies and we cannot get 2.6.24 to install and run on a new system because some of the software parts are no longer available).

Does anyone have any ideas for what we might be able to do to a more modern installation to get this legacy compiler to run?

Edit:

To answer some of the comments…

Sadly it is the source code changes that are specific to our chip that are lost. This loss occurred over two major company reorgs and several sysadmins (a couple of which really left a mess). We now use configuration control, but that is closing the barn door too late for this problem.

The use of a VM is a good idea, and may be what we end up doing. Thank you for that idea.

Finally, I tried strace as ephemient suggested and found that the last system call was brk() which returned an error on the new system (2.6.26 kernel) and returned success on the old system (2.6.24 kernel). This would indicate that I really am running out of virtual memory, except that tcsh ‘limit’ returns the same values on old and new systems, and /proc/meminfo shows the new systems has slightly more memory and quite a bit more swap space. Maybe it is a problem of fragmentation or where the program is being loaded?

I did some further research and ‘brk randomization’ was added in kernel 2.6.25, however CONFIG_COMPAT_BRK is supposedly enabled by default (which disables brk randomization).

Edit:

OK, more info: It really looks like brk randomization is the culprit, the legacy gcc is calling brk() to change the end of the data segment and that now fails, causing the legacy gcc to report ‘virtual memory exhausted’. There are a few documented ways to disable brk randomization:

  • sudo echo 0 > /proc/sys/kernel/randomize_va_space

  • sudo sysctl -w kernel.randomize_va_space=0

  • starting a new shell with setarch i386 -R tcsh (or ‘-R -L’)

I have tried them and they do seem to have an effect in that the brk() return value is different (and always the same) than without them (tried on both kernel 2.6.25 and 2.6.26), but the brk() still fails so the legacy gcc still fails :-(.

In addition I have set vm.legacy_va_layout=1 and vm.overcommit_memory=2 with no change, and I have rebooted with the vm.legacy_va_layout=1 and kernel.randomize_va_space=0 settings saved in /etc/sysctl.conf. Still no change.

Edit:

Using kernel.randomize_va_space=0 on kernel 2.6.26 (and 2.6.25) results in the following brk() call being reported by strace legacy-gcc:

brk(0x80556d4) = 0x8056000

This indicates the brk() failed, but it looks like it failed because the the data segment already ends beyond what was requested. Using objdump, I can see the data segment should end at 0x805518c whereas the failed brk() indicates that the data segment currently ends at 0x8056000:

 Sections: Idx Name          Size      VMA       LMA       File off  Algn   0 .interp       00000013  080480d4  080480d4  000000d4  2**0                   CONTENTS, ALLOC, LOAD, READONLY, DATA   1 .hash         000001a0  080480e8  080480e8  000000e8  2**2                   CONTENTS, ALLOC, LOAD, READONLY, DATA   2 .dynsym       00000410  08048288  08048288  00000288  2**2                   CONTENTS, ALLOC, LOAD, READONLY, DATA   3 .dynstr       0000020e  08048698  08048698  00000698  2**0                   CONTENTS, ALLOC, LOAD, READONLY, DATA   4 .rel.bss      00000038  080488a8  080488a8  000008a8  2**2                   CONTENTS, ALLOC, LOAD, READONLY, DATA   5 .rel.plt      00000158  080488e0  080488e0  000008e0  2**2                   CONTENTS, ALLOC, LOAD, READONLY, DATA   6 .init         00000008  08048a40  08048a40  00000a40  2**4                   CONTENTS, ALLOC, LOAD, READONLY, CODE   7 .plt          000002c0  08048a48  08048a48  00000a48  2**2                   CONTENTS, ALLOC, LOAD, READONLY, CODE   8 .text         000086cc  08048d10  08048d10  00000d10  2**4                   CONTENTS, ALLOC, LOAD, READONLY, CODE   9 .fini         00000008  080513e0  080513e0  000093e0  2**4                   CONTENTS, ALLOC, LOAD, READONLY, CODE  10 .rodata       000027d0  080513e8  080513e8  000093e8  2**0                   CONTENTS, ALLOC, LOAD, READONLY, DATA  11 .data         000005d4  08054bb8  08054bb8  0000bbb8  2**2                   CONTENTS, ALLOC, LOAD, DATA  12 .ctors        00000008  0805518c  0805518c  0000c18c  2**2                   CONTENTS, ALLOC, LOAD, DATA  13 .dtors        00000008  08055194  08055194  0000c194  2**2                   CONTENTS, ALLOC, LOAD, DATA  14 .got          000000b8  0805519c  0805519c  0000c19c  2**2                   CONTENTS, ALLOC, LOAD, DATA  15 .dynamic      00000088  08055254  08055254  0000c254  2**2                   CONTENTS, ALLOC, LOAD, DATA  16 .bss          000003b8  080552dc  080552dc  0000c2dc  2**3                   ALLOC  17 .note         00000064  00000000  00000000  0000c2dc  2**0                   CONTENTS, READONLY  18 .comment      00000062  00000000  00000000  0000c340  2**0                   CONTENTS, READONLY SYMBOL TABLE: no symbols 

Edit:

To echo ephemient’s comment below: ‘So strange to treat GCC as a binary without source’!

So, using strace, objdump, gdb and my limited understanding of 386 assembler and architecture I have traced the problem to the 1st malloc call in the legacy code. The legacy gcc calls malloc, which returns NULL, which results in the ‘virtual memory exhausted’ message on stderr. This malloc is in libc.so.5, and it calls getenv a bunch of times and ends up calling brk()… I guess to increase the heap… which fails.

From this I can only surmise that the problem is more than brk randomization, or I have not fully disabled brk randomization, despite the randomize_va_space=0 and legacy_va_layout=1 sysctl settings.

  • 0 0 Answers
  • 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. 2026-05-11T14:30:02+00:00Added an answer on May 11, 2026 at 2:30 pm

    Install linux + the old gcc onto a virtual machine.

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

Sidebar

Ask A Question

Stats

  • Questions 144k
  • Answers 144k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Try, from c in DataContext.cus_contact join cp in DataContext.cus_phone_jct on… May 12, 2026 at 8:38 am
  • Editorial Team
    Editorial Team added an answer Since you used the --default-eol=native option, any binary files that… May 12, 2026 at 8:38 am
  • Editorial Team
    Editorial Team added an answer The default behavior for Sequel is to select all columns,… May 12, 2026 at 8:38 am

Related Questions

I have a large legacy C++ project compiled under Visual Studio 2008. I know
I'm using NAnt 0.85 to build a legacy project. The script itself uses the
We are using Excel to convert SpreatSheetML to XLS in an ASP.NET webservice. Moreover,
A legacy embedded system is implemented using a cooperative multi-tasking scheduler. The system essentially

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.