HEX
Server: LiteSpeed
System: Linux kapuas.iixcp.rumahweb.net 5.14.0-427.42.1.el9_4.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Nov 1 14:58:02 EDT 2024 x86_64
User: mirz4654 (1666)
PHP: 8.1.33
Disabled: system,exec,escapeshellarg,escapeshellcmd,passthru,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,popen,pclose,dl,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setsid,posix_setuid,posix_setpgid,ini_alter,show_source,define_syslog_variables,symlink,syslog,openlog,openlog,closelog,ocinumcols,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dll,ftp,myshellexec,socket_bind,mail,posix_getwpuid
Upload Files
File: //usr/lib/rpm/redhat/brp-llvm-compile-lto-elf
#!/usr/bin/bash -eu


if [ -z "$RPM_BUILD_ROOT" ] || [ "$RPM_BUILD_ROOT" = "/" ]; then
	exit 0
fi

CLANG_FLAGS=$@
NCPUS=${RPM_BUILD_NCPUS:-1}

check_convert_bitcode () {
  local file_name=$(realpath ${1})
  local file_type=$(file ${file_name})

  shift
  CLANG_FLAGS="$@"

  if [[ "${file_type}" == *"LLVM IR bitcode"* ]]; then
    # Check the output of llvm-strings for the command line, which is in the LLVM bitcode because
    # we pass -frecord-gcc-switches.
    # Check for a line that has "-flto" after (or without) "-fno-lto".
    llvm-strings ${file_name} | while read line ; do
      flto=$(echo $line   | grep -o -b -e -flto     | tail -n 1 | cut -d : -f 1)
      fnolto=$(echo $line | grep -o -b -e -fno-lto  | tail -n 1 | cut -d : -f 1)

      if test -n "$flto" && { test -z "$fnolto" || test "$flto" -gt "$fnolto"; } ; then
        echo "Compiling LLVM bitcode file ${file_name}."
        clang ${CLANG_FLAGS} -fno-lto -Wno-unused-command-line-argument \
          -x ir ${file_name} -c -o ${file_name}
        break
      fi
      done
  elif [[ "${file_type}" == *"current ar archive"* ]]; then
    echo "Unpacking ar archive ${file_name} to check for LLVM bitcode components."
    # create archive stage for objects
    local archive_stage=$(mktemp -d)
    local archive=${file_name}
    pushd ${archive_stage}
    ar x ${archive}
    for archived_file in $(find -not -type d); do
      check_convert_bitcode ${archived_file} ${CLANG_FLAGS}
      echo "Repacking ${archived_file} into ${archive}."
      ar r ${archive} ${archived_file}
    done
    popd
  fi
}

echo "Checking for LLVM bitcode artifacts"
export -f check_convert_bitcode
# Deduplicate by device:inode to avoid processing hardlinks in parallel.
find "$RPM_BUILD_ROOT" -type f -name "*.[ao]" -printf "%D:%i %p\n" | \
  awk '!seen[$1]++' | cut -d" " -f2- | \
  xargs -d"\n" -r -n1 -P$NCPUS sh -c "check_convert_bitcode \$@ $CLANG_FLAGS" ARG0