diff options
| author | Ali Bahrami <Ali.Bahrami@Sun.COM> | 2008-11-19 14:51:09 -0700 |
|---|---|---|
| committer | Ali Bahrami <Ali.Bahrami@Sun.COM> | 2008-11-19 14:51:09 -0700 |
| commit | 354507029a42e4bcb1ea64fc4685f2bfd4792db8 (patch) | |
| tree | 469cbb1aca81d8d3dfc381e78b1a9c6ba789d156 /usr/src/cmd/sgs | |
| parent | dfaab43a45f1b5f0689624fe908cad9da2ad4a05 (diff) | |
| download | illumos-joyent-354507029a42e4bcb1ea64fc4685f2bfd4792db8.tar.gz | |
6736890 PT_SUNWBSS should be disabled
PSARC/2008/715 PT_SUNWBSS removal
Diffstat (limited to 'usr/src/cmd/sgs')
22 files changed, 79 insertions, 281 deletions
diff --git a/usr/src/cmd/sgs/include/libld.h b/usr/src/cmd/sgs/include/libld.h index 0716bb41fe..92a0fb1d78 100644 --- a/usr/src/cmd/sgs/include/libld.h +++ b/usr/src/cmd/sgs/include/libld.h @@ -240,9 +240,7 @@ struct ofl_desc { Is_desc *ofl_isbss; /* .bss input section (globals) */ Is_desc *ofl_islbss; /* .lbss input section (globals) */ Is_desc *ofl_istlsbss; /* .tlsbss input section (globals) */ - Is_desc *ofl_issunwdata1; /* .data input section */ - /* partially expanded. */ - Is_desc *ofl_issunwbss; /* .SUNW_bss input section (globals) */ + Is_desc *ofl_isparexpn; /* -z nopartial .data input section */ Os_desc *ofl_osdynamic; /* .dynamic output section */ Os_desc *ofl_osdynsym; /* .dynsym output section */ Os_desc *ofl_osldynsym; /* .SUNW_ldynsym output section */ @@ -272,7 +270,7 @@ struct ofl_desc { Word ofl_dtflags_1; /* DT_FLAGS_1 entries */ Word ofl_dtflags; /* DT_FLAGS entries */ Os_desc *ofl_ossyminfo; /* .SUNW_syminfo output section */ - Half ofl_sunwdata1ndx; /* section index for sunwdata1 */ + Half ofl_parexpnndx; /* -z nopartial section index */ /* Ref. at perform_outreloc() in */ /* libld/{mach}/machrel.c */ Xword *ofl_checksum; /* DT_CHECKSUM value address */ diff --git a/usr/src/cmd/sgs/include/rtld.h b/usr/src/cmd/sgs/include/rtld.h index a7a65ee49c..16857d5c31 100644 --- a/usr/src/cmd/sgs/include/rtld.h +++ b/usr/src/cmd/sgs/include/rtld.h @@ -27,8 +27,6 @@ #ifndef _RTLD_H #define _RTLD_H -#pragma ident "%Z%%M% %I% %E% SMI" - /* * Global include file for the runtime linker. */ @@ -738,17 +736,16 @@ typedef struct rt_map32 { #define FLG_RT_NOOPEN 0x00100000 /* dlopen() not allowed */ #define FLG_RT_FINICLCT 0x00200000 /* fini has been collected (tsort) */ #define FLG_RT_INITCALL 0x00400000 /* objects .init has been called */ -#define FLG_RT_SUNWBSS 0x00800000 /* object with PT_SUNWBSS, not mapped */ -#define FLG_RT_OBJINTPO 0x01000000 /* object is a global interposer */ -#define FLG_RT_SYMINTPO 0x02000000 /* object contains symbol interposer */ -#define MSK_RT_INTPOSE 0x03000000 /* mask for all interposer */ +#define FLG_RT_OBJINTPO 0x00800000 /* object is a global interposer */ +#define FLG_RT_SYMINTPO 0x01000000 /* object contains symbol interposer */ +#define MSK_RT_INTPOSE 0x01800000 /* mask for all interposer */ /* possibilities */ -#define FLG_RT_MOVE 0x04000000 /* object needs move operation */ -#define FLG_RT_TMPLIST 0x08000000 /* object is part of a temporary list */ -#define FLG_RT_REGSYMS 0x10000000 /* object has DT_REGISTER entries */ -#define FLG_RT_INITCLCT 0x20000000 /* init has been collected (tsort) */ -#define FLG_RT_HANDLE 0x40000000 /* generate a handle for this object */ -#define FLG_RT_RELOCING 0x80000000 /* object is being relocated */ +#define FLG_RT_MOVE 0x02000000 /* object needs move operation */ +#define FLG_RT_TMPLIST 0x04000000 /* object is part of a temporary list */ +#define FLG_RT_REGSYMS 0x08000000 /* object has DT_REGISTER entries */ +#define FLG_RT_INITCLCT 0x10000000 /* init has been collected (tsort) */ +#define FLG_RT_HANDLE 0x20000000 /* generate a handle for this object */ +#define FLG_RT_RELOCING 0x40000000 /* object is being relocated */ #define FL1_RT_COPYTOOK 0x00000001 /* copy relocation taken */ #define FL1_RT_RELATIVE 0x00000002 /* relative path expansion required */ diff --git a/usr/src/cmd/sgs/libconv/common/phdr.msg b/usr/src/cmd/sgs/libconv/common/phdr.msg index 29e290df26..b1f1684f92 100644 --- a/usr/src/cmd/sgs/libconv/common/phdr.msg +++ b/usr/src/cmd/sgs/libconv/common/phdr.msg @@ -20,11 +20,9 @@ # # -# Copyright 2007 Sun Microsystems, Inc. All rights reserved. +# Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# ident "%Z%%M% %I% %E% SMI" -# @ MSG_PT_NULL "[ PT_NULL ]" @ MSG_PT_NULL_ALT "PT_NULL" @@ -47,8 +45,6 @@ @ MSG_PT_SUNWBSS_ALT "PT_SUNWBSS" @ MSG_PT_SUNWSTACK "[ PT_SUNWSTACK ]" @ MSG_PT_SUNWSTACK_ALT "PT_SUNWSTACK" -@ MSG_PT_SUNWBSS "[ PT_SUNWBSS ]" -@ MSG_PT_SUNWBSS_ALT "PT_SUNWBSS" @ MSG_PT_SUNWDTRACE "[ PT_SUNWDTRACE ]" @ MSG_PT_SUNWDTRACE_ALT "PT_SUNWDTRACE" @ MSG_PT_SUNWCAP "[ PT_SUNWCAP ]" diff --git a/usr/src/cmd/sgs/libld/common/_libld.h b/usr/src/cmd/sgs/libld/common/_libld.h index 4190eb16e8..76b6c7fb17 100644 --- a/usr/src/cmd/sgs/libld/common/_libld.h +++ b/usr/src/cmd/sgs/libld/common/_libld.h @@ -536,8 +536,7 @@ extern Sdf_desc *sdf_find(const char *, List *); #define ld_make_bss ld64_make_bss #define ld_make_data ld64_make_data #define ld_make_got ld64_make_got -#define ld_make_sunwbss ld64_make_sunwbss -#define ld_make_sunwdata ld64_make_sunwdata +#define ld_make_parexpn_data ld64_make_parexpn_data #define ld_make_sunwmove ld64_make_sunmove #define ld_make_text ld64_make_text #define ld_map_out ld64_map_out @@ -621,8 +620,7 @@ extern Sdf_desc *sdf_find(const char *, List *); #define ld_make_bss ld32_make_bss #define ld_make_data ld32_make_data #define ld_make_got ld32_make_got -#define ld_make_sunwbss ld32_make_sunwbss -#define ld_make_sunwdata ld32_make_sunwdata +#define ld_make_parexpn_data ld32_make_parexpn_data #define ld_make_sunwmove ld32_make_sunmove #define ld_make_text ld32_make_text #define ld_map_out ld32_map_out @@ -720,8 +718,7 @@ extern Xword ld_lcm(Xword, Xword); extern uintptr_t ld_make_bss(Ofl_desc *, Xword, Xword, Bss_Type); extern Is_desc *ld_make_data(Ofl_desc *, size_t); extern uintptr_t ld_make_got(Ofl_desc *); -extern uintptr_t ld_make_sunwbss(Ofl_desc *, size_t, Xword); -extern uintptr_t ld_make_sunwdata(Ofl_desc *, size_t, Xword); +extern uintptr_t ld_make_parexpn_data(Ofl_desc *, size_t, Xword); extern uintptr_t ld_make_sunwmove(Ofl_desc *, int); extern Is_desc *ld_make_text(Ofl_desc *, size_t); extern void ld_map_out(Ofl_desc *); diff --git a/usr/src/cmd/sgs/libld/common/entry.c b/usr/src/cmd/sgs/libld/common/entry.c index 39ecec21c8..d06df73030 100644 --- a/usr/src/cmd/sgs/libld/common/entry.c +++ b/usr/src/cmd/sgs/libld/common/entry.c @@ -26,7 +26,6 @@ * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" #define ELF_TARGET_AMD64 @@ -53,7 +52,6 @@ typedef enum { #endif LD_DYN, LD_DTRACE, - LD_SUNWBSS, LD_TLS, #if defined(_ELF64) LD_UNWIND, /* (amd64-only) */ @@ -136,9 +134,6 @@ static const Sg_desc sg_desc[LD_NUM] = { SG_DESC_INIT(PT_SUNWDTRACE, 0, MSG_ORIG(MSG_ENT_DTRACE), (FLG_SG_TYPE | FLG_SG_FLAGS)), - /* LD_SUNWBSS */ - SG_DESC_INIT(PT_SUNWBSS, 0, MSG_ORIG(MSG_ENT_SUNWBSS), FLG_SG_TYPE), - /* LD_TLS */ SG_DESC_INIT(PT_TLS, PF_R, MSG_ORIG(MSG_ENT_TLS), (FLG_SG_TYPE | FLG_SG_FLAGS)), @@ -172,10 +167,6 @@ static const Sg_desc sg_desc[LD_NUM] = { * at runtime, once memory has been allocated and the templates copied. */ static const Ent_desc ent_desc[] = { - {{NULL, NULL}, MSG_ORIG(MSG_SCN_SUNWBSS), NULL, - SHF_ALLOC + SHF_WRITE, SHF_ALLOC + SHF_WRITE, - (Sg_desc *)LD_SUNWBSS, 0, FALSE}, - {{NULL, NULL}, NULL, SHT_NOTE, 0, 0, (Sg_desc *)LD_NOTE, 0, FALSE}, @@ -271,11 +262,8 @@ ld_ent_setup(Ofl_desc *ofl, Xword segalign) sgp[LD_LDATA].sg_phdr.p_flags = ld_targ.t_m.m_dataseg_perm; sgp[LD_DTRACE].sg_phdr.p_flags |= PF_X; #endif - if (ofl->ofl_flags & FLG_OF_DYNAMIC) { - sgp[LD_SUNWBSS].sg_phdr.p_flags = ld_targ.t_m.m_dataseg_perm; - } else { + if ((ofl->ofl_flags & FLG_OF_DYNAMIC) == 0) sgp[LD_DATA].sg_phdr.p_flags |= PF_X; - } /* * Traverse the new entrance descriptor list converting the segment diff --git a/usr/src/cmd/sgs/libld/common/libld.msg b/usr/src/cmd/sgs/libld/common/libld.msg index 6c9a770eda..17137b0e15 100644 --- a/usr/src/cmd/sgs/libld/common/libld.msg +++ b/usr/src/cmd/sgs/libld/common/libld.msg @@ -703,8 +703,6 @@ @ MSG_SCN_STAB ".stab" @ MSG_SCN_STABEXCL ".stab.exclstr" @ MSG_SCN_STRTAB ".strtab" -@ MSG_SCN_SUNWBSS ".SUNW_bss" -@ MSG_SCN_SUNWDATA1 ".SUNW_data1" @ MSG_SCN_SUNWMOVE ".SUNW_move" @ MSG_SCN_SUNWRELOC ".SUNW_reloc" @ MSG_SCN_SUNWSYMINFO ".SUNW_syminfo" @@ -746,7 +744,6 @@ @ MSG_ENT_TLS "tls" @ MSG_ENT_UNWIND "unwind" -@ MSG_ENT_SUNWBSS "SUNW_bss" @ MSG_ENT_SUNWCAP "SUNW_cap" # Symbol names diff --git a/usr/src/cmd/sgs/libld/common/machrel.amd.c b/usr/src/cmd/sgs/libld/common/machrel.amd.c index fc55b08fd2..5438433ef1 100644 --- a/usr/src/cmd/sgs/libld/common/machrel.amd.c +++ b/usr/src/cmd/sgs/libld/common/machrel.amd.c @@ -23,7 +23,6 @@ * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" /* Get the x86 version of the relocation engine */ #define DO_RELOC_LIBLD_X86 @@ -344,7 +343,7 @@ ld_perform_outreloc(Rel_desc * orsp, Ofl_desc * ofl) else ndx = sdp->sd_shndx; } else - ndx = ofl->ofl_sunwdata1ndx; + ndx = ofl->ofl_parexpnndx; } else ndx = sdp->sd_symndx; diff --git a/usr/src/cmd/sgs/libld/common/machrel.intel.c b/usr/src/cmd/sgs/libld/common/machrel.intel.c index 14c7973585..955abf3a11 100644 --- a/usr/src/cmd/sgs/libld/common/machrel.intel.c +++ b/usr/src/cmd/sgs/libld/common/machrel.intel.c @@ -27,7 +27,6 @@ * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" /* Get the x86 version of the relocation engine */ #define DO_RELOC_LIBLD_X86 @@ -291,7 +290,7 @@ ld_perform_outreloc(Rel_desc * orsp, Ofl_desc * ofl) else ndx = sdp->sd_shndx; } else - ndx = ofl->ofl_sunwdata1ndx; + ndx = ofl->ofl_parexpnndx; } else ndx = sdp->sd_symndx; diff --git a/usr/src/cmd/sgs/libld/common/machrel.sparc.c b/usr/src/cmd/sgs/libld/common/machrel.sparc.c index 079c1b8baa..00a1b46a4d 100644 --- a/usr/src/cmd/sgs/libld/common/machrel.sparc.c +++ b/usr/src/cmd/sgs/libld/common/machrel.sparc.c @@ -26,7 +26,6 @@ * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" /* Get the sparc version of the relocation engine */ #define DO_RELOC_LIBLD_SPARC @@ -714,7 +713,7 @@ ld_perform_outreloc(Rel_desc * orsp, Ofl_desc * ofl) else ndx = sdp->sd_shndx; } else - ndx = ofl->ofl_sunwdata1ndx; + ndx = ofl->ofl_parexpnndx; } else ndx = sdp->sd_symndx; diff --git a/usr/src/cmd/sgs/libld/common/map.c b/usr/src/cmd/sgs/libld/common/map.c index 5d39eb49c8..03a9dac047 100644 --- a/usr/src/cmd/sgs/libld/common/map.c +++ b/usr/src/cmd/sgs/libld/common/map.c @@ -2667,14 +2667,11 @@ ld_map_parse(const char *mapfile, Ofl_desc *ofl) case PT_NOTE: dst_type = 9; break; - case PT_SUNWBSS: - dst_type = 10; - break; case PT_TLS: - dst_type = 11; + dst_type = 10; break; case PT_NULL: - dst_type = 12; + dst_type = 11; break; default: eprintf(ofl->ofl_lml, ERR_FATAL, diff --git a/usr/src/cmd/sgs/libld/common/outfile.c b/usr/src/cmd/sgs/libld/common/outfile.c index 08c7efc721..f5f25ca3e8 100644 --- a/usr/src/cmd/sgs/libld/common/outfile.c +++ b/usr/src/cmd/sgs/libld/common/outfile.c @@ -530,9 +530,6 @@ ld_create_outfile(Ofl_desc *ofl) if (ofl->ofl_unwindhdr) nseg++; #endif - } else if (ptype == PT_SUNWBSS) { - if (ofl->ofl_issunwbss) - nseg++; } else if (ptype == PT_SUNWDTRACE) { if (ofl->ofl_dtracesym) nseg++; diff --git a/usr/src/cmd/sgs/libld/common/relocate.c b/usr/src/cmd/sgs/libld/common/relocate.c index f9b4886959..932ae57c34 100644 --- a/usr/src/cmd/sgs/libld/common/relocate.c +++ b/usr/src/cmd/sgs/libld/common/relocate.c @@ -2038,8 +2038,8 @@ process_movereloc(Ofl_desc *ofl, Is_desc *rsect) if (psdp->sd_flags & FLG_SY_PAREXPN) { int _num, num; - reld.rel_osdesc = ofl->ofl_issunwdata1->is_osdesc; - reld.rel_isdesc = ofl->ofl_issunwdata1; + reld.rel_osdesc = ofl->ofl_isparexpn->is_osdesc; + reld.rel_isdesc = ofl->ofl_isparexpn; reld.rel_roffset = mp->m_poffset; for (num = mp->m_repeat, _num = 0; _num < num; _num++) { @@ -2657,7 +2657,7 @@ ld_adj_movereloc(Ofl_desc *ofl, Rel_desc *arsp) * the relocation entry relocating the expanded partial symbol. */ arsp->rel_roffset += psdp->sd_sym->st_value - - ofl->ofl_issunwdata1->is_osdesc->os_shdr->sh_addr; + ofl->ofl_isparexpn->is_osdesc->os_shdr->sh_addr; DBG_CALL(Dbg_move_adjexpandreloc(ofl->ofl_lml, arsp->rel_roffset, psdp->sd_name)); } diff --git a/usr/src/cmd/sgs/libld/common/sections.c b/usr/src/cmd/sgs/libld/common/sections.c index f4261f2f91..dfd8cd7d7a 100644 --- a/usr/src/cmd/sgs/libld/common/sections.c +++ b/usr/src/cmd/sgs/libld/common/sections.c @@ -2049,53 +2049,17 @@ make_sym_sec(Ofl_desc *ofl, const char *sectname, Word stype, int ident) } /* - * Build a .sunwbss section for allocation of tentative definitions. - */ -uintptr_t -ld_make_sunwbss(Ofl_desc *ofl, size_t size, Xword align) -{ - Shdr *shdr; - Elf_Data *data; - Is_desc *isec; - - /* - * Allocate header structs. We will set the name ourselves below, - * and there is no entcnt for a BSS. So, the shname and entcnt - * arguments are 0. - */ - if (new_section(ofl, SHT_NOBITS, MSG_ORIG(MSG_SCN_SUNWBSS), 0, - &isec, &shdr, &data) == S_ERROR) - return (S_ERROR); - - data->d_size = size; - data->d_align = align; - - shdr->sh_size = (Xword)size; - shdr->sh_addralign = align; - - /* - * Retain this .sunwbss input section as this will be where global - * symbol references are added. - */ - ofl->ofl_issunwbss = isec; - if (ld_place_section(ofl, isec, 0, 0) == (Os_desc *)S_ERROR) - return (S_ERROR); - - return (1); -} - -/* * This routine is called when -z nopartial is in effect. */ uintptr_t -ld_make_sunwdata(Ofl_desc *ofl, size_t size, Xword align) +ld_make_parexpn_data(Ofl_desc *ofl, size_t size, Xword align) { Shdr *shdr; Elf_Data *data; Is_desc *isec; Os_desc *osp; - if (new_section(ofl, SHT_PROGBITS, MSG_ORIG(MSG_SCN_SUNWDATA1), 0, + if (new_section(ofl, SHT_PROGBITS, MSG_ORIG(MSG_SCN_DATA), 0, &isec, &shdr, &data) == S_ERROR) return (S_ERROR); @@ -2111,11 +2075,11 @@ ld_make_sunwdata(Ofl_desc *ofl, size_t size, Xword align) return (S_ERROR); /* - * Retain this .sunwdata1 input section as this will - * be where global - * symbol references are added. + * Retain handle to this .data input section. Variables using move + * sections (partial initialization) will be redirected here when + * such global references are added and '-z nopartial' is in effect. */ - ofl->ofl_issunwdata1 = isec; + ofl->ofl_isparexpn = isec; osp = ld_place_section(ofl, isec, ld_targ.t_id.id_data, 0); if (osp == (Os_desc *)S_ERROR) return (S_ERROR); diff --git a/usr/src/cmd/sgs/libld/common/sunwmove.c b/usr/src/cmd/sgs/libld/common/sunwmove.c index f844f076bb..847af64264 100644 --- a/usr/src/cmd/sgs/libld/common/sunwmove.c +++ b/usr/src/cmd/sgs/libld/common/sunwmove.c @@ -23,7 +23,6 @@ * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" #include <string.h> #include <debug.h> @@ -39,10 +38,8 @@ make_mvsections(Ofl_desc *ofl) Listnode * lnp1; Psym_info * psym; Word mv_nums = 0; - Xword align_sunwbss = 0; /* Alignment for .sunwbss */ - Xword align_sunwdata1 = 0; /* for .sunwdata1 */ - size_t size_sunwbss = 0; /* Size of .sunwbss */ - size_t size_sunwdata1 = 0; /* Size of .sunwdata1 */ + Xword align_parexpn = 0; /* for -z nopartial .data sec */ + size_t size_parexpn = 0; /* Size of parexpn section */ /* * Compute the size of the output move section @@ -59,27 +56,15 @@ make_mvsections(Ofl_desc *ofl) align_val = 8; if (symd->sd_flags & FLG_SY_PAREXPN) { /* - * This global symbol goes to .sunwdata1 + * This global symbol goes to the special + * partial initialization .data section. */ - size_sunwdata1 = (size_t)S_ROUND(size_sunwdata1, + size_parexpn = (size_t)S_ROUND(size_parexpn, sym->st_value) + sym->st_size; - if (align_val > align_sunwdata1) - align_sunwdata1 = align_val; + if (align_val > align_parexpn) + align_parexpn = align_val; } else { - if ((ofl->ofl_flags & FLG_OF_SHAROBJ) && - (symd->sd_flags & FLG_SY_TENTSYM) && - (ELF_ST_BIND(sym->st_info) != STB_LOCAL)) { - /* - * If output file is non-executable - * shared object, and this is a tentative symbol - * this symbol goes to .sunwbss - */ - size_sunwbss = (size_t)S_ROUND(size_sunwbss, - sym->st_value) + sym->st_size; - if (align_val > align_sunwbss) - align_sunwbss = align_val; - } mv_nums += psym->psym_num; } } @@ -90,25 +75,15 @@ make_mvsections(Ofl_desc *ofl) } /* - * Generate the .sunwbss section now that we know its size and - * alignment. - */ - if (size_sunwbss) { - if (ld_make_sunwbss(ofl, size_sunwbss, - align_sunwbss) == S_ERROR) - return (S_ERROR); - } - - /* * Add empty area for partially initialized symbols. * - * The .SUNWDATA1 is to be created when '-z option' is in effect or - * there are any partially init. symbol which are to be expanded. + * A special .data section is created when the '-z nopartial' + * option is in effect in order to receive the expanded data. */ - if (size_sunwdata1) { + if (size_parexpn) { /* LINTED */ - if (ld_make_sunwdata(ofl, size_sunwdata1, - align_sunwdata1) == S_ERROR) + if (ld_make_parexpn_data(ofl, size_parexpn, + align_parexpn) == S_ERROR) return (S_ERROR); } return (1); diff --git a/usr/src/cmd/sgs/libld/common/syms.c b/usr/src/cmd/sgs/libld/common/syms.c index 5ace9ddfa3..52ca5e28ec 100644 --- a/usr/src/cmd/sgs/libld/common/syms.c +++ b/usr/src/cmd/sgs/libld/common/syms.c @@ -1408,10 +1408,10 @@ ld_sym_validate(Ofl_desc *ofl) * object only account for scoped COMMON symbols (these will * be converted to .bss references). * - * For partially initialized symbol, - * if it is expanded, it goes to sunwdata1. - * if it is local, it goes to .bss. - * if the output is shared object, it goes to .sunwbss. + * When -z nopartial is in effect, partially initialized + * symbols are directed to the special .data section + * created for that purpose (ofl->ofl_isparexpn). + * Otherwise, partially initialized symbols go to .bss. * * Also refer to make_mvsections() in sunwmove.c */ @@ -1419,20 +1419,8 @@ ld_sym_validate(Ofl_desc *ofl) (((oflags & FLG_OF_RELOBJ) == 0) || ((sdp->sd_flags1 & FLG_SY1_HIDDEN) && (oflags & FLG_OF_PROCRED)))) { - int countbss = 0; - - if (sdp->sd_psyminfo == 0) { - countbss = 1; - } else if ((sdp->sd_flags & FLG_SY_PAREXPN) != 0) { - countbss = 0; - } else if (ELF_ST_BIND(sym->st_info) == STB_LOCAL) { - countbss = 1; - } else if ((ofl->ofl_flags & FLG_OF_SHAROBJ) != 0) { - countbss = 0; - } else - countbss = 1; - - if (countbss) { + if ((sdp->sd_psyminfo == 0) || + ((sdp->sd_flags & FLG_SY_PAREXPN) == 0)) { Xword * size, * align; if (type != STT_TLS) { diff --git a/usr/src/cmd/sgs/libld/common/update.c b/usr/src/cmd/sgs/libld/common/update.c index af06f02d3c..b3dc2fa37c 100644 --- a/usr/src/cmd/sgs/libld/common/update.c +++ b/usr/src/cmd/sgs/libld/common/update.c @@ -181,14 +181,14 @@ update_osym(Ofl_desc *ofl) Ifl_desc *ifl; Word bssndx, etext_ndx, edata_ndx = 0, end_ndx, start_ndx; Word end_abs = 0, etext_abs = 0, edata_abs; - Word tlsbssndx = 0, sunwbssndx = 0, sunwdata1ndx; + Word tlsbssndx = 0, parexpnndx; #if defined(_ELF64) Word lbssndx = 0; Addr lbssaddr = 0; #endif Addr bssaddr, etext = 0, edata = 0, end = 0, start = 0; Addr tlsbssaddr = 0; - Addr sunwbssaddr = 0, sunwdata1addr; + Addr parexpnaddr; int start_set = 0; Sym _sym = {0}, *sym, *symtab = 0; Sym *dynsym = 0, *ldynsym = 0; @@ -611,15 +611,16 @@ update_osym(Ofl_desc *ofl) } /* - * Assign .sunwdata1 information + * If expanding partially expanded symbols under '-z nopartial', + * prepare to do that. */ - if (ofl->ofl_issunwdata1) { - osp = ofl->ofl_issunwdata1->is_osdesc; - sunwdata1addr = (Addr)(osp->os_shdr->sh_addr + - ofl->ofl_issunwdata1->is_indata->d_off); + if (ofl->ofl_isparexpn) { + osp = ofl->ofl_isparexpn->is_osdesc; + parexpnaddr = (Addr)(osp->os_shdr->sh_addr + + ofl->ofl_isparexpn->is_indata->d_off); /* LINTED */ - sunwdata1ndx = elf_ndxscn(osp->os_scn); - ofl->ofl_sunwdata1ndx = osp->os_scnsymndx; + parexpnndx = elf_ndxscn(osp->os_scn); + ofl->ofl_parexpnndx = osp->os_scnsymndx; } /* @@ -788,19 +789,19 @@ update_osym(Ofl_desc *ofl) * If we are expanding the locally bound partially * initialized symbols, then update the address here. */ - if (ofl->ofl_issunwdata1 && + if (ofl->ofl_isparexpn && (sdp->sd_flags & FLG_SY_PAREXPN) && !update_done) { static Addr laddr = 0; - sym->st_shndx = sunwdata1ndx; - sdp->sd_isc = ofl->ofl_issunwdata1; + sym->st_shndx = parexpnndx; + sdp->sd_isc = ofl->ofl_isparexpn; if (flags & FLG_OF_RELOBJ) { - sym->st_value = sunwdata1addr; + sym->st_value = parexpnaddr; } else { sym->st_value = laddr; laddr += sym->st_size; } - sunwdata1addr += sym->st_size; + parexpnaddr += sym->st_size; } /* @@ -941,18 +942,6 @@ update_osym(Ofl_desc *ofl) tlsbssndx = elf_ndxscn(osp->os_scn); } - /* - * Assign .SUNW_bss information for use with updating COMMON symbols. - */ - if (ofl->ofl_issunwbss) { - osp = ofl->ofl_issunwbss->is_osdesc; - sunwbssaddr = (Addr)(osp->os_shdr->sh_addr + - ofl->ofl_issunwbss->is_indata->d_off); - /* LINTED */ - sunwbssndx = elf_ndxscn(osp->os_scn); - } - - if ((sorted_syms = libld_calloc(ofl->ofl_globcnt + ofl->ofl_elimcnt + ofl->ofl_scopecnt, sizeof (*sorted_syms))) == 0) return ((Addr)S_ERROR); @@ -1023,37 +1012,20 @@ update_osym(Ofl_desc *ofl) (sdp->sd_shndx = symptr->st_shndx) == SHN_COMMON)) { /* - * An expanded symbol goes to .sunwdata1. - * - * A partial initialized global symbol within a shared - * object goes to .sunwbss. - * + * An expanded symbol goes to a special .data section + * prepared for that purpose (ofl->ofl_isparexpn). * Assign COMMON allocations to .bss. - * * Otherwise leave it as is. */ if (sdp->sd_flags & FLG_SY_PAREXPN) { restore = 1; - sdp->sd_shndx = sunwdata1ndx; + sdp->sd_shndx = parexpnndx; sdp->sd_flags &= ~FLG_SY_SPECSEC; symptr->st_value = (Xword) S_ROUND( - sunwdata1addr, symptr->st_value); - sunwdata1addr = symptr->st_value + + parexpnaddr, symptr->st_value); + parexpnaddr = symptr->st_value + symptr->st_size; - sdp->sd_isc = ofl->ofl_issunwdata1; - sdp->sd_flags |= FLG_SY_COMMEXP; - - } else if ((sdp->sd_psyminfo != (Psym_info *)NULL) && - (flags & FLG_OF_SHAROBJ) && - (ELF_ST_BIND(symptr->st_info) != STB_LOCAL)) { - restore = 1; - sdp->sd_shndx = sunwbssndx; - sdp->sd_flags &= ~FLG_SY_SPECSEC; - symptr->st_value = (Xword)S_ROUND(sunwbssaddr, - symptr->st_value); - sunwbssaddr = symptr->st_value + - symptr->st_size; - sdp->sd_isc = ofl->ofl_issunwbss; + sdp->sd_isc = ofl->ofl_isparexpn; sdp->sd_flags |= FLG_SY_COMMEXP; } else if (ELF_ST_TYPE(symptr->st_info) != STT_TLS && @@ -2952,9 +2924,9 @@ expand_move(Ofl_desc *ofl, Sym_desc *sdp, Move *u1) Addr base1; unsigned int stride; - osp = ofl->ofl_issunwdata1->is_osdesc; + osp = ofl->ofl_isparexpn->is_osdesc; base1 = (Addr)(osp->os_shdr->sh_addr + - ofl->ofl_issunwdata1->is_indata->d_off); + ofl->ofl_isparexpn->is_indata->d_off); taddr0 = taddr = osp->os_outdata->d_buf; mv = u1; @@ -3572,12 +3544,6 @@ ld_update_outfile(Ofl_desc *ofl) phdr->p_memsz = offset - hshdr->sh_offset; /* - * If this is PT_SUNWBSS, set alignment - */ - if (phdr->p_type == PT_SUNWBSS) - phdr->p_align = p_align; - - /* * If this is the first loadable segment of a dynamic object, * or an interpreter has been specified (a static object built * with an interpreter will still be given a PT_HDR entry), then @@ -3616,8 +3582,7 @@ ld_update_outfile(Ofl_desc *ofl) * (presumably from a map file) use it and make sure the * previous segment does not run into this segment. */ - if ((phdr->p_type == PT_LOAD) || - (phdr->p_type == PT_SUNWBSS)) { + if (phdr->p_type == PT_LOAD) { if ((sgp->sg_flags & FLG_SG_VADDR)) { if (_phdr && (vaddr > phdr->p_vaddr) && (phdr->p_type == PT_LOAD)) @@ -3716,8 +3681,7 @@ ld_update_outfile(Ofl_desc *ofl) shdr->sh_info, MSG_INTL(MSG_FIL_INVSHINFO)); if (!(flags & FLG_OF_RELOBJ) && - (phdr->p_type == PT_LOAD) || - (phdr->p_type == PT_SUNWBSS)) { + (phdr->p_type == PT_LOAD)) { if (hshdr) vaddr += (shdr->sh_offset - hshdr->sh_offset); @@ -3837,7 +3801,7 @@ ld_update_outfile(Ofl_desc *ofl) /* * Update Move Table. */ - if (ofl->ofl_osmove || ofl->ofl_issunwdata1) { + if (ofl->ofl_osmove || ofl->ofl_isparexpn) { if (update_move(ofl) == S_ERROR) return (S_ERROR); } diff --git a/usr/src/cmd/sgs/packages/common/SUNWonld-README b/usr/src/cmd/sgs/packages/common/SUNWonld-README index 672997c5c4..37f7ba9482 100644 --- a/usr/src/cmd/sgs/packages/common/SUNWonld-README +++ b/usr/src/cmd/sgs/packages/common/SUNWonld-README @@ -1404,3 +1404,5 @@ Bugid Risk Synopsis 6748160 problem with -zrescan (D) PSARC/2008/651 New ld archive rescan options 6763342 sloppy relocations need to get sloppier +6736890 PT_SUNWBSS should be disabled (D) + PSARC/2008/715 PT_SUNWBSS removal diff --git a/usr/src/cmd/sgs/rtld/common/_elf.h b/usr/src/cmd/sgs/rtld/common/_elf.h index 58e33f47c1..062bb89e37 100644 --- a/usr/src/cmd/sgs/rtld/common/_elf.h +++ b/usr/src/cmd/sgs/rtld/common/_elf.h @@ -105,7 +105,6 @@ typedef struct _rt_elf_private { ulong_t e_moveent; /* size of base movetab entry */ ulong_t e_tlsstatoff; /* TLS offset into static block */ void *e_movetab; /* movetable address */ - Phdr *e_sunwbss; /* program header for SUNWBSS */ Phdr *e_pttls; /* PT_TLS */ Phdr *e_ptunwind; /* PT_SUNW_UNWIND (amd64 specific) */ ulong_t e_syment; /* size of symtab entry */ @@ -149,7 +148,6 @@ typedef struct _rt_elf_private { #define VERDEF(X) (((Rt_elfp *)(X)->rt_priv)->e_verdef) #define VERDEFNUM(X) (((Rt_elfp *)(X)->rt_priv)->e_verdefnum) #define VERSYM(X) (((Rt_elfp *)(X)->rt_priv)->e_versym) -#define SUNWBSS(X) (((Rt_elfp *)(X)->rt_priv)->e_sunwbss) #define SYMINENT(X) (((Rt_elfp *)(X)->rt_priv)->e_syminent) #define PLTPAD(X) (((Rt_elfp *)(X)->rt_priv)->e_pltpad) #define PLTPADEND(X) (((Rt_elfp *)(X)->rt_priv)->e_pltpadend) diff --git a/usr/src/cmd/sgs/rtld/common/elf.c b/usr/src/cmd/sgs/rtld/common/elf.c index 717ad4dd2f..ccd118b056 100644 --- a/usr/src/cmd/sgs/rtld/common/elf.c +++ b/usr/src/cmd/sgs/rtld/common/elf.c @@ -1123,8 +1123,7 @@ elf_map_it( * Skip non-loadable segments or segments that don't occupy * any memory. */ - if (((phdr->p_type != PT_LOAD) && - (phdr->p_type != PT_SUNWBSS)) || (phdr->p_memsz == 0)) + if ((phdr->p_type != PT_LOAD) || (phdr->p_memsz == 0)) continue; /* @@ -1154,20 +1153,7 @@ elf_map_it( /* * Determine the type of mapping required. */ - if (phdr->p_type == PT_SUNWBSS) { - /* - * Potentially, we can defer the loading of any SUNWBSS - * segment, depending on whether the symbols it provides - * have been bound to. In this manner, large segments - * that are interposed upon between shared libraries - * may not require mapping. Note, that the mapping - * information is recorded in our mapping descriptor at - * this time. - */ - mlen = phdr->p_memsz; - flen = 0; - - } else if ((phdr->p_filesz == 0) && (phdr->p_flags == 0)) { + if ((phdr->p_filesz == 0) && (phdr->p_flags == 0)) { /* * If this segment has no backing file and no flags * specified, then it defines a reservation. At this @@ -2678,7 +2664,6 @@ elf_map_so(Lm_list *lml, Aliste lmco, const char *pname, const char *oname, Phdr *lph; /* last loadable Phdr */ Phdr *lfph = 0; /* last loadable (filesz != 0) Phdr */ Phdr *lmph = 0; /* last loadable (memsz != 0) Phdr */ - Phdr *swph = 0; /* program header for SUNWBSS */ Phdr *tlph = 0; /* program header for PT_TLS */ Phdr *unwindph = 0; /* program header for PT_SUNW_UNWIND */ Cap *cap = 0; /* program header for SUNWCAP */ @@ -2755,8 +2740,7 @@ elf_map_so(Lm_list *lml, Aliste lmco, const char *pname, const char *oname, */ for (i = 0, pptr = phdr; i < (int)ehdr->e_phnum; i++, pptr = (Phdr *)((Off)pptr + ehdr->e_phentsize)) { - if ((pptr->p_type == PT_LOAD) || - (pptr->p_type == PT_SUNWBSS)) { + if (pptr->p_type == PT_LOAD) { if (fph == 0) { fph = pptr; @@ -2773,8 +2757,6 @@ elf_map_so(Lm_list *lml, Aliste lmco, const char *pname, const char *oname, lmph = pptr; if (pptr->p_filesz) lfph = pptr; - if (pptr->p_type == PT_SUNWBSS) - swph = pptr; if (pptr->p_align > align) align = pptr->p_align; @@ -2950,10 +2932,6 @@ elf_map_so(Lm_list *lml, Aliste lmco, const char *pname, const char *oname, /* * If this shared object contains any special segments, record them. */ - if (swph) { - FLAGS(lmp) |= FLG_RT_SUNWBSS; - SUNWBSS(lmp) = phdr + (swph - phdr0); - } if (tlph && (tls_assign(lml, lmp, (phdr + (tlph - phdr0))) == 0)) { remove_so(lml, lmp); return (0); diff --git a/usr/src/cmd/sgs/rtld/common/move.c b/usr/src/cmd/sgs/rtld/common/move.c index 766b69c5ac..eb085b349c 100644 --- a/usr/src/cmd/sgs/rtld/common/move.c +++ b/usr/src/cmd/sgs/rtld/common/move.c @@ -24,8 +24,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * Object file dependent support for ELF objects. */ @@ -56,7 +54,6 @@ move_data(Rt_map *lmp) { Lm_list *lml = LIST(lmp); Move *mv = MOVETAB(lmp); - Phdr *pptr = SUNWBSS(lmp); ulong_t num, mvnum = MOVESZ(lmp) / MOVEENT(lmp); int moves; @@ -74,32 +71,6 @@ move_data(Rt_map *lmp) Half rep, repno, stride; Sym *sym; - /* - * If the target address needs to be mapped in, - * map it first. - * (You have to protect the code, thread safe) - */ - if (FLAGS(lmp) & FLG_RT_SUNWBSS) { - long zlen; - Off foff; - caddr_t zaddr, eaddr; - - foff = (Off) (pptr->p_vaddr + ADDR(lmp)); - zaddr = (caddr_t)M_PROUND(foff); - eaddr = pptr->p_vaddr + ADDR(lmp) + - (caddr_t)pptr->p_memsz; - zero((caddr_t)foff, (long)(zaddr - foff)); - zlen = eaddr - zaddr; - if (zlen > 0) { - if (dz_map(lml, zaddr, zlen, - (PROT_READ | PROT_WRITE), - (MAP_FIXED | MAP_PRIVATE)) == MAP_FAILED) - return (0); - } - - FLAGS(lmp) &= ~FLG_RT_SUNWBSS; - } - if ((sym = (Sym *)SYMTAB(lmp) + ELF_M_SYM(mv->m_info)) == 0) continue; diff --git a/usr/src/cmd/sgs/rtld/mdbmod/common/rtld.c b/usr/src/cmd/sgs/rtld/mdbmod/common/rtld.c index 35091d452c..8252887337 100644 --- a/usr/src/cmd/sgs/rtld/mdbmod/common/rtld.c +++ b/usr/src/cmd/sgs/rtld/mdbmod/common/rtld.c @@ -24,8 +24,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <msg.h> #include <_rtld.h> #include <conv.h> @@ -70,7 +68,6 @@ static const mdb_bitmask_t rtflags_bits[] = { { MSG_ORIG(MSG_FLG_NOOPEN), FLG_RT_NOOPEN, FLG_RT_NOOPEN}, { MSG_ORIG(MSG_FLG_FINICLCT), FLG_RT_FINICLCT, FLG_RT_FINICLCT}, { MSG_ORIG(MSG_FLG_INITCALL), FLG_RT_INITCALL, FLG_RT_INITCALL}, - { MSG_ORIG(MSG_FLG_SUNWBSS), FLG_RT_SUNWBSS, FLG_RT_SUNWBSS}, { MSG_ORIG(MSG_FLG_OBJINTPO), FLG_RT_OBJINTPO, FLG_RT_OBJINTPO}, { MSG_ORIG(MSG_FLG_SYMINTPO), FLG_RT_SYMINTPO, FLG_RT_SYMINTPO}, { MSG_ORIG(MSG_FLG_MOVE), FLG_RT_MOVE, FLG_RT_MOVE}, diff --git a/usr/src/cmd/sgs/rtld/mdbmod/common/rtld.msg b/usr/src/cmd/sgs/rtld/mdbmod/common/rtld.msg index 1fe46e0a0f..7ca2cb36a8 100644 --- a/usr/src/cmd/sgs/rtld/mdbmod/common/rtld.msg +++ b/usr/src/cmd/sgs/rtld/mdbmod/common/rtld.msg @@ -23,8 +23,6 @@ # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# pragma ident "%Z%%M% %I% %E% SMI" -# @ _START_ @@ -86,7 +84,6 @@ @ MSG_FLG_NOOPEN "NO-OPEN" @ MSG_FLG_FINICLCT "FINI-COLLECTED" @ MSG_FLG_INITCALL "INIT-CALLED" -@ MSG_FLG_SUNWBSS "SUNWBSS" @ MSG_FLG_OBJINTPO "OBJECT-INTERPOSE" @ MSG_FLG_SYMINTPO "SYMBOL-INTERPOSE" @ MSG_FLG_MOVE "MOVE" |
