Commits

Anonymous committed 0f2c1a1

Added (1) the ability to compile in 32-bit mode, and (2) the ability to run the compile under opensuse

Comments (0)

Files changed (2)

bash/compile_files.sh

 
 char *files[FILES_NUM] = {
  "/etc/ld.so.cache",
+#ifdef __x86_64__
  "/usr/lib/x86_64-linux-gnu/libstdc++.so.6",
  "/lib/x86_64-linux-gnu/libgcc_s.so.1",
  "/lib/x86_64-linux-gnu/libc.so.6",
  "/lib/x86_64-linux-gnu/libm.so.6",
- 0, 0, 0, 0, 0
+ "/usr/lib64/libstdc++.so.6", 
+ "/lib64/libm.so.6", 
+ "/lib64/libgcc_s.so.1", 
+ "/lib64/libc.so.6", 0
+#else
+ "/lib/i686-linux-gnu/libgcc_s.so.1",
+ "/lib/i686-linux-gnu/libc.so.6",
+ "/lib/i686-linux-gnu/libm.so.6",
+ "/usr/lib/i686-linux-gnu/libstdc++.so.6",
+ "/usr/lib/libstdc++.so.6",
+ "/lib/libc.so.6",
+ "/lib/libgcc_s.so.1",
+ "/lib/libm.so.6",
+ 0
+#endif
 };
 
 char *prefixed[FILES_NUM] = {
     BLOCK_SYSCALL(__NR_rt_sigprocmask);
     BLOCK_SYSCALL(__NR_rt_sigreturn);
     BLOCK_SYSCALL(__NR_ioctl);
+#ifdef __x86_64__
     BLOCK_SYSCALL(__NR_shmget);
     BLOCK_SYSCALL(__NR_shmat);
     BLOCK_SYSCALL(__NR_shmctl);
-    BLOCK_SYSCALL(__NR_setitimer);
     BLOCK_SYSCALL(__NR_socket);
-    BLOCK_SYSCALL(__NR_sendfile);
     BLOCK_SYSCALL(__NR_semget);
+#endif
+    BLOCK_SYSCALL(__NR_setitimer);
+    BLOCK_SYSCALL(__NR_sendfile);
     BLOCK_SYSCALL(__NR_creat);
     BLOCK_SYSCALL(__NR_rmdir);
     BLOCK_SYSCALL(__NR_link);

bash/handler_callbacks

 
   source compile_files.sh
 
+  local BITS32=""
+
+  [ "$1" == "-32" ] && BITS32="-m32" && shift
+  
+
   COMPILE_TEXT=$(/bin/echo "$*" | $SED_BIN 's@\(#include[\r\n\t ]*<[a-zA-Z0-9\.]*>\)@\1\n@g')
   HASMAIN=$(/bin/echo "${COMPILE_TEXT}" | $GREP_BIN -w -E "main")
   USESRETURN=$(/bin/echo "${COMPILE_TEXT}" | $GREP_BIN -o "return[\t\n\r ]*[a-zA-Z0-9]*[\t\n\r ]*;[\t\n\r ]*}$")
     $(echo "}" >> ${COUTFILE}.cc)
   fi
 
-  ERRORS=$($CXX ${GCC_FLAGS} -Dmain="APP_TMP_MAIN_main" -c -o ${OOUTFILE}.o ${COUTFILE}.cc 2>&1)
+  ERRORS=$($CXX ${GCC_FLAGS} ${BITS32} -Dmain="APP_TMP_MAIN_main" -c -o ${OOUTFILE}.o ${COUTFILE}.cc 2>&1)
 
   if [ "$ERRORS" ]; then
     BADSTUFF=$(echo "$ERRORS" | $GREP_BIN -o -E -m 1 "(warning\:|error\:).*" )
 
   write_ptrace_watcher ${COUTFILE}
 
-  ERRORS=$($CXX -fpermissive -w -o $AOUTFILE ${COUTFILE}.cc ${OOUTFILE}.o 2>&1 )
+  ERRORS=$($CXX ${BITS32} -fpermissive -w -o $AOUTFILE ${COUTFILE}.cc ${OOUTFILE}.o 2>&1 )
   if [ "$ERRORS" -a $? -eq 1 ]; then
     BADSTUFF=$(echo "$ERRORS" | $GREP_BIN -E -m 1 "(warning\:|error\:|undefined).*" )
 
     message_post $RESPONSE "precomp: ${BADSTUFF}"
+
+    debug "precomp: ${ERRORS}"
+
     $RM_BIN -f $AOUTFILE $WARNFIL $OOUTFILE $COUTFILE ${COUTFILE}.cc ${OOUTFILE}.o
 
     return