[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug ld/594] ld refuses to put data into PT_NOTE segment
From: |
Nick Clifton |
Subject: |
Re: [Bug ld/594] ld refuses to put data into PT_NOTE segment |
Date: |
Mon, 07 Feb 2005 18:04:15 +0000 |
User-agent: |
Mozilla Thunderbird 1.0 (X11/20041206) |
Hi Paul,
Please could you try out the attached small patch and see if this
fixed things for you.
Cheers
Nick
Index: bfd/elf.c
===================================================================
RCS file: /cvs/src/src/bfd/elf.c,v
retrieving revision 1.264
diff -c -3 -p -r1.264 elf.c
*** bfd/elf.c 6 Feb 2005 23:21:44 -0000 1.264
--- bfd/elf.c 7 Feb 2005 17:53:16 -0000
*************** assign_file_positions_for_segments (bfd
*** 4163,4168 ****
--- 4163,4169 ----
/* The section VMA must equal the file position
modulo the page size. */
bfd_size_type page = align;
+
if ((abfd->flags & D_PAGED) != 0)
page = bed->maxpagesize;
adjust = vma_page_aligned_bias (sec->vma,
*************** assign_file_positions_for_segments (bfd
*** 4222,4227 ****
--- 4223,4234 ----
p->p_filesz += sec->size;
p->p_memsz += sec->size;
}
+ /* PR ld/594: Sections in note segments which are not loaded
+ contribute to the file size but not the in-memory size. */
+ else if (p->p_type == PT_NOTE
+ && (flags & SEC_HAS_CONTENTS) != 0)
+ p->p_filesz += sec->size;
+
/* .tbss is special. It doesn't contribute to p_memsz of
normal segments. */
else if ((flags & SEC_THREAD_LOCAL) == 0