(export '(*compile-print* *compile-verbose*))
-(import 'si::*tmp-dir* 'compiler)
+(import 'si::(*tmp-dir* *cc* *ld* *objdump*))
(import 'si::*error-p* 'compiler)
;;; This had been true with Linux 1.2.13 a.out or even older
(code result) (system (mysub (ts string) "$" "\\$"))
(unless (and (zerop code) (zerop result))
(cerror "Continues anyway."
- "(SYSTEM ~S) returned a non-zero value ~D."
- string
- result)
+ "(SYSTEM ~S) returned a non-zero value ~D ~D."
+ string code result)
(setq *error-p* t))
(values result)))
(si::copy-stream st *standard-output*))
(with-open-file (st hn)
(si::copy-stream st *standard-output*))
- (when (zerop (system "which objdump >/dev/null"))
- (safe-system (si::string-concatenate "objdump --source " (namestring on))))
+ (when (eql (aref *objdump* 0) #\/);program found at startup in path
+ (safe-system (si::string-concatenate *objdump* (namestring on))))
(mdelete-file cn)
(mdelete-file dn)
(mdelete-file hn)
(terpri *compiler-output2*)))))
-(defvar *cc* "cc")
-(defvar *ld* "ld")
(defvar *ld-libs* "ld-libs")
(defvar *opt-three* "")
(defvar *opt-two* "")
(setq na (namestring
(make-pathname :name name :type (pathname-type(first args)))))
#+(or dos winnt)
- (format nil "~a -I~a ~a ~a -c -w ~s -o ~s"
+ (format nil "~a -I~a ~a ~a -c -w ~a -o ~a"
*cc*
(concatenate 'string si::*system-directory* "../h")
(if (and (boundp '*c-debug*) *c-debug*) " -g " "")
)
#-(or dos winnt)
- (format nil "~a -I~a ~a ~a -c ~s -o ~s ~a"
+ (format nil "~a -I~a ~a ~a -c ~a -o ~a ~a"
*cc*
(concatenate 'string si::*system-directory* "../h")
(if (and (boundp '*c-debug*) *c-debug*) " -g " "")
(*(a_))->address=p->st_value; \
break; \
}}})
+
+#undef LOAD_SYM_BY_NAME
+#define LOAD_SYM_BY_NAME(sym,st1) (!strncmp(st1+sym->st_name,"__moddi3",8))
#define prof_block(x) x
#endif
-#define psystem(x) prof_block(system(x))
+#define psystem(x) prof_block(vsystem(x))
#define pfork() prof_block(fork())
#include "error.h"
:device (pathname-device x)
:directory (append (pathname-directory x) y)))))))))
+(defun get-path (s &aux (m (string-match "([^/ ]*)( |$)" s))(b (match-beginning 1))(e (match-end 1))
+ (r (with-open-file (s (concatenate 'string "|which " (subseq s b e))) (read s nil 'eof))))
+ (if (eq r 'eof) s (concatenate 'string (string-downcase r) (subseq s e))))
+
+
+(defvar *cc* "cc")
+(defvar *ld* "ld")
+(defvar *objdump* "objdump --source ")
+
(defun set-up-top-level (&aux (i (argc)) tem)
(declare (fixnum i))
- (setq *tmp-dir* (get-temp-dir))
+ (setq *tmp-dir* (get-temp-dir)
+ *cc* (get-path *cc*)
+ *ld* (get-path *ld*)
+ *objdump* (get-path *objdump*))
(dotimes (j i) (push (argv j) tem))
(setq *command-args* (nreverse tem))
(setq tem *lib-directory*)
else
fclose(strm->sm.sm_fp);
strm->sm.sm_fp = NULL;
- if (type_of(strm->sm.sm_object0 ) == t_cons &&
+ if (strm->sm.sm_object0 &&
+ type_of(strm->sm.sm_object0 ) == t_cons &&
Mcar(strm->sm.sm_object0 ) == sSAallow_gzipped_fileA)
fLdelete_file(Mcdr(strm->sm.sm_object0));
break;
stream_in->sm.sm_buffer = 0;
stream_in->sm.sm_int0 = sockets_in[1];
stream_in->sm.sm_int1 = 0;
+ stream_in->sm.sm_object0=stream_in->sm.sm_object1=OBJNULL;
stream_out = (object) alloc_object(t_stream);
stream_out->sm.sm_mode = smm_output;
stream_out->sm.sm_fp = fp2;
setup_stream_buffer(stream_out);
stream_out->sm.sm_int0 = sockets_out[1];
stream_out->sm.sm_int1 = 0;
+ stream_out->sm.sm_object0=stream_out->sm.sm_object1=OBJNULL;
stream = make_two_way_stream(stream_in, stream_out);
return(stream);
}
#define ulmax(a_,b_) ({ul _a=a_,_b=b_;_a<_b ? _b : _a;})
#define ALLOC_SEC(sec) (sec->sh_flags&SHF_ALLOC && (sec->sh_type==SHT_PROGBITS || sec->sh_type==SHT_NOBITS))
-#define LOAD_SEC(sec) (sec->sh_flags&SHF_ALLOC && sec->sh_type==SHT_PROGBITS)
-#define LOAD_SYM(sym) ({ul _b=ELF_ST_BIND(sym->st_info),_t=ELF_ST_TYPE(sym->st_info); \
- sym->st_value && (_b==STB_GLOBAL || _b==STB_WEAK || (_t>=STT_LOPROC && _t<=STT_HIPROC));})
+#define LOAD_SEC(sec) (sec->sh_flags&SHF_ALLOC && sec->sh_type==SHT_PROGBITS)
+#define LOAD_SYM_BY_BIND(sym) ({ul _b=ELF_ST_BIND(sym->st_info); sym->st_value && (_b==STB_GLOBAL || _b==STB_WEAK);})
+#define LOAD_SYM_BY_NAME(sym,st1) 0
+#define LOAD_SYM(sym,st1) (LOAD_SYM_BY_BIND(sym)||LOAD_SYM_BY_NAME(sym,st1))
#define MASK(n) (~(~0ULL << (n)))
for (sym=sym1;sym<syme;sym++) {
- if (!LOAD_SYM(sym))
+ if (!LOAD_SYM(sym,st1))
continue;
if (d1) {
for (sym=sym1;sym<syme;sym++) {
- if (!LOAD_SYM(sym))
+ if (!LOAD_SYM(sym,st1))
continue;
if (d1) {
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
-
+#include <sys/wait.h>
#include "include.h"
+int
+vsystem(const char *command) {
+
+ unsigned j,n=strlen(command);
+ char *z=alloca(n+1),**p1,**pp,*c;
+ int s;
+ pid_t pid;
+
+ memcpy(z,command,n+1);
+ for (j=0,c=z;strtok(c," \n\t");c=NULL,j++);
+
+ memcpy(z,command,n+1);
+ p1=alloca((j+1)*sizeof(*p1));
+ for (pp=p1,c=z;(*pp=strtok(c," \n\t"));c=NULL,pp++);
+
+ if (!(pid=vfork())) {
+ execvp(*p1,p1);
+ _exit(2);
+ }
+
+ massert(pid>0);
+ massert(pid==waitpid(pid,&s,0));
+
+ return s;
+
+}
+
+
#ifdef ATT3B2
#include <signal.h>
int