diff options
Diffstat (limited to 'usr/src')
27 files changed, 259 insertions, 146 deletions
diff --git a/usr/src/cmd/sgs/elfdump/common/elfdump.c b/usr/src/cmd/sgs/elfdump/common/elfdump.c index 69d2d9b727..58cfdda21e 100644 --- a/usr/src/cmd/sgs/elfdump/common/elfdump.c +++ b/usr/src/cmd/sgs/elfdump/common/elfdump.c @@ -751,7 +751,7 @@ cap(const char *file, Cache *cache, Word shnum, Word phnum, Ehdr *ehdr, Elf *elf) { Word cnt; - Shdr *cshdr = 0; + Shdr *cshdr = NULL; Cache *ccache; Off cphdr_off = 0; Xword cphdr_sz; @@ -798,7 +798,7 @@ cap(const char *file, Cache *cache, Word shnum, Word phnum, Ehdr *ehdr, break; } - if ((cshdr == 0) && (cphdr_off == 0)) + if ((cshdr == NULL) && (cphdr_off == 0)) return; /* @@ -822,8 +822,22 @@ cap(const char *file, Cache *cache, Word shnum, Word phnum, Ehdr *ehdr, capn = (Word)(cshdr->sh_size / cshdr->sh_entsize); for (ndx = 0; ndx < capn; cap++, ndx++) { - if (cap->c_tag != CA_SUNW_NULL) - Elf_cap_entry(0, cap, ndx, ehdr->e_machine); + if (cap->c_tag == CA_SUNW_NULL) + continue; + + Elf_cap_entry(0, cap, ndx, ehdr->e_machine); + + /* + * An SF1_SUNW_ADDR32 software capability in a 32-bit + * object is suspicious as it has no effect. + */ + if ((cap->c_tag == CA_SUNW_SF_1) && + (ehdr->e_ident[EI_CLASS] == ELFCLASS32) && + (cap->c_un.c_val & SF1_SUNW_ADDR32)) { + (void) fprintf(stderr, + MSG_INTL(MSG_WARN_INADDR32SF1), + file, ccache->c_name); + } } } else (void) fprintf(stderr, MSG_INTL(MSG_WARN_INVCAP1), file); diff --git a/usr/src/cmd/sgs/elfdump/common/elfdump.msg b/usr/src/cmd/sgs/elfdump/common/elfdump.msg index 0f091677b6..5d02a70f30 100644 --- a/usr/src/cmd/sgs/elfdump/common/elfdump.msg +++ b/usr/src/cmd/sgs/elfdump/common/elfdump.msg @@ -157,6 +157,8 @@ header\n" @ MSG_WARN_INVCAP3 "%s: capabilities section: %s: and PT_CAP program \ header have conflicting size or offsets\n" +@ MSG_WARN_INADDR32SF1 "%s: capabilities section %s: software capability \ + ADDR32: is ineffective within a 32-bit object\n" # Elf Output Messages diff --git a/usr/src/cmd/sgs/include/i386/machdep_x86.h b/usr/src/cmd/sgs/include/i386/machdep_x86.h index cde6694d60..d58f4bcfbe 100644 --- a/usr/src/cmd/sgs/include/i386/machdep_x86.h +++ b/usr/src/cmd/sgs/include/i386/machdep_x86.h @@ -33,8 +33,6 @@ #ifndef _MACHDEP_X86_H #define _MACHDEP_X86_H -#pragma ident "%Z%%M% %I% %E% SMI" - #include <link.h> #include <sys/machelf.h> @@ -207,14 +205,12 @@ extern "C" { * DT_REGISTER is not valid on i386 or amd64 */ #define M_DT_REGISTER 0xffffffff -#define M_DT_PLTRESERVE 0xfffffffe /* * Make plt section information transparent to the common code. */ #define M_PLT_SHF_FLAGS (SHF_ALLOC | SHF_EXECINSTR) - /* * Make data segment information transparent to the common code. */ diff --git a/usr/src/cmd/sgs/include/sgs.h b/usr/src/cmd/sgs/include/sgs.h index c3648c29fa..1a57cdb115 100644 --- a/usr/src/cmd/sgs/include/sgs.h +++ b/usr/src/cmd/sgs/include/sgs.h @@ -210,6 +210,7 @@ typedef struct { #define SGS_REJ_STR 10 /* generic error - info is a string */ #define SGS_REJ_UNKFILE 11 /* unknown file type */ #define SGS_REJ_HWCAP_1 12 /* hardware capabilities mismatch */ +#define SGS_REJ_SFCAP_1 13 /* software capabilities mismatch */ /* * For those source files used both inside and outside of the diff --git a/usr/src/cmd/sgs/include/sparc/machdep_sparc.h b/usr/src/cmd/sgs/include/sparc/machdep_sparc.h index 12f6d54196..d9876f547c 100644 --- a/usr/src/cmd/sgs/include/sparc/machdep_sparc.h +++ b/usr/src/cmd/sgs/include/sparc/machdep_sparc.h @@ -33,8 +33,6 @@ #ifndef _MACHDEP_SPARC_H #define _MACHDEP_SPARC_H -#pragma ident "%Z%%M% %I% %E% SMI" - #include <link.h> #include <sys/machelf.h> @@ -222,12 +220,6 @@ extern "C" { #define M_DT_REGISTER DT_SPARC_REGISTER /* - * PLTRESERVE is not relevant on sparc - */ -#define M_DT_PLTRESERVE 0xffffffff - - -/* * Make plt section information transparent to the common code. */ #define M_PLT_SHF_FLAGS (SHF_ALLOC | SHF_WRITE | SHF_EXECINSTR) diff --git a/usr/src/cmd/sgs/libconv/common/elf.c b/usr/src/cmd/sgs/libconv/common/elf.c index 6e962aabaa..9439f40c1c 100644 --- a/usr/src/cmd/sgs/libconv/common/elf.c +++ b/usr/src/cmd/sgs/libconv/common/elf.c @@ -23,7 +23,6 @@ * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" /* * String conversion routines for ELF header attributes. @@ -398,34 +397,36 @@ conv_reject_desc(Rej_desc * rej, Conv_reject_desc_buf_t *reject_desc_buf, ushort_t type = rej->rej_type; uint_t info = rej->rej_info; - if (type == SGS_REJ_MACH) - /* LINTED */ + switch (type) { + case SGS_REJ_MACH: return (conv_ehdr_mach((Half)info, 0, &reject_desc_buf->inv_buf)); - else if (type == SGS_REJ_CLASS) - /* LINTED */ + case SGS_REJ_CLASS: return (conv_ehdr_class((uchar_t)info, 0, &reject_desc_buf->inv_buf)); - else if (type == SGS_REJ_DATA) - /* LINTED */ + case SGS_REJ_DATA: return (conv_ehdr_data((uchar_t)info, 0, &reject_desc_buf->inv_buf)); - else if (type == SGS_REJ_TYPE) - /* LINTED */ + case SGS_REJ_TYPE: return (conv_ehdr_type((Half)info, 0, &reject_desc_buf->inv_buf)); - else if ((type == SGS_REJ_BADFLAG) || (type == SGS_REJ_MISFLAG) || - (type == SGS_REJ_HAL) || (type == SGS_REJ_US3)) + case SGS_REJ_BADFLAG: + case SGS_REJ_MISFLAG: + case SGS_REJ_HAL: + case SGS_REJ_US3: return (conv_ehdr_flags(mach, (Word)info, 0, &reject_desc_buf->flags_buf)); - else if (type == SGS_REJ_UNKFILE) + case SGS_REJ_UNKFILE: return ((const char *)0); - else if ((type == SGS_REJ_STR) || (type == SGS_REJ_HWCAP_1)) { + case SGS_REJ_STR: + case SGS_REJ_HWCAP_1: + case SGS_REJ_SFCAP_1: if (rej->rej_str) return ((const char *)rej->rej_str); else return (MSG_ORIG(MSG_STR_EMPTY)); - } else + default: return (conv_invalid_val(&reject_desc_buf->inv_buf, info, CONV_FMT_DECIMAL)); + } } diff --git a/usr/src/cmd/sgs/libelf/common/README.LFS b/usr/src/cmd/sgs/libelf/common/README.LFS index 99829cbcce..1173268096 100644 --- a/usr/src/cmd/sgs/libelf/common/README.LFS +++ b/usr/src/cmd/sgs/libelf/common/README.LFS @@ -23,9 +23,6 @@ # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# ident "%Z%%M% %I% %E% SMI" - - Why 32-bit libelf is not Large File Aware @@ -112,7 +109,7 @@ versions of the public functions that use them, also found in It is important to note that these new versions cannot replace the original definitions. Those must continue to be available to support -non-largefile-aware programs. These new types and functions would be in +non-large-file-aware programs. These new types and functions would be in addition to the pre-existing versions. When you make code like this large file aware, it is necessary to undertake @@ -129,7 +126,7 @@ large file support: These preprocessor definitions would be used to determine whether a given program linked against libelf would see the regular, or -the large file aware versons of the above types and routines. +the large file aware versions of the above types and routines. This is the same approach used in other large file capable software, such as libc. diff --git a/usr/src/cmd/sgs/libld/common/files.c b/usr/src/cmd/sgs/libld/common/files.c index 52927ba177..b931b165e1 100644 --- a/usr/src/cmd/sgs/libld/common/files.c +++ b/usr/src/cmd/sgs/libld/common/files.c @@ -253,6 +253,20 @@ sf1_cap(Ofl_desc *ofl, Xword val, Ifl_desc *ifl, const char *name) return; } +#if !defined(_ELF64) + if (ifl->ifl_ehdr->e_type == ET_REL) { + /* + * The SF1_SUNW_ADDR32 is only meaningful when building a 64-bit + * object. Warn the user, and remove the setting, if we're + * building a 32-bit object. + */ + if (val & SF1_SUNW_ADDR32) { + eprintf(ofl->ofl_lml, ERR_WARNING, + MSG_INTL(MSG_FIL_INADDR32SF1), ifl->ifl_name, name); + val &= ~SF1_SUNW_ADDR32; + } + } +#endif /* * If this object doesn't specify any capabilities, ignore it, and * leave the state as is. @@ -269,12 +283,36 @@ sf1_cap(Ofl_desc *ofl, Xword val, Ifl_desc *ifl, const char *name) ifl->ifl_name, name, EC_XWORD(badval)); val &= SF1_SUNW_MASK; } - if (val == SF1_SUNW_FPUSED) { + if ((val & (SF1_SUNW_FPKNWN | SF1_SUNW_FPUSED)) == SF1_SUNW_FPUSED) { eprintf(ofl->ofl_lml, ERR_WARNING, MSG_INTL(MSG_FIL_BADSF1), ifl->ifl_name, name, EC_XWORD(val)); return; } + /* + * If the input file is not a relocatable object, then we're only here + * to warn the user of any questionable capabilities. + */ + if (ifl->ifl_ehdr->e_type != ET_REL) { +#if defined(_ELF64) + /* + * If we're building a 64-bit executable, and we come across a + * dependency that requires a restricted address space, then + * that dependencies requirement can only be satisfied if the + * executable triggers the restricted address space. This is a + * warning rather than a fatal error, as the possibility exists + * that an appropriate dependency will be provided at runtime. + * The runtime linker will refuse to use this dependency. + */ + if ((val & SF1_SUNW_ADDR32) && (ofl->ofl_flags & FLG_OF_EXEC) && + ((ofl->ofl_sfcap_1 & SF1_SUNW_ADDR32) == 0)) { + eprintf(ofl->ofl_lml, ERR_WARNING, + MSG_INTL(MSG_FIL_EXADDR32SF1), ifl->ifl_name, name); + } +#endif + return; + } + Dbg_cap_sec_entry(ofl->ofl_lml, DBG_CAP_OLD, CA_SUNW_SF_1, ofl->ofl_sfcap_1, ld_targ.t_m.m_mach); Dbg_cap_sec_entry(ofl->ofl_lml, DBG_CAP_NEW, CA_SUNW_SF_1, @@ -367,9 +405,23 @@ process_cap(Ifl_desc *ifl, Is_desc *cisp, Ofl_desc *ofl) for (ndx = 0; ndx < cnum; cdata++, ndx++) { switch (cdata->c_tag) { case CA_SUNW_HW_1: - hw1_cap(ofl, cdata->c_un.c_val); + /* + * Only the hardware capabilities that are + * defined in a relocatable object become part + * of the hardware capabilities in the output + * file. + */ + if (ifl->ifl_ehdr->e_type == ET_REL) + hw1_cap(ofl, cdata->c_un.c_val); break; case CA_SUNW_SF_1: + /* + * Only the software capabilities that are + * defined in a relocatable object become part + * of the software capabilities in the output + * file. However, check the validity of the + * software capabilities of any dependencies. + */ sf1_cap(ofl, cdata->c_un.c_val, ifl, cisp->is_name); break; @@ -1806,12 +1858,12 @@ process_elf(Ifl_desc *ifl, Elf *elf, Ofl_desc *ofl) } /* - * Process any hardware/software capabilities sections. Only propagate - * capabilities for input relocatable objects. If the object doesn't - * contain any capabilities, any capability state that has already been - * gathered will prevail. + * Process any hardware/software capabilities sections. Only the + * capabilities for input relocatable objects are propagated. If the + * relocatable objects don't contain any capabilities, any capability + * state that has already been gathered will prevail. */ - if (capisp && (ifl->ifl_ehdr->e_type == ET_REL)) + if (capisp) process_cap(ifl, capisp, ofl); /* diff --git a/usr/src/cmd/sgs/libld/common/libld.msg b/usr/src/cmd/sgs/libld/common/libld.msg index dc41473549..e07f582e55 100644 --- a/usr/src/cmd/sgs/libld/common/libld.msg +++ b/usr/src/cmd/sgs/libld/common/libld.msg @@ -388,6 +388,10 @@ @ MSG_FIL_UNKCAP "file %s: section %s: unknown capability tag: %d" @ MSG_FIL_BADSF1 "file %s: section %s: unknown software capabilities: \ 0x%llx; ignored" +@ MSG_FIL_INADDR32SF1 "file %s: section %s: software capability ADDR32: is \ + ineffective when building 32-bit object; ignored" +@ MSG_FIL_EXADDR32SF1 "file %s: section %s: software capability ADDR32: \ + requires executable be built with ADDR32 capability" @ MSG_FIL_BADORDREF "file %s: section %s[%d]: contains illegal reference \ to discarded section: %s[%d]" @@ -964,9 +968,11 @@ @ MSG_MAP_NOFILTER "%s: %lld: filtee definition required" @ MSG_MAP_BADSF1 "%s: %lld: unknown software capabilities: 0x%llx; \ ignored" +@ MSG_MAP_INADDR32SF1 "%s: %lld: software capability ADDR32: is ineffective \ + when building 32-bit object: ignored" @ MSG_MAP_NOINTPOSE "%s: %lld: interposition symbols can only be defined \ when building a dynamic executable" -@ MSG_MAP_NOEXVLSZ "%s: %lld: value and size attributes are imcompatible \ +@ MSG_MAP_NOEXVLSZ "%s: %lld: value and size attributes are incompatible \ with extern or parent symbols" @ MSG_MAP_SEGSAME "segments `%s' and `%s' have the same assigned \ diff --git a/usr/src/cmd/sgs/libld/common/map.c b/usr/src/cmd/sgs/libld/common/map.c index 3d8212c845..5d39eb49c8 100644 --- a/usr/src/cmd/sgs/libld/common/map.c +++ b/usr/src/cmd/sgs/libld/common/map.c @@ -325,12 +325,26 @@ map_cap(const char *mapfile, Word type, Ofl_desc *ofl) EC_XWORD(Line_num), EC_LWORD(badsf1)); ofl->ofl_sfcap_1 &= SF1_SUNW_MASK; } - if (ofl->ofl_sfcap_1 == SF1_SUNW_FPUSED) { + if ((ofl->ofl_sfcap_1 & + (SF1_SUNW_FPKNWN | SF1_SUNW_FPUSED)) == SF1_SUNW_FPUSED) { eprintf(ofl->ofl_lml, ERR_WARNING, MSG_INTL(MSG_FIL_BADSF1), mapfile, EC_XWORD(Line_num), EC_LWORD(SF1_SUNW_FPUSED)); - ofl->ofl_sfcap_1 = 0; + ofl->ofl_sfcap_1 &= ~SF1_SUNW_FPUSED; } +#if !defined(_ELF64) + /* + * The SF1_SUNW_ADDR32 software capability is only meaningful + * when building a 64-bit object. Warn the user, and remove the + * setting, if we're building a 32-bit object. + */ + if (ofl->ofl_sfcap_1 & SF1_SUNW_ADDR32) { + eprintf(ofl->ofl_lml, ERR_WARNING, + MSG_INTL(MSG_MAP_INADDR32SF1), mapfile, + EC_XWORD(Line_num)); + ofl->ofl_sfcap_1 &= ~SF1_SUNW_ADDR32; + } +#endif } return (1); } diff --git a/usr/src/cmd/sgs/librtld_db/rdb_demo/amd64/Makefile b/usr/src/cmd/sgs/librtld_db/rdb_demo/amd64/Makefile index dc25dd71d4..b0dd8ced52 100644 --- a/usr/src/cmd/sgs/librtld_db/rdb_demo/amd64/Makefile +++ b/usr/src/cmd/sgs/librtld_db/rdb_demo/amd64/Makefile @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,12 +18,11 @@ # # CDDL HEADER END # + # -# Copyright 2004 Sun Microsystems, Inc. All rights reserved. +# Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# ident "%Z%%M% %I% %E% SMI" -# include ../Makefile.com @@ -39,14 +37,14 @@ LDFLAGS= -L ../../$(MACH64) \ LINTFLAGS64 += $(VAR_LIBRTLD_DB_LINTFLAGS64) # DEMO DELETE END -DEMOCFLAGS= -xarch=generic64 +# Change -m64 to -xarch=generic64 for use with older Sun compilers. +DEMOCFLAGS= -m64 .KEEP_STATE: all: $(OBJDIR) .WAIT $(PROG) -test: $(TESTS) - +test: $(TESTS) # DEMO DELETE START DEMOCFLAGS= @@ -62,7 +60,6 @@ $(OBJDIR)/%.o: ../i386/%.c $(COMPILE.c) $< -o $@ $(POST_PROCESS_O) - # DEMO DELETE START include ../../../../../Makefile.master.64 # DEMO DELETE END diff --git a/usr/src/cmd/sgs/librtld_db/rdb_demo/i386/Makefile b/usr/src/cmd/sgs/librtld_db/rdb_demo/i386/Makefile index f92cf0a923..4c0ab5c003 100644 --- a/usr/src/cmd/sgs/librtld_db/rdb_demo/i386/Makefile +++ b/usr/src/cmd/sgs/librtld_db/rdb_demo/i386/Makefile @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,11 +18,10 @@ # # CDDL HEADER END # + # -#ident "%Z%%M% %I% %E% SMI" -# -# Copyright (c) 1995 by Sun Microsystems, Inc. -# All rights reserved. +# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. # include ../Makefile.com @@ -32,6 +30,8 @@ include ../Makefile.com all: $(OBJDIR) .WAIT $(PROG) +test: $(TESTS) + # DEMO DELETE START install: all $(ROOTONLDBINPROG) diff --git a/usr/src/cmd/sgs/librtld_db/rdb_demo/sparc/Makefile b/usr/src/cmd/sgs/librtld_db/rdb_demo/sparc/Makefile index eb35cf9595..4c0ab5c003 100644 --- a/usr/src/cmd/sgs/librtld_db/rdb_demo/sparc/Makefile +++ b/usr/src/cmd/sgs/librtld_db/rdb_demo/sparc/Makefile @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,11 +18,10 @@ # # CDDL HEADER END # + # -#ident "%Z%%M% %I% %E% SMI" -# -# Copyright (c) 1996 by Sun Microsystems, Inc. -# All rights reserved. +# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. # include ../Makefile.com @@ -32,12 +30,14 @@ include ../Makefile.com all: $(OBJDIR) .WAIT $(PROG) -test: $(TESTS) +test: $(TESTS) # DEMO DELETE START + install: all $(ROOTONLDBINPROG) lint: $(LINTOUT) + # DEMO DELETE END include ../Makefile.targ diff --git a/usr/src/cmd/sgs/librtld_db/rdb_demo/sparcv9/Makefile b/usr/src/cmd/sgs/librtld_db/rdb_demo/sparcv9/Makefile index cd4d8c07da..27c2e123cf 100644 --- a/usr/src/cmd/sgs/librtld_db/rdb_demo/sparcv9/Makefile +++ b/usr/src/cmd/sgs/librtld_db/rdb_demo/sparcv9/Makefile @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,12 +18,11 @@ # # CDDL HEADER END # + # -# Copyright 1996-2003 Sun Microsystems, Inc. All rights reserved. +# Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# ident "%Z%%M% %I% %E% SMI" -# include ../Makefile.com @@ -39,14 +37,14 @@ LDFLAGS= -L ../../$(MACH64) \ LINTFLAGS64 += $(VAR_LIBRTLD_DB_LINTFLAGS64) # DEMO DELETE END -DEMOCFLAGS= -xarch=v9 +# Change -m64 to -xarch=generic64 for use with older Sun compilers. +DEMOCFLAGS= -m64 .KEEP_STATE: all: $(OBJDIR) .WAIT $(PROG) -test: $(TESTS) - +test: $(TESTS) # DEMO DELETE START DEMOCFLAGS= diff --git a/usr/src/cmd/sgs/link_audit/common/Makefile.demo b/usr/src/cmd/sgs/link_audit/common/Makefile.demo index f8ea9b9323..4ecc9e918c 100644 --- a/usr/src/cmd/sgs/link_audit/common/Makefile.demo +++ b/usr/src/cmd/sgs/link_audit/common/Makefile.demo @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,19 +18,18 @@ # # CDDL HEADER END # + # -# Copyright 2004 Sun Microsystems, Inc. All rights reserved. +# Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# ident "%Z%%M% %I% %E% SMI" -# MACH:sh= uname -p -sparc_XARCH= -xarch=v8 -sparc64_XARCH= -xarch=v9 +sparc_XARCH= +sparc64_XARCH= -m64 i386_XARCH= -i38664_XARCH= -xarch=generic64 +i38664_XARCH= -m64 C_PICFLAGS= -Kpic C_PICFLAGS64= -Kpic diff --git a/usr/src/cmd/sgs/packages/common/SUNWonld-README b/usr/src/cmd/sgs/packages/common/SUNWonld-README index bae54073a6..8400ac1665 100644 --- a/usr/src/cmd/sgs/packages/common/SUNWonld-README +++ b/usr/src/cmd/sgs/packages/common/SUNWonld-README @@ -1212,6 +1212,15 @@ Bugid Risk Synopsis 6668050 First trip through PLT does not preserve args in xmm registers -------------------------------------------------------------------------------- +------------------------------------- +Solaris 10 409 (7th Q-update - s10u7) +------------------------------------- +Bugid Risk Synopsis +================================================================================ +6629404 ld with -z ignore doesn't scale +6606203 link editor ought to allow creation of >2gb sized objects (P) +-------------------------------------------------------------------------------- + -------------- Solaris Nevada -------------- @@ -1311,7 +1320,6 @@ Bugid Risk Synopsis PSARC/2007/620 elfdump -T, and simplified matching 6627765 soffice failure after integration of 6603313 - dangling GROUP pointer. 6319025 SUNWbtool packaging issues in Nevada and S10u1. -6629404 ld with -z ignore doesn't scale 6626135 elfedit capabilities str->value mapping should come from usr/src/common/elfcap 6642769 ld(1) -z combreloc should become default behavior (D) @@ -1332,7 +1340,6 @@ Bugid Risk Synopsis 6672394 ldd(1) unused dependency processing is tricked by relocations errors 6671255 link-editor should support cross linking (D) PSARC/2008/179 cross link-editor -6606203 link editor ought to allow creation of >2gb sized objects (P) 6674666 elfedit dyn:posflag1 needs option to locate element via NEEDED item 6568447 bcp is broken by 6551627 (link-editor components only) 6675591 elfwrap - wrap data in an ELF file (D,P) @@ -1382,3 +1389,6 @@ Bugid Risk Synopsis PSARC/2008/603 ELF objects to adopt GNU-style Versym indexes 6752728 link-editor can enter UNDEF symbols in symbol sort sections 6756472 AOUT search path pruning (D) +6754965 introduce the SF1_SUNW_ADDR32 bit in software capabilities (D) + (link-editor components only) + PSARC/2008/622 32-bit Address Restriction Software Capabilities Flag diff --git a/usr/src/cmd/sgs/rtld/common/_elf.h b/usr/src/cmd/sgs/rtld/common/_elf.h index 7d52eeab1f..58e33f47c1 100644 --- a/usr/src/cmd/sgs/rtld/common/_elf.h +++ b/usr/src/cmd/sgs/rtld/common/_elf.h @@ -30,8 +30,6 @@ #ifndef __ELF_DOT_H #define __ELF_DOT_H -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/types.h> #include <elf.h> #include <_rtld.h> @@ -94,7 +92,6 @@ typedef struct _rt_elf_private { char *e_strtab; /* string table */ void *e_reloc; /* relocation table */ uint_t *e_pltgot; /* addrs for procedure linkage table */ - void *e_pltreserve; /* ia64: DT_IA_64_PLTRESERVE */ void *e_dynplt; /* dynamic plt table - used by prof */ void *e_jmprel; /* plt relocations */ ulong_t e_sunwsortent; /* size of sunw[sym|tls]sort entry */ @@ -156,7 +153,6 @@ typedef struct _rt_elf_private { #define SYMINENT(X) (((Rt_elfp *)(X)->rt_priv)->e_syminent) #define PLTPAD(X) (((Rt_elfp *)(X)->rt_priv)->e_pltpad) #define PLTPADEND(X) (((Rt_elfp *)(X)->rt_priv)->e_pltpadend) -#define PLTRESERVE(X) (((Rt_elfp *)(X)->rt_priv)->e_pltreserve) #define SUNWSORTENT(X) (((Rt_elfp *)(X)->rt_priv)->e_sunwsortent) #define SUNWSYMSORT(X) (((Rt_elfp *)(X)->rt_priv)->e_sunwsymsort) #define SUNWSYMSORTSZ(X) (((Rt_elfp *)(X)->rt_priv)->e_sunwsymsortsz) diff --git a/usr/src/cmd/sgs/rtld/common/_rtld.h b/usr/src/cmd/sgs/rtld/common/_rtld.h index 57764f9526..5b427fe3ad 100644 --- a/usr/src/cmd/sgs/rtld/common/_rtld.h +++ b/usr/src/cmd/sgs/rtld/common/_rtld.h @@ -317,6 +317,7 @@ typedef struct { #define RT_FL2_BRANDED 0x00000800 /* process is branded */ #define RT_FL2_NOPLM 0x00001000 /* process has no primary link map */ #define RT_FL2_SETUID 0x00002000 /* ld.so.1 is setuid root */ +#define RT_FL2_ADDR32 0x00004000 /* 32-bit address space requirement */ /* * Information flags for env_info. @@ -529,6 +530,7 @@ extern Rt_map *_caller(caddr_t, int); extern caddr_t caller(void); extern void *calloc(size_t, size_t); extern void cap_assign(Cap *, Rt_map *); +extern int cap_check(Rej_desc *, Ehdr *); extern const char *_conv_reloc_type(uint_t rel); extern uintptr_t dbg_setup(const char *, Dbg_desc *); extern const char *demangle(const char *); @@ -578,7 +580,6 @@ extern int hdl_add(Grp_hdl *, Rt_map *, uint_t); extern Grp_hdl *hdl_create(Lm_list *, Rt_map *, Rt_map *, uint_t, uint_t, uint_t); extern int hdl_initialize(Grp_hdl *, Rt_map *, int, int); -extern int hwcap_check(Rej_desc *, Ehdr *); extern Pnode *hwcap_filtees(Pnode **, Aliste, Lm_cntl *, Dyninfo *, Rt_map *, const char *, int, uint_t, int *); extern void is_dep_ready(Rt_map *, Rt_map *, int); diff --git a/usr/src/cmd/sgs/rtld/common/analyze.c b/usr/src/cmd/sgs/rtld/common/analyze.c index 7dcf5b00d0..f5c4043b4b 100644 --- a/usr/src/cmd/sgs/rtld/common/analyze.c +++ b/usr/src/cmd/sgs/rtld/common/analyze.c @@ -713,18 +713,23 @@ are_u_this(Rej_desc *rej, int fd, struct stat *status, const char *name) /* * If this object is an explicitly defined shared * object under inspection by ldd, and contains a - * incompatible hardware capabilities requirement, then + * incompatible capabilities requirement, then * inform the user, but continue processing. * * XXXX - ldd -v for any rej failure. */ - if ((rej->rej_type == SGS_REJ_HWCAP_1) && + if (((rej->rej_type == SGS_REJ_HWCAP_1) || + (rej->rej_type == SGS_REJ_SFCAP_1)) && (lml_main.lm_flags & LML_FLG_TRC_LDDSTUB) && ((lmp = lml_main.lm_head) != 0) && (FLAGS1(lmp) & FL1_RT_LDDSTUB) && (NEXT(lmp) == 0)) { - (void) printf(MSG_INTL(MSG_LDD_GEN_HWCAP_1), - name, rej->rej_str); + const char *fmt; + if (rej->rej_type == SGS_REJ_HWCAP_1) + fmt = MSG_INTL(MSG_LDD_GEN_HWCAP_1); + else + fmt = MSG_INTL(MSG_LDD_GEN_SFCAP_1); + (void) printf(fmt, name, rej->rej_str); return (vector[i]); } return (0); diff --git a/usr/src/cmd/sgs/rtld/common/cap.c b/usr/src/cmd/sgs/rtld/common/cap.c index 312220521f..a5f80a4374 100644 --- a/usr/src/cmd/sgs/rtld/common/cap.c +++ b/usr/src/cmd/sgs/rtld/common/cap.c @@ -24,8 +24,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/types.h> #include <sys/mman.h> #include <dirent.h> @@ -63,11 +61,10 @@ compare(const void *fdesc1, const void *fdesc2) } /* - * If this object defines a set of hardware capability requirements, insure the - * kernal can cope with them. + * Process any hardware and software capabilities. */ int -hwcap_check(Rej_desc *rej, Ehdr *ehdr) +cap_check(Rej_desc *rej, Ehdr *ehdr) { Cap *cptr; Phdr *phdr; @@ -82,29 +79,57 @@ hwcap_check(Rej_desc *rej, Ehdr *ehdr) continue; /* LINTED */ - cptr = (Cap *)((char *)ehdr + phdr->p_offset); - while (cptr->c_tag != CA_SUNW_NULL) { - if (cptr->c_tag == CA_SUNW_HW_1) - break; - cptr++; - } - if (cptr->c_tag == CA_SUNW_NULL) - break; + for (cptr = (Cap *)((char *)ehdr + phdr->p_offset); + (cptr->c_tag != CA_SUNW_NULL); cptr++) { + + if ((cptr->c_tag == CA_SUNW_HW_1) && + (rtld_flags2 & RT_FL2_HWCAP)) { + /* + * If this object defines a set of hardware + * capability requirements, ensure the kernel + * can cope with them. + */ + if ((val = (cptr->c_un.c_val & ~hwcap)) != 0) { + static Conv_cap_val_hw1_buf_t cap_buf; + + rej->rej_type = SGS_REJ_HWCAP_1; + rej->rej_str = + conv_cap_val_hw1(val, M_MACH, 0, + &cap_buf); + return (0); + } + + /* + * Retain this hardware capabilities value for + * possible later inspection should this object + * be processed as a filtee. + */ + fmap->fm_hwptr = cptr->c_un.c_val; - if ((val = (cptr->c_un.c_val & ~hwcap)) != 0) { - static Conv_cap_val_hw1_buf_t cap_buf; - - rej->rej_type = SGS_REJ_HWCAP_1; - rej->rej_str = - conv_cap_val_hw1(val, M_MACH, 0, &cap_buf); - return (0); + } +#if defined(_ELF64) + if (cptr->c_tag == CA_SUNW_SF_1) { + /* + * A 64-bit executable that started the process + * can be restricted to a 32-bit address space. + * A 64-bit dependency that is restricted to a + * 32-bit address space can not be loaded unless + * the executable has established this + * requirement. + */ + if ((cptr->c_un.c_val & SF1_SUNW_ADDR32) && + ((rtld_flags2 & RT_FL2_ADDR32) == 0)) { + static Conv_cap_val_sf1_buf_t cap_buf; + + rej->rej_type = SGS_REJ_SFCAP_1; + rej->rej_str = + conv_cap_val_sf1(SF1_SUNW_ADDR32, + M_MACH, 0, &cap_buf); + return (0); + } + } +#endif } - - /* - * Retain this hardware capabilities pointer for possible later - * inspection should this object be processed as a filtee. - */ - fmap->fm_hwptr = cptr->c_un.c_val; } return (1); } diff --git a/usr/src/cmd/sgs/rtld/common/elf.c b/usr/src/cmd/sgs/rtld/common/elf.c index 6d86c460cf..1bd0e9c4bc 100644 --- a/usr/src/cmd/sgs/rtld/common/elf.c +++ b/usr/src/cmd/sgs/rtld/common/elf.c @@ -208,7 +208,7 @@ elf_are_u(Rej_desc *rej) * Verify machine specific flags, and hardware capability requirements. */ if ((elf_mach_flags_check(rej, ehdr) == 0) || - ((rtld_flags2 & RT_FL2_HWCAP) && (hwcap_check(rej, ehdr) == 0))) + (cap_check(rej, ehdr) == 0)) return (0); /* @@ -2496,10 +2496,6 @@ elf_new_lm(Lm_list *lml, const char *pname, const char *oname, Dyn *ld, case M_DT_REGISTER: FLAGS(lmp) |= FLG_RT_REGSYMS; break; - case M_DT_PLTRESERVE: - PLTRESERVE(lmp) = (void *)(ld->d_un.d_ptr + - base); - break; } } diff --git a/usr/src/cmd/sgs/rtld/common/globals.c b/usr/src/cmd/sgs/rtld/common/globals.c index 2dc64eb35e..b0ec08db1c 100644 --- a/usr/src/cmd/sgs/rtld/common/globals.c +++ b/usr/src/cmd/sgs/rtld/common/globals.c @@ -18,6 +18,7 @@ * * CDDL HEADER END */ + /* * Copyright (c) 1988 AT&T * All Rights Reserved @@ -26,7 +27,6 @@ * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" #include <sys/types.h> #include <sys/mman.h> @@ -218,6 +218,7 @@ ldd_reject[] = { MSG_LDD_REJ_STR, /* MSG_INTL(MSG_LDD_REJ_STR) */ MSG_LDD_REJ_UNKFILE, /* MSG_INTL(MSG_LDD_REJ_UNKFILE) */ MSG_LDD_REJ_HWCAP_1, /* MSG_INTL(MSG_LDD_REJ_HWCAP_1) */ + MSG_LDD_REJ_SFCAP_1, /* MSG_INTL(MSG_LDD_REJ_SFCAP_1) */ }; @@ -236,4 +237,5 @@ err_reject[] = { MSG_ERR_REJ_STR, /* MSG_INTL(MSG_ERR_REJ_STR) */ MSG_ERR_REJ_UNKFILE, /* MSG_INTL(MSG_ERR_REJ_UNKFILE) */ MSG_ERR_REJ_HWCAP_1, /* MSG_INTL(MSG_ERR_REJ_HWCAP_1) */ + MSG_ERR_REJ_SFCAP_1, /* MSG_INTL(MSG_ERR_REJ_SFCAP_1) */ }; diff --git a/usr/src/cmd/sgs/rtld/common/rtld.msg b/usr/src/cmd/sgs/rtld/common/rtld.msg index 60a1dd765e..2b1cbff33d 100644 --- a/usr/src/cmd/sgs/rtld/common/rtld.msg +++ b/usr/src/cmd/sgs/rtld/common/rtld.msg @@ -23,8 +23,6 @@ # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# ident "%Z%%M% %I% %E% SMI" -# @ _START_ @@ -199,8 +197,10 @@ @ MSG_LDD_REJ_STR " - %s" @ MSG_LDD_REJ_UNKFILE " - unknown file type" @ MSG_LDD_REJ_HWCAP_1 " - hardware capability unsupported: %s" +@ MSG_LDD_REJ_SFCAP_1 " - software capability unsupported: %s" @ MSG_LDD_GEN_HWCAP_1 "%s: warning: hardware capability unsupported: %s\n" +@ MSG_LDD_GEN_SFCAP_1 "%s: warning: hardware capability unsupported: %s\n" # Error rejection messages. @@ -216,6 +216,7 @@ @ MSG_ERR_REJ_STR "%s: %s" @ MSG_ERR_REJ_UNKFILE "%s: unknown file type" @ MSG_ERR_REJ_HWCAP_1 "%s: hardware capability unsupported: %s" +@ MSG_ERR_REJ_SFCAP_1 "%s: software capability unsupported: %s" # Error TLS failures diff --git a/usr/src/cmd/sgs/rtld/common/setup.c b/usr/src/cmd/sgs/rtld/common/setup.c index ee8b97eb4d..6f38807046 100644 --- a/usr/src/cmd/sgs/rtld/common/setup.c +++ b/usr/src/cmd/sgs/rtld/common/setup.c @@ -29,8 +29,6 @@ * All Rights Reserved */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * Run time linker common setup. * @@ -724,6 +722,17 @@ setup(char **envp, auxv_t *auxv, Word _flags, char *_platform, int _syspagsz, } } +#if defined(_ELF64) + /* + * If this is a 64-bit process, determine whether this process has + * restricted the process address space to 32-bits. Any dependencies + * that are restricted to a 32-bit address space can only be loaded if + * the executable has established this requirement. + */ + if (SFCAP(mlmp) & SF1_SUNW_ADDR32) + rtld_flags2 |= RT_FL2_ADDR32; +#endif + FLAGS(mlmp) |= (FLG_RT_ISMAIN | FLG_RT_MODESET); FLAGS1(mlmp) |= FL1_RT_USED; diff --git a/usr/src/common/elfcap/elfcap.c b/usr/src/common/elfcap/elfcap.c index affe3427d4..4e1a414bc4 100644 --- a/usr/src/common/elfcap/elfcap.c +++ b/usr/src/common/elfcap/elfcap.c @@ -94,6 +94,10 @@ static const elfcap_desc_t sf1[ELFCAP_NUM_SF1] = { { /* 0x00000002 */ SF1_SUNW_FPUSED, STRDESC("SF1_SUNW_FPUSED"), STRDESC("FPUSED"), STRDESC("fpused"), + }, + { /* 0x00000004 */ + SF1_SUNW_ADDR32, STRDESC("SF1_SUNW_ADDR32"), + STRDESC("ADDR32"), STRDESC("addr32"), } }; diff --git a/usr/src/common/elfcap/elfcap.h b/usr/src/common/elfcap/elfcap.h index 76aa346136..8e611ec5c0 100644 --- a/usr/src/common/elfcap/elfcap.h +++ b/usr/src/common/elfcap/elfcap.h @@ -18,16 +18,15 @@ * * CDDL HEADER END */ + /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _ELFCAP_DOT_H #define _ELFCAP_DOT_H -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/types.h> #ifdef __cplusplus @@ -100,7 +99,7 @@ typedef enum { * # of each type of capability known to the system. These values * must be kept in sync with the arrays found in elfcap.c */ -#define ELFCAP_NUM_SF1 2 +#define ELFCAP_NUM_SF1 3 #define ELFCAP_NUM_HW1_SPARC 16 #define ELFCAP_NUM_HW1_386 25 diff --git a/usr/src/uts/common/sys/elf.h b/usr/src/uts/common/sys/elf.h index aef689a483..dda9173532 100644 --- a/usr/src/uts/common/sys/elf.h +++ b/usr/src/uts/common/sys/elf.h @@ -30,8 +30,6 @@ #ifndef _SYS_ELF_H #define _SYS_ELF_H -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/elftypes.h> #ifdef __cplusplus @@ -703,11 +701,10 @@ typedef struct { * Define software capabilities (CA_SUNW_SF_1 values). Note, hardware * capabilities (CA_SUNW_HW_1 values) are taken directly from sys/auxv_$MACH.h. */ -#define SF1_SUNW_FPKNWN 0x001 /* use/non-use of frame pointer is */ -#define SF1_SUNW_FPUSED 0x002 /* known, and frame pointer is */ - /* in use */ -#define SF1_SUNW_MASK 0x003 /* known software capabilities mask */ - +#define SF1_SUNW_FPKNWN 0x001 /* frame pointer usage is known */ +#define SF1_SUNW_FPUSED 0x002 /* frame pointer is in use */ +#define SF1_SUNW_ADDR32 0x004 /* 32-bit address space requirement */ +#define SF1_SUNW_MASK 0x007 /* known software capabilities mask */ /* * Known values for note entry types (e_type == ET_CORE) |
