summaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorpk <pk@NetBSD.org>1994-08-13 08:42:33 +0000
committerpk <pk@NetBSD.org>1994-08-13 08:42:33 +0000
commit864ea66ef99f69eb7103173b6700bbbd2be075ee (patch)
tree51c9660243af462462ab3d472bc54892f5fcd02f /gnu
parent1e5c13e0088b716a4bf10bdb97fc3aee99117257 (diff)
Use new a.out flags.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/usr.bin/ld/ld.c26
-rw-r--r--gnu/usr.bin/ld/ld/ld.c26
-rw-r--r--gnu/usr.bin/ld/ldd/ldd.c11
3 files changed, 49 insertions, 14 deletions
diff --git a/gnu/usr.bin/ld/ld.c b/gnu/usr.bin/ld/ld.c
index c8768e6e83b..89605f908b9 100644
--- a/gnu/usr.bin/ld/ld.c
+++ b/gnu/usr.bin/ld/ld.c
@@ -32,7 +32,7 @@ static char sccsid[] = "@(#)ld.c 6.10 (Berkeley) 5/22/91";
Set, indirect, and warning symbol features added by Randy Smith. */
/*
- * $Id: ld.c,v 1.32 1994/07/23 08:40:45 pk Exp $
+ * $Id: ld.c,v 1.33 1994/08/13 08:42:33 pk Exp $
*/
/* Define how to initialize system-dependent header fields. */
@@ -1201,16 +1201,23 @@ read_file_symbols(entry)
if (N_IS_DYNAMIC(hdr) && !(entry->flags & E_JUST_SYMS)) {
if (relocatable_output) {
errx(1,
- "%s: -r and shared objects currently not supported ",
+ "%s: -r and shared objects currently not supported",
get_file_name(entry));
return;
}
+#if notyet /* Compatibility */
+ if (!(N_GETFLAG(hdr) & EX_PIC))
+ warnx("%s: EX_PIC not set",
+ get_file_name(entry));
+#endif
entry->flags |= E_DYNAMIC;
if (entry->superfile || rrs_add_shobj(entry))
read_shared_object(fd, entry);
else
entry->flags |= E_SCRAPPED;
} else {
+ if (N_GETFLAG(hdr) & EX_PIC)
+ pic_code_seen = 1;
read_entry_symbols(fd, entry);
entry->strings = (char *)alloca(entry->string_size);
read_entry_strings(fd, entry);
@@ -1908,7 +1915,7 @@ consider_relocation(entry, dataseg)
if (relocatable_output) {
lsp = &entry->symbols[reloc->r_symbolnum];
if (RELOC_BASEREL_P(reloc)) {
- pic_code_seen = 1;
+ pic_code_seen = 1; /* Compatibility */
if (!RELOC_EXTERN_P(reloc))
lsp->flags |= LS_RENAME;
}
@@ -2409,9 +2416,18 @@ static int nsyms;
void
write_header()
{
- int flags = (rrs_section_type == RRS_FULL) ? EX_DYNAMIC : 0;
+ int flags;
+
+ if (link_mode & SHAREABLE)
+ flags = EX_DYNAMIC | EX_PIC;
+ else if (pic_code_seen)
+ flags = EX_PIC;
+ else if (rrs_section_type == RRS_FULL)
+ flags = EX_DYNAMIC;
+ else
+ flags = 0;
- if (oldmagic && (flags & EX_DYNAMIC))
+ if (oldmagic && (flags & EX_DPMASK))
warnx("Cannot set flag in old magic headers\n");
N_SET_FLAG (outheader, flags);
diff --git a/gnu/usr.bin/ld/ld/ld.c b/gnu/usr.bin/ld/ld/ld.c
index c8768e6e83b..89605f908b9 100644
--- a/gnu/usr.bin/ld/ld/ld.c
+++ b/gnu/usr.bin/ld/ld/ld.c
@@ -32,7 +32,7 @@ static char sccsid[] = "@(#)ld.c 6.10 (Berkeley) 5/22/91";
Set, indirect, and warning symbol features added by Randy Smith. */
/*
- * $Id: ld.c,v 1.32 1994/07/23 08:40:45 pk Exp $
+ * $Id: ld.c,v 1.33 1994/08/13 08:42:33 pk Exp $
*/
/* Define how to initialize system-dependent header fields. */
@@ -1201,16 +1201,23 @@ read_file_symbols(entry)
if (N_IS_DYNAMIC(hdr) && !(entry->flags & E_JUST_SYMS)) {
if (relocatable_output) {
errx(1,
- "%s: -r and shared objects currently not supported ",
+ "%s: -r and shared objects currently not supported",
get_file_name(entry));
return;
}
+#if notyet /* Compatibility */
+ if (!(N_GETFLAG(hdr) & EX_PIC))
+ warnx("%s: EX_PIC not set",
+ get_file_name(entry));
+#endif
entry->flags |= E_DYNAMIC;
if (entry->superfile || rrs_add_shobj(entry))
read_shared_object(fd, entry);
else
entry->flags |= E_SCRAPPED;
} else {
+ if (N_GETFLAG(hdr) & EX_PIC)
+ pic_code_seen = 1;
read_entry_symbols(fd, entry);
entry->strings = (char *)alloca(entry->string_size);
read_entry_strings(fd, entry);
@@ -1908,7 +1915,7 @@ consider_relocation(entry, dataseg)
if (relocatable_output) {
lsp = &entry->symbols[reloc->r_symbolnum];
if (RELOC_BASEREL_P(reloc)) {
- pic_code_seen = 1;
+ pic_code_seen = 1; /* Compatibility */
if (!RELOC_EXTERN_P(reloc))
lsp->flags |= LS_RENAME;
}
@@ -2409,9 +2416,18 @@ static int nsyms;
void
write_header()
{
- int flags = (rrs_section_type == RRS_FULL) ? EX_DYNAMIC : 0;
+ int flags;
+
+ if (link_mode & SHAREABLE)
+ flags = EX_DYNAMIC | EX_PIC;
+ else if (pic_code_seen)
+ flags = EX_PIC;
+ else if (rrs_section_type == RRS_FULL)
+ flags = EX_DYNAMIC;
+ else
+ flags = 0;
- if (oldmagic && (flags & EX_DYNAMIC))
+ if (oldmagic && (flags & EX_DPMASK))
warnx("Cannot set flag in old magic headers\n");
N_SET_FLAG (outheader, flags);
diff --git a/gnu/usr.bin/ld/ldd/ldd.c b/gnu/usr.bin/ld/ldd/ldd.c
index 084780f9252..560e1a9e320 100644
--- a/gnu/usr.bin/ld/ldd/ldd.c
+++ b/gnu/usr.bin/ld/ldd/ldd.c
@@ -27,7 +27,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: ldd.c,v 1.8 1994/06/10 15:17:02 pk Exp $
+ * $Id: ldd.c,v 1.9 1994/08/13 08:42:44 pk Exp $
*/
#include <sys/types.h>
@@ -91,9 +91,12 @@ char *argv[];
argv++;
continue;
}
- if (read(fd, &hdr, sizeof hdr) != sizeof hdr ||
- !(N_GETFLAG(hdr) & EX_DYNAMIC) ||
- hdr.a_entry < __LDPGSZ) {
+ if (read(fd, &hdr, sizeof hdr) != sizeof hdr
+ || (N_GETFLAG(hdr) & EX_DPMASK) != EX_DYNAMIC
+#if 1 /* Compatibility */
+ || hdr.a_entry < __LDPGSZ
+#endif
+ ) {
warnx("%s: not a dynamic executable", *argv);
(void)close(fd);