ld: not enough room for program headers

linux

    Next

  • 1. compiling the linux kernel
    hope this is the right newsgroup and on topic: what developers tools/resources are used to compile the linux kernel when using win32? when using linux itself?
  • 2. cow benchmark
    Hi, I have been working on COW ( copy-on-write ) in a filesystem. I am looking for benchmark applications to test the copy-on-write feature. Any suggestions ? Regards, Vineet
  • 3. How can I know the memory allocated by a kernel module through kmalloc()
    Hello, I want to measure the memory that has been dynamically allocated by a kernel module through kmalloc(). Does anyone know any profiling tool? Thanks in advance! Yunli
  • 4. Waiting on multiple events in a driver?
    Hi everyone, I was wondering if I could do two init_wait_queue_entry() and two corresponding add_wait_queue() calls to wait on two events simultaneously in a driver (with cleanup via two remove_wait_queue() calls). I would prefer not to wait on just one event, which would mean processes could wake up needlessly. Thanks, Lee

ld: not enough room for program headers

Postby Neil Ferguson » Sat, 09 Oct 2004 09:15:37 GMT

Hi,

Please let me know if this is off-topic; I'm new to the group.

My problem is linker behavior.  The error message is:

     Not enough room for program headers (allocated 7, need 8)

The project is a port of a large number of legacy Fortran.  There is nothing
very {*filter*} in the source or build except I am trying to use the linker
option:

  --section-start   .bss=0x080ee000

I find that if I tweek the value, the message goes away (so far!).  I have
tried the option -Tbss with the same or worse result.

Is this a bug in ld?  The compilers are Absoft Fortran 95.  The OS is Suse
8.2.

I am doing this because I need to align uninitialized data objects common to
several of my programs.  Objects don't need to occupy the same user address
from program to program, but they do need to appear at the same relative
page offset.

Thanks,

Neil Ferguson



Re: ld: not enough room for program headers

Postby John Reiser » Sat, 09 Oct 2004 10:23:28 GMT

>      Not enough room for program headers (allocated 7, need 8)

This is the result of a one-pass attack at the two-pass problem of 
computing how many Elf32_Phdr need to be allocated.  The fault lies
both in ld itself and in the default linker script.

Run "ld --verbose" to see the default linker script, and note the line
   . = 0x08048000 + SIZEOF_HEADERS;
This is the problem.  ld estimates SIZEOF_HEADERS, and sometimes guesses
low by 1 Elf32_Phdr (or by 2 in extremely rare cases).  A workaround is
to capture the default linker script "ld --verbose >script.lds", delete
the header and trailer lines [delimited by '====='], change the initial
address to ". = 0x08048000 + 52 + 8*32;" where 52 is sizeof(Elf32_Ehdr)
and 32 is sizeof(Elf32_Phdr), then use the resulting script to replace 
the default: "ld -T script.lds ..."

-- 

Re: ld: not enough room for program headers

Postby Neil Ferguson » Thu, 14 Oct 2004 11:25:23 GMT






Excellent.  Thank you.

Neil Ferguson



Similar Threads:

1.Test Case : __attribute__ ((aligned (16384)))==>Not enough room for program headers

On Linux, I was unable to compile the below test case with cc, gcc, or
g++! Does anyone know how I can if it's possible?

/* test.c */
#include <stdio.h>

struct 
{
  int t1;
  int t2;
  float tx;
} shared_memory __attribute__ ((aligned (16384)));

int main ()
{
  printf ("hello\n");
}

%g++ test.c
/usr/bin/ld: a.out Not enough room for program headers (allocated 7,
need 8)
/usr/bin/ld: final link failed: Bad value
collect2: ld returned 1 exit status

Thank you,
Christopher Lusardi


Note: On SGI, I can use "pragma align_symbol (shared_memory, 16384)"
after the definition of the struct without the error. If I use the
pragma on Linux it does not align properly.

2.for huge "recommended" patch, not enough room in /var/sadm/patch

Not enough room in /var/sadm/patch, the install-script
says.

But on other partitions and disks I have *lots* of
space available.  Just not on the root partition,
which contains /var/sadm/patch (among much else,
of course).

Might this work.

Rename /var/sadm/patch to eg /var/sadm/patch2-original,
then create a patch dir in some partition that had
logs of space, and then make /var/sadm/patch
a symlink to there.



Or should I symlink either higher up the var/sadm tree,
or symlink *several* of those directories?

And is there any reason to *copy* those directories
to where I'm going to symlink to, so that if there's
already some contents, they'll still be "there"?

(That install-script doesn't explicitly check for
this trick -- I hope not.)

-----

Or is there maybe some better way to do surmount this not-enough-disk pbm?



----------

Of course I do down to single-user before doing
the   ./install_cluster,

but any reason I can't leave everything else
mounted?

I mean, in recent years, has anyone *ever* gotten
hurt by doing that?   (If so, please say how, so we
can all get wised-up on this, uh, danger.)


Thanks!!!

David



3.Test Case Included:... __attribute__ ((aligned (16384)))==>Not enough room for program headers(allocated 8, need 9)

Hello,

  The below question is pertaining to error with code on :

     Red Hat Linux release Fedora Core release 3 (Hedelberg)

  Note: I have to use the code per requirements!

  The below code will compile without error on :

     Red Hat Linux release Red Hat Enterprise Linux WS release 3
  (Taroon Update 2)

  I'm using g++.

/************************************************/
struct
{
  int t1;
  int t2;
  int t3
  int t4;

} shared_memory __attribute__ ((aligned (16384))) = {};

int main ()
{
  printf ("address is %X\n",&shared_memory);
}

/************************************************/

Note: Without the attribute, the program compiles. But it's incorrect
because of the address of the variable is not what I have to have!

What can I do to get the program to compile and run with the
shared_memory aligned to some 16384 address?

Thank you,
Christopher Lusardi

4.Test Case Included:... __attribute__ ((aligned (16384)))==>Not enough room for program headers(allocated 7, need 8)

Hello,

  On Linux, if I use the "-N" option with the below test case it
compiles (g++) and runs perfectly, but I get "undefined" when I try to
compile an X application with the aligned attribute, using g++.

  Without the "-N" option the linker complains with the message on the
subject line.

/************************* Program 1: test.c ***********************/
struct 
{
  int t1;
  int t2;
  int tx;
} shared_memory __attribute__ ((aligned (16384)));

int main ()
{
  printf ("address is %X\n",&shared_memory);
}
/************************* But Program 2 Woun't Compile ***********/

When I compile it, I get:
undefined reference to XmStringCreateLtoR
undefined reference to XtVASetValues
...

These undefineds are in standard X libraries.

Note: Without the described attribute, the program compiles. But it's
incorrect because of the variable's address isn't want I want!

If I surround the library includes with extern "C" the compiler
complains about the line with the extern. I mention this because that
is the standard way of linking C++ files to C files.

What can I do to get the X application to compile and run with the
shared_memory aligned to some 16384 address?

Thank you,
Christopher Lusardi

5.Please explain "Could not load program Not enough space"

6. "ld: fatal: library -lc: not found" error when compiling program

7. [News] For Windows, One Anti-viru$ Program is Not Enough

8. Cannot run Fortran program on AIX: not enough memory



Return to linux

 

Who is online

Users browsing this forum: No registered users and 12 guest