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
2727 infodir=""
2828 sysroot=""
2929 cross_prefix=""
30+os_release=""
3031 cc="gcc"
3132 ar="ar"
3233 bigendian="no"
@@ -123,6 +124,8 @@ for opt do · 90 unmodified lines
123124 ;;
124125 --cross-prefix=*) assign_opt "$opt" cross_prefix
125126 ;;
127+ --os-release=*) assign_opt "$opt" os_release
128+ ;;
126129 --cc=*) assign_opt "$opt"
127130 ;;
128131 --ar=*) assign_opt "$opt" ; ar_set="yes"
@@ -232,6 +235,7 @@ Cross build options (experimental): · 103 unmodified lines
232235 --cpu=CPU target CPU [$cpu]
233236 --targetos=... target OS (Darwin,WIN32,Android/Termux) [$targetos]
234237 --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]
238+ --os-release=x.y.z use os release x.y.z [$os_release]
235239 EOF
236240 exit 1
237241 }
@@ -290,6 +294,11 @@ then · 52 unmodified lines
290294 ar="${cross_prefix}${ar}"
291295 fi
292296
297+if test -z "$os_release"
298+then
299+ os_release=$(uname -r)
300+fi
301+
293302 case "$cpu" in
294303 x86|i386|i486|i586|i686|i86pc|BePC|i686-AT386)
295304 cpu="i386"
@@ -704,6 +713,7 @@ print_str CONFIG_TCC_ELFINTERP "$tcc_elfinterp" · 408 unmodified lines
704713 print_str CONFIG_TCC_SWITCHES "$tcc_switches"
705714 print_str CONFIG_LDDIR "$tcc_lddir"
706715 print_str CONFIG_TRIPLET "$triplet"
716+print_str CONFIG_OS_RELEASE "$os_release"
707717 echo "#endif" >> $TMPH && echo >> $TMPH
708718
709719 print_str CONFIG_SYSROOT "$sysroot" x
tccelf.c+2−8
@@ -2804,9 +2804,6 @@ static void create_arm_attribute_section(TCCState *s1) · 2803 unmodified lines
28042804 #endif
28052805
28062806 #if TARGETOS_OpenBSD || TARGETOS_NetBSD || TARGETOS_FreeBSD
2807−#ifndef _WIN32
2808−#include <sys/utsname.h>
2809−#endif
28102807
28112808 static void fill_bsd_note(Section *s, int type,
28122809 const char *value, uint32_t data)
@@ -2839,12 +2836,9 @@ static Section *create_bsd_note_section(TCCState *s1, · 26 unmodified lines
28392836 {
28402837 Section *s;
28412838 unsigned int major = 0, minor = 0, patch = 0;
2842−#ifndef _WIN32
2843− struct utsname uts;
28442839
2845−/* Maybe move this to configure option for cross compiling */
2846− if (!uname(&uts))
2847− sscanf(uts.release, "%u.%u.%u", &major, &minor, &patch);
2840+#ifdef CONFIG_OS_RELEASE
2841+ sscanf(CONFIG_OS_RELEASE, "%u.%u.%u", &major, &minor, &patch);
28482842 #endif
28492843 #if TARGETOS_FreeBSD
28502844 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