Mercurial > illumos > illumos-gate
changeset 13916:a84bad6b576e
3436 relocatable objects also need sloppy relocation
Reviewed by: Gordon Ross <gwr@nexenta.com>
Reviewed by: Robert Mustacchi <rm@joyent.com>
Approved by: Garrett D'Amore <garrett@damore.org>
author | Richard Lowe <richlowe@richlowe.net> |
---|---|
date | Tue, 01 Jan 2013 21:14:26 -0500 |
parents | 08b681f7233e |
children | c2c5e1bf3119 |
files | usr/src/cmd/sgs/libld/common/place.c usr/src/cmd/sgs/packages/common/SUNWonld-README |
diffstat | 2 files changed, 23 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/usr/src/cmd/sgs/libld/common/place.c Tue Jan 01 16:07:37 2013 -0500 +++ b/usr/src/cmd/sgs/libld/common/place.c Tue Jan 01 21:14:26 2013 -0500 @@ -851,6 +851,13 @@ } /* + * When building relocatable objects, we must not redirect COMDAT + * section names into their outputs, such that our output object may + * be successfully used as an input object also requiring COMDAT + * processing + */ + + /* * GNU section names may follow the convention: * * .gnu.linkonce.* @@ -863,13 +870,15 @@ * because we know the name is not NULL, and therefore must have * at least one character plus a NULL termination. */ - if (((ofl->ofl_flags & FLG_OF_RELOBJ) == 0) && - (isp->is_name == oname) && (isp->is_name[1] == 'g') && + if ((isp->is_name == oname) && (isp->is_name[1] == 'g') && (strncmp(MSG_ORIG(MSG_SCN_GNU_LINKONCE), isp->is_name, MSG_SCN_GNU_LINKONCE_SIZE) == 0)) { - if ((oname = - (char *)gnu_linkonce_sec(isp->is_name)) != isp->is_name) { - DBG_CALL(Dbg_sec_redirected(ofl->ofl_lml, isp, oname)); + if ((ofl->ofl_flags & FLG_OF_RELOBJ) == 0) { + if ((oname = (char *)gnu_linkonce_sec(isp->is_name)) != + isp->is_name) { + DBG_CALL(Dbg_sec_redirected(ofl->ofl_lml, isp, + oname)); + } } /* @@ -894,16 +903,17 @@ * sections, and this identification can be triggered by a pattern * match section names. */ - if (((ofl->ofl_flags & FLG_OF_RELOBJ) == 0) && - (isp->is_name == oname) && (isp->is_flags & FLG_IS_COMDAT) && + if ((isp->is_name == oname) && (isp->is_flags & FLG_IS_COMDAT) && ((sname = gnu_comdat_sym(ifl, isp)) != NULL)) { size_t size = sname - isp->is_name; - if ((oname = libld_malloc(size + 1)) == NULL) - return ((Os_desc *)S_ERROR); - (void) strncpy(oname, isp->is_name, size); - oname[size] = '\0'; - DBG_CALL(Dbg_sec_redirected(ofl->ofl_lml, isp, oname)); + if ((ofl->ofl_flags & FLG_OF_RELOBJ) == 0) { + if ((oname = libld_malloc(size + 1)) == NULL) + return ((Os_desc *)S_ERROR); + (void) strncpy(oname, isp->is_name, size); + oname[size] = '\0'; + DBG_CALL(Dbg_sec_redirected(ofl->ofl_lml, isp, oname)); + } /* * Enable relaxed relocation processing, as this is
--- a/usr/src/cmd/sgs/packages/common/SUNWonld-README Tue Jan 01 16:07:37 2013 -0500 +++ b/usr/src/cmd/sgs/packages/common/SUNWonld-README Tue Jan 01 21:14:26 2013 -0500 @@ -1642,3 +1642,4 @@ 3265 link-editor builds bogus .eh_frame_hdr on ia32 3453 GNU comdat redirection does exactly the wrong thing 3439 discarded sections shouldn't end up on output lists +3436 relocatable objects also need sloppy relocation