History

Use configure to set note release bsd

Using uname in tccelf.c was not working when cross compiling. So move it to configure script.

herman ten brugge committed 1 year ago

Commit 03072a31 parent 8c3396a2 files · +12 −8Browse files

Unified · Split

2 files
  1. configure +10 −0
  2. tccelf.c +2 −8
configure+10−0
@@ -27,6 +27,7 @@ mandir="" · 26 unmodified lines
27infodir=""27infodir=""
28sysroot=""28sysroot=""
29cross_prefix=""29cross_prefix=""
30os_release=""
30cc="gcc"31cc="gcc"
31ar="ar"32ar="ar"
32bigendian="no"33bigendian="no"
@@ -123,6 +124,8 @@ for opt do · 90 unmodified lines
123 ;;124 ;;
124 --cross-prefix=*) assign_opt "$opt" cross_prefix125 --cross-prefix=*) assign_opt "$opt" cross_prefix
125 ;;126 ;;
127 --os-release=*) assign_opt "$opt" os_release
128 ;;
126 --cc=*) assign_opt "$opt"129 --cc=*) assign_opt "$opt"
127 ;;130 ;;
128 --ar=*) assign_opt "$opt" ; ar_set="yes"131 --ar=*) assign_opt "$opt" ; ar_set="yes"
@@ -232,6 +235,7 @@ Cross build options (experimental): · 103 unmodified lines
232 --cpu=CPU target CPU [$cpu]235 --cpu=CPU target CPU [$cpu]
233 --targetos=... target OS (Darwin,WIN32,Android/Termux) [$targetos]236 --targetos=... target OS (Darwin,WIN32,Android/Termux) [$targetos]
234 --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]237 --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]
238 --os-release=x.y.z use os release x.y.z [$os_release]
235EOF239EOF
236exit 1240exit 1
237}241}
@@ -290,6 +294,11 @@ then · 52 unmodified lines
290 ar="${cross_prefix}${ar}"294 ar="${cross_prefix}${ar}"
291fi295fi
292 296
297if test -z "$os_release"
298then
299 os_release=$(uname -r)
300fi
301
293case "$cpu" in302case "$cpu" in
294 x86|i386|i486|i586|i686|i86pc|BePC|i686-AT386)303 x86|i386|i486|i586|i686|i86pc|BePC|i686-AT386)
295 cpu="i386"304 cpu="i386"
@@ -704,6 +713,7 @@ print_str CONFIG_TCC_ELFINTERP "$tcc_elfinterp" · 408 unmodified lines
704print_str CONFIG_TCC_SWITCHES "$tcc_switches"713print_str CONFIG_TCC_SWITCHES "$tcc_switches"
705print_str CONFIG_LDDIR "$tcc_lddir"714print_str CONFIG_LDDIR "$tcc_lddir"
706print_str CONFIG_TRIPLET "$triplet"715print_str CONFIG_TRIPLET "$triplet"
716print_str CONFIG_OS_RELEASE "$os_release"
707echo "#endif" >> $TMPH && echo >> $TMPH717echo "#endif" >> $TMPH && echo >> $TMPH
708 718
709print_str CONFIG_SYSROOT "$sysroot" x719print_str CONFIG_SYSROOT "$sysroot" x
tccelf.c+2−8
@@ -2804,9 +2804,6 @@ static void create_arm_attribute_section(TCCState *s1) · 2803 unmodified lines
2804#endif2804#endif
2805 2805
2806#if TARGETOS_OpenBSD || TARGETOS_NetBSD || TARGETOS_FreeBSD2806#if TARGETOS_OpenBSD || TARGETOS_NetBSD || TARGETOS_FreeBSD
2807#ifndef _WIN32
2808#include <sys/utsname.h>
2809#endif
2810 2807
2811static void fill_bsd_note(Section *s, int type,2808static void fill_bsd_note(Section *s, int type,
2812 const char *value, uint32_t data)2809 const char *value, uint32_t data)
@@ -2839,12 +2836,9 @@ static Section *create_bsd_note_section(TCCState *s1, · 26 unmodified lines
2839{2836{
2840 Section *s;2837 Section *s;
2841 unsigned int major = 0, minor = 0, patch = 0;2838 unsigned int major = 0, minor = 0, patch = 0;
2842#ifndef _WIN32
2843 struct utsname uts;
2844 2839
2845/* Maybe move this to configure option for cross compiling */2840#ifdef CONFIG_OS_RELEASE
2846 if (!uname(&uts))2841 sscanf(CONFIG_OS_RELEASE, "%u.%u.%u", &major, &minor, &patch);
2847 sscanf(uts.release, "%u.%u.%u", &major, &minor, &patch);
2848#endif2842#endif
2849#if TARGETOS_FreeBSD2843#if TARGETOS_FreeBSD
2850 if (major < 14)2844 if (major < 14)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t