This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
PATCH: Linker is broken
On Thu, May 13, 2004 at 05:30:13PM -0700, H. J. Lu wrote:
> On Thu, May 13, 2004 at 10:54:52AM -0700, H. J. Lu wrote:
> > Hi Jakub,
> >
> > I think your patch
> >
> > http://sources.redhat.com/ml/binutils/2004-05/msg00143.html
> >
> > breaks the linker. See
> >
> > http://sources.redhat.com/bugzilla/show_bug.cgi?id=159
> >
>
> If I back out the scripttempl/elf.sc change, the testcase works.
>
>
The problem is .eh_frame is readonly. The new linker script moves it
at the beginning of data segment. When it is empty, the new alignment
causes map_sections_to_segments to allocate a segment for an empty
.eh_frame section. This patch fixes the testcase. Should
map_sections_to_segments be able to deal with empty readonly
section at the alignment boundary at the beginning of data segment?
H.J.
----
2004-05-13 H.J. Lu <hongjiu.lu@intel.com>
* scripttempl/elf.sc: Move .eh_frame to readonly segment.
--- ld/scripttempl/elf.sc.eh 2004-05-11 13:34:38.000000000 -0700
+++ ld/scripttempl/elf.sc 2004-05-13 19:41:47.000000000 -0700
@@ -311,6 +311,7 @@ cat <<EOF
${CREATE_SHLIB-${SBSS2}}
${OTHER_READONLY_SECTIONS}
.eh_frame_hdr : { *(.eh_frame_hdr) }
+ .eh_frame ${RELOCATING-0} : { KEEP (*(.eh_frame)) }
/* Adjust the address for the data segment. We want to adjust up to
the same address within the page on the next page up. */
@@ -319,7 +320,6 @@ cat <<EOF
${CREATE_PIE+${RELOCATING+. = ${SHLIB_DATA_ADDR-${DATA_SEGMENT_ALIGN}};}}
/* Exception handling */
- .eh_frame ${RELOCATING-0} : { KEEP (*(.eh_frame)) }
.gcc_except_table ${RELOCATING-0} : { *(.gcc_except_table) }
/* Thread Local Storage sections */