mirror of
https://github.com/TinyCC/tinycc.git
synced 2025-11-16 04:24:45 +00:00
Use configure to set note release bsd
Using uname in tccelf.c was not working when cross compiling. So move it to configure script.
This commit is contained in:
10
configure
vendored
10
configure
vendored
@@ -27,6 +27,7 @@ mandir=""
|
||||
infodir=""
|
||||
sysroot=""
|
||||
cross_prefix=""
|
||||
os_release=""
|
||||
cc="gcc"
|
||||
ar="ar"
|
||||
bigendian="no"
|
||||
@@ -123,6 +124,8 @@ for opt do
|
||||
;;
|
||||
--cross-prefix=*) assign_opt "$opt" cross_prefix
|
||||
;;
|
||||
--os-release=*) assign_opt "$opt" os_release
|
||||
;;
|
||||
--cc=*) assign_opt "$opt"
|
||||
;;
|
||||
--ar=*) assign_opt "$opt" ; ar_set="yes"
|
||||
@@ -232,6 +235,7 @@ Cross build options (experimental):
|
||||
--cpu=CPU target CPU [$cpu]
|
||||
--targetos=... target OS (Darwin,WIN32,Android/Termux) [$targetos]
|
||||
--cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]
|
||||
--os-release=x.y.z use os release x.y.z [$os_release]
|
||||
EOF
|
||||
exit 1
|
||||
}
|
||||
@@ -290,6 +294,11 @@ then
|
||||
ar="${cross_prefix}${ar}"
|
||||
fi
|
||||
|
||||
if test -z "$os_release"
|
||||
then
|
||||
os_release=$(uname -r)
|
||||
fi
|
||||
|
||||
case "$cpu" in
|
||||
x86|i386|i486|i586|i686|i86pc|BePC|i686-AT386)
|
||||
cpu="i386"
|
||||
@@ -704,6 +713,7 @@ print_str CONFIG_TCC_ELFINTERP "$tcc_elfinterp"
|
||||
print_str CONFIG_TCC_SWITCHES "$tcc_switches"
|
||||
print_str CONFIG_LDDIR "$tcc_lddir"
|
||||
print_str CONFIG_TRIPLET "$triplet"
|
||||
print_str CONFIG_OS_RELEASE "$os_release"
|
||||
echo "#endif" >> $TMPH && echo >> $TMPH
|
||||
|
||||
print_str CONFIG_SYSROOT "$sysroot" x
|
||||
|
||||
10
tccelf.c
10
tccelf.c
@@ -2804,9 +2804,6 @@ static void create_arm_attribute_section(TCCState *s1)
|
||||
#endif
|
||||
|
||||
#if TARGETOS_OpenBSD || TARGETOS_NetBSD || TARGETOS_FreeBSD
|
||||
#ifndef _WIN32
|
||||
#include <sys/utsname.h>
|
||||
#endif
|
||||
|
||||
static void fill_bsd_note(Section *s, int type,
|
||||
const char *value, uint32_t data)
|
||||
@@ -2839,12 +2836,9 @@ static Section *create_bsd_note_section(TCCState *s1,
|
||||
{
|
||||
Section *s;
|
||||
unsigned int major = 0, minor = 0, patch = 0;
|
||||
#ifndef _WIN32
|
||||
struct utsname uts;
|
||||
|
||||
/* Maybe move this to configure option for cross compiling */
|
||||
if (!uname(&uts))
|
||||
sscanf(uts.release, "%u.%u.%u", &major, &minor, &patch);
|
||||
#ifdef CONFIG_OS_RELEASE
|
||||
sscanf(CONFIG_OS_RELEASE, "%u.%u.%u", &major, &minor, &patch);
|
||||
#endif
|
||||
#if TARGETOS_FreeBSD
|
||||
if (major < 14)
|
||||
|
||||
Reference in New Issue
Block a user