* Sun/Oracle C++ compiler patch @ 2011-02-25 0:17 Chris Quenelle 2011-02-25 9:54 ` Tristan Gingold 0 siblings, 1 reply; 7+ messages in thread From: Chris Quenelle @ 2011-02-25 0:17 UTC (permalink / raw) To: binutils (ignore the last copy of this email, it had a terrible subject line) Hello, When the Sun/Oracle C++ compiler was ported to Linux, we started bundling a patched version of gnu ld to get the necessary treatment for our exception range sections. I don't believe anyone has tried to offer this patch upstream, and it would really help us out if we could use the system linker when running on Linux. I've included the contents of the patch at the end of this email. --chris % more patch-intel-Linux-2.17.90 *** binutils-2.17.90/ld/scripttempl/elf.sc 2007-08-07 00:00:22.000000000 +0400 --- bu-patched/ld/scripttempl/elf.sc 2008-06-06 15:08:24.602615680 +0400 *************** *** 372,377 **** --- 372,378 ---- .eh_frame_hdr : { *(.eh_frame_hdr) } .eh_frame ${RELOCATING-0} : ONLY_IF_RO { KEEP (*(.eh_frame)) } .gcc_except_table ${RELOCATING-0} : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) } + .exception_ranges ${RELOCATING-0} : ONLY_IF_RO { *(.exception_ranges .exception_ranges*) } /* Adjust the address for the data segment. We want to adjust up to the same address within the page on the next page up. */ *************** *** 382,387 **** --- 383,389 ---- /* Exception handling */ .eh_frame ${RELOCATING-0} : ONLY_IF_RW { KEEP (*(.eh_frame)) } .gcc_except_table ${RELOCATING-0} : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) } + .exception_ranges ${RELOCATING-0} : ONLY_IF_RW { *(.exception_ranges .exception_ranges*) } /* Thread Local Storage sections */ .tdata ${RELOCATING-0} : { *(.tdata${RELOCATING+ .tdata.* .gnu.linkonce.td.*}) } ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Sun/Oracle C++ compiler patch 2011-02-25 0:17 Sun/Oracle C++ compiler patch Chris Quenelle @ 2011-02-25 9:54 ` Tristan Gingold 2011-02-25 12:19 ` Jakub Jelinek 0 siblings, 1 reply; 7+ messages in thread From: Tristan Gingold @ 2011-02-25 9:54 UTC (permalink / raw) To: Chris Quenelle; +Cc: binutils On Feb 25, 2011, at 1:17 AM, Chris Quenelle wrote: > (ignore the last copy of this email, it had a terrible subject line) > > Hello, > > When the Sun/Oracle C++ compiler was ported to Linux, we started > bundling a patched version of gnu ld to get the necessary treatment > for our exception range sections. I don't believe anyone has tried to > offer this patch upstream, and it would really help us out if we could > use the system linker when running on Linux. I've included the > contents of the patch at the end of this email. Just a suggestion: can you add a comment just before to explain that this is for Sun/Oracle C++ compiler ? This is not obvious from the section name. Is the content of this section documented somewhere ? Tristan. ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Sun/Oracle C++ compiler patch 2011-02-25 9:54 ` Tristan Gingold @ 2011-02-25 12:19 ` Jakub Jelinek 2011-02-25 18:11 ` Chris Quenelle 2011-04-01 3:13 ` Chris Quenelle 0 siblings, 2 replies; 7+ messages in thread From: Jakub Jelinek @ 2011-02-25 12:19 UTC (permalink / raw) To: Tristan Gingold; +Cc: Chris Quenelle, binutils On Fri, Feb 25, 2011 at 10:54:32AM +0100, Tristan Gingold wrote: > > On Feb 25, 2011, at 1:17 AM, Chris Quenelle wrote: > > > (ignore the last copy of this email, it had a terrible subject line) > > > > Hello, > > > > When the Sun/Oracle C++ compiler was ported to Linux, we started > > bundling a patched version of gnu ld to get the necessary treatment > > for our exception range sections. I don't believe anyone has tried to > > offer this patch upstream, and it would really help us out if we could > > use the system linker when running on Linux. I've included the > > contents of the patch at the end of this email. > > Just a suggestion: can you add a comment just before to explain that this is for Sun/Oracle C++ compiler ? This is not > obvious from the section name. > > Is the content of this section documented somewhere ? Also, do you really need ONLY_IF_R{O,W}, i.e. do some older Oracle C++ compiler versions emit the section writable and some later compilers emit it read-only (or vice versa)? .eh_frame with very old gcc versions used to be a writable sections that needed runtime relocation, then gcc changed to a new format which doesn't need any relocations and thus it is desirable to put the section into a read-only segment if all .eh_frame input sections are read-only. Jakub ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Sun/Oracle C++ compiler patch 2011-02-25 12:19 ` Jakub Jelinek @ 2011-02-25 18:11 ` Chris Quenelle 2011-04-01 3:13 ` Chris Quenelle 1 sibling, 0 replies; 7+ messages in thread From: Chris Quenelle @ 2011-02-25 18:11 UTC (permalink / raw) To: Jakub Jelinek; +Cc: Tristan Gingold, binutils On Friday February 25 4:19AM, Jakub Jelinek wrote: > On Fri, Feb 25, 2011 at 10:54:32AM +0100, Tristan Gingold wrote: >> On Feb 25, 2011, at 1:17 AM, Chris Quenelle wrote: >> >>> (ignore the last copy of this email, it had a terrible subject line) >>> >>> Hello, >>> >>> When the Sun/Oracle C++ compiler was ported to Linux, we started >>> bundling a patched version of gnu ld to get the necessary treatment >>> for our exception range sections. I don't believe anyone has tried to >>> offer this patch upstream, and it would really help us out if we could >>> use the system linker when running on Linux. I've included the >>> contents of the patch at the end of this email. >> Just a suggestion: can you add a comment just before to explain that this is for Sun/Oracle C++ compiler ? This is not >> obvious from the section name. >> >> Is the content of this section documented somewhere ? > Also, do you really need ONLY_IF_R{O,W}, i.e. do some older Oracle C++ compiler versions > emit the section writable and some later compilers emit it read-only (or vice versa)? > .eh_frame with very old gcc versions used to be a writable sections that needed > runtime relocation, then gcc changed to a new format which doesn't need any relocations > and thus it is desirable to put the section into a read-only segment if all > .eh_frame input sections are read-only. > > Jakub Jakub: I believe our fix was made by just copying the way gcc_except_table is treated. Our sections see to be writable in the a.out, I've emailed our C++ team to ask if we do runtime relocations. (ugh) Tristan: I'll add a comment and repost the patch when I resolve Jakub's question. Thanks! --chris ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Sun/Oracle C++ compiler patch 2011-02-25 12:19 ` Jakub Jelinek 2011-02-25 18:11 ` Chris Quenelle @ 2011-04-01 3:13 ` Chris Quenelle 2011-04-11 15:40 ` Nick Clifton 1 sibling, 1 reply; 7+ messages in thread From: Chris Quenelle @ 2011-04-01 3:13 UTC (permalink / raw) To: Jakub Jelinek; +Cc: Tristan Gingold, binutils On Friday February 25 4:19AM, Jakub Jelinek wrote: > On Fri, Feb 25, 2011 at 10:54:32AM +0100, Tristan Gingold wrote: >> On Feb 25, 2011, at 1:17 AM, Chris Quenelle wrote: >> >>> (ignore the last copy of this email, it had a terrible subject line) >>> >>> Hello, >>> >>> When the Sun/Oracle C++ compiler was ported to Linux, we started >>> bundling a patched version of gnu ld to get the necessary treatment >>> for our exception range sections. I don't believe anyone has tried to >>> offer this patch upstream, and it would really help us out if we could >>> use the system linker when running on Linux. I've included the >>> contents of the patch at the end of this email. >> Just a suggestion: can you add a comment just before to explain that this is for Sun/Oracle C++ compiler ? This is not >> obvious from the section name. >> >> Is the content of this section documented somewhere ? > Also, do you really need ONLY_IF_R{O,W}, i.e. do some older Oracle C++ compiler versions > emit the section writable and some later compilers emit it read-only (or vice versa)? > .eh_frame with very old gcc versions used to be a writable sections that needed > runtime relocation, then gcc changed to a new format which doesn't need any relocations > and thus it is desirable to put the section into a read-only segment if all > .eh_frame input sections are read-only. > > Jakub Sorry for the delay in this thread. I'm not really sure that the "ONLY_IF_RW" in the linker script maps onto the sh_flags field having the SHF_WRITE bit turned on in the section header table. Could you confirm that? Currently our exception range sections are writable, but I haven't been able to confirm that's necessary because of fixups by the C++ runtime system. If it's not necessary or if we change it later, it would be nice if the linker didn't need more modification. Is there any harm in allowing the same behavior if our sections later become read-only? Because of the time-lapse here, I'll include the patch again so that people have context for the thread. --chris % more patch-intel-Linux-2.17.90 *** binutils-2.17.90/ld/scripttempl/elf.sc 2007-08-07 00:00:22.000000000 +0400 --- bu-patched/ld/scripttempl/elf.sc 2008-06-06 15:08:24.602615680 +0400 *************** *** 372,377 **** --- 372,378 ---- .eh_frame_hdr : { *(.eh_frame_hdr) } .eh_frame ${RELOCATING-0} : ONLY_IF_RO { KEEP (*(.eh_frame)) } .gcc_except_table ${RELOCATING-0} : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) } + .exception_ranges ${RELOCATING-0} : ONLY_IF_RO { *(.exception_ranges .exception_ranges*) } /* Adjust the address for the data segment. We want to adjust up to the same address within the page on the next page up. */ *************** *** 382,387 **** --- 383,389 ---- /* Exception handling */ .eh_frame ${RELOCATING-0} : ONLY_IF_RW { KEEP (*(.eh_frame)) } .gcc_except_table ${RELOCATING-0} : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) } + .exception_ranges ${RELOCATING-0} : ONLY_IF_RW { *(.exception_ranges .exception_ranges*) } /* Thread Local Storage sections */ .tdata ${RELOCATING-0} : { *(.tdata${RELOCATING+ .tdata.* .gnu.linkonce.td.*}) } ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Sun/Oracle C++ compiler patch 2011-04-01 3:13 ` Chris Quenelle @ 2011-04-11 15:40 ` Nick Clifton 2011-04-12 21:49 ` Chris Quenelle 0 siblings, 1 reply; 7+ messages in thread From: Nick Clifton @ 2011-04-11 15:40 UTC (permalink / raw) To: Chris Quenelle; +Cc: Jakub Jelinek, Tristan Gingold, binutils Hi Chris, > I'm not really sure that the "ONLY_IF_RW" in the linker script maps onto > the sh_flags field having the SHF_WRITE bit turned on in the section > header table. Could you confirm that? It does. > Currently our exception range sections are writable, but I haven't been > able to confirm that's necessary because of fixups by the C++ runtime > system. If it's not necessary or if we change it later, it would be > nice if the linker didn't need more modification. Agreed. > Is there any harm in allowing the same behavior if our sections later > become read-only? None. > .gcc_except_table ${RELOCATING-0} : ONLY_IF_RO { *(.gcc_except_table > .gcc_except_table.*) } > + .exception_ranges ${RELOCATING-0} : ONLY_IF_RO { *(.exception_ranges > .exception_ranges*) } > .gcc_except_table ${RELOCATING-0} : ONLY_IF_RW { *(.gcc_except_table > .gcc_except_table.*) } > + .exception_ranges ${RELOCATING-0} : ONLY_IF_RW { *(.exception_ranges > .exception_ranges*) } The patch looks OK to me, and so I have checked it in along with this changelog entry. I did take Tristan's suggestion however and so I added a comment explaining where the .exception_ranges section originates. Cheers Nick ld/ChangeLog 2011-04-11 Chris Quenelle <chris.quenelle@oracle.com> * scripttempl/elf.sc (.exception_ranges): Add new section. ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Sun/Oracle C++ compiler patch 2011-04-11 15:40 ` Nick Clifton @ 2011-04-12 21:49 ` Chris Quenelle 0 siblings, 0 replies; 7+ messages in thread From: Chris Quenelle @ 2011-04-12 21:49 UTC (permalink / raw) To: Nick Clifton; +Cc: Jakub Jelinek, Tristan Gingold, binutils Thank you very much for your help, I appreciate it. On Monday April 11 8:40AM, Nick Clifton wrote: > > The patch looks OK to me, and so I have checked it in along with this > changelog entry. I did take Tristan's suggestion however and so I > added a comment explaining where the .exception_ranges section > originates. > > Cheers > Nick > > ld/ChangeLog > 2011-04-11 Chris Quenelle <chris.quenelle@oracle.com> > > * scripttempl/elf.sc (.exception_ranges): Add new section. > ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2011-04-12 21:49 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2011-02-25 0:17 Sun/Oracle C++ compiler patch Chris Quenelle 2011-02-25 9:54 ` Tristan Gingold 2011-02-25 12:19 ` Jakub Jelinek 2011-02-25 18:11 ` Chris Quenelle 2011-04-01 3:13 ` Chris Quenelle 2011-04-11 15:40 ` Nick Clifton 2011-04-12 21:49 ` Chris Quenelle
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).