diff options
author | dg <dg@FreeBSD.org> | 1994-01-03 18:35:54 +0000 |
---|---|---|
committer | dg <dg@FreeBSD.org> | 1994-01-03 18:35:54 +0000 |
commit | d44d2d472f3e1b740ef13daa56c5fe596ac8ae65 (patch) | |
tree | 843f2ac107662b253aa7c4a7f07018e0e2daae40 /gnu/usr.bin/ld | |
parent | 787505bcb71fbac392206277fb94309536adee8e (diff) | |
download | FreeBSD-src-d44d2d472f3e1b740ef13daa56c5fe596ac8ae65.zip FreeBSD-src-d44d2d472f3e1b740ef13daa56c5fe596ac8ae65.tar.gz |
Implemented 'QMAGIC' a.out format correctly, and changed the default
output to be QMAGIC.
Diffstat (limited to 'gnu/usr.bin/ld')
-rw-r--r-- | gnu/usr.bin/ld/i386/md.c | 16 | ||||
-rw-r--r-- | gnu/usr.bin/ld/i386/md.h | 15 | ||||
-rw-r--r-- | gnu/usr.bin/ld/ld.c | 19 | ||||
-rw-r--r-- | gnu/usr.bin/ld/ld.h | 8 | ||||
-rw-r--r-- | gnu/usr.bin/ld/rtld/Makefile | 4 |
5 files changed, 34 insertions, 28 deletions
diff --git a/gnu/usr.bin/ld/i386/md.c b/gnu/usr.bin/ld/i386/md.c index 40766df..02fda41 100644 --- a/gnu/usr.bin/ld/i386/md.c +++ b/gnu/usr.bin/ld/i386/md.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: md.c,v 1.4 1993/11/22 19:05:23 jkh Exp $ + * $Id: md.c,v 1.6 1993/12/02 01:03:04 jkh Exp $ */ #include <sys/param.h> @@ -41,6 +41,8 @@ #include "ld.h" +int netzmagic = 0; + /* * Get relocation addend corresponding to relocation record RP * from address ADDR @@ -96,10 +98,14 @@ md_init_header(hp, magic, flags) struct exec *hp; int magic, flags; { - if (oldmagic) - hp->a_midmag = oldmagic; - else - N_SETMAGIC((*hp), magic, MID_I386, flags); + if (!netzmagic && (magic == ZMAGIC) && !(link_mode & DYNAMIC)) { + hp->a_midmag = magic; + } else { + if (netzmagic) + N_SETMAGIC_NET((*hp), magic, MID_I386, flags); + else + N_SETMAGIC((*hp), magic, MID_I386, flags); + } /* TEXT_START depends on the value of outheader.a_entry. */ if (!(link_mode & SHAREABLE)) /*WAS: if (entry_symbol) */ diff --git a/gnu/usr.bin/ld/i386/md.h b/gnu/usr.bin/ld/i386/md.h index 285b0e6..c7271b3 100644 --- a/gnu/usr.bin/ld/i386/md.h +++ b/gnu/usr.bin/ld/i386/md.h @@ -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: md.h,v 1.5 1993/12/08 10:14:48 pk Exp $ + * $Id: md.h,v 1.6 1993/12/11 12:02:05 jkh Exp $ */ @@ -45,10 +45,15 @@ #define PAGSIZ 4096 #endif -#define N_SET_FLAG(ex,f) N_SETMAGIC(ex,N_GETMAGIC(ex), MID_MACHINE, \ - N_GETFLAG(ex)|(f)) - -#define N_IS_DYNAMIC(ex) ((N_GETFLAG(ex) & EX_DYNAMIC)) +#define N_SET_FLAG(ex,f) (netzmagic ? \ + N_SETMAGIC_NET(ex,N_GETMAGIC_NET(ex), MID_MACHINE, \ + N_GETFLAG_NET(ex)|(f)) : \ + N_SETMAGIC(ex,N_GETMAGIC(ex), MID_MACHINE, \ + N_GETFLAG(ex)|(f))) + +#define N_IS_DYNAMIC(ex) ((N_GETMAGIC_NET(ex) == ZMAGIC) ? \ + ((N_GETFLAG_NET(ex) & EX_DYNAMIC)) : \ + ((N_GETFLAG(ex) & EX_DYNAMIC))) /* * Should be handled by a.out.h ? diff --git a/gnu/usr.bin/ld/ld.c b/gnu/usr.bin/ld/ld.c index a11cd22..18af1c4 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.16 1993/12/11 11:58:24 jkh Exp $ + * $Id: ld.c,v 1.17 1993/12/22 23:28:08 jkh Exp $ */ /* Define how to initialize system-dependent header fields. */ @@ -585,14 +585,13 @@ decode_option(swt, arg) return; #endif -#ifdef QMAGIC case 'Q': - magic = oldmagic = QMAGIC; + magic = QMAGIC; return; case 'Z': - magic = oldmagic = ZMAGIC; + magic = ZMAGIC; + netzmagic = 1; return; -#endif case 'o': output_filename = arg; @@ -658,7 +657,7 @@ decode_option(swt, arg) return; case 'z': - oldmagic = magic = ZMAGIC; + magic = ZMAGIC; return; default: @@ -1438,7 +1437,7 @@ digest_symbols () * the padding in the text segment size. */ - if (magic == ZMAGIC || page_align_data) { + if (magic == ZMAGIC || magic == QMAGIC || page_align_data) { int text_end = text_size + N_TXTOFF(outheader); text_pad = PALIGN(text_end, page_size) - text_end; text_size += text_pad; @@ -1491,7 +1490,7 @@ printf("bssstart = %#x, bsssize = %#x\n", if (specified_data_size && specified_data_size > data_size) data_pad = specified_data_size - data_size; - if (magic == ZMAGIC) + if (magic == ZMAGIC || magic == QMAGIC) data_pad = PALIGN(data_pad + data_size, page_size) - data_size; bss_size -= data_pad; @@ -2177,9 +2176,7 @@ write_header () { int flags = (rrs_section_type == RRS_FULL) ? EX_DYNAMIC : 0; -#ifdef QMAGIC - if (!oldmagic) -#endif + if (netzmagic || magic == QMAGIC || (link_mode & DYNAMIC)) N_SET_FLAG (outheader, flags); outheader.a_text = text_size; diff --git a/gnu/usr.bin/ld/ld.h b/gnu/usr.bin/ld/ld.h index 081734e..1cee37a 100644 --- a/gnu/usr.bin/ld/ld.h +++ b/gnu/usr.bin/ld/ld.h @@ -1,4 +1,4 @@ -/* $Id: ld.h,v 1.7 1993/12/04 00:52:58 jkh Exp $ */ +/* $Id: ld.h,v 1.8 1993/12/11 11:58:26 jkh Exp $ */ /*- * This code is derived from software copyrighted by the Free Software * Foundation. @@ -54,12 +54,10 @@ char *progname; /* Define this to specify the default executable format. */ #ifndef DEFAULT_MAGIC -#define DEFAULT_MAGIC ZMAGIC +#define DEFAULT_MAGIC QMAGIC #endif -#ifdef QMAGIC -int oldmagic; -#endif +extern netzmagic; /* diff --git a/gnu/usr.bin/ld/rtld/Makefile b/gnu/usr.bin/ld/rtld/Makefile index 09277ba..1a76c51 100644 --- a/gnu/usr.bin/ld/rtld/Makefile +++ b/gnu/usr.bin/ld/rtld/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.6 1993/11/25 01:06:42 jkh Exp $ +# $Id: Makefile,v 1.7 1993/12/11 21:05:59 jkh Exp $ PROG= ld.so SRCS= mdprologue.S sbrk.c rtld.c shlib.c etc.c md.c @@ -7,7 +7,7 @@ LDDIR?= $(.CURDIR)/.. #PICFLAG=-pic PICFLAG=-fpic CFLAGS += -I$(LDDIR) -I$(.CURDIR) -I$(LDDIR)/$(MACHINE) -O $(PICFLAG) -DRTLD -LDFLAGS = -Bshareable -Bsymbolic -assert nosymbolic +LDFLAGS = -Bshareable -Bsymbolic -assert nosymbolic -Z LIBS = -lc_pic -lgcc_pic BINDIR= /usr/libexec ASFLAGS = -k |