diff options
| author | Richard Lowe <richlowe@richlowe.net> | 2021-04-05 14:06:47 -0500 |
|---|---|---|
| committer | Richard Lowe <richlowe@richlowe.net> | 2021-04-09 15:48:05 -0500 |
| commit | 8222814ef8560ee0ba222eca8ca5acffc6cd0e44 (patch) | |
| tree | 55274c4f702ccf5aa98764391b250a81ba3f1990 /usr/src/cmd | |
| parent | 99ea293e719ac006d413e4fde6ac0d5cd4dd6c59 (diff) | |
| download | illumos-joyent-8222814ef8560ee0ba222eca8ca5acffc6cd0e44.tar.gz | |
13487 want mapfile-based assertions about symbol properties
Reviewed by: Robert Mustacchi <rm@fingolfin.org>
Reviewed by: Jason King <jason.brian.king@gmail.com>
Approved by: Dan McDonald <danmcd@joyent.com>
Diffstat (limited to 'usr/src/cmd')
26 files changed, 2071 insertions, 803 deletions
diff --git a/usr/src/cmd/ast/libast/mapfile-vers b/usr/src/cmd/ast/libast/mapfile-vers index d790b19b43..1575e26ab6 100644 --- a/usr/src/cmd/ast/libast/mapfile-vers +++ b/usr/src/cmd/ast/libast/mapfile-vers @@ -43,12 +43,71 @@ $mapfile_version 2 # functions SYMBOL_VERSION SUNWprivate_1.1 { global: - _Sfextern; - _Sfi; - _Sfmaxr; - _Sftable; - _Vmextern; - _Vmheap; +$if _ELF64 + _Sfextern { + ASSERT = { + TYPE = OBJECT; + SIZE = 184; + }; + }; +$elif _ELF32 + _Sfextern { + ASSERT = { + TYPE = OBJECT; + SIZE = 100; + }; + }; +$else +$error unknown ELFCLASS +$endif + _Sfi { + ASSERT = { + TYPE = OBJECT; + SIZE = addrsize; + }; + }; + _Sfmaxr { + ASSERT = { + TYPE = OBJECT; + SIZE = addrsize; + }; + }; +$if _ELF64 + _Sftable { + ASSERT = { + TYPE = OBJECT; + SIZE = 1296; + }; + }; + _Vmextern { + ASSERT = { + TYPE = OBJECT; + SIZE = addrsize[9]; + }; + }; + +$elif _ELF32 + _Sftable { + ASSERT = { + TYPE = OBJECT; + SIZE = 1192; + }; + }; + _Vmextern { + ASSERT = { + TYPE = OBJECT; + SIZE = addrsize[10]; + }; + }; +$else +$error unknown ELFCLASS +$endif + _Vmheap { + ASSERT = { + TYPE = OBJECT; + SIZE = addrsize[14]; + }; + }; _ast___getdelim; _ast__filbuf; _ast_asprintf; @@ -151,15 +210,77 @@ SYMBOL_VERSION SUNWprivate_1.1 { _ast_iconv_name; _ast_iconv_open; _ast_iconv_write; - _ast_info; - _ast_intercepts; - _ast_lc_categories; - _ast_lc_charsets; - _ast_lc_languages; - _ast_lc_maps; - _ast_lc_territories; +$if _ELF64 + _ast_info { + ASSERT = { + TYPE = OBJECT; + SIZE = 1064; + }; + }; +$elif _ELF32 + _ast_info { + ASSERT = { + TYPE = OBJECT; + SIZE = 1012; + }; + }; +$else +$error unknown ELFCLASS +$endif + _ast_intercepts { + ASSERT = { + TYPE = OBJECT; + SIZE = addrsize[2]; + }; + }; +$if _ELF64 + _ast_lc_categories { + ASSERT = { + TYPE = OBJECT; + SIZE = 560; + }; + }; +$elif _ELF32 + _ast_lc_categories { + ASSERT = { + TYPE = OBJECT; + SIZE = 336; + }; + }; +$else +$error unknown ELFCLASS +$endif + _ast_lc_charsets { + ASSERT = { + TYPE = OBJECT; + SIZE = addrsize[72]; + }; + }; + _ast_lc_languages { + ASSERT = { + TYPE = OBJECT; + SIZE = addrsize[1144]; + }; + }; + _ast_lc_maps { + ASSERT = { + TYPE = OBJECT; + SIZE = addrsize[35]; + }; + }; + _ast_lc_territories { + ASSERT = { + TYPE = OBJECT; + SIZE = addrsize[909]; + }; + }; _ast_localeconv; - _ast_locales; + _ast_locales { + ASSERT = { + TYPE = OBJECT; + SIZE = addrsize[14]; + }; + }; _ast_malloc; _ast_memalign; _ast_memdup; @@ -170,15 +291,35 @@ SYMBOL_VERSION SUNWprivate_1.1 { _ast_mktemp; _ast_mktime; _ast_nftw; - _ast_optarg; + _ast_optarg { + ASSERT = { + TYPE = OBJECT; + SIZE = addrsize; + }; + }; _ast_optctx; - _ast_opterr; + _ast_opterr { + ASSERT = { + TYPE = OBJECT; + SIZE = 4; + }; + }; _ast_optesc; _ast_optget; _ast_opthelp; - _ast_optind; + _ast_optind { + ASSERT = { + TYPE = OBJECT; + SIZE = 4; + }; + }; _ast_optjoin; - _ast_optopt; + _ast_optopt { + ASSERT = { + TYPE = OBJECT; + SIZE = 4; + }; + }; _ast_optstr; _ast_optusage; _ast_pathaccess; @@ -347,16 +488,81 @@ SYMBOL_VERSION SUNWprivate_1.1 { _ast_wscanf; _ccmapcpy; _ccmapstr; - _dtopen; - _error_info_; + _dtopen; +$if _ELF64 + _error_info_ { + ASSERT = { + TYPE = OBJECT; + SIZE = 176; + }; + }; +$elif _ELF32 + _error_info_ { + ASSERT = { + TYPE = OBJECT; + SIZE = 120; + }; + }; +$else +$error unknown ELFCLASS +$endif _fini; - _hash_info_; + _hash_info_ { + ASSERT = { + TYPE = OBJECT; + SIZE = addrsize; + }; + }; _iblocks; - _init; - _mode_permmap_; - _mode_table_; - _opt_info_; - _proc_info_; + _init; + _mode_permmap_ { + ASSERT = { + TYPE = OBJECT; + SIZE = 96; + }; + }; +$if _ELF64 + _mode_table_ { + ASSERT = { + TYPE = OBJECT; + SIZE = 240; + }; + }; + _opt_info_ { + ASSERT = { + TYPE = OBJECT; + SIZE = 176; + }; + }; + _proc_info_ { + ASSERT = { + TYPE = OBJECT; + SIZE = 72; + }; + }; + +$elif _ELF32 + _mode_table_ { + ASSERT = { + TYPE = OBJECT; + SIZE = 200; + }; + }; + _opt_info_ { + ASSERT = { + TYPE = OBJECT; + SIZE = 128; + }; + }; + _proc_info_ { + ASSERT = { + TYPE = OBJECT; + SIZE = 52; + }; + }; +$else +$error unknown ELFCLASS +$endif _re_comp; _re_exec; _re_putc; @@ -364,7 +570,23 @@ SYMBOL_VERSION SUNWprivate_1.1 { _reg_classfun; _reg_drop; _reg_fatal; - _reg_state; +$if _ELF64 + _reg_state { + ASSERT = { + TYPE = OBJECT; + SIZE = 3888; + }; + }; +$elif _ELF32 + _reg_state { + ASSERT = { + TYPE = OBJECT; + SIZE = 2784; + }; + }; +$else +$error unknown ELFCLASS +$endif _sfcvt; _sfdlen; _sfexcept; @@ -387,7 +609,12 @@ SYMBOL_VERSION SUNWprivate_1.1 { _sfsetpool; _sfstrtod; _sftype; - _sig_info_; + _sig_info_ { + ASSERT = { + TYPE = OBJECT; + SIZE = addrsize[3]; + }; + }; _stdgets; _stdopen; _stdprintf; @@ -667,7 +894,12 @@ SYMBOL_VERSION SUNWprivate_1.1 { tvsleep; tvtouch; typefix; - univ_env; + univ_env { + ASSERT = { + TYPE = OBJECT; + SIZE = 13; + }; + }; vecargs; vecfile; vecfree; @@ -699,24 +931,114 @@ SYMBOL_VERSION SUNWprivate_1.1 { # data SYMBOL_VERSION SUNWprivate_1.1 { global: - Dtbag; - Dthash; - Dtlist; - Dtobag; - Dtoset; - Dtqueue; - Dtset; - Dtstack; - Dttree; - Vmbest; - Vmdcheap; - Vmdcsbrk; - Vmdebug; - Vmheap; - Vmlast; - Vmpool; - Vmprofile; - Vmregion; + Dtbag { + ASSERT = { + TYPE = OBJECT; + SIZE = addrsize; + }; + }; + Dthash { + ASSERT = { + TYPE = OBJECT; + SIZE = addrsize; + }; + }; + Dtlist { + ASSERT = { + TYPE = OBJECT; + SIZE = addrsize; + }; + }; + Dtobag { + ASSERT = { + TYPE = OBJECT; + SIZE = addrsize; + }; + }; + Dtoset { + ASSERT = { + TYPE = OBJECT; + SIZE = addrsize; + }; + }; + Dtqueue { + ASSERT = { + TYPE = OBJECT; + SIZE = addrsize; + }; + }; + Dtset { + ASSERT = { + TYPE = OBJECT; + SIZE = addrsize; + }; + }; + Dtstack { + ASSERT = { + TYPE = OBJECT; + SIZE = addrsize; + }; + }; + Dttree { + ASSERT = { + TYPE = OBJECT; + SIZE = addrsize; + }; + }; + Vmbest { + ASSERT = { + TYPE = OBJECT; + SIZE = addrsize; + }; + }; + Vmdcheap { + ASSERT = { + TYPE = OBJECT; + SIZE = addrsize; + }; + }; + Vmdcsbrk { + ASSERT = { + TYPE = OBJECT; + SIZE = addrsize; + }; + }; + Vmdebug { + ASSERT = { + TYPE = OBJECT; + SIZE = addrsize; + }; + }; + Vmheap { + ASSERT = { + TYPE = OBJECT; + SIZE = addrsize; + }; + }; + Vmlast { + ASSERT = { + TYPE = OBJECT; + SIZE = addrsize; + }; + }; + Vmpool { + ASSERT = { + TYPE = OBJECT; + SIZE = addrsize; + }; + }; + Vmprofile { + ASSERT = { + TYPE = OBJECT; + SIZE = addrsize; + }; + }; + Vmregion { + ASSERT = { + TYPE = OBJECT; + SIZE = addrsize; + }; + }; _DATA_dtlist; _DATA_dttree; _DATA_sigdata; @@ -726,24 +1048,144 @@ SYMBOL_VERSION SUNWprivate_1.1 { _DATA_vmlast; _DATA_vmpool; _DATA_vmprofile; - _Sfstderr; - _Sfstdin; - _Sfstdout; - _Stak_data; - _ast_conf_data; - _ast_conf_ndata; - _ast_conf_nprefix; - _ast_conf_prefix; +$if _ELF64 + _Sfstderr { + ASSERT = { + TYPE = OBJECT; + SIZE = 176; + }; + }; + _Sfstdin { + ASSERT = { + TYPE = OBJECT; + SIZE = 176; + }; + }; + _Sfstdout { + ASSERT = { + TYPE = OBJECT; + SIZE = 176; + }; + }; + _Stak_data { + ASSERT = { + TYPE = OBJECT; + SIZE = 176; + }; + }; + _ast_conf_data { + ASSERT = { + TYPE = OBJECT; + SIZE = 27440; + }; + }; +$elif _ELF32 + _Sfstderr { + ASSERT = { + TYPE = OBJECT; + SIZE = 104; + }; + }; + _Sfstdin { + ASSERT = { + TYPE = OBJECT; + SIZE = 104; + }; + }; + _Sfstdout { + ASSERT = { + TYPE = OBJECT; + SIZE = 104; + }; + }; + _Stak_data { + ASSERT = { + TYPE = OBJECT; + SIZE = 104; + }; + }; + _ast_conf_data { + ASSERT = { + TYPE = OBJECT; + SIZE = 23324; + }; + }; +$else +$error unknown ELFCLASS +$endif + _ast_conf_ndata { + ASSERT = { + TYPE = OBJECT; + SIZE = 4; + }; + }; + _ast_conf_nprefix { + ASSERT = { + TYPE = OBJECT; + SIZE = 4; + }; + }; + _ast_conf_prefix { + ASSERT = { + TYPE = OBJECT; + SIZE = 374; + }; + }; _ccmap; - _error_infop_; - _opt_infop_; - _tm_data_; - _tm_datap_; - _tm_info_; - _tm_infop_; - sfstderr; - sfstdin; - sfstdout; + _error_infop_ { + ASSERT = { + TYPE = OBJECT; + SIZE = addrsize; + }; + }; + _opt_infop_ { + ASSERT = { + TYPE = OBJECT; + SIZE = addrsize; + }; + }; + _tm_data_ { + ASSERT = { + TYPE = OBJECT; + SIZE = addrsize[7]; + }; + }; + _tm_datap_ { + ASSERT = { + TYPE = OBJECT; + SIZE = addrsize; + }; + }; + _tm_info_ { + ASSERT = { + TYPE = OBJECT; + SIZE = addrsize[6]; + }; + }; + _tm_infop_ { + ASSERT = { + TYPE = OBJECT; + SIZE = addrsize; + }; + }; + sfstderr { + ASSERT = { + TYPE = OBJECT; + SIZE = addrsize; + }; + }; + sfstdin { + ASSERT = { + TYPE = OBJECT; + SIZE = addrsize; + }; + }; + sfstdout { + ASSERT = { + TYPE = OBJECT; + SIZE = addrsize; + }; + }; local: *; }; diff --git a/usr/src/cmd/ast/libpp/mapfile-vers b/usr/src/cmd/ast/libpp/mapfile-vers index 76d7fcc53c..499b7285ec 100644 --- a/usr/src/cmd/ast/libpp/mapfile-vers +++ b/usr/src/cmd/ast/libpp/mapfile-vers @@ -42,7 +42,7 @@ $mapfile_version 2 SYMBOL_VERSION SUNWprivate_1.1 { global: - pp; + pp { ASSERT = { TYPE = OBJECT; SIZE = 716; }; }; ppop; pplex; ppinput; diff --git a/usr/src/cmd/ast/libshell/mapfile-vers b/usr/src/cmd/ast/libshell/mapfile-vers index de5e85d7c1..344f0697c1 100644 --- a/usr/src/cmd/ast/libshell/mapfile-vers +++ b/usr/src/cmd/ast/libshell/mapfile-vers @@ -122,8 +122,14 @@ SYMBOL_VERSION SUNWprivate_1.1 { nv_unset; # semi-private, needed for shcomp - sh; - e_dict; +$if _ELF64 + sh { ASSERT = { TYPE = OBJECT; SIZE = 1888; }; }; +$elif _ELF32 + sh { ASSERT = { TYPE = OBJECT; SIZE = 1216; }; }; +$else +$error unknown ELFCLASS +$endif + e_dict { ASSERT = { TYPE = OBJECT; SIZE = 9; }; }; local: *; diff --git a/usr/src/cmd/fs.d/nfs/rp_basic/Makefile.com b/usr/src/cmd/fs.d/nfs/rp_basic/Makefile.com index 282067be42..d9708ea5f6 100644 --- a/usr/src/cmd/fs.d/nfs/rp_basic/Makefile.com +++ b/usr/src/cmd/fs.d/nfs/rp_basic/Makefile.com @@ -48,13 +48,15 @@ CPPFLAGS += -D_REENTRANT -I$(SRC)/cmd/fs.d/nfs/lib # not linted SMATCH=off +ZGUIDANCE= -Wl,-zguidance=noasserts + .KEEP_STATE: all: $(LIBS) install: $(ROOTLIBDIR) $(ROOTLIBDIR64) all -lint: lintcheck + pics/ref_subr.o: ../../lib/ref_subr.c $(COMPILE.c) -o pics/ref_subr.o ../../lib/ref_subr.c diff --git a/usr/src/cmd/fwflash/plugins/Makefile.targ b/usr/src/cmd/fwflash/plugins/Makefile.targ index 408b3d5556..3dc6cf0b05 100644 --- a/usr/src/cmd/fwflash/plugins/Makefile.targ +++ b/usr/src/cmd/fwflash/plugins/Makefile.targ @@ -63,7 +63,10 @@ $(HERMON-MELLANOX_LIB):= LDLIBS += -L. $(ROOT)/usr/lib/fwflash/identify/hermon.s $(SD-GENERIC_LIB):= LDLIBS += -L$(ROOT)/usr/lib/scsi -lscsi $(SD-GENERIC_LIB):= DYNFLAGS += -R/usr/lib/scsi -.KEEP_STATE: +# Size assertions are non-constant and not useful here +ZGUIDANCE=-Wl,-zguidance=noasserts + +.KEEP STATE: all: $(LIBS) diff --git a/usr/src/cmd/fwflash/plugins/transport/Makefile.targ b/usr/src/cmd/fwflash/plugins/transport/Makefile.targ index 31a935bf5a..c9a37337dd 100644 --- a/usr/src/cmd/fwflash/plugins/transport/Makefile.targ +++ b/usr/src/cmd/fwflash/plugins/transport/Makefile.targ @@ -78,7 +78,10 @@ $(UFM_LIB):= LDLIBS += -lpcidb -lnvpair -lc $(SES_LIB):= DYNFLAGS += -R/usr/lib/scsi $(SD_LIB):= DYNFLAGS += -R/usr/lib/scsi -.KEEP_STATE: +# Size assertions are non-constant and not useful here +ZGUIDANCE=-Wl,-zguidance=noasserts + +.KEEP STATE: $(ROOTUSRLIBFWFLASHIDF)/$(SLINKS) : $(ROOTUSRLIBFWFLASHIDF)/$(SES_LIB) @$(RM) $@ diff --git a/usr/src/cmd/sgs/include/libld.h b/usr/src/cmd/sgs/include/libld.h index 3e821ecdbe..a48cdaf553 100644 --- a/usr/src/cmd/sgs/include/libld.h +++ b/usr/src/cmd/sgs/include/libld.h @@ -407,6 +407,8 @@ struct ofl_desc { ofl_guideflag_t ofl_guideflags; /* -z guide flags */ APlist *ofl_assdeflib; /* -z assert-deflib exceptions */ int ofl_aslr; /* -z aslr, -1 disable, 1 enable */ + APlist *ofl_symasserts; /* assertions about symbols */ + /* from mapfiles */ }; #define FLG_OF_DYNAMIC 0x00000001 /* generate dynamic output module */ @@ -538,6 +540,7 @@ struct ofl_desc { #define FLG_OFG_NO_MF 0x00000008 /* use v2 mapfile syntax */ #define FLG_OFG_NO_TEXT 0x00000010 /* verify pure text segment */ #define FLG_OFG_NO_UNUSED 0x00000020 /* remove unused dependency */ +#define FLG_OFG_NO_ASSERTS 0x00000040 /* suggest mapfile assertions */ /* * Test to see if a guidance should be given for a given category @@ -1146,6 +1149,25 @@ typedef struct { Word md_oidx; /* output Move entry index */ } Mv_desc; +#define SYM_ASSERT_SIZE 0x01 +#define SYM_ASSERT_BIND 0x02 +#define SYM_ASSERT_TYPE 0x04 +#define SYM_ASSERT_BITS 0x08 +#define SYM_ASSERT_ALIAS 0x10 + +typedef struct { + Sym_desc *ass_sdp; + char *ass_file; + Lineno ass_lineno; + uchar_t ass_type; + uchar_t ass_bind; + Lword ass_size; + Boolean ass_bits; + const char *ass_alias; + /* Assertions explicitly enabled by user */ + uint_t ass_enabled; +} Ass_desc; + /* * Symbol descriptor. */ @@ -1165,6 +1187,7 @@ struct sym_desc { Word sd_shndx; /* sect. index sym is associated w/ */ sd_flag_t sd_flags; /* state flags */ Half sd_ref; /* reference definition of symbol */ + Ass_desc *sd_ass; /* pointer back to symbol assertions */ }; /* @@ -1317,6 +1340,8 @@ struct sym_avlnode { #define FLG_SY_DEFERRED 0x0200000000000 /* symbol should not be bound to */ /* during BIND_NOW relocations */ +#define FLG_SY_MAPASSRT 0x0400000000000 /* Symbol has attribute assertions */ + /* * A symbol can only be truly hidden if it is not a capabilities symbol. */ diff --git a/usr/src/cmd/sgs/lex/common/mapfile-vers b/usr/src/cmd/sgs/lex/common/mapfile-vers index 1e59867fcb..12c3fba721 100644 --- a/usr/src/cmd/sgs/lex/common/mapfile-vers +++ b/usr/src/cmd/sgs/lex/common/mapfile-vers @@ -54,6 +54,6 @@ SYMBOL_VERSION SUNW_1.1 { yyreject_e; yyreject_w; yywrap; - local: + local: *; }; diff --git a/usr/src/cmd/sgs/libconv/common/symbols.c b/usr/src/cmd/sgs/libconv/common/symbols.c index fd81544c59..1a7b057935 100644 --- a/usr/src/cmd/sgs/libconv/common/symbols.c +++ b/usr/src/cmd/sgs/libconv/common/symbols.c @@ -144,6 +144,12 @@ conv_sym_info_type_strings(Half mach, Conv_fmt_flags_t fmt_flags) MSG_STT_FILE_CF, MSG_STT_COMMON_CF, MSG_STT_TLS_CF, MSG_STT_IFUNC_CF }; + static const Msg types_cfnp[] = { + MSG_STT_NOTYPE_CFNP, MSG_STT_OBJECT_CFNP, + MSG_STT_FUNC_CFNP, MSG_STT_SECTION_CFNP, + MSG_STT_FILE_CFNP, MSG_STT_COMMON_CFNP, + MSG_STT_TLS_CFNP, MSG_STT_IFUNC_CFNP + }; static const Msg types_nf[] = { MSG_STT_NOTYPE_NF, MSG_STT_OBJECT_NF, MSG_STT_FUNC_NF, MSG_STT_SECTION_NF, @@ -154,17 +160,22 @@ conv_sym_info_type_strings(Half mach, Conv_fmt_flags_t fmt_flags) CONV_DS_MSG_INIT(STT_NOTYPE, types_def) }; static const conv_ds_msg_t ds_types_cf = { CONV_DS_MSG_INIT(STT_NOTYPE, types_cf) }; + static const conv_ds_msg_t ds_types_cfnp = { + CONV_DS_MSG_INIT(STT_NOTYPE, types_cfnp) }; static const conv_ds_msg_t ds_types_nf = { CONV_DS_MSG_INIT(STT_NOTYPE, types_nf) }; static const Msg sparc_def[] = { MSG_STT_SPARC_REGISTER_DEF }; static const Msg sparc_cf[] = { MSG_STT_SPARC_REGISTER_CF }; + static const Msg sparc_cfnp[] = { MSG_STT_SPARC_REGISTER_CFNP }; static const Msg sparc_nf[] = { MSG_STT_SPARC_REGISTER_NF }; static const conv_ds_msg_t ds_sparc_def = { CONV_DS_MSG_INIT(STT_SPARC_REGISTER, sparc_def) }; static const conv_ds_msg_t ds_sparc_cf = { CONV_DS_MSG_INIT(STT_SPARC_REGISTER, sparc_cf) }; + static const conv_ds_msg_t ds_sparc_cfnp = { + CONV_DS_MSG_INIT(STT_SPARC_REGISTER, sparc_cfnp) }; static const conv_ds_msg_t ds_sparc_nf = { CONV_DS_MSG_INIT(STT_SPARC_REGISTER, sparc_nf) }; @@ -183,6 +194,11 @@ conv_sym_info_type_strings(Half mach, Conv_fmt_flags_t fmt_flags) if (is_sparc) retarr[retndx++] = CONV_DS_ADDR(ds_sparc_cf); break; + case CONV_FMT_ALT_CFNP: + retarr[retndx++] = CONV_DS_ADDR(ds_types_cfnp); + if (is_sparc) + retarr[retndx++] = CONV_DS_ADDR(ds_sparc_cfnp); + break; case CONV_FMT_ALT_NF: retarr[retndx++] = CONV_DS_ADDR(ds_types_nf); if (is_sparc) @@ -227,6 +243,10 @@ conv_sym_info_bind_strings(Conv_fmt_flags_t fmt_flags) MSG_STB_LOCAL_CF, MSG_STB_GLOBAL_CF, MSG_STB_WEAK_CF }; + static const Msg binds_cfnp[] = { + MSG_STB_LOCAL_CFNP, MSG_STB_GLOBAL_CFNP, + MSG_STB_WEAK_CFNP + }; static const Msg binds_nf[] = { MSG_STB_LOCAL_NF, MSG_STB_GLOBAL_NF, MSG_STB_WEAK_NF @@ -235,6 +255,8 @@ conv_sym_info_bind_strings(Conv_fmt_flags_t fmt_flags) CONV_DS_MSG_INIT(STB_LOCAL, binds_def) }; static const conv_ds_msg_t ds_binds_cf = { CONV_DS_MSG_INIT(STB_LOCAL, binds_cf) }; + static const conv_ds_msg_t ds_binds_cfnp = { + CONV_DS_MSG_INIT(STB_LOCAL, binds_cfnp) }; static const conv_ds_msg_t ds_binds_nf = { CONV_DS_MSG_INIT(STB_LOCAL, binds_nf) }; @@ -244,6 +266,8 @@ conv_sym_info_bind_strings(Conv_fmt_flags_t fmt_flags) CONV_DS_ADDR(ds_binds_def), NULL }; static const conv_ds_t *ds_cf[] = { CONV_DS_ADDR(ds_binds_cf), NULL }; + static const conv_ds_t *ds_cfnp[] = { + CONV_DS_ADDR(ds_binds_cfnp), NULL }; static const conv_ds_t *ds_nf[] = { CONV_DS_ADDR(ds_binds_nf), NULL }; @@ -252,6 +276,8 @@ conv_sym_info_bind_strings(Conv_fmt_flags_t fmt_flags) switch (CONV_TYPE_FMT_ALT(fmt_flags)) { case CONV_FMT_ALT_CF: return (ds_cf); + case CONV_FMT_ALT_CFNP: + return (ds_cfnp); case CONV_FMT_ALT_NF: return (ds_nf); } diff --git a/usr/src/cmd/sgs/libconv/common/symbols.msg b/usr/src/cmd/sgs/libconv/common/symbols.msg index 7af17b2a36..c95cac8b35 100644 --- a/usr/src/cmd/sgs/libconv/common/symbols.msg +++ b/usr/src/cmd/sgs/libconv/common/symbols.msg @@ -23,41 +23,53 @@ # Use is subject to license terms. # -@ MSG_STT_NOTYPE_CF "STT_NOTYPE" # 0 +@ MSG_STT_NOTYPE_CF "STT_NOTYPE" # 0 +@ MSG_STT_NOTYPE_CFNP "NOTYPE" @ MSG_STT_NOTYPE_NF "notype" @ MSG_STT_NOTYPE_DEF "NOTY" @ MSG_STT_OBJECT_CF "STT_OBJECT" # 1 +@ MSG_STT_OBJECT_CFNP "OBJECT" @ MSG_STT_OBJECT_NF "object" @ MSG_STT_OBJECT_DEF "OBJT" @ MSG_STT_FUNC_CF "STT_FUNC" # 2 +@ MSG_STT_FUNC_CFNP "FUNC" @ MSG_STT_FUNC_NF "func" @ MSG_STT_FUNC_DEF "FUNC" @ MSG_STT_SECTION_CF "STT_SECTION" # 3 +@ MSG_STT_SECTION_CFNP "SECTION" @ MSG_STT_SECTION_NF "section" @ MSG_STT_SECTION_DEF "SECT" @ MSG_STT_FILE_CF "STT_FILE" # 4 +@ MSG_STT_FILE_CFNP "FILE" @ MSG_STT_FILE_NF "file" @ MSG_STT_FILE_DEF "FILE" @ MSG_STT_COMMON_CF "STT_COMMON" # 5 +@ MSG_STT_COMMON_CFNP "COMMON" @ MSG_STT_COMMON_NF "common" @ MSG_STT_COMMON_DEF "COMM" @ MSG_STT_TLS_CF "STT_TLS" # 6 +@ MSG_STT_TLS_CFNP "TLS" @ MSG_STT_TLS_NF "tls" @ MSG_STT_TLS_DEF "TLS " @ MSG_STT_IFUNC_CF "STT_IFUNC" # 6 +@ MSG_STT_IFUNC_CFNP "IFUNC" @ MSG_STT_IFUNC_NF "ifunc" @ MSG_STT_IFUNC_DEF "IFNC" @ MSG_STT_SPARC_REGISTER_CF "STT_SPARC_REGISTER" #13 +@ MSG_STT_SPARC_REGISTER_CFNP "SPARC_REGISTER" @ MSG_STT_SPARC_REGISTER_NF "sparc_register" @ MSG_STT_SPARC_REGISTER_DEF "REGI" @ MSG_STB_LOCAL_CF "STB_LOCAL" # 0 +@ MSG_STB_LOCAL_CFNP "LOCAL" @ MSG_STB_LOCAL_NF "local" @ MSG_STB_LOCAL_DEF "LOCL" @ MSG_STB_GLOBAL_CF "STB_GLOBAL" # 1 +@ MSG_STB_GLOBAL_CFNP "GLOBAL" @ MSG_STB_GLOBAL_NF "global" @ MSG_STB_GLOBAL_DEF "GLOB" @ MSG_STB_WEAK_CF "STB_WEAK" # 2 +@ MSG_STB_WEAK_CFNP "WEAK" @ MSG_STB_WEAK_NF "weak" @ MSG_STB_WEAK_DEF "WEAK" diff --git a/usr/src/cmd/sgs/libdl/common/mapfile-vers b/usr/src/cmd/sgs/libdl/common/mapfile-vers index 9251d2ab0b..2bd3aa32c6 100644 --- a/usr/src/cmd/sgs/libdl/common/mapfile-vers +++ b/usr/src/cmd/sgs/libdl/common/mapfile-vers @@ -103,8 +103,8 @@ $if _sparc && _ELF32 SYMBOL_VERSION SISCD_2.3 { global: $endif - dlclose { TYPE = FUNCTION }; - dlerror { TYPE = FUNCTION }; + dlclose { TYPE = FUNCTION }; + dlerror { TYPE = FUNCTION }; dlopen { TYPE = FUNCTION }; dlsym { TYPE = FUNCTION }; }; @@ -113,14 +113,14 @@ $endif SYMBOL_VERSION SUNWprivate_1.1 { global: _ld_libc { TYPE = FUNCTION }; - _dlinfo { TYPE = FUNCTION }; - _dldump { TYPE = FUNCTION }; + _dlinfo { TYPE = FUNCTION }; + _dldump { TYPE = FUNCTION }; _dlmopen { TYPE = FUNCTION }; - _dlopen { TYPE = FUNCTION }; + _dlopen { TYPE = FUNCTION }; _dlerror { TYPE = FUNCTION }; _dlsym { TYPE = FUNCTION }; _dlclose { TYPE = FUNCTION }; - _dladdr { TYPE = FUNCTION }; + _dladdr { TYPE = FUNCTION }; _dladdr1 { TYPE = FUNCTION }; $if amd64 diff --git a/usr/src/cmd/sgs/libld/common/_libld.h b/usr/src/cmd/sgs/libld/common/_libld.h index d34bda5fa4..42e15e4e82 100644 --- a/usr/src/cmd/sgs/libld/common/_libld.h +++ b/usr/src/cmd/sgs/libld/common/_libld.h @@ -460,6 +460,7 @@ typedef struct { #define AL_CNT_SEGMENTS 20 /* ofl_segs */ #define AL_CNT_ASSDEFLIB 4 /* ofl_assdeflib exceptions count */ +#define AL_CNT_MAPASSERT 10 /* mapfile assertions */ /* * Return codes for {tls|got}_fixups() routines diff --git a/usr/src/cmd/sgs/libld/common/_map.h b/usr/src/cmd/sgs/libld/common/_map.h index 3c2dad735b..f05ddf01ce 100644 --- a/usr/src/cmd/sgs/libld/common/_map.h +++ b/usr/src/cmd/sgs/libld/common/_map.h @@ -156,6 +156,8 @@ typedef enum { TK_INT = 12, /* Integer value: Unsigned machine word */ TK_STAR = 13, /* * */ TK_BANG = 14, /* ! */ + TK_LEFTSQR = 15, /* [ */ + TK_RIGHTSQR = 16, /* ] */ /* * Items below this point are for the use of ld_map_gettoken(). @@ -197,11 +199,13 @@ typedef union { * Values for gettoken() flags argument. These flags are used to * alter gettoken() default behavior under certain conditions. */ -#define TK_F_EOFOK 1 /* Quietly return TK_EOF instead of normal */ - /* TK_ERROR "premature EOF" error */ -#define TK_F_STRLC 2 /* TK_STRING: Convert string to lowercase */ -#define TK_F_KEYWORD 4 /* For directives and attributes: Disallow */ +#define TK_F_EOFOK 0x1 /* Quietly return TK_EOF instead of normal */ + /* TK_ERROR "premature EOF" error */ +#define TK_F_STRLC 0x2 /* TK_STRING: Convert string to lowercase */ +#define TK_F_KEYWORD 0x4 /* For directives and attributes: Disallow */ /* quoted TK_STRING tokens */ +#define TK_F_MULOK 0x8 /* TK_INT: Allow multiplicand[multiplier] */ + /* syntax */ /* * Possible return values from ld_map_strtoxword() @@ -246,9 +250,10 @@ typedef struct { const char *ms_name; /* symbol name */ sd_flag_t ms_sdflags; /* 0 / mapfile set flags */ Word ms_shndx; /* SHN_UNDEF / mapfile set sec index */ - uchar_t ms_type; /* STT_NOTYPE / mapfile set type */ + uchar_t ms_type; /* STT_NOTYPE / mapfile set type */ Addr ms_value; /* user set value, if ms_value_set */ Addr ms_size; /* 0 / mapfile set size */ + Boolean ms_size_set; /* True if ms_size set, even if to 0 */ const char *ms_filtee; /* NULL or filtee name */ Boolean ms_value_set; /* TRUE if ms_value set, even if to 0 */ Word ms_dft_flag; /* 0, or type of filter in ms_filtee */ @@ -264,6 +269,7 @@ typedef struct { #define ld_map_ifl ld64_map_ifl #define ld_map_parse_v1 ld64_map_parse_v1 #define ld_map_parse_v2 ld64_map_parse_v2 +#define ld_map_peektoken ld64_map_peektoken #define ld_map_seg_alloc ld64_map_seg_alloc #define ld_map_seg_ent_add ld64_map_seg_ent_add #define ld_map_seg_ent_files ld64_map_seg_ent_files @@ -292,6 +298,7 @@ typedef struct { #define ld_map_ifl ld32_map_ifl #define ld_map_parse_v1 ld32_map_parse_v1 #define ld_map_parse_v2 ld32_map_parse_v2 +#define ld_map_peektoken ld32_map_peektoken #define ld_map_seg_alloc ld32_map_seg_alloc #define ld_map_seg_ent_add ld32_map_seg_ent_add #define ld_map_seg_ent_files ld32_map_seg_ent_files @@ -317,6 +324,7 @@ typedef struct { */ extern void ld_map_lowercase(char *); extern Token ld_map_gettoken(Mapfile *, int, ld_map_tkval_t *); +extern Token ld_map_peektoken(Mapfile *); extern Boolean ld_map_parse_v1(Mapfile *); extern Boolean ld_map_parse_v2(Mapfile *); extern ld_map_strtoxword_t ld_map_strtoxword(const char *restrict, @@ -349,7 +357,7 @@ extern Boolean ld_map_seg_size_symbol(Mapfile *, Sg_desc *, Token, const char *symname); extern Sg_desc *ld_map_seg_stack(Mapfile *); extern Boolean ld_map_sym_enter(Mapfile *, ld_map_ver_t *, - ld_map_sym_t *); + ld_map_sym_t *, Ass_desc *); extern void ld_map_sym_filtee(Mapfile *, ld_map_ver_t *, ld_map_sym_t *, Word, const char *); extern void ld_map_sym_scope(Mapfile *, const char *, diff --git a/usr/src/cmd/sgs/libld/common/args.c b/usr/src/cmd/sgs/libld/common/args.c index 1d6baf37c4..f1ad264438 100644 --- a/usr/src/cmd/sgs/libld/common/args.c +++ b/usr/src/cmd/sgs/libld/common/args.c @@ -890,6 +890,7 @@ guidance_parse(Ofl_desc *ofl, char *optarg) { MSG_ORIG(MSG_ARG_GUIDE_NO_MAPFILE), FLG_OFG_NO_MF }, { MSG_ORIG(MSG_ARG_GUIDE_NO_TEXT), FLG_OFG_NO_TEXT }, { MSG_ORIG(MSG_ARG_GUIDE_NO_UNUSED), FLG_OFG_NO_UNUSED }, + { MSG_ORIG(MSG_ARG_GUIDE_NO_ASSERTS), FLG_OFG_NO_ASSERTS }, { NULL, 0 } }; diff --git a/usr/src/cmd/sgs/libld/common/ldmain.c b/usr/src/cmd/sgs/libld/common/ldmain.c index 66d14e22c8..f77e6ac8b7 100644 --- a/usr/src/cmd/sgs/libld/common/ldmain.c +++ b/usr/src/cmd/sgs/libld/common/ldmain.c @@ -194,6 +194,7 @@ ld_main(int argc, char **argv, Half mach) MSG_INTL(MSG_GUIDE_SUMMARY)); return (1); } + if (ofl->ofl_flags & FLG_OF_FATAL) { ld_eprintf(ofl, ERR_FATAL, MSG_INTL(MSG_ARG_FLAGS)); /* If any ERR_GUIDANCE messages were issued, add a summary */ diff --git a/usr/src/cmd/sgs/libld/common/libld.msg b/usr/src/cmd/sgs/libld/common/libld.msg index 182afd2478..86d8d2e9f3 100644 --- a/usr/src/cmd/sgs/libld/common/libld.msg +++ b/usr/src/cmd/sgs/libld/common/libld.msg @@ -21,9 +21,6 @@ # # Copyright (c) 1995, 2010, Oracle and/or its affiliates. All rights reserved. -# - -# # Copyright (c) 2012, Joyent, Inc. All rights reserved. # Copyright 2017 RackTop Systems. # @@ -176,7 +173,7 @@ \t\t\ton dynamic dependencies\n" @ MSG_ARG_DETAIL_ZGUIDE "\t[-z guidance | -z guidance=item1,item2,...]\n\ \t\t\tenable guidance warnings. items: \ - noall, nodefs,\n\ + noall, noasserts, nodefs,\n\ \t\t\tnodirect, nolazyload, nomapfile, notext, \ nounused\n" @ MSG_ARG_DETAIL_ZH "\t[-z help], [--help]\n\ @@ -473,8 +470,8 @@ @ MSG_SCN_NONALLOC "%s: non-allocatable section '%s' directed to a \ loadable segment: %s" -@ MSG_SCN_MULTICOMDAT "file %s: section [%u]%s: cannot be susceptible to multiple \ - COMDAT mechanisms: %s" +@ MSG_SCN_MULTICOMDAT "file %s: section [%u]%s: cannot be susceptible \ + to multiple COMDAT mechanisms: %s" @ MSG_SCN_DWFOVRFLW "%s: section %s: encoded DWARF data exceeds \ section size" @@ -521,10 +518,10 @@ 0x%llx for symbol index" @ MSG_PSYM_INVMINFO2 "file %s: section [%u]%s: entry[%d] has invalid m_info: \ 0x%llx for size" -@ MSG_PSYM_INVMREPEAT "file %s: section [%u]%s: entry[%d] has invalid m_repeat: \ - 0x%llx" -@ MSG_PSYM_CANNOTEXPND "file %s: section [%u]%s: entry[%d] can not be expanded: \ - associated symbol size is unknown %s" +@ MSG_PSYM_INVMREPEAT "file %s: section [%u]%s: entry[%d] has \ + invalid m_repeat: 0x%llx" +@ MSG_PSYM_CANNOTEXPND "file %s: section [%u]%s: entry[%d] can not be \ + expanded: associated symbol size is unknown %s" @ MSG_PSYM_NOSTATIC "and partial initialization cannot be deferred to \ a static object" @ MSG_MOVE_OVERLAP "file %s: section [%u]%s: symbol '%s' overlapping move \ @@ -710,6 +707,8 @@ @ MSG_GUIDE_TEXT "position independent (PIC) code recommended for \ shared objects" @ MSG_GUIDE_UNUSED "removal of unused dependency recommended: %s" +@ MSG_GUIDE_ASSERT_SIZE "size assertion recommended for non-local data: %s \ + size: %llu" @ _END_ @@ -731,6 +730,8 @@ @ MSG_QSTR_DASH "'-'" @ MSG_QSTR_LEFTBKT "'{'" @ MSG_QSTR_RIGHTBKT "'}'" +@ MSG_QSTR_LEFTSQR "'['" +@ MSG_QSTR_RIGHTSQR "']'" @ MSG_QSTR_PIPE "'|'" @ MSG_QSTR_STAR "'*'" @ MSG_STR_DOT "." @@ -1190,6 +1191,7 @@ @ MSG_MAP_EXP_ATTR "%s: %llu: expected attribute name (%s), or \ terminator (';', '}'): %s" +@ MSG_MAP_EXP_BINDTYPE "%s: %llu: expected binding type (%s): %s" @ MSG_MAP_EXP_CAPMASK "%s: %llu: expected capability name, integer value, or \ terminator (';', '}'): %s" @ MSG_MAP_EXP_CAPNAME "%s: %llu: expected name, or terminator (';', '}'): %s" @@ -1206,6 +1208,7 @@ @ MSG_MAP_EXP_FILNAM "%s: %llu: expected file name following %s: %s" @ MSG_MAP_EXP_FILPATH "%s: %llu: expected file path following %s: %s" @ MSG_MAP_EXP_INT "%s: %llu: expected integer value following %s: %s" +@ MSG_MAP_EXP_RIGHTSQ "%s: %llu: expected ']' to terminate multiplier of: %s" @ MSG_MAP_EXP_LBKT "%s: %llu: expected '{' following %s: %s" @ MSG_MAP_EXP_OBJNAM "%s: %llu: expected object name following %s: %s" @ MSG_MAP_SFLG_ONEBANG "%s: %llu: '!' can only be specified once per flag" @@ -1220,6 +1223,7 @@ @ MSG_MAP_EXP_SEM "%s: %llu: expected ';' to terminate %s: %s" @ MSG_MAP_EXP_SEMLBKT "%s: %llu: expected ';' or '{' following %s: %s" @ MSG_MAP_EXP_SEMRBKT "%s: %llu: expected ';' or '}' to terminate %s: %s" +@ MSG_MAP_EXP_SHATTRTYPE "%s: %llu: expected section attribute (%s): %s" @ MSG_MAP_EXP_SHTYPE "%s: %llu: expected section type: %s" @ MSG_MAP_EXP_SYM "%s: %llu: expected symbol name, symbol scope, \ or '*': %s" @@ -1234,12 +1238,18 @@ @ MSG_MAP_EXP_VERSION "%s: %llu: expected version name following %s: %s" @ MSG_MAP_BADEXTRA "%s: %llu: unexpected text found following %s directive" @ MSG_MAP_VALUELIMIT "%s: %llu: numeric value exceeds word size: %s" +@ MSG_MAP_MULOVERFLOW "%s: %llu: multiplication overflow (%llu * %llu)" @ MSG_MAP_MALVALUE "%s: %llu: malformed numeric value: %s" @ MSG_MAP_BADVALUETAIL "%s: %llu: unexpected characters following numeric \ constant: %s" @ MSG_MAP_WSNEEDED "%s: %llu: whitespace needed before token: %s" @ MSG_MAP_BADCHAR "%s: %llu: unexpected text: %s" @ MSG_MAP_BADKWQUOTE "%s: %llu: mapfile keywords should not be quoted: %s" +@ MSG_MAP_BADALIAS "%s: %llu: expected string valued ALIAS" +@ MSG_MAP_ALIAS_COMBO "%s: %llu: %s: ALIAS assertions may only be \ + used with BINDING" +@ MSG_MAP_EXTPAR_ASSERT "%s: %llu: can't assert attributes of \ + extern/parent symbol: %s" @ MSG_MAP_CDIR_NOTBOL "%s: %llu: mapfile control directive not at start of \ line: %s" @ MSG_MAP_NOATTR "%s: %llu: %s specified no attributes (empty {})" @@ -1290,6 +1300,23 @@ @ MSG_ARG_ASSDEFLIB_MALFORMED "library name malformed: %s" @ MSG_ARG_ASSDEFLIB_FOUND "dynamic library found on default search path \ (%s): lib%s.so" +# Assertion failures +@ MSG_ASSFAIL_ALIAS "%s: %llu: assertion failed: symbol %s is \ + not an alias of %s" +@ MSG_ASSFAIL_SCOPE "%s: %llu: assertion failed: scope of symbol %s \ + should be: %s is: %s" +@ MSG_ASSFAIL_SIZE "%s: %llu: assertion failed: size of symbol %s \ + should be: %llu is: %llu" +@ MSG_ASSFAIL_TYPE "%s: %llu: assertion failed: type of symbol %s \ + should be: %s is: %s", +@ MSG_ASSFAIL_BITS "%s: %llu: assertion failed: symbol %s is in an \ + SHT_NOBITS section" +@ MSG_ASSFAIL_NOBITS "%s: %llu: assertion failed: symbol %s is not in an \ + SHT_NOBITS section" +@ MSG_ALIAS_BADSYM "%s: %llu: assertion failed: unknown symbol in ALIAS: %s" +@ MSG_ALIAS_NOTALIAS "%s: %llu: %s and %s (%s: %llu) should be asserted \ + as aliases" +@ MSG_ALIAS_TOALIAS "%s: %llu: %s should not be aliased to an alias" @ _END_ @@ -1503,6 +1530,7 @@ @ MSG_ARG_GUIDE_NO_MAPFILE "nomapfile" @ MSG_ARG_GUIDE_NO_TEXT "notext" @ MSG_ARG_GUIDE_NO_UNUSED "nounused" +@ MSG_ARG_GUIDE_NO_ASSERTS "noasserts" # -z type= strings @ MSG_ARG_TYPE_RELOC "reloc" @@ -1537,6 +1565,7 @@ @ MSG_MAP_NOTE "note" @ MSG_MAP_NULL "null" @ MSG_MAP_STACK "stack" +@ MSG_MAP_ADDRSIZE "addrsize" @ MSG_MAP_ADDVERS "addvers" @ MSG_MAP_FUNCTION "function" @ MSG_MAP_DATA "data" @@ -1552,12 +1581,17 @@ @ MSG_MAP_DYNSORT "dynsort" @ MSG_MAP_NODYNSORT "nodynsort" +@ MSG_MAPKW_ALIAS "ALIAS" @ MSG_MAPKW_ALIGN "ALIGN" @ MSG_MAPKW_ALLOC "ALLOC" @ MSG_MAPKW_ALLOW "ALLOW" @ MSG_MAPKW_AMD64_LARGE "AMD64_LARGE" +@ MSG_MAPKW_ASSERT "ASSERT" @ MSG_MAPKW_ASSIGN_SECTION "ASSIGN_SECTION" @ MSG_MAPKW_AUX "AUXILIARY" +@ MSG_MAPKW_BIND "BIND" +@ MSG_MAPKW_BINDING "BINDING" +@ MSG_MAPKW_BITS "BITS" @ MSG_MAPKW_CAPABILITY "CAPABILITY" @ MSG_MAPKW_COMMON "COMMON" @ MSG_MAPKW_DATA "DATA" @@ -1570,30 +1604,34 @@ @ MSG_MAPKW_EXECUTE "EXECUTE" @ MSG_MAPKW_EXPORTED "EXPORTED" @ MSG_MAPKW_EXTERN "EXTERN" -@ MSG_MAPKW_FILTER "FILTER" +@ MSG_MAPKW_FILE "FILE" @ MSG_MAPKW_FILE_BASENAME "FILE_BASENAME" -@ MSG_MAPKW_FILE_PATH "FILE_PATH" @ MSG_MAPKW_FILE_OBJNAME "FILE_OBJNAME" -@ MSG_MAPKW_FUNCTION "FUNCTION" +@ MSG_MAPKW_FILE_PATH "FILE_PATH" +@ MSG_MAPKW_FILTER "FILTER" @ MSG_MAPKW_FLAGS "FLAGS" +@ MSG_MAPKW_FUNC "FUNC" +@ MSG_MAPKW_FUNCTION "FUNCTION" @ MSG_MAPKW_GLOBAL "GLOBAL" -@ MSG_MAPKW_INTERPOSE "INTERPOSE" -@ MSG_MAPKW_HIDDEN "HIDDEN" @ MSG_MAPKW_HDR_NOALLOC "HDR_NOALLOC" +@ MSG_MAPKW_HIDDEN "HIDDEN" @ MSG_MAPKW_HW "HW" @ MSG_MAPKW_HW_1 "HW_1" @ MSG_MAPKW_HW_2 "HW_2" +@ MSG_MAPKW_INTERPOSE "INTERPOSE" @ MSG_MAPKW_IS_NAME "IS_NAME" @ MSG_MAPKW_IS_ORDER "IS_ORDER" @ MSG_MAPKW_LOAD_SEGMENT "LOAD_SEGMENT" @ MSG_MAPKW_LOCAL "LOCAL" @ MSG_MAPKW_MACHINE "MACHINE" @ MSG_MAPKW_MAX_SIZE "MAX_SIZE" -@ MSG_MAPKW_NOHDR "NOHDR" +@ MSG_MAPKW_NOBITS "NOBITS" @ MSG_MAPKW_NODIRECT "NODIRECT" @ MSG_MAPKW_NODYNSORT "NODYNSORT" +@ MSG_MAPKW_NOHDR "NOHDR" @ MSG_MAPKW_NOTE_SEGMENT "NOTE_SEGMENT" @ MSG_MAPKW_NULL_SEGMENT "NULL_SEGMENT" +@ MSG_MAPKW_OBJECT "OBJECT" @ MSG_MAPKW_OS_ORDER "OS_ORDER" @ MSG_MAPKW_PADDR "PADDR" @ MSG_MAPKW_PARENT "PARENT" @@ -1601,21 +1639,25 @@ @ MSG_MAPKW_PLATFORM "PLATFORM" @ MSG_MAPKW_PROTECTED "PROTECTED" @ MSG_MAPKW_READ "READ" -@ MSG_MAPKW_ROUND "ROUND" @ MSG_MAPKW_REQUIRE "REQUIRE" +@ MSG_MAPKW_ROUND "ROUND" +@ MSG_MAPKW_SECTION "SECTION" @ MSG_MAPKW_SEGMENT_ORDER "SEGMENT_ORDER" @ MSG_MAPKW_SF "SF" @ MSG_MAPKW_SF_1 "SF_1" +@ MSG_MAPKW_SHATTR "SH_ATTR" @ MSG_MAPKW_SINGLETON "SINGLETON" @ MSG_MAPKW_SIZE "SIZE" @ MSG_MAPKW_SIZE_SYMBOL "SIZE_SYMBOL" @ MSG_MAPKW_STACK "STACK" +@ MSG_MAPKW_SYMBOLIC "SYMBOLIC" @ MSG_MAPKW_SYMBOL_SCOPE "SYMBOL_SCOPE" @ MSG_MAPKW_SYMBOL_VERSION "SYMBOL_VERSION" -@ MSG_MAPKW_SYMBOLIC "SYMBOLIC" +@ MSG_MAPKW_TLS "TLS" @ MSG_MAPKW_TYPE "TYPE" @ MSG_MAPKW_VADDR "VADDR" @ MSG_MAPKW_VALUE "VALUE" +@ MSG_MAPKW_WEAK "WEAK" @ MSG_MAPKW_WRITE "WRITE" diff --git a/usr/src/cmd/sgs/libld/common/map.c b/usr/src/cmd/sgs/libld/common/map.c index c54db63696..401d66946f 100644 --- a/usr/src/cmd/sgs/libld/common/map.c +++ b/usr/src/cmd/sgs/libld/common/map.c @@ -55,7 +55,7 @@ * Tokens are representations of the sys/auxv_$MACH.h capabilities, for example: * * #define AV_386_FPU 0x0001 is represented as FPU - * #define AV_386_TSC 0x0002 " " " " TSC + * #define AV_386_TSC 0x0002 " " " " TSC * * Or, the above two capabilities could be represented as V0x3. Note, the * OVERRIDE flag is used to ensure that only those values provided via this @@ -286,7 +286,7 @@ valuetoxword(Mapfile *mf, ld_map_tkval_t *tkv, Xword *value) /* * Process a mapfile segment declaration definition. * segment_name = segment_attribute; - * segment_attribute : segment_type segment_flags virtual_addr + * segment_attribute : segment_type segment_flags virtual_addr * physical_addr length alignment */ static Boolean @@ -589,7 +589,7 @@ map_equal(Mapfile *mf, Sg_desc *sgp) /* * Process a mapfile mapping directives definition. * - * segment_name : section_attribute [ : file_name ] + * segment_name : section_attribute [ : file_name ] * * Where segment_attribute is one of: section_name section_type section_flags; */ @@ -795,7 +795,7 @@ map_colon(Mapfile *mf, Ent_desc *enp) /* * Process a mapfile size symbol definition. - * segment_name @ symbol_name; + * segment_name @ symbol_name; */ static Boolean map_atsign(Mapfile *mf, Sg_desc *sgp) @@ -850,7 +850,7 @@ map_pipe(Mapfile *mf, Sg_desc *sgp) /* * Process a mapfile library specification definition. - * shared_object_name - shared object definition + * shared_object_name - shared object definition * shared object definition : [ shared object type [ = SONAME ]] * [ versions ]; */ @@ -1074,6 +1074,7 @@ map_version(Mapfile *mf, char *name) } /* LINTED */ ms.ms_size = (Addr)number; + ms.ms_size_set = TRUE; break; /* END CSTYLED */ } @@ -1180,7 +1181,7 @@ map_version(Mapfile *mf, char *name) * resolution process. Symbols defined as locals will * be reduced in scope after all input file processing. */ - if (!ld_map_sym_enter(mf, &mv, &ms)) + if (!ld_map_sym_enter(mf, &mv, &ms, NULL)) return (FALSE); break; @@ -1217,7 +1218,7 @@ ld_map_parse_v1(Mapfile *mf) char *name; Ofl_desc *ofl = mf->mf_ofl; ld_map_tkval_t tkv; /* Value of token */ - avl_index_t where; + avl_index_t where; /* * We now parse the mapfile until the gettoken routine returns EOF. diff --git a/usr/src/cmd/sgs/libld/common/map_core.c b/usr/src/cmd/sgs/libld/common/map_core.c index 9ab1dd71a5..5f2ad9a177 100644 --- a/usr/src/cmd/sgs/libld/common/map_core.c +++ b/usr/src/cmd/sgs/libld/common/map_core.c @@ -195,7 +195,7 @@ typedef STACK(void) generic_stack_t; #define CEXP_OP_STACK_INIT 1 #define CEXP_VAL_STACK_INIT 1 #else -#define CDIR_STACK_INIT 16 +#define CDIR_STACK_INIT 16 #define CEXP_OP_STACK_INIT 8 #define CEXP_VAL_STACK_INIT (CEXP_OP_STACK_INIT * 2) /* 2 vals per binop */ #endif @@ -478,9 +478,9 @@ static const mf_tokdisp_t gettok_dispatch_v2 = { TK_OP_ID, /* 88 - X */ TK_OP_ID, /* 89 - Y */ TK_OP_ID, /* 90 - Z */ - TK_OP_BADCHR, /* 91 - [ */ + TK_LEFTSQR, /* 91 - [ */ TK_OP_BADCHR, /* 92 - \ */ - TK_OP_BADCHR, /* 93 - ] */ + TK_RIGHTSQR, /* 93 - ] */ TK_OP_BADCHR, /* 94 - ^ */ TK_OP_ID, /* 95 - _ */ TK_OP_BADCHR, /* 96 - ` */ @@ -1711,6 +1711,7 @@ ld_map_getint(Mapfile *mf, ld_map_tkval_t *value, Boolean notail) ld_map_strtoxword_t s2xw_ret; ld_map_npatch_t np; char *endptr; + char *startptr = mf->mf_next; char *errstr = mf->mf_next; value->tkv_int.tkvi_str = mf->mf_next; @@ -1727,8 +1728,9 @@ ld_map_getint(Mapfile *mf, ld_map_tkval_t *value, Boolean notail) } /* Advance position to item following value, skipping whitespace */ - value->tkv_int.tkvi_cnt = endptr - mf->mf_next; + value->tkv_int.tkvi_cnt = endptr - startptr; mf->mf_next = endptr; + while (isspace_nonl(*mf->mf_next)) mf->mf_next++; @@ -1927,6 +1929,29 @@ gettoken_cquote_str(Mapfile *mf, int flags, ld_map_tkval_t *tkv) } /* + * Peek ahead at the text token. + * + * entry: + * mf - Mapfile descriptor + * + * exit: + * Returns one of the TK_* values, including the TK_OP values (that is, + * tokens are not processed into their necessarily final form). + */ +Token +ld_map_peektoken(Mapfile *mf) +{ + int ch; + + if (mf->mf_next_ch == 0) + ch = *mf->mf_next; + else + ch = mf->mf_next_ch; + + return ((ch & 0x80) ? TK_OP_ILLCHR : mf->mf_tokdisp[ch]); +} + +/* * Get a token from the mapfile. * * entry: @@ -2115,6 +2140,10 @@ ld_map_tokenstr(Token tok, ld_map_tkval_t *tkv, Conv_inv_buf_t *inv_buf) return (MSG_ORIG(MSG_QSTR_LEFTBKT)); case TK_RIGHTBKT: return (MSG_ORIG(MSG_QSTR_RIGHTBKT)); + case TK_LEFTSQR: + return (MSG_ORIG(MSG_QSTR_LEFTSQR)); + case TK_RIGHTSQR: + return (MSG_ORIG(MSG_QSTR_RIGHTSQR)); case TK_PIPE: return (MSG_ORIG(MSG_QSTR_PIPE)); case TK_INT: @@ -2661,10 +2690,10 @@ ld_map_post_process(Ofl_desc *ofl) * as the sort key. * * v2) The version 2 syntax has the user specify a name for - * the entry criteria, and then provide a list of entry - * criteria names via the IS_ORDER segment attribute. - * Sections placed via the criteria listed in IS_ORDER - * are sorted, and the others are not. + * the entry criteria, and then provide a list of entry + * criteria names via the IS_ORDER segment attribute. + * Sections placed via the criteria listed in IS_ORDER + * are sorted, and the others are not. * * Regardless of the syntax version used, the section sorting * code expects the following: diff --git a/usr/src/cmd/sgs/libld/common/map_support.c b/usr/src/cmd/sgs/libld/common/map_support.c index 8e69b6052e..722ba39f70 100644 --- a/usr/src/cmd/sgs/libld/common/map_support.c +++ b/usr/src/cmd/sgs/libld/common/map_support.c @@ -1057,7 +1057,7 @@ ld_map_sym_filtee(Mapfile *mf, ld_map_ver_t *mv, ld_map_sym_t *ms, * problems, increments mv->mv_errcnt, and returns TRUE. */ Boolean -ld_map_sym_enter(Mapfile *mf, ld_map_ver_t *mv, ld_map_sym_t *ms) +ld_map_sym_enter(Mapfile *mf, ld_map_ver_t *mv, ld_map_sym_t *ms, Ass_desc *ma) { Ofl_desc *ofl = mf->mf_ofl; Word hash; @@ -1125,6 +1125,26 @@ ld_map_sym_enter(Mapfile *mf, ld_map_ver_t *mv, ld_map_sym_t *ms) if (sym->st_shndx == SHN_UNDEF) sdp->sd_flags |= (FLG_SY_MAPREF | FLG_SY_GLOBREF); + if (ma != NULL && ma->ass_enabled != 0) { + Ass_desc *m; + + /* + * Mark the symbol so we can issue guidance more + * easily + */ + sdp->sd_flags |= FLG_SY_MAPASSRT; + + if ((m = libld_calloc(1, sizeof (Ass_desc))) == NULL) + return (FALSE); + memcpy(m, ma, sizeof (Ass_desc)); + m->ass_sdp = sdp; + sdp->sd_ass = m; + + if (aplist_append(&ofl->ofl_symasserts, m, + AL_CNT_MAPASSERT) == NULL) { + return (FALSE); + } + } } else { conflict = NULL; sym = sdp->sd_sym; @@ -1143,7 +1163,7 @@ ld_map_sym_enter(Mapfile *mf, ld_map_ver_t *mv, ld_map_sym_t *ms) sym->st_value = ms->ms_value; } if (sym->st_size) { - if (ms->ms_size && (sym->st_size != ms->ms_size)) + if (ms->ms_size_set && (sym->st_size != ms->ms_size)) conflict = MSG_INTL(MSG_MAP_DIFF_SYMSZ); } else { sym->st_size = ms->ms_size; @@ -1195,7 +1215,7 @@ ld_map_sym_enter(Mapfile *mf, ld_map_ver_t *mv, ld_map_sym_t *ms) * copy-relocations to be established to filter OBJT * definitions. */ - if ((ms->ms_shndx == SHN_ABS) && ms->ms_size && !ms->ms_value_set) { + if ((ms->ms_shndx == SHN_ABS) && ms->ms_size_set && !ms->ms_value_set) { /* Create backing section if not there */ if (sdp->sd_isc == NULL) { Is_desc *isp; diff --git a/usr/src/cmd/sgs/libld/common/map_v2.c b/usr/src/cmd/sgs/libld/common/map_v2.c index eb397838af..791ad34971 100644 --- a/usr/src/cmd/sgs/libld/common/map_v2.c +++ b/usr/src/cmd/sgs/libld/common/map_v2.c @@ -126,6 +126,7 @@ typedef struct { typedef struct { ld_map_ver_t ss_mv; ld_map_sym_t ss_ms; + Ass_desc ss_ma; } symbol_state_t; /* @@ -564,17 +565,79 @@ gettoken_leftbkt(Mapfile *mf, const char *lhs) * Updates *tkv and returns TK_INT for success, TK_ERROR otherwise. */ static Token -gettoken_int(Mapfile *mf, const char *lhs, ld_map_tkval_t *tkv) +gettoken_int(Mapfile *mf, const char *lhs, ld_map_tkval_t *tkv, int flags) { Token tok; Conv_inv_buf_t inv_buf; + char *start = mf->mf_next; - switch (tok = ld_map_gettoken(mf, 0, tkv)) { + switch (tok = ld_map_gettoken(mf, flags, tkv)) { case TK_ERROR: + return (tok); + case TK_STRING: + if (strcmp(MSG_ORIG(MSG_MAP_ADDRSIZE), tkv->tkv_str) == 0) { + tkv->tkv_int.tkvi_str = tkv->tkv_str; + switch (ld_targ.t_m.m_class) { + case ELFCLASS32: + tkv->tkv_int.tkvi_value = sizeof (Elf32_Addr); + break; + case ELFCLASS64: + tkv->tkv_int.tkvi_value = sizeof (Elf64_Addr); + break; + case ELFCLASSNONE: + tkv->tkv_int.tkvi_value = 0; + break; + default: + assert(0); + } + tkv->tkv_int.tkvi_cnt = MSG_MAP_ADDRSIZE_SIZE; + tok = TK_INT; + } else { + break; + } + /* FALLTHROUGH */ case TK_INT: + if ((flags & TK_F_MULOK) && + (ld_map_peektoken(mf) == TK_LEFTSQR)) { + ld_map_tkval_t mltplr; + Xword oldval; + + /* read the [, which we know must be there */ + (void) ld_map_gettoken(mf, flags, &mltplr); + + if (ld_map_gettoken(mf, flags & ~TK_F_MULOK, + &mltplr) != TK_INT) { + tkv->tkv_int.tkvi_cnt = mf->mf_next - start; + mf_fatal(mf, MSG_INTL(MSG_MAP_EXP_INT), + MSG_ORIG(MSG_QSTR_LEFTSQR), + ld_map_tokenstr(TK_INT, tkv, &inv_buf)); + return (TK_ERROR); + } + + if (ld_map_peektoken(mf) != TK_RIGHTSQR) { + tkv->tkv_int.tkvi_cnt = mf->mf_next - start; + mf_fatal(mf, MSG_INTL(MSG_MAP_EXP_RIGHTSQ), + ld_map_tokenstr(TK_INT, tkv, &inv_buf)); + return (TK_ERROR); + } + + /* Read the right ] */ + (void) ld_map_gettoken(mf, flags, NULL); + tkv->tkv_int.tkvi_cnt = mf->mf_next - start; + oldval = tkv->tkv_int.tkvi_value; + tkv->tkv_int.tkvi_value *= mltplr.tkv_int.tkvi_value; + + if ((tkv->tkv_int.tkvi_value / + mltplr.tkv_int.tkvi_value) != oldval) { + mf_fatal(mf, MSG_INTL(MSG_MAP_MULOVERFLOW), + tkv->tkv_int.tkvi_value, + mltplr.tkv_int.tkvi_value); + return (TK_ERROR); + } + } + return (tok); } - mf_fatal(mf, MSG_INTL(MSG_MAP_EXP_INT), lhs, ld_map_tokenstr(tok, tkv, &inv_buf)); return (TK_ERROR); @@ -993,7 +1056,6 @@ parse_cap_list(Mapfile *mf, Token eq_tok, Caplist *caplist, * CAPABILITY [capid] { HW = hwcap_flags... * -------------------------^ */ -/* ARGSUSED 2 */ static Token at_cap_hw(Mapfile *mf, Token eq_tok, void *uvalue) { @@ -1048,7 +1110,6 @@ at_cap_hw(Mapfile *mf, Token eq_tok, void *uvalue) * CAPABILITY [capid] { HW_1 = value ; * ---------------------------^ */ -/* ARGSUSED 2 */ static Token at_cap_hw_1(Mapfile *mf, Token eq_tok, void *uvalue) { @@ -1060,7 +1121,6 @@ at_cap_hw_1(Mapfile *mf, Token eq_tok, void *uvalue) * CAPABILITY [capid] { HW_2 = value ; * ---------------------------^ */ -/* ARGSUSED 2 */ static Token at_cap_hw_2(Mapfile *mf, Token eq_tok, void *uvalue) { @@ -1072,7 +1132,6 @@ at_cap_hw_2(Mapfile *mf, Token eq_tok, void *uvalue) * CAPABILITY [capid] { SF = sfcap_flags... * -------------------------^ */ -/* ARGSUSED 2 */ static Token at_cap_sf(Mapfile *mf, Token eq_tok, void *uvalue) { @@ -1120,7 +1179,6 @@ at_cap_sf(Mapfile *mf, Token eq_tok, void *uvalue) * CAPABILITY [capid] { SF_1 = value ; * ---------------------------^ */ -/* ARGSUSED 2 */ static Token at_cap_sf_1(Mapfile *mf, Token eq_tok, void *uvalue) { @@ -1132,7 +1190,6 @@ at_cap_sf_1(Mapfile *mf, Token eq_tok, void *uvalue) * CAPABILITY [capid] { MACHINE = value ; * ------------------------------^ */ -/* ARGSUSED 2 */ static Token at_cap_mach(Mapfile *mf, Token eq_tok, void *uvalue) { @@ -1144,7 +1201,6 @@ at_cap_mach(Mapfile *mf, Token eq_tok, void *uvalue) * CAPABILITY [capid] { PLATFORM = value ; * -------------------------------^ */ -/* ARGSUSED 2 */ static Token at_cap_plat(Mapfile *mf, Token eq_tok, void *uvalue) { @@ -1270,7 +1326,6 @@ gts_efunc_at_dv_allow(Mapfile *mf, Token tok, ld_map_tkval_t *tkv) * DEPEND_VERSIONS object_name { ALLOW = version * -------------------------------------^ */ -/* ARGSUSED 1 */ static Token at_dv_allow(Mapfile *mf, Token eq_tok, void *uvalue) { @@ -1303,7 +1358,6 @@ gts_efunc_at_dv_require(Mapfile *mf, Token tok, ld_map_tkval_t *tkv) * DEPEND_VERSIONS object_name { REQURE = version * --------------------------------------^ */ -/* ARGSUSED 1 */ static Token at_dv_require(Mapfile *mf, Token eq_tok, void *uvalue) { @@ -1419,7 +1473,7 @@ dir_phdr_add_null(Mapfile *mf) return (TK_ERROR); /* integer token */ - if (gettoken_int(mf, MSG_ORIG(MSG_MAPKW_PHDR_ADD_NULL), &tkv) == + if (gettoken_int(mf, MSG_ORIG(MSG_MAPKW_PHDR_ADD_NULL), &tkv, 0) == TK_ERROR) return (TK_ERROR); @@ -1440,7 +1494,6 @@ dir_phdr_add_null(Mapfile *mf) * segment_directive segment_name { ALIGN = value * ----------------------------------------^ */ -/* ARGSUSED 1 */ static Token at_seg_align(Mapfile *mf, Token eq_tok, void *uvalue) { @@ -1448,7 +1501,7 @@ at_seg_align(Mapfile *mf, Token eq_tok, void *uvalue) ld_map_tkval_t tkv; /* value */ - if (gettoken_int(mf, MSG_ORIG(MSG_MAPKW_ALIGN), &tkv) == TK_ERROR) + if (gettoken_int(mf, MSG_ORIG(MSG_MAPKW_ALIGN), &tkv, 0) == TK_ERROR) return (TK_ERROR); sgp->sg_phdr.p_align = tkv.tkv_int.tkvi_value; @@ -1476,7 +1529,6 @@ gts_efunc_at_seg_assign_file_basename(Mapfile *mf, Token tok, * segment_directive segment_name { ASSIGN { FILE_BASENAME = file_name * ---------------------------------------------------------^ */ -/* ARGSUSED 1 */ static Token at_seg_assign_file_basename(Mapfile *mf, Token eq_tok, void *uvalue) { @@ -1513,7 +1565,6 @@ gts_efunc_at_seg_assign_file_objname(Mapfile *mf, Token tok, * segment_directive segment_name { ASSIGN { FILE_OBJNAME = name * --------------------------------------------------------^ */ -/* ARGSUSED 1 */ static Token at_seg_assign_file_objname(Mapfile *mf, Token eq_tok, void *uvalue) { @@ -1549,7 +1600,6 @@ gts_efunc_at_seg_assign_file_path(Mapfile *mf, Token tok, ld_map_tkval_t *tkv) * segment_directive segment_name { ASSIGN { FILE_PATH = file_path * -----------------------------------------------------^ */ -/* ARGSUSED 1 */ static Token at_seg_assign_file_path(Mapfile *mf, Token eq_tok, void *uvalue) { @@ -1572,7 +1622,6 @@ at_seg_assign_file_path(Mapfile *mf, Token eq_tok, void *uvalue) * segment_directive segment_name { ASSIGN { FLAGS = ... ; * -------------------------------------------------^ */ -/* ARGSUSED 1 */ static Token at_seg_assign_flags(Mapfile *mf, Token eq_tok, void *uvalue) { @@ -1690,7 +1739,6 @@ gts_efunc_at_seg_assign_is_name(Mapfile *mf, Token tok, ld_map_tkval_t *tkv) * segment_directive segment_name { ASSIGN { IS_NAME = section_name ; * ---------------------------------------------------^ */ -/* ARGSUSED 1 */ static Token at_seg_assign_is_name(Mapfile *mf, Token eq_tok, void *uvalue) { @@ -1723,7 +1771,6 @@ gts_efunc_at_seg_assign_type(Mapfile *mf, Token tok, ld_map_tkval_t *tkv) * segment_directive segment_name { ASSIGN { TYPE = section_type ; * ------------------------------------------------^ */ -/* ARGSUSED 1 */ static Token at_seg_assign_type(Mapfile *mf, Token eq_tok, void *uvalue) { @@ -1771,7 +1818,6 @@ at_seg_assign_type(Mapfile *mf, Token eq_tok, void *uvalue) * segment_directive segment_name { ASSIGN { ... * -----------------------------------------^ */ -/* ARGSUSED 1 */ static Token at_seg_assign(Mapfile *mf, Token eq_tok, void *uvalue) { @@ -1868,7 +1914,6 @@ at_seg_assign(Mapfile *mf, Token eq_tok, void *uvalue) * segment_directive segment_name { DISABLE ; * ----------------------------------------^ */ -/* ARGSUSED 1 */ static Token at_seg_disable(Mapfile *mf, Token eq_tok, void *uvalue) { @@ -1897,7 +1942,6 @@ at_seg_disable(Mapfile *mf, Token eq_tok, void *uvalue) * STACK { FLAGS eq-op ... ; * -------------------^ */ -/* ARGSUSED 2 */ static Token at_seg_flags(Mapfile *mf, Token eq_tok, void *uvalue) { @@ -1919,7 +1963,6 @@ at_seg_flags(Mapfile *mf, Token eq_tok, void *uvalue) * segment_directive segment_name { IS_ORDER eq_op value * -----------------------------------------------^ */ -/* ARGSUSED 2 */ static Token at_seg_is_order(Mapfile *mf, Token eq_tok, void *uvalue) { @@ -1994,7 +2037,6 @@ at_seg_is_order(Mapfile *mf, Token eq_tok, void *uvalue) * segment_directive segment_name { MAX_SIZE = value * -------------------------------------------^ */ -/* ARGSUSED 1 */ static Token at_seg_max_size(Mapfile *mf, Token eq_tok, void *uvalue) { @@ -2002,7 +2044,7 @@ at_seg_max_size(Mapfile *mf, Token eq_tok, void *uvalue) ld_map_tkval_t tkv; /* value */ - if (gettoken_int(mf, MSG_ORIG(MSG_MAPKW_MAX_SIZE), &tkv) == TK_ERROR) + if (gettoken_int(mf, MSG_ORIG(MSG_MAPKW_MAX_SIZE), &tkv, 0) == TK_ERROR) return (TK_ERROR); sgp->sg_length = tkv.tkv_int.tkvi_value; @@ -2016,7 +2058,6 @@ at_seg_max_size(Mapfile *mf, Token eq_tok, void *uvalue) * segment_directive segment_name { NOHDR ; * --------------------------------------^ */ -/* ARGSUSED 1 */ static Token at_seg_nohdr(Mapfile *mf, Token eq_tok, void *uvalue) { @@ -2042,7 +2083,6 @@ at_seg_nohdr(Mapfile *mf, Token eq_tok, void *uvalue) * segment_directive segment_name { OS_ORDER eq_op assign_name... * -----------------------------------------------^ */ -/* ARGSUSED 2 */ static Token at_seg_os_order(Mapfile *mf, Token eq_tok, void *uvalue) { @@ -2091,7 +2131,6 @@ at_seg_os_order(Mapfile *mf, Token eq_tok, void *uvalue) * segment_directive segment_name { PADDR = paddr * ----------------------------------------^ */ -/* ARGSUSED 1 */ static Token at_seg_paddr(Mapfile *mf, Token eq_tok, void *uvalue) { @@ -2110,7 +2149,7 @@ at_seg_paddr(Mapfile *mf, Token eq_tok, void *uvalue) } /* value */ - if (gettoken_int(mf, MSG_ORIG(MSG_MAPKW_PADDR), &tkv) == TK_ERROR) + if (gettoken_int(mf, MSG_ORIG(MSG_MAPKW_PADDR), &tkv, 0) == TK_ERROR) return (TK_ERROR); sgp->sg_phdr.p_paddr = tkv.tkv_int.tkvi_value; @@ -2124,7 +2163,6 @@ at_seg_paddr(Mapfile *mf, Token eq_tok, void *uvalue) * segment_directive segment_name { ROUND = value * ----------------------------------------^ */ -/* ARGSUSED 1 */ static Token at_seg_round(Mapfile *mf, Token eq_tok, void *uvalue) { @@ -2132,7 +2170,7 @@ at_seg_round(Mapfile *mf, Token eq_tok, void *uvalue) ld_map_tkval_t tkv; /* value */ - if (gettoken_int(mf, MSG_ORIG(MSG_MAPKW_ROUND), &tkv) == TK_ERROR) + if (gettoken_int(mf, MSG_ORIG(MSG_MAPKW_ROUND), &tkv, 0) == TK_ERROR) return (TK_ERROR); sgp->sg_round = tkv.tkv_int.tkvi_value; @@ -2146,7 +2184,6 @@ at_seg_round(Mapfile *mf, Token eq_tok, void *uvalue) * segment_directive segment_name { SIZE_SYMBOL = symbol_name * ----------------------------------------------^ */ -/* ARGSUSED 2 */ static Token at_seg_size_symbol(Mapfile *mf, Token eq_tok, void *uvalue) { @@ -2206,7 +2243,6 @@ at_seg_size_symbol(Mapfile *mf, Token eq_tok, void *uvalue) * segment_directive segment_name { VADDR = vaddr * ----------------------------------------^ */ -/* ARGSUSED 1 */ static Token at_seg_vaddr(Mapfile *mf, Token eq_tok, void *uvalue) { @@ -2225,7 +2261,7 @@ at_seg_vaddr(Mapfile *mf, Token eq_tok, void *uvalue) } /* value */ - if (gettoken_int(mf, MSG_ORIG(MSG_MAPKW_VADDR), &tkv) == TK_ERROR) + if (gettoken_int(mf, MSG_ORIG(MSG_MAPKW_VADDR), &tkv, 0) == TK_ERROR) return (TK_ERROR); sgp->sg_phdr.p_vaddr = tkv.tkv_int.tkvi_value; @@ -2657,7 +2693,6 @@ gts_efunc_at_sym_aux(Mapfile *mf, Token tok, ld_map_tkval_t *tkv) * SYMBOL [version_name] { symbol_name { AUXILIARY = soname * -------------------------------------------------^ */ -/* ARGSUSED 1 */ static Token at_sym_aux(Mapfile *mf, Token eq_tok, void *uvalue) { @@ -2691,7 +2726,6 @@ gts_efunc_at_sym_filter(Mapfile *mf, Token tok, ld_map_tkval_t *tkv) * SYMBOL [version_name] { symbol_name { FILTER = soname * ----------------------------------------------^ */ -/* ARGSUSED 1 */ static Token at_sym_filter(Mapfile *mf, Token eq_tok, void *uvalue) { @@ -2713,7 +2747,6 @@ at_sym_filter(Mapfile *mf, Token eq_tok, void *uvalue) * SYMBOL [version_name] { symbol_name { FLAGS = ... * ---------------------------------------------^ */ -/* ARGSUSED 1 */ static Token at_sym_flags(Mapfile *mf, Token eq_tok, void *uvalue) { @@ -2860,7 +2893,6 @@ at_sym_flags(Mapfile *mf, Token eq_tok, void *uvalue) * SYMBOL [version_name] { symbol_name { SIZE = value * --------------------------------------------^ */ -/* ARGSUSED 1 */ static Token at_sym_size(Mapfile *mf, Token eq_tok, void *uvalue) { @@ -2868,10 +2900,12 @@ at_sym_size(Mapfile *mf, Token eq_tok, void *uvalue) ld_map_tkval_t tkv; /* value */ - if (gettoken_int(mf, MSG_ORIG(MSG_MAPKW_SIZE), &tkv) == TK_ERROR) + if (gettoken_int(mf, MSG_ORIG(MSG_MAPKW_SIZE), &tkv, + TK_F_MULOK) == TK_ERROR) return (TK_ERROR); ss->ss_ms.ms_size = tkv.tkv_int.tkvi_value; + ss->ss_ms.ms_size_set = TRUE; /* terminator */ return (gettoken_term(mf, MSG_ORIG(MSG_MAPKW_SIZE))); @@ -2920,7 +2954,6 @@ gts_efunc_at_sym_type(Mapfile *mf, Token tok, ld_map_tkval_t *tkv) * SYMBOL [version_name] { symbol_name { TYPE = symbol_type * --------------------------------------------^ */ -/* ARGSUSED 1 */ static Token at_sym_type(Mapfile *mf, Token eq_tok, void *uvalue) { @@ -2952,7 +2985,6 @@ at_sym_type(Mapfile *mf, Token eq_tok, void *uvalue) * SYMBOL [version_name] { symbol_name { VALUE = value * ---------------------------------------------^ */ -/* ARGSUSED 1 */ static Token at_sym_value(Mapfile *mf, Token eq_tok, void *uvalue) { @@ -2960,24 +2992,299 @@ at_sym_value(Mapfile *mf, Token eq_tok, void *uvalue) ld_map_tkval_t tkv; /* value */ - if (gettoken_int(mf, MSG_ORIG(MSG_MAPKW_VALUE), &tkv) == TK_ERROR) + if (gettoken_int(mf, MSG_ORIG(MSG_MAPKW_VALUE), &tkv, 0) == TK_ERROR) return (TK_ERROR); ss->ss_ms.ms_value = tkv.tkv_int.tkvi_value; ss->ss_ms.ms_value_set = TRUE; - /* terminator */ return (gettoken_term(mf, MSG_ORIG(MSG_MAPKW_VALUE))); } +typedef struct { + const char *name; + uchar_t ms_type; +} at_ass_type_t; + +static at_ass_type_t at_ass_type_list[] = { + /* Accept DATA as well to match sym attrs */ + { MSG_ORIG(MSG_MAPKW_DATA), STT_OBJECT }, + { MSG_ORIG(MSG_MAPKW_OBJECT), STT_OBJECT }, + { MSG_ORIG(MSG_MAPKW_FUNC), STT_FUNC }, + /* Accept FUNCTION as well to match sym attrs */ + { MSG_ORIG(MSG_MAPKW_FUNCTION), STT_FUNC }, + { MSG_ORIG(MSG_MAPKW_SECTION), STT_SECTION }, + { MSG_ORIG(MSG_MAPKW_FILE), STT_FILE }, + { MSG_ORIG(MSG_MAPKW_COMMON), STT_COMMON }, + { MSG_ORIG(MSG_MAPKW_TLS), STT_TLS }, + { 0 } +}; + +static size_t at_ass_type_list_bufsize = + KW_NAME_SIZE(MSG_MAPKW_OBJECT) + + KW_NAME_SIZE(MSG_MAPKW_FUNC) + + KW_NAME_SIZE(MSG_MAPKW_FUNCTION) + + KW_NAME_SIZE(MSG_MAPKW_SECTION) + + KW_NAME_SIZE(MSG_MAPKW_FILE) + + KW_NAME_SIZE(MSG_MAPKW_COMMON) + + KW_NAME_SIZE(MSG_MAPKW_TLS); + +static void +gts_efunc_at_ass_type(Mapfile *mf, Token tok, ld_map_tkval_t *tkv) +{ + Conv_inv_buf_t inv_buf; + char buf[VLA_SIZE(at_ass_type_list_bufsize)]; + + mf_fatal(mf, MSG_INTL(MSG_MAP_EXP_SYMTYPE), + ld_map_kwnames(at_ass_type_list, SGSOFFSETOF(at_ass_type_t, name), + sizeof (at_ass_type_list[0]), buf, at_ass_type_list_bufsize), + ld_map_tokenstr(tok, tkv, &inv_buf)); +} + +typedef struct { + const char *name; /* attribute name */ + Boolean ms_bits; /* bits? */ +} at_ass_shattr_t; + +static at_ass_shattr_t at_ass_shattr_list[] = { + { MSG_ORIG(MSG_MAPKW_BITS), TRUE }, + { MSG_ORIG(MSG_MAPKW_NOBITS), FALSE }, + { 0 } +}; + +static size_t at_ass_shattr_list_bufsize = + KW_NAME_SIZE(MSG_MAPKW_BITS) + + KW_NAME_SIZE(MSG_MAPKW_NOBITS); + +static void +gts_efunc_at_ass_shattr(Mapfile *mf, Token tok, ld_map_tkval_t *tkv) +{ + Conv_inv_buf_t inv_buf; + char buf[VLA_SIZE(at_ass_shattr_list_bufsize)]; + + mf_fatal(mf, MSG_INTL(MSG_MAP_EXP_SHATTRTYPE), + ld_map_kwnames(at_ass_shattr_list, + SGSOFFSETOF(at_ass_shattr_t, name), sizeof (at_ass_shattr_list[0]), + buf, at_ass_shattr_list_bufsize), + ld_map_tokenstr(tok, tkv, &inv_buf)); +} + +static Token +at_ass_shattr(Mapfile *mf, Token eq_tok, void *uvalue) +{ + symbol_state_t *ss = uvalue; + at_ass_shattr_t *shattr; + ld_map_tkval_t tkv; + + if (gettoken_str(mf, TK_F_KEYWORD, &tkv, + gts_efunc_at_ass_shattr) == TK_ERROR) + return (TK_ERROR); + + shattr = ld_map_kwfind(tkv.tkv_str, at_ass_shattr_list, + SGSOFFSETOF(at_ass_shattr_t, name), sizeof (shattr[0])); + + if (shattr == NULL) { + gts_efunc_at_ass_shattr(mf, TK_STRING, &tkv); + return (TK_ERROR); + } + + ss->ss_ma.ass_bits = shattr->ms_bits; + ss->ss_ma.ass_enabled |= SYM_ASSERT_BITS; + + return (gettoken_term(mf, MSG_ORIG(MSG_MAPKW_SHATTR))); +} + +typedef struct { + const char *name; /* binding name */ + uchar_t ms_bind; /* STB_ value */ +} at_ass_bind_t; + +static at_ass_bind_t at_ass_bind_list[] = { + { MSG_ORIG(MSG_MAPKW_GLOBAL), STB_GLOBAL }, + { MSG_ORIG(MSG_MAPKW_LOCAL), STB_LOCAL }, + { MSG_ORIG(MSG_MAPKW_WEAK), STB_WEAK }, + { 0 } +}; + +static size_t at_ass_bind_list_bufsize = + KW_NAME_SIZE(MSG_MAPKW_GLOBAL) + + KW_NAME_SIZE(MSG_MAPKW_LOCAL) + + KW_NAME_SIZE(MSG_MAPKW_WEAK); + +static void +gts_efunc_at_ass_bind(Mapfile *mf, Token tok, ld_map_tkval_t *tkv) +{ + Conv_inv_buf_t inv_buf; + char buf[VLA_SIZE(at_ass_bind_list_bufsize)]; + + mf_fatal(mf, MSG_INTL(MSG_MAP_EXP_BINDTYPE), + ld_map_kwnames(at_ass_bind_list, SGSOFFSETOF(at_ass_bind_t, name), + sizeof (at_ass_bind_list[0]), buf, at_ass_bind_list_bufsize), + ld_map_tokenstr(tok, tkv, &inv_buf)); +} + +static Token +at_ass_bind(Mapfile *mf, Token eq_tok, void *uvalue) +{ + symbol_state_t *ss = uvalue; + at_ass_bind_t *bind; + ld_map_tkval_t tkv; + + if (gettoken_str(mf, TK_F_KEYWORD, &tkv, + gts_efunc_at_ass_bind) == TK_ERROR) + return (TK_ERROR); + + bind = ld_map_kwfind(tkv.tkv_str, at_ass_bind_list, + SGSOFFSETOF(at_ass_bind_t, name), sizeof (bind[0])); + + if (bind == NULL) { + gts_efunc_at_ass_bind(mf, TK_STRING, &tkv); + return (TK_ERROR); + } + + ss->ss_ma.ass_bind = bind->ms_bind; + ss->ss_ma.ass_enabled |= SYM_ASSERT_BIND; + + return (gettoken_term(mf, MSG_ORIG(MSG_MAPKW_BIND))); +} + +static Token +at_ass_size(Mapfile *mf, Token eq_tok, void *uvalue) +{ + symbol_state_t *ss = uvalue; + ld_map_tkval_t tkv; + + if (gettoken_int(mf, MSG_ORIG(MSG_MAPKW_SIZE), &tkv, + TK_F_MULOK) == TK_ERROR) + return (TK_ERROR); + + ss->ss_ma.ass_size = tkv.tkv_int.tkvi_value; + ss->ss_ma.ass_enabled |= SYM_ASSERT_SIZE; + + return (gettoken_term(mf, MSG_ORIG(MSG_MAPKW_SIZE))); +} + +static Token +at_ass_alias(Mapfile *mf, Token eq_tok, void *uvalue) +{ + symbol_state_t *ss = uvalue; + ld_map_tkval_t tkv; + + if (ld_map_gettoken(mf, 0, &tkv) != TK_STRING) { + mf_fatal0(mf, MSG_INTL(MSG_MAP_BADALIAS)); + return (TK_ERROR); + } + + ss->ss_ma.ass_alias = tkv.tkv_str; + ss->ss_ma.ass_enabled |= SYM_ASSERT_ALIAS; + + return (gettoken_term(mf, MSG_ORIG(MSG_MAPKW_ALIAS))); +} + +static Token +at_ass_type(Mapfile *mf, Token eq_tok, void *uvalue) +{ + ld_map_tkval_t tkv; + at_ass_type_t *type; + symbol_state_t *ss = uvalue; + + if (gettoken_str(mf, TK_F_KEYWORD, &tkv, + gts_efunc_at_ass_type) == TK_ERROR) + return (TK_ERROR); + + type = ld_map_kwfind(tkv.tkv_str, at_ass_type_list, + SGSOFFSETOF(at_sym_type_t, name), sizeof (type[0])); + + if (type == NULL) { + gts_efunc_at_ass_type(mf, TK_STRING, &tkv); + return (TK_ERROR); + } + + ss->ss_ma.ass_type = type->ms_type; + ss->ss_ma.ass_enabled |= SYM_ASSERT_TYPE; + + return (gettoken_term(mf, MSG_ORIG(MSG_MAPKW_ASSERT))); +} + +static Token +at_sym_assert(Mapfile *mf, Token eq_tok, void *uvalue) +{ + static attr_t attr_list[] = { + { MSG_ORIG(MSG_MAPKW_ALIAS), at_ass_alias, ATTR_FMT_EQ }, + /* + * The Solaris manuals describe both BIND and BINDING, take both + * but prefer BINDING + */ + { MSG_ORIG(MSG_MAPKW_BIND), at_ass_bind, ATTR_FMT_EQ }, + { MSG_ORIG(MSG_MAPKW_BINDING), at_ass_bind, ATTR_FMT_EQ }, + { MSG_ORIG(MSG_MAPKW_SHATTR), at_ass_shattr, ATTR_FMT_EQ }, + { MSG_ORIG(MSG_MAPKW_SIZE), at_ass_size, ATTR_FMT_EQ }, + { MSG_ORIG(MSG_MAPKW_TYPE), at_ass_type, ATTR_FMT_EQ }, + { 0 } + }; + + static size_t attr_list_bufsize = + KW_NAME_SIZE(MSG_MAPKW_ALIAS) + + KW_NAME_SIZE(MSG_MAPKW_BIND) + + KW_NAME_SIZE(MSG_MAPKW_BINDING) + + KW_NAME_SIZE(MSG_MAPKW_SHATTR) + + KW_NAME_SIZE(MSG_MAPKW_SIZE) + + KW_NAME_SIZE(MSG_MAPKW_TYPE); + + symbol_state_t *ss = uvalue; + int done = 0; + Token tok; + ld_map_tkval_t tkv; + Conv_inv_buf_t inv_buf; + + /* Read assertions until the closing } */ + for (done = 0; done == 0; ) { + switch (tok = ld_map_gettoken(mf, 0, &tkv)) { + case TK_ERROR: + return (TK_ERROR); + case TK_LEFTBKT: + if (parse_attributes(mf, ss->ss_ms.ms_name, + attr_list, attr_list_bufsize, ss) == TK_ERROR) + return (TK_ERROR); + + /* + * If we're stating we're an alias for another symbol, + * the only other thing that maybe specified for + * _this_ symbol is its binding. + */ + if ((ss->ss_ma.ass_enabled & SYM_ASSERT_ALIAS) && + (ss->ss_ma.ass_enabled & + ~(SYM_ASSERT_ALIAS|SYM_ASSERT_BIND))) { + mf_fatal(mf, MSG_INTL(MSG_MAP_ALIAS_COMBO), + ss->ss_ms.ms_name); + return (TK_ERROR); + } + + tok = gettoken_term(mf, MSG_INTL(MSG_MAP_SYMATTR)); + if (tok == TK_ERROR) + return (TK_ERROR); + if (tok == TK_SEMICOLON) + return (tok); + break; + default: + mf_fatal(mf, MSG_INTL(MSG_MAP_EXP_SYMDELIM), + ld_map_tokenstr(tok, &tkv, &inv_buf)); + return (TK_ERROR); + } + } + + /* If we drop through here, something is wrong */ + return (TK_ERROR); +} + /* * Parse the attributes for a SCOPE or VERSION symbol directive. * * entry: * mf - Mapfile descriptor * dir_name - Name of directive. - * ss - Pointer to symbol state block that has had its ss_nv + * ss - Pointer to symbol state block that has had its ss_mv * member initialzed via a call to ld_map_sym_ver_init(). * * exit: @@ -2995,6 +3302,7 @@ parse_symbol_attributes(Mapfile *mf, const char *dir_name, symbol_state_t *ss) { MSG_ORIG(MSG_MAPKW_SIZE), at_sym_size, ATTR_FMT_EQ }, { MSG_ORIG(MSG_MAPKW_TYPE), at_sym_type, ATTR_FMT_EQ }, { MSG_ORIG(MSG_MAPKW_VALUE), at_sym_value, ATTR_FMT_EQ }, + { MSG_ORIG(MSG_MAPKW_ASSERT), at_sym_assert, ATTR_FMT_EQ }, /* List must be null terminated */ { 0 } @@ -3010,7 +3318,8 @@ parse_symbol_attributes(Mapfile *mf, const char *dir_name, symbol_state_t *ss) KW_NAME_SIZE(MSG_MAPKW_FLAGS) + KW_NAME_SIZE(MSG_MAPKW_SIZE) + KW_NAME_SIZE(MSG_MAPKW_TYPE) + - KW_NAME_SIZE(MSG_MAPKW_VALUE); + KW_NAME_SIZE(MSG_MAPKW_VALUE) + + KW_NAME_SIZE(MSG_MAPKW_ASSERT); Token tok; ld_map_tkval_t tkv, tkv_sym; @@ -3034,7 +3343,10 @@ parse_symbol_attributes(Mapfile *mf, const char *dir_name, symbol_state_t *ss) case TK_STRING: /* Default value for all symbol attributes is 0 */ (void) memset(&ss->ss_ms, 0, sizeof (ss->ss_ms)); + (void) memset(&ss->ss_ma, 0, sizeof (ss->ss_ma)); ss->ss_ms.ms_name = tkv_sym.tkv_str; + ss->ss_ma.ass_file = mf->mf_name; + ss->ss_ma.ass_lineno = mf->mf_lineno; /* * Turn off the WEAK flag to indicate that definitions @@ -3080,7 +3392,22 @@ parse_symbol_attributes(Mapfile *mf, const char *dir_name, symbol_state_t *ss) done = 1; /* FALLTHROUGH */ - case TK_SEMICOLON: + case TK_SEMICOLON: { + ld_map_sym_t *ms = &ss->ss_ms; + /* + * If an EXTERN or PARENT symbol has + * assertions issue an error, since we can't + * check them. + */ + if ((ss->ss_ma.ass_enabled != 0) && + (((ms->ms_sdflags & FLG_SY_PARENT) != 0) || + ((ms->ms_sdflags & FLG_SY_EXTERN) != 0))) { + mf_fatal(mf, + MSG_INTL(MSG_MAP_EXTPAR_ASSERT), + ms->ms_name); + return (TK_ERROR); + } + /* * Add the new symbol. It should be noted that * all symbols added by the mapfile start out @@ -3091,9 +3418,10 @@ parse_symbol_attributes(Mapfile *mf, const char *dir_name, symbol_state_t *ss) * processing. */ if (!ld_map_sym_enter(mf, &ss->ss_mv, - &ss->ss_ms)) + &ss->ss_ms, &ss->ss_ma)) return (TK_ERROR); break; + } default: mf_fatal(mf, MSG_INTL(MSG_MAP_EXP_SYMDELIM), ld_map_tokenstr(tok, &tkv, &inv_buf)); diff --git a/usr/src/cmd/sgs/libld/common/update.c b/usr/src/cmd/sgs/libld/common/update.c index 8ef1be8343..94692ae22a 100644 --- a/usr/src/cmd/sgs/libld/common/update.c +++ b/usr/src/cmd/sgs/libld/common/update.c @@ -129,6 +129,12 @@ dynsort_dupwarn(Ofl_desc *ofl, Sym *ldynsym, const char *str, } } +static inline Boolean +ass_enabled(Ass_desc *ma, uint_t ass) +{ + return ((ma->ass_enabled & ass) != 0); +} + /* * Build and update any output symbol tables. Here we work on all the symbol * tables at once to reduce the duplication of symbol and string manipulation. @@ -1123,6 +1129,51 @@ update_osym(Ofl_desc *ofl) symptr->st_info = ELF_ST_INFO(bind, type); } + +#define IS_DATA_SYMBOL(x) ((ELF_ST_TYPE(x->st_info) == STT_OBJECT) || \ + (ELF_ST_TYPE(x->st_info) == STT_COMMON) || \ + (ELF_ST_TYPE(x->st_info) == STT_TLS)) + +/* + * Filter symbols, special symbols, and those that will be reduced aren't + * worth guidance + */ +#define IS_BORING_SYMBOL(x) (x->sd_flags & (FLG_SY_REDUCED|FLG_SY_STDFLTR| \ + FLG_SY_SPECSEC|FLG_SY_HIDDEN|FLG_SY_ELIM|FLG_SY_IGNORE)) + +/* Local symbols and unresolved weaks aren't useful to guide on */ +#define IS_BORING_SCOPE(x) ((ELF_ST_BIND(x->st_info) == STB_LOCAL) || \ + ((ELF_ST_BIND(x->st_info) == STB_WEAK) && \ + (x->st_shndx == SHN_UNDEF))) + +/* Symbol has the assertions recommended for global data */ +#define HAS_NEEDED_ASSERTS(x) ((x->sd_ass != NULL) && \ + (ass_enabled(x->sd_ass, SYM_ASSERT_SIZE) || \ + ass_enabled(x->sd_ass, SYM_ASSERT_ALIAS))) + + /* + * If we're building a shared object and a mapfile is + * specified, issue guidance if any symbol mentioned in the + * mapfile is a global data symbol with no asserted size. + * + * This is somewhat heuristic to maximize the chance of + * -zguidance users seeing our good advice without us being + * annoying (eg. we don't guide when things like + * mapfile.noex* are the only mapfiles) + */ + if (OFL_GUIDANCE(ofl, FLG_OFG_NO_ASSERTS) && + (aplist_nitems(ofl->ofl_maps) > 0) && /* mapfile used */ + (ofl->ofl_flags & FLG_OF_SHAROBJ) && /* building .so */ + (ofl->ofl_flags & FLG_OF_VERDEF) && /* versions/reduce */ + (sdp->sd_ref == REF_REL_NEED) && /* symbol in .o */ + IS_DATA_SYMBOL(sdp->sd_sym) && + !IS_BORING_SCOPE(sdp->sd_sym) && + !IS_BORING_SYMBOL(sdp) && + !HAS_NEEDED_ASSERTS(sdp)) { + ld_eprintf(ofl, ERR_GUIDANCE, + MSG_INTL(MSG_GUIDE_ASSERT_SIZE), + sdp->sd_name, (Lword)sdp->sd_sym->st_size); + } } /* @@ -3608,6 +3659,209 @@ translate_link(Ofl_desc *ofl, Os_desc *osp, Word link, const char *msg) return ((Word)elf_ndxscn(osp->os_scn)); } +typedef struct { + avl_node_t aav_avl; + Ass_desc *aav_ass; +} Aav_node; + +static int +aav_compare(const void *first, const void *second) +{ + Sym *fs = ((Aav_node *)first)->aav_ass->ass_sdp->sd_sym; + Sym *ss = ((Aav_node *)second)->aav_ass->ass_sdp->sd_sym; + + if (fs->st_value < ss->st_value) + return (-1); + if (fs->st_value > ss->st_value) + return (1); + + if (fs->st_size < ss->st_size) + return (-1); + if (fs->st_size > ss->st_size) + return (1); + + return (0); +} + + +/* + * Check any assertions from mapfiles, provide guidance if there is global + * data in a shared object that does not assert its size. + */ +static uintptr_t +check_mapfile_assertions(Ofl_desc *ofl) +{ + Ass_desc *ma; + uintptr_t ret = 0; + Aliste idx; + avl_tree_t ass_avl; + + avl_create(&ass_avl, &aav_compare, sizeof (Aav_node), + SGSOFFSETOF(Aav_node, aav_avl)); + + for (APLIST_TRAVERSE(ofl->ofl_symasserts, idx, ma)) { + Sym_desc *sdp = ma->ass_sdp; + Conv_inv_buf_t inv_buf, inv_buf2; + + /* + * Try to insert the assertion into the tree if it's not an + * alias assertion. If it's already present, it means we have + * two non-alias assertions and should complain + */ + if (!ass_enabled(ma, SYM_ASSERT_ALIAS)) { + Aav_node *av = libld_calloc(1, sizeof (Aav_node)); + Aav_node *dup; + avl_index_t where; + + if (av == NULL) + return (S_ERROR); + + av->aav_ass = ma; + + if ((dup = avl_find(&ass_avl, av, &where)) != NULL) { + ld_eprintf(ofl, ERR_FATAL, + MSG_INTL(MSG_ALIAS_NOTALIAS), + ma->ass_file, + ma->ass_lineno, + ma->ass_sdp->sd_name, + dup->aav_ass->ass_sdp->sd_name, + dup->aav_ass->ass_file, + dup->aav_ass->ass_lineno); + ret = S_ERROR; + } else { + avl_insert(&ass_avl, av, where); + } + } + + /* + * All assertions can assert on binding. Other + * assertion behaviour differs based on whether we're + * asserting specifics, or asserting an ALIAS. In the + * latter case, we just compare all the attributes + * against another symbol. + */ + if (ass_enabled(ma, SYM_ASSERT_BIND) && + (ma->ass_bind != ELF_ST_BIND(sdp->sd_sym->st_info))) { + Sym *sym = sdp->sd_sym; + + ld_eprintf(ofl, ERR_FATAL, MSG_INTL(MSG_ASSFAIL_SCOPE), + ma->ass_file, ma->ass_lineno, + demangle(sdp->sd_name), + conv_sym_info_bind(ma->ass_bind, CONV_FMT_ALT_CFNP, + &inv_buf), + conv_sym_info_bind(ELF_ST_BIND(sym->st_info), + CONV_FMT_ALT_CFNP, &inv_buf2)); + ret = S_ERROR; + } + + if (ass_enabled(ma, SYM_ASSERT_ALIAS)) { + Sym *rsym, *sym; + Sym_desc *asdp; + + if ((asdp = ld_sym_find(ma->ass_alias, SYM_NOHASH, + NULL, ofl)) == NULL) { + ld_eprintf(ofl, ERR_FATAL, + MSG_INTL(MSG_ALIAS_BADSYM), + ma->ass_file, ma->ass_lineno, + ma->ass_alias); + ret = S_ERROR; + } else { + /* + * We forbid aliases of aliases, preferring + * they all point to the concrete symbol. + * This is unnecessary, but a strong + * preference for maintainability. + * + * This does prevent circular references + * however, and if this check is removed a + * real check for such would need to be added. + */ + if (((asdp->sd_flags & FLG_SY_MAPASSRT) != 0) && + ass_enabled(asdp->sd_ass, + SYM_ASSERT_ALIAS)) { + ld_eprintf(ofl, ERR_FATAL, + MSG_INTL(MSG_ALIAS_TOALIAS), + ma->ass_file, ma->ass_lineno, + ma->ass_alias); + ret = S_ERROR; + } + + rsym = asdp->sd_sym; + sym = sdp->sd_sym; + + if ((rsym->st_value != sym->st_value) || + (rsym->st_size != sym->st_size) || + (ELF_ST_TYPE(rsym->st_info) != + ELF_ST_TYPE(sym->st_info))) { + ld_eprintf(ofl, ERR_FATAL, + MSG_INTL(MSG_ASSFAIL_ALIAS), + ma->ass_file, ma->ass_lineno, + demangle(sdp->sd_name), + asdp->sd_name); + ret = S_ERROR; + } + } + + /* + * If this is an alias, none of our other checks + * matter. + */ + continue; + } + + /* + * We only want to assert on the size of a _function_ if it's + * explicitly sized, otherwise skip + */ + if (ass_enabled(ma, SYM_ASSERT_SIZE) && + (ma->ass_size != sdp->sd_sym->st_size)) { + ld_eprintf(ofl, ERR_FATAL, MSG_INTL(MSG_ASSFAIL_SIZE), + ma->ass_file, ma->ass_lineno, + demangle(sdp->sd_name), + ma->ass_size, (Lword)sdp->sd_sym->st_size); + ret = S_ERROR; + } + + if (ass_enabled(ma, SYM_ASSERT_BITS) && (sdp->sd_isc != NULL)) { + if ((ma->ass_bits == TRUE) && + (sdp->sd_isc->is_shdr->sh_type == SHT_NOBITS)) { + ld_eprintf(ofl, ERR_FATAL, + MSG_INTL(MSG_ASSFAIL_BITS), + ma->ass_file, ma->ass_lineno, + demangle(sdp->sd_name)); + ret = S_ERROR; + } + if ((ma->ass_bits == FALSE) && + (sdp->sd_isc->is_shdr->sh_type != SHT_NOBITS)) { + ld_eprintf(ofl, ERR_FATAL, + MSG_INTL(MSG_ASSFAIL_NOBITS), + ma->ass_file, ma->ass_lineno, + demangle(sdp->sd_name)); + ret = S_ERROR; + } + } + + if (ass_enabled(ma, SYM_ASSERT_TYPE) && + (ma->ass_type != ELF_ST_TYPE(sdp->sd_sym->st_info))) { + Ehdr *ehdr = sdp->sd_file->ifl_ehdr; + + ld_eprintf(ofl, ERR_FATAL, + MSG_INTL(MSG_ASSFAIL_TYPE), + ma->ass_file, ma->ass_lineno, + demangle(sdp->sd_name), + conv_sym_info_type(ehdr->e_machine, + ma->ass_type, CONV_FMT_ALT_CFNP, &inv_buf), + conv_sym_info_type(ehdr->e_machine, + ELF_ST_TYPE(sdp->sd_sym->st_info), + CONV_FMT_ALT_CFNP, &inv_buf2)); + ret = S_ERROR; + } + } + + return (ret); +} + + /* * Having created all of the necessary sections, segments, and associated * headers, fill in the program headers and update any other data in the @@ -4166,6 +4420,13 @@ ld_update_outfile(Ofl_desc *ofl) if ((etext = update_osym(ofl)) == (Addr)S_ERROR) return (S_ERROR); + + /* + * Now the symbol tables are complete, process any mapfile + * assertions + */ + if (check_mapfile_assertions(ofl) == S_ERROR) + return (S_ERROR); /* * If we have an PT_INTERP phdr, update it now from the associated * section information. diff --git a/usr/src/cmd/sgs/liblddbg/common/mapfile-vers b/usr/src/cmd/sgs/liblddbg/common/mapfile-vers index bd9d7c9adf..0c0c57fbb8 100644 --- a/usr/src/cmd/sgs/liblddbg/common/mapfile-vers +++ b/usr/src/cmd/sgs/liblddbg/common/mapfile-vers @@ -43,562 +43,568 @@ $mapfile_version 2 SYMBOL_VERSION SUNWprivate_4.83 { - global: - dbg_desc { # interposed - ld.so.1(1) - FLAGS = NODIRECT; - }; - dbg_print { # interposed - ld(1) and ld.so.1(1) - FLAGS = NODIRECT; - }; - - Dbg_args_file; - Dbg_args_option; - Dbg_args_str2chr; - Dbg_args_Wldel; - Dbg_audit_activity; - Dbg_audit_ignore; - Dbg_audit_interface; - Dbg_audit_lib; - Dbg_audit_objclose; - Dbg_audit_objfilter; - Dbg_audit_objopen; - Dbg_audit_objsearch; - Dbg_audit_pltenter; - Dbg_audit_pltexit; - Dbg_audit_preinit; - Dbg_audit_symbind; - Dbg_audit_skip; - Dbg_audit_terminate; - Dbg_audit_version; - - Dbg_basic_collect; - Dbg_basic_create; - Dbg_basic_files; - Dbg_basic_finish; - Dbg_basic_options; - Dbg_basic_relocate; - Dbg_basic_validate; - - Dbg_help; - Dbg_setup; - Dbg_state_str; - Dbg_version; - - Dbg32_bind_global; - Dbg64_bind_global; - Dbg32_bind_plt_summary; - Dbg64_bind_plt_summary; - Dbg64_bind_pltpad_from; - Dbg64_bind_pltpad_to; - Dbg32_bind_reject; - Dbg64_bind_reject; - Dbg32_bind_weak; - Dbg64_bind_weak; - - Dbg32_cap_candidate; - Dbg64_cap_candidate; - Dbg32_cap_filter; - Dbg64_cap_filter; - Dbg32_cap_id; - Dbg64_cap_id; - Dbg32_cap_identical; - Dbg64_cap_identical; - Dbg32_cap_mapfile_title; - Dbg64_cap_mapfile_title; - Dbg32_cap_post_title; - Dbg64_cap_post_title; - Dbg32_cap_ptr_entry; - Dbg64_cap_ptr_entry; - Dbg32_cap_sec_title; - Dbg64_cap_sec_title; - Dbg32_cap_val; - Dbg64_cap_val; - Dbg32_cap_val_entry; - Dbg64_cap_val_entry; - - Dbg32_dl_dladdr; - Dbg64_dl_dladdr; - Dbg32_dl_dlclose; - Dbg64_dl_dlclose; - Dbg32_dl_dldump; - Dbg64_dl_dldump; - Dbg32_dl_dlerror; - Dbg64_dl_dlerror; - Dbg32_dl_dlinfo; - Dbg64_dl_dlinfo; - Dbg32_dl_dlopen; - Dbg64_dl_dlopen; - Dbg32_dl_dlsym; - Dbg64_dl_dlsym; - Dbg32_dl_iphdr_callback; - Dbg64_dl_iphdr_callback; - Dbg32_dl_iphdr_enter; - Dbg64_dl_iphdr_enter; - Dbg32_dl_iphdr_mapchange; - Dbg64_dl_iphdr_mapchange; - Dbg32_dl_iphdr_unmap_ret; - Dbg64_dl_iphdr_unmap_ret; - - Dbg32_demangle_name; - Dbg64_demangle_name; - - Dbg32_ent_print; - Dbg64_ent_print; - - Dbg32_file_analyze; - Dbg64_file_analyze; - Dbg32_file_aout; - Dbg64_file_aout; - Dbg32_file_ar; - Dbg64_file_ar; - Dbg32_file_ar_rescan; - Dbg64_file_ar_rescan; - Dbg32_file_bind_entry; - Dbg64_file_bind_entry; - Dbg32_file_bindings; - Dbg64_file_bindings; - Dbg32_file_bindings_done; - Dbg64_file_bindings_done; - Dbg32_file_cntl; - Dbg64_file_cntl; - Dbg32_file_config_dis; - Dbg64_file_config_dis; - Dbg32_file_config_obj; - Dbg64_file_config_obj; - Dbg32_file_deferred; - Dbg64_file_deferred; - Dbg32_file_del_rescan; - Dbg64_file_del_rescan; - Dbg32_file_delete; - Dbg64_file_delete; - Dbg32_file_elf; - Dbg64_file_elf; - Dbg32_file_cleanup; - Dbg64_file_cleanup; - Dbg32_file_filtee; - Dbg64_file_filtee; - Dbg32_file_filter; - Dbg64_file_filter; - Dbg32_file_fixname; - Dbg64_file_fixname; - Dbg32_file_generic; - Dbg64_file_generic; - Dbg32_file_hdl_action; - Dbg64_file_hdl_action; - Dbg32_file_hdl_collect; - Dbg64_file_hdl_collect; - Dbg32_file_hdl_title; - Dbg64_file_hdl_title; - Dbg32_file_lazyload; - Dbg64_file_lazyload; - Dbg32_file_ldso; - Dbg64_file_ldso; - Dbg32_file_mmapobj; - Dbg64_file_mmapobj; - Dbg32_file_mode_promote; - Dbg64_file_mode_promote; - Dbg32_file_modified; - Dbg64_file_modified; - Dbg32_file_needed; - Dbg64_file_needed; - Dbg32_file_output; - Dbg64_file_output; - Dbg32_file_preload; - Dbg64_file_preload; - Dbg32_file_prot; - Dbg64_file_prot; - Dbg32_file_rejected; - Dbg64_file_rejected; - Dbg32_file_reuse; - Dbg64_file_reuse; - Dbg32_file_skip; - Dbg64_file_skip; - - Dbg32_got_display; - Dbg64_got_display; - - Dbg32_libs_audit; - Dbg64_libs_audit; - Dbg32_libs_find; - Dbg64_libs_find; - Dbg32_libs_found; - Dbg64_libs_found; - Dbg32_libs_insecure; - Dbg64_libs_insecure; - Dbg32_libs_init; - Dbg64_libs_init; - Dbg32_libs_l; - Dbg64_libs_l; - Dbg32_libs_path; - Dbg64_libs_path; - Dbg32_libs_req; - Dbg64_libs_req; - Dbg32_libs_update; - Dbg64_libs_update; - Dbg32_libs_yp; - Dbg64_libs_yp; - Dbg32_libs_ylu; - Dbg64_libs_ylu; - - Dbg32_map_cexp_id; - Dbg64_map_cexp_id; - Dbg32_map_dv; - Dbg64_map_dv; - Dbg32_map_dv_entry; - Dbg64_map_dv_entry; - Dbg32_map_ent; - Dbg64_map_ent; - Dbg32_map_ent_ord_title; - Dbg64_map_ent_ord_title; - Dbg32_map_hdr_noalloc; - Dbg64_map_hdr_noalloc; - Dbg32_map_parse; - Dbg64_map_parse; - Dbg32_map_pass; - Dbg64_map_pass; - Dbg32_map_post_title; - Dbg64_map_post_title; - Dbg32_map_seg; - Dbg64_map_seg; - Dbg32_map_seg_order; - Dbg64_map_seg_order; - Dbg32_map_seg_os_order; - Dbg64_map_seg_os_order; - Dbg32_map_size_new; - Dbg64_map_size_new; - Dbg32_map_size_old; - Dbg64_map_size_old; - Dbg32_map_sort_seg; - Dbg64_map_sort_seg; - Dbg32_map_sort_title; - Dbg64_map_sort_title; - Dbg32_map_symbol; - Dbg64_map_symbol; - Dbg32_map_version; - Dbg64_map_version; - - Dbg32_move_adjexpandreloc; - Dbg64_move_adjexpandreloc; - Dbg32_move_adjmovereloc; - Dbg64_move_adjmovereloc; - Dbg32_move_bad; - Dbg64_move_bad; - Dbg32_move_data; - Dbg64_move_data; - Dbg32_move_entry1; - Dbg64_move_entry1; - Dbg32_move_entry2; - Dbg64_move_entry2; - Dbg32_move_expand; - Dbg64_move_expand; - Dbg32_move_input; - Dbg64_move_input; - Dbg32_move_outmove; - Dbg64_move_outmove; - Dbg32_move_outsctadj; - Dbg64_move_outsctadj; - Dbg32_move_parexpn; - Dbg64_move_parexpn; - - Dbg32_reloc_apply_reg; - Dbg64_reloc_apply_reg; - Dbg32_reloc_apply_val; - Dbg64_reloc_apply_val; - Dbg32_reloc_ars_entry; - Dbg64_reloc_ars_entry; - Dbg32_reloc_copy; - Dbg64_reloc_copy; - Dbg32_reloc_discard; - Dbg64_reloc_discard; - Dbg32_reloc_doact; - Dbg64_reloc_doact; - Dbg32_reloc_doact_title; - Dbg64_reloc_doact_title; - Dbg32_reloc_dooutrel; - Dbg64_reloc_dooutrel; - Dbg32_reloc_entry; - Dbg64_reloc_entry; - Dbg32_reloc_error; - Dbg64_reloc_error; - Dbg32_reloc_generate; - Dbg64_reloc_generate; - Dbg32_reloc_in; - Dbg64_reloc_in; - Dbg32_reloc_ors_entry; - Dbg64_reloc_ors_entry; - Dbg32_reloc_out; - Dbg64_reloc_out; - Dbg32_reloc_proc; - Dbg64_reloc_proc; - Dbg32_reloc_run; - Dbg64_reloc_run; - Dbg32_reloc_sloppycomdat; - Dbg64_reloc_sloppycomdat; - Dbg32_reloc_transition; - Dbg64_reloc_transition; - - Dbg32_sec_added; - Dbg64_sec_added; - Dbg32_sec_backing; - Dbg64_sec_backing; - Dbg32_sec_created; - Dbg64_sec_created; - Dbg32_sec_discarded; - Dbg64_sec_discarded; - Dbg32_sec_genstr_compress; - Dbg64_sec_genstr_compress; - Dbg32_sec_group; - Dbg64_sec_group; - Dbg32_sec_gnu_comdat; - Dbg64_sec_gnu_comdat; - Dbg32_sec_in; - Dbg64_sec_in; - Dbg32_sec_order_error; - Dbg64_sec_order_error; - Dbg32_sec_order_list; - Dbg64_sec_order_list; - Dbg32_sec_redirected; - Dbg64_sec_redirected; - Dbg32_sec_strtab; - Dbg64_sec_strtab; - Dbg32_sec_unsup_strmerge; - Dbg64_sec_unsup_strmerge; - - Dbg32_seg_entry; - Dbg64_seg_entry; - Dbg32_seg_list; - Dbg64_seg_list; - Dbg32_seg_os; - Dbg64_seg_os; - Dbg32_seg_title; - Dbg64_seg_title; - - Dbg32_shdr_modified; - Dbg64_shdr_modified; - - Dbg32_statistics_ar; - Dbg64_statistics_ar; - Dbg32_statistics_ld; - Dbg64_statistics_ld; - - Dbg32_support_action; - Dbg64_support_action; - Dbg32_support_load; - Dbg64_support_load; - Dbg32_support_req; - Dbg64_support_req; - Dbg32_support_vnone; - Dbg64_support_vnone; - - Dbg32_syminfo_entry; - Dbg64_syminfo_entry; - Dbg32_syminfo_title; - Dbg64_syminfo_title; - - Dbg32_syms_ar_checking; - Dbg64_syms_ar_checking; - Dbg32_syms_ar_force; - Dbg64_syms_ar_force; - Dbg32_syms_ar_resolve; - Dbg64_syms_ar_resolve; - Dbg32_syms_ar_skip; - Dbg64_syms_ar_skip; - Dbg32_syms_ar_title; - Dbg64_syms_ar_title; - Dbg32_syms_cap_convert; - Dbg64_syms_cap_convert; - Dbg32_syms_cap_local; - Dbg64_syms_cap_local; - Dbg32_syms_cap_lookup; - Dbg64_syms_cap_lookup; - Dbg32_syms_cap_title; - Dbg64_syms_cap_title; - Dbg32_syms_copy_reloc; - Dbg64_syms_copy_reloc; - Dbg32_syms_created; - Dbg64_syms_created; - Dbg32_syms_discarded; - Dbg64_syms_discarded; - Dbg32_syms_dup_discarded; - Dbg64_syms_dup_discarded; - Dbg32_syms_dup_sort_addr; - Dbg64_syms_dup_sort_addr; - Dbg32_syms_entered; - Dbg64_syms_entered; - Dbg32_syms_entry; - Dbg64_syms_entry; - Dbg32_syms_global; - Dbg64_syms_global; - Dbg32_syms_ignore; - Dbg64_syms_ignore; - Dbg32_syms_ignore_gnuver; - Dbg64_syms_ignore_gnuver; - Dbg32_syms_lazy_rescan; - Dbg64_syms_lazy_rescan; - Dbg32_syms_lookup; - Dbg64_syms_lookup; - Dbg32_syms_lookup_aout; - Dbg32_syms_new; - Dbg64_syms_new; - Dbg32_syms_old; - Dbg64_syms_old; - Dbg32_syms_process; - Dbg64_syms_process; - Dbg32_syms_reduce; - Dbg64_syms_reduce; - Dbg32_syms_resolved; - Dbg64_syms_resolved; - Dbg32_syms_resolving; - Dbg64_syms_resolving; - Dbg32_syms_sec_entry; - Dbg64_syms_sec_entry; - Dbg32_syms_sec_title; - Dbg64_syms_sec_title; - Dbg32_syms_spec_title; - Dbg64_syms_spec_title; - Dbg32_syms_updated; - Dbg64_syms_updated; - Dbg32_syms_up_title; - Dbg64_syms_up_title; - Dbg32_syms_wrap; - Dbg64_syms_wrap; - - Dbg_tls_modactivity; - Dbg_tls_static_block; - Dbg_tls_static_resv; - - Dbg32_util_call_array; - Dbg64_util_call_array; - Dbg32_util_call_fini; - Dbg64_util_call_fini; - Dbg32_util_call_init; - Dbg64_util_call_init; - Dbg32_util_call_main; - Dbg64_util_call_main; - Dbg32_util_collect; - Dbg64_util_collect; - Dbg32_util_dbnotify; - Dbg64_util_dbnotify; - Dbg32_util_edge_in; - Dbg64_util_edge_in; - Dbg32_util_edge_out; - Dbg64_util_edge_out; - Dbg32_util_lcinterface; - Dbg64_util_lcinterface; - Dbg32_util_intoolate; - Dbg64_util_intoolate; - Dbg32_util_nl; - Dbg64_util_nl; - Dbg32_util_scc_entry; - Dbg64_util_scc_entry; - Dbg32_util_scc_title; - Dbg64_util_scc_title; - Dbg32_util_str; - Dbg64_util_str; - - Dbg32_unused_file; - Dbg64_unused_file; - Dbg32_unused_lcinterface; - Dbg64_unused_lcinterface; - Dbg32_unused_path; - Dbg64_unused_path; - Dbg32_unused_sec; - Dbg64_unused_sec; - Dbg32_unused_unref; - Dbg64_unused_unref; - - Dbg32_ver_avail_entry; - Dbg64_ver_avail_entry; - Dbg32_ver_avail_title; - Dbg64_ver_avail_title; - Dbg32_ver_def_title; - Dbg64_ver_def_title; - Dbg32_ver_desc_entry; - Dbg64_ver_desc_entry; - Dbg32_ver_need_done; - Dbg64_ver_need_done; - Dbg32_ver_need_entry; - Dbg64_ver_need_entry; - Dbg32_ver_need_title; - Dbg64_ver_need_title; - Dbg32_ver_nointerface; - Dbg64_ver_nointerface; - Dbg32_ver_symbol; - Dbg64_ver_symbol; + global: + dbg_desc { + # interposed - ld.so.1(1) + FLAGS = NODIRECT; + ASSERT = { + TYPE = OBJECT; + SIZE = addrsize; + }; + }; + dbg_print { + # interposed - ld(1) and ld.so.1(1) + FLAGS = NODIRECT; + }; + + Dbg_args_file; + Dbg_args_option; + Dbg_args_str2chr; + Dbg_args_Wldel; + Dbg_audit_activity; + Dbg_audit_ignore; + Dbg_audit_interface; + Dbg_audit_lib; + Dbg_audit_objclose; + Dbg_audit_objfilter; + Dbg_audit_objopen; + Dbg_audit_objsearch; + Dbg_audit_pltenter; + Dbg_audit_pltexit; + Dbg_audit_preinit; + Dbg_audit_symbind; + Dbg_audit_skip; + Dbg_audit_terminate; + Dbg_audit_version; + + Dbg_basic_collect; + Dbg_basic_create; + Dbg_basic_files; + Dbg_basic_finish; + Dbg_basic_options; + Dbg_basic_relocate; + Dbg_basic_validate; + + Dbg_help; + Dbg_setup; + Dbg_state_str; + Dbg_version; + + Dbg32_bind_global; + Dbg64_bind_global; + Dbg32_bind_plt_summary; + Dbg64_bind_plt_summary; + Dbg64_bind_pltpad_from; + Dbg64_bind_pltpad_to; + Dbg32_bind_reject; + Dbg64_bind_reject; + Dbg32_bind_weak; + Dbg64_bind_weak; + + Dbg32_cap_candidate; + Dbg64_cap_candidate; + Dbg32_cap_filter; + Dbg64_cap_filter; + Dbg32_cap_id; + Dbg64_cap_id; + Dbg32_cap_identical; + Dbg64_cap_identical; + Dbg32_cap_mapfile_title; + Dbg64_cap_mapfile_title; + Dbg32_cap_post_title; + Dbg64_cap_post_title; + Dbg32_cap_ptr_entry; + Dbg64_cap_ptr_entry; + Dbg32_cap_sec_title; + Dbg64_cap_sec_title; + Dbg32_cap_val; + Dbg64_cap_val; + Dbg32_cap_val_entry; + Dbg64_cap_val_entry; + + Dbg32_dl_dladdr; + Dbg64_dl_dladdr; + Dbg32_dl_dlclose; + Dbg64_dl_dlclose; + Dbg32_dl_dldump; + Dbg64_dl_dldump; + Dbg32_dl_dlerror; + Dbg64_dl_dlerror; + Dbg32_dl_dlinfo; + Dbg64_dl_dlinfo; + Dbg32_dl_dlopen; + Dbg64_dl_dlopen; + Dbg32_dl_dlsym; + Dbg64_dl_dlsym; + Dbg32_dl_iphdr_callback; + Dbg64_dl_iphdr_callback; + Dbg32_dl_iphdr_enter; + Dbg64_dl_iphdr_enter; + Dbg32_dl_iphdr_mapchange; + Dbg64_dl_iphdr_mapchange; + Dbg32_dl_iphdr_unmap_ret; + Dbg64_dl_iphdr_unmap_ret; + + Dbg32_demangle_name; + Dbg64_demangle_name; + + Dbg32_ent_print; + Dbg64_ent_print; + + Dbg32_file_analyze; + Dbg64_file_analyze; + Dbg32_file_aout; + Dbg64_file_aout; + Dbg32_file_ar; + Dbg64_file_ar; + Dbg32_file_ar_rescan; + Dbg64_file_ar_rescan; + Dbg32_file_bind_entry; + Dbg64_file_bind_entry; + Dbg32_file_bindings; + Dbg64_file_bindings; + Dbg32_file_bindings_done; + Dbg64_file_bindings_done; + Dbg32_file_cntl; + Dbg64_file_cntl; + Dbg32_file_config_dis; + Dbg64_file_config_dis; + Dbg32_file_config_obj; + Dbg64_file_config_obj; + Dbg32_file_deferred; + Dbg64_file_deferred; + Dbg32_file_del_rescan; + Dbg64_file_del_rescan; + Dbg32_file_delete; + Dbg64_file_delete; + Dbg32_file_elf; + Dbg64_file_elf; + Dbg32_file_cleanup; + Dbg64_file_cleanup; + Dbg32_file_filtee; + Dbg64_file_filtee; + Dbg32_file_filter; + Dbg64_file_filter; + Dbg32_file_fixname; + Dbg64_file_fixname; + Dbg32_file_generic; + Dbg64_file_generic; + Dbg32_file_hdl_action; + Dbg64_file_hdl_action; + Dbg32_file_hdl_collect; + Dbg64_file_hdl_collect; + Dbg32_file_hdl_title; + Dbg64_file_hdl_title; + Dbg32_file_lazyload; + Dbg64_file_lazyload; + Dbg32_file_ldso; + Dbg64_file_ldso; + Dbg32_file_mmapobj; + Dbg64_file_mmapobj; + Dbg32_file_mode_promote; + Dbg64_file_mode_promote; + Dbg32_file_modified; + Dbg64_file_modified; + Dbg32_file_needed; + Dbg64_file_needed; + Dbg32_file_output; + Dbg64_file_output; + Dbg32_file_preload; + Dbg64_file_preload; + Dbg32_file_prot; + Dbg64_file_prot; + Dbg32_file_rejected; + Dbg64_file_rejected; + Dbg32_file_reuse; + Dbg64_file_reuse; + Dbg32_file_skip; + Dbg64_file_skip; + + Dbg32_got_display; + Dbg64_got_display; + + Dbg32_libs_audit; + Dbg64_libs_audit; + Dbg32_libs_find; + Dbg64_libs_find; + Dbg32_libs_found; + Dbg64_libs_found; + Dbg32_libs_insecure; + Dbg64_libs_insecure; + Dbg32_libs_init; + Dbg64_libs_init; + Dbg32_libs_l; + Dbg64_libs_l; + Dbg32_libs_path; + Dbg64_libs_path; + Dbg32_libs_req; + Dbg64_libs_req; + Dbg32_libs_update; + Dbg64_libs_update; + Dbg32_libs_yp; + Dbg64_libs_yp; + Dbg32_libs_ylu; + Dbg64_libs_ylu; + + Dbg32_map_cexp_id; + Dbg64_map_cexp_id; + Dbg32_map_dv; + Dbg64_map_dv; + Dbg32_map_dv_entry; + Dbg64_map_dv_entry; + Dbg32_map_ent; + Dbg64_map_ent; + Dbg32_map_ent_ord_title; + Dbg64_map_ent_ord_title; + Dbg32_map_hdr_noalloc; + Dbg64_map_hdr_noalloc; + Dbg32_map_parse; + Dbg64_map_parse; + Dbg32_map_pass; + Dbg64_map_pass; + Dbg32_map_post_title; + Dbg64_map_post_title; + Dbg32_map_seg; + Dbg64_map_seg; + Dbg32_map_seg_order; + Dbg64_map_seg_order; + Dbg32_map_seg_os_order; + Dbg64_map_seg_os_order; + Dbg32_map_size_new; + Dbg64_map_size_new; + Dbg32_map_size_old; + Dbg64_map_size_old; + Dbg32_map_sort_seg; + Dbg64_map_sort_seg; + Dbg32_map_sort_title; + Dbg64_map_sort_title; + Dbg32_map_symbol; + Dbg64_map_symbol; + Dbg32_map_version; + Dbg64_map_version; + + Dbg32_move_adjexpandreloc; + Dbg64_move_adjexpandreloc; + Dbg32_move_adjmovereloc; + Dbg64_move_adjmovereloc; + Dbg32_move_bad; + Dbg64_move_bad; + Dbg32_move_data; + Dbg64_move_data; + Dbg32_move_entry1; + Dbg64_move_entry1; + Dbg32_move_entry2; + Dbg64_move_entry2; + Dbg32_move_expand; + Dbg64_move_expand; + Dbg32_move_input; + Dbg64_move_input; + Dbg32_move_outmove; + Dbg64_move_outmove; + Dbg32_move_outsctadj; + Dbg64_move_outsctadj; + Dbg32_move_parexpn; + Dbg64_move_parexpn; + + Dbg32_reloc_apply_reg; + Dbg64_reloc_apply_reg; + Dbg32_reloc_apply_val; + Dbg64_reloc_apply_val; + Dbg32_reloc_ars_entry; + Dbg64_reloc_ars_entry; + Dbg32_reloc_copy; + Dbg64_reloc_copy; + Dbg32_reloc_discard; + Dbg64_reloc_discard; + Dbg32_reloc_doact; + Dbg64_reloc_doact; + Dbg32_reloc_doact_title; + Dbg64_reloc_doact_title; + Dbg32_reloc_dooutrel; + Dbg64_reloc_dooutrel; + Dbg32_reloc_entry; + Dbg64_reloc_entry; + Dbg32_reloc_error; + Dbg64_reloc_error; + Dbg32_reloc_generate; + Dbg64_reloc_generate; + Dbg32_reloc_in; + Dbg64_reloc_in; + Dbg32_reloc_ors_entry; + Dbg64_reloc_ors_entry; + Dbg32_reloc_out; + Dbg64_reloc_out; + Dbg32_reloc_proc; + Dbg64_reloc_proc; + Dbg32_reloc_run; + Dbg64_reloc_run; + Dbg32_reloc_sloppycomdat; + Dbg64_reloc_sloppycomdat; + Dbg32_reloc_transition; + Dbg64_reloc_transition; + + Dbg32_sec_added; + Dbg64_sec_added; + Dbg32_sec_backing; + Dbg64_sec_backing; + Dbg32_sec_created; + Dbg64_sec_created; + Dbg32_sec_discarded; + Dbg64_sec_discarded; + Dbg32_sec_genstr_compress; + Dbg64_sec_genstr_compress; + Dbg32_sec_group; + Dbg64_sec_group; + Dbg32_sec_gnu_comdat; + Dbg64_sec_gnu_comdat; + Dbg32_sec_in; + Dbg64_sec_in; + Dbg32_sec_order_error; + Dbg64_sec_order_error; + Dbg32_sec_order_list; + Dbg64_sec_order_list; + Dbg32_sec_redirected; + Dbg64_sec_redirected; + Dbg32_sec_strtab; + Dbg64_sec_strtab; + Dbg32_sec_unsup_strmerge; + Dbg64_sec_unsup_strmerge; + + Dbg32_seg_entry; + Dbg64_seg_entry; + Dbg32_seg_list; + Dbg64_seg_list; + Dbg32_seg_os; + Dbg64_seg_os; + Dbg32_seg_title; + Dbg64_seg_title; + + Dbg32_shdr_modified; + Dbg64_shdr_modified; + + Dbg32_statistics_ar; + Dbg64_statistics_ar; + Dbg32_statistics_ld; + Dbg64_statistics_ld; + + Dbg32_support_action; + Dbg64_support_action; + Dbg32_support_load; + Dbg64_support_load; + Dbg32_support_req; + Dbg64_support_req; + Dbg32_support_vnone; + Dbg64_support_vnone; + + Dbg32_syminfo_entry; + Dbg64_syminfo_entry; + Dbg32_syminfo_title; + Dbg64_syminfo_title; + + Dbg32_syms_ar_checking; + Dbg64_syms_ar_checking; + Dbg32_syms_ar_force; + Dbg64_syms_ar_force; + Dbg32_syms_ar_resolve; + Dbg64_syms_ar_resolve; + Dbg32_syms_ar_skip; + Dbg64_syms_ar_skip; + Dbg32_syms_ar_title; + Dbg64_syms_ar_title; + Dbg32_syms_cap_convert; + Dbg64_syms_cap_convert; + Dbg32_syms_cap_local; + Dbg64_syms_cap_local; + Dbg32_syms_cap_lookup; + Dbg64_syms_cap_lookup; + Dbg32_syms_cap_title; + Dbg64_syms_cap_title; + Dbg32_syms_copy_reloc; + Dbg64_syms_copy_reloc; + Dbg32_syms_created; + Dbg64_syms_created; + Dbg32_syms_discarded; + Dbg64_syms_discarded; + Dbg32_syms_dup_discarded; + Dbg64_syms_dup_discarded; + Dbg32_syms_dup_sort_addr; + Dbg64_syms_dup_sort_addr; + Dbg32_syms_entered; + Dbg64_syms_entered; + Dbg32_syms_entry; + Dbg64_syms_entry; + Dbg32_syms_global; + Dbg64_syms_global; + Dbg32_syms_ignore; + Dbg64_syms_ignore; + Dbg32_syms_ignore_gnuver; + Dbg64_syms_ignore_gnuver; + Dbg32_syms_lazy_rescan; + Dbg64_syms_lazy_rescan; + Dbg32_syms_lookup; + Dbg64_syms_lookup; + Dbg32_syms_lookup_aout; + Dbg32_syms_new; + Dbg64_syms_new; + Dbg32_syms_old; + Dbg64_syms_old; + Dbg32_syms_process; + Dbg64_syms_process; + Dbg32_syms_reduce; + Dbg64_syms_reduce; + Dbg32_syms_resolved; + Dbg64_syms_resolved; + Dbg32_syms_resolving; + Dbg64_syms_resolving; + Dbg32_syms_sec_entry; + Dbg64_syms_sec_entry; + Dbg32_syms_sec_title; + Dbg64_syms_sec_title; + Dbg32_syms_spec_title; + Dbg64_syms_spec_title; + Dbg32_syms_updated; + Dbg64_syms_updated; + Dbg32_syms_up_title; + Dbg64_syms_up_title; + Dbg32_syms_wrap; + Dbg64_syms_wrap; + + Dbg_tls_modactivity; + Dbg_tls_static_block; + Dbg_tls_static_resv; + + Dbg32_util_call_array; + Dbg64_util_call_array; + Dbg32_util_call_fini; + Dbg64_util_call_fini; + Dbg32_util_call_init; + Dbg64_util_call_init; + Dbg32_util_call_main; + Dbg64_util_call_main; + Dbg32_util_collect; + Dbg64_util_collect; + Dbg32_util_dbnotify; + Dbg64_util_dbnotify; + Dbg32_util_edge_in; + Dbg64_util_edge_in; + Dbg32_util_edge_out; + Dbg64_util_edge_out; + Dbg32_util_lcinterface; + Dbg64_util_lcinterface; + Dbg32_util_intoolate; + Dbg64_util_intoolate; + Dbg32_util_nl; + Dbg64_util_nl; + Dbg32_util_scc_entry; + Dbg64_util_scc_entry; + Dbg32_util_scc_title; + Dbg64_util_scc_title; + Dbg32_util_str; + Dbg64_util_str; + + Dbg32_unused_file; + Dbg64_unused_file; + Dbg32_unused_lcinterface; + Dbg64_unused_lcinterface; + Dbg32_unused_path; + Dbg64_unused_path; + Dbg32_unused_sec; + Dbg64_unused_sec; + Dbg32_unused_unref; + Dbg64_unused_unref; + + Dbg32_ver_avail_entry; + Dbg64_ver_avail_entry; + Dbg32_ver_avail_title; + Dbg64_ver_avail_title; + Dbg32_ver_def_title; + Dbg64_ver_def_title; + Dbg32_ver_desc_entry; + Dbg64_ver_desc_entry; + Dbg32_ver_need_done; + Dbg64_ver_need_done; + Dbg32_ver_need_entry; + Dbg64_ver_need_entry; + Dbg32_ver_need_title; + Dbg64_ver_need_title; + Dbg32_ver_nointerface; + Dbg64_ver_nointerface; + Dbg32_ver_symbol; + Dbg64_ver_symbol; } SUNWprivate_3.23; # The following interfaces are used by various parts of the link-editors and # elfdump(1). The link-editors are always packaged together but there -# seems to be a variety of old elfdump's lying around. elfdump only uses +# seems to be a variety of old elfdump's lying around. elfdump only uses # this interface, and thus by separating in from the ever changing Dbg_* # interfaces we can provide a stable versioning environment for this utility. SYMBOL_VERSION SUNWprivate_3.23 { - global: - Elf_syminfo_entry; - Elf_syminfo_title; - - Elf32_cap_entry; - Elf64_cap_entry; - Elf32_cap_title; - Elf64_cap_title; - - Elf32_demangle_name; - Elf64_demangle_name; - Elf32_dyn_entry; - Elf64_dyn_entry; - Elf32_dyn_null_entry; - Elf64_dyn_null_entry; - Elf32_dyn_title; - Elf64_dyn_title; - - Elf32_ehdr; - Elf64_ehdr; - - Elf32_got_entry; - Elf64_got_entry; - Elf32_got_title; - Elf64_got_title; - - Elf32_phdr; - Elf64_phdr; - - Elf32_reloc_apply_reg; - Elf64_reloc_apply_reg; - Elf32_reloc_apply_val; - Elf64_reloc_apply_val; - Elf32_reloc_entry_1; - Elf64_reloc_entry_1; - Elf32_reloc_entry_2; - Elf64_reloc_entry_2; - Elf32_reloc_title; - Elf64_reloc_title; - - Elf32_shdr; - Elf64_shdr; - - Elf32_syms_table_title; - Elf64_syms_table_title; - Elf32_syms_table_entry; - Elf64_syms_table_entry; - - Elf32_ver_def_title; - Elf64_ver_def_title; - Elf32_ver_line_1; - Elf64_ver_line_1; - Elf32_ver_line_2; - Elf64_ver_line_2; - Elf32_ver_line_3; - Elf64_ver_line_3; - Elf32_ver_line_4; - Elf64_ver_line_4; - Elf32_ver_line_5; - Elf64_ver_line_5; - Elf32_ver_need_title; - Elf64_ver_need_title; - - local: - *; + global: + Elf_syminfo_entry; + Elf_syminfo_title; + + Elf32_cap_entry; + Elf64_cap_entry; + Elf32_cap_title; + Elf64_cap_title; + + Elf32_demangle_name; + Elf64_demangle_name; + Elf32_dyn_entry; + Elf64_dyn_entry; + Elf32_dyn_null_entry; + Elf64_dyn_null_entry; + Elf32_dyn_title; + Elf64_dyn_title; + + Elf32_ehdr; + Elf64_ehdr; + + Elf32_got_entry; + Elf64_got_entry; + Elf32_got_title; + Elf64_got_title; + + Elf32_phdr; + Elf64_phdr; + + Elf32_reloc_apply_reg; + Elf64_reloc_apply_reg; + Elf32_reloc_apply_val; + Elf64_reloc_apply_val; + Elf32_reloc_entry_1; + Elf64_reloc_entry_1; + Elf32_reloc_entry_2; + Elf64_reloc_entry_2; + Elf32_reloc_title; + Elf64_reloc_title; + + Elf32_shdr; + Elf64_shdr; + + Elf32_syms_table_title; + Elf64_syms_table_title; + Elf32_syms_table_entry; + Elf64_syms_table_entry; + + Elf32_ver_def_title; + Elf64_ver_def_title; + Elf32_ver_line_1; + Elf64_ver_line_1; + Elf32_ver_line_2; + Elf64_ver_line_2; + Elf32_ver_line_3; + Elf64_ver_line_3; + Elf32_ver_line_4; + Elf64_ver_line_4; + Elf32_ver_line_5; + Elf64_ver_line_5; + Elf32_ver_need_title; + Elf64_ver_need_title; + + local: + *; }; diff --git a/usr/src/cmd/sgs/librtld_db/common/mapfile-vers b/usr/src/cmd/sgs/librtld_db/common/mapfile-vers index 02ac13ea5d..68dcadf9b8 100644 --- a/usr/src/cmd/sgs/librtld_db/common/mapfile-vers +++ b/usr/src/cmd/sgs/librtld_db/common/mapfile-vers @@ -77,11 +77,11 @@ $endif #Externally defined symbols SYMBOL_SCOPE { global: - ps_pauxv { FLAGS = NODIRECT PARENT }; - ps_pdmodel { FLAGS = NODIRECT PARENT }; - ps_pglobal_lookup { FLAGS = NODIRECT PARENT }; - ps_pglobal_sym { FLAGS = NODIRECT PARENT }; - ps_plog { FLAGS = NODIRECT PARENT }; - ps_pread { FLAGS = NODIRECT PARENT }; - ps_pwrite { FLAGS = NODIRECT PARENT }; + ps_pauxv { FLAGS = NODIRECT PARENT; }; + ps_pdmodel { FLAGS = NODIRECT PARENT; }; + ps_pglobal_lookup { FLAGS = NODIRECT PARENT; }; + ps_pglobal_sym { FLAGS = NODIRECT PARENT; }; + ps_plog { FLAGS = NODIRECT PARENT; }; + ps_pread { FLAGS = NODIRECT PARENT; }; + ps_pwrite { FLAGS = NODIRECT PARENT; }; }; diff --git a/usr/src/cmd/sgs/rtld/common/mapfile-vers b/usr/src/cmd/sgs/rtld/common/mapfile-vers index 0a9e5c3e5b..c67b144f2c 100644 --- a/usr/src/cmd/sgs/rtld/common/mapfile-vers +++ b/usr/src/cmd/sgs/rtld/common/mapfile-vers @@ -45,91 +45,140 @@ $mapfile_version 2 # All symbols in ld.so.1 are private as no-one should bind to these directly. # SYMBOL_VERSION SUNWprivate_1.3 { - protected: - dladdr; # Standard dlopen(3x) family - dladdr1; - dldump; - dlclose; - dlerror; - dlinfo; - dlopen; - dlmopen; - dlsym; - - _dladdr; # these should not exist - _dladdr1; - _dldump; - _dlclose; - _dlerror; - _dlinfo; - _dlopen; - _dlmopen; - _dlsym; - - _ld_libc; # provides libc initialization - - _elf_rtbndr; # dbx expects to find these - elf_rtbndr; - _rt_boot; # Provides basic adb symbol offsets - - rtld_db_dlactivity; # Required to support librtld_db - rtld_db_preinit; - rtld_db_postinit; - r_debug; - - elf_plt_write; - is_so_loaded; - lml_main; - lookup_sym; - - alist_append; # librtld support - ld_entry_cnt; - dbg_desc; # Diagnostic support - dbg_print; - eprintf; # Error message printing - veprintf; - - dgettext; # Messaging support - strerror; - - calloc; # Memory management (mapmalloc). - free; - malloc; - realloc; - - _environ; # PLT tracing getenv() support. - environ; - - memcpy; # Some routines are useful for support - snprintf; # libraries such as liblddbg. - sprintf; # Note that some of these functions - strcat; # (like sprintf) may have reduced - strcmp; # functionality over libc, as a simpler - strcpy; # implementation is provided in ld.so.1. - strlen; - strrchr; - strtok_r; - ___errno; - qsort; - dl_iterate_phdr; + protected: + dladdr; # Standard dlopen(3x) family + dladdr1; + dldump; + dlclose; + dlerror; + dlinfo; + dlopen; + dlmopen; + dlsym; + + _dladdr; # these should not exist + _dladdr1; + _dldump; + _dlclose; + _dlerror; + _dlinfo; + _dlopen; + _dlmopen; + _dlsym; + + _ld_libc; # provides libc initialization + + _elf_rtbndr; # dbx expects to find these + elf_rtbndr; + _rt_boot; # Provides basic adb symbol offsets + + rtld_db_dlactivity; # Required to support librtld_db + rtld_db_preinit; + rtld_db_postinit; + r_debug { + ASSERT = { + TYPE = OBJECT; + $if _x86 && _ELF32 + + SIZE = 44; + $elif _x86 && _ELF64 + + SIZE = 80; + $else + + $error Unknown platform + + $endif + + }; + }; + + elf_plt_write; + is_so_loaded; + lml_main { + ASSERT = { + TYPE = OBJECT; + $if _x86 && _ELF32 + + SIZE = addrsize[41]; + $elif _x86 && _ELF64 + + SIZE = addrsize[38]; + $else + + $error Unknown platform + + $endif + + }; + }; + lookup_sym; + + alist_append; # librtld support + ld_entry_cnt { ASSERT = { TYPE = OBJECT; SIZE = addrsize; }; }; + # Diagnostic support + dbg_desc { ASSERT = { TYPE = OBJECT; SIZE = addrsize; }; }; + dbg_print; + eprintf; # Error message printing + veprintf; + + dgettext; # Messaging support + strerror; + + calloc; # Memory management (mapmalloc). + free; + malloc; + realloc; + + # PLT tracing getenv() support. + _environ { ASSERT = { TYPE = OBJECT; SIZE = addrsize; }; }; + environ { + ASSERT = { + BINDING = WEAK; + ALIAS = _environ; + }; + }; + + memcpy; # Some routines are useful for support + snprintf; # libraries such as liblddbg. + sprintf; # Note that some of these functions + strcat; # (like sprintf) may have reduced + strcmp; # functionality over libc, as a simpler + strcpy; # implementation is provided in ld.so.1. + strlen; + strrchr; + strtok_r; + ___errno; + qsort; + dl_iterate_phdr; $if _x86 && _ELF64 - # amd64 ABI exception unwinding - _dlamd64getunwind; - dlamd64getunwind; + # amd64 ABI exception unwinding + _dlamd64getunwind; + dlamd64getunwind; $endif - # doXX_reloc_rtld and relocXX_table are required to - # support librtld.so. + # doXX_reloc_rtld and relocXX_table are required to + # support librtld.so. $if _ELF32 - do32_reloc_rtld; - reloc32_table; + do32_reloc_rtld; + reloc32_table { + ASSERT = { + TYPE = OBJECT; + SIZE = addrsize[117]; + }; + }; $elif _ELF64 - do64_reloc_rtld; - reloc64_table; + do64_reloc_rtld; + reloc64_table { + ASSERT = { + TYPE = OBJECT; + SIZE = addrsize[68]; + }; + }; $else $error unknown ELFCLASS $endif - local: - *; + local: + *; }; diff --git a/usr/src/cmd/sgs/tools/SUNWonld-README b/usr/src/cmd/sgs/tools/SUNWonld-README index d29de0aa81..3ae424340c 100644 --- a/usr/src/cmd/sgs/tools/SUNWonld-README +++ b/usr/src/cmd/sgs/tools/SUNWonld-README @@ -1671,3 +1671,4 @@ Bugid Risk Synopsis 11067 debug statistics crash ld(1) when -z allextract 13481 ld(1) should skip GCC local aliases when building symsort sections 13684 ld aborts when input object has no file name +13487 want mapfile-based assertions about symbol properties diff --git a/usr/src/cmd/sgs/yacc/common/mapfile-vers b/usr/src/cmd/sgs/yacc/common/mapfile-vers index 0dd3e28202..84ce31733a 100644 --- a/usr/src/cmd/sgs/yacc/common/mapfile-vers +++ b/usr/src/cmd/sgs/yacc/common/mapfile-vers @@ -43,6 +43,7 @@ SYMBOL_VERSION SUNW_1.1 { global: main; yyerror; - local: + local: *; }; + |
