diff options
author | Richard Lowe <richlowe@richlowe.net> | 2021-03-30 20:26:27 -0500 |
---|---|---|
committer | Richard Lowe <richlowe@richlowe.net> | 2021-04-05 14:04:36 -0500 |
commit | f980a4bbce3d867e2bb5e61c180593f416d181a5 (patch) | |
tree | af7b5f86efcbc5c28d94ed9721172fe25fa1e707 /usr/src | |
parent | b4adc50c2ffdb6ae8e81d8be3c37ed01066fe920 (diff) | |
download | illumos-joyent-f980a4bbce3d867e2bb5e61c180593f416d181a5.tar.gz |
13684 ld aborts when input object has no file name
Reviewed by: Dan McDonald <danmcd@joyent.com>
Reviewed by: Gordon Ross <Gordon.W.Ross@gmail.com>
Approved by: Robert Mustacchi <rm@fingolfin.org>
Diffstat (limited to 'usr/src')
-rw-r--r-- | usr/src/cmd/sgs/libld/common/syms.c | 15 | ||||
-rw-r--r-- | usr/src/cmd/sgs/libld/common/update.c | 4 | ||||
-rw-r--r-- | usr/src/cmd/sgs/tools/SUNWonld-README | 1 |
3 files changed, 15 insertions, 5 deletions
diff --git a/usr/src/cmd/sgs/libld/common/syms.c b/usr/src/cmd/sgs/libld/common/syms.c index a40f8ae5cd..ff073c9aa7 100644 --- a/usr/src/cmd/sgs/libld/common/syms.c +++ b/usr/src/cmd/sgs/libld/common/syms.c @@ -1718,8 +1718,9 @@ ld_sym_validate(Ofl_desc *ofl) sym->st_name) && (st_insert(ofl->ofl_strtab, sdp->sd_name) == -1)) return (S_ERROR); - if (allow_ldynsym && sym->st_name && - ldynsym_symtype[type]) { + if (allow_ldynsym && ldynsym_symtype[type] && + ((sym->st_name != 0) || + (type == STT_FILE))) { ofl->ofl_dynscopecnt++; if (st_insert(ofl->ofl_dynstrtab, sdp->sd_name) == -1) @@ -2452,8 +2453,14 @@ ld_sym_process(Is_desc *isc, Ifl_desc *ifl, Ofl_desc *ofl) sdp->sd_name) == -1)) return (S_ERROR); - if (allow_ldynsym && sym->st_name && - ldynsym_symtype[type]) { + /* + * STT_FILE symbols must always remain, to + * maintain the ordering semantics of symbol + * tables. + */ + if (allow_ldynsym && ldynsym_symtype[type] && + ((sym->st_name != 0) || + (type == STT_FILE))) { ofl->ofl_dynlocscnt++; if (st_insert(ofl->ofl_dynstrtab, sdp->sd_name) == -1) diff --git a/usr/src/cmd/sgs/libld/common/update.c b/usr/src/cmd/sgs/libld/common/update.c index d61d4cfcd5..8ef1be8343 100644 --- a/usr/src/cmd/sgs/libld/common/update.c +++ b/usr/src/cmd/sgs/libld/common/update.c @@ -702,9 +702,11 @@ update_osym(Ofl_desc *ofl) enter_in_symtab = symtab && (!(ofl->ofl_flags & FLG_OF_REDLSYM) || sdp->sd_move); - enter_in_ldynsym = ldynsym && sdp->sd_name && + enter_in_ldynsym = ldynsym && + ((sym->st_name != 0) || (type == STT_FILE)) && ldynsym_symtype[type] && !(ofl->ofl_flags & FLG_OF_REDLSYM); + _symshndx = NULL; if (enter_in_symtab) { diff --git a/usr/src/cmd/sgs/tools/SUNWonld-README b/usr/src/cmd/sgs/tools/SUNWonld-README index a414a6bfe8..d29de0aa81 100644 --- a/usr/src/cmd/sgs/tools/SUNWonld-README +++ b/usr/src/cmd/sgs/tools/SUNWonld-README @@ -1670,3 +1670,4 @@ Bugid Risk Synopsis 11057 hidden undefined weak symbols should not leave relocations 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 |