mirror of
				https://github.com/jart/cosmopolitan.git
				synced 2025-10-27 19:34:33 +00:00 
			
		
		
		
	This is a recently introduced Linux Kernel feature that gives people
like Debian package mantainers the power to arbitrarily redefine how
executables are interpreted by the kernel. If your system gets tuned
this way and you're not able to disable it, then you need to restore
default behavior for the APE MZqFpD prefix as follows:
    sudo sh -c "echo ':APE:M::MZqFpD::/bin/sh:' >/proc/sys/fs/binfmt_misc/register"
This prefix will cover all .com executables built with this tooling.
Please don't run the above command unless you're certain you need it.
See #2 for additional context.
		
	
			
		
			
				
	
	
		
			39 lines
		
	
	
	
		
			1.1 KiB
		
	
	
	
		
			Bash
		
	
	
		
			Executable file
		
	
	
	
	
			
		
		
	
	
			39 lines
		
	
	
	
		
			1.1 KiB
		
	
	
	
		
			Bash
		
	
	
		
			Executable file
		
	
	
	
	
| #!/bin/sh
 | |
| #-*-mode:sh;indent-tabs-mode:nil;tab-width:2;coding:utf-8-*-┐
 | |
| #───vi: set net ft=sh ts=2 sts=2 fenc=utf-8 :vi─────────────┘
 | |
| #
 | |
| # OVERVIEW
 | |
| #
 | |
| #   Compiler Version Discovery
 | |
| #
 | |
| # DESCRIPTION
 | |
| #
 | |
| #   Cosmopolitan itself may be built using either GCC and Clang, and our
 | |
| #   build irons out many of the differences between the two. This script
 | |
| #   is used by build/definitions.mk alongside build/getccname to support
 | |
| #   the different versions folks use.
 | |
| #
 | |
| #   Our aim is to support GCC 4.2.1+ since that's the last GPLv2 version
 | |
| #   with any sort of industry consensus. Please note, Cosmopolitan never
 | |
| #   links GCC runtimes when using later versions, so some concerns might
 | |
| #   not apply.
 | |
| 
 | |
| if [ ! -d o/third_party/gcc ]; then
 | |
|   third_party/gcc/unbundle.sh
 | |
| fi
 | |
| 
 | |
| set -e
 | |
| 
 | |
| MAJOR_VERSION=$(
 | |
|   $1 --version |
 | |
|     head -n1 |
 | |
|     sed -n '
 | |
|         s!^[^(]*([^)]*) \([[:digit:]][[:digit:]]*\).*!\1!p
 | |
|         s!^.*clang.*version \([[:digit:]][[:digit:]]*\).*!\1!p
 | |
|       ')
 | |
| 
 | |
| if [ -z "$MAJOR_VERSION" ]; then
 | |
|   echo 6
 | |
| else
 | |
|   printf '%s\n' "$MAJOR_VERSION"
 | |
| fi
 |