mirror of
https://github.com/MiyooCFW/buildroot.git
synced 2025-09-27 22:24:19 +03:00
create rootf's & SDK from 2018.02.9 buildroot (#10)
--------- Co-authored-by: tiopex <tiopxyz@gmail.com> Co-authored-by: tiopex <67048640+tiopex@users.noreply.github.com>
This commit is contained in:
@@ -49,12 +49,8 @@ static char _date_[sizeof("-D__DATE__=\"MMM DD YYYY\"")];
|
||||
* -D__TIME__=
|
||||
* -D__DATE__=
|
||||
* -Wno-builtin-macro-redefined
|
||||
* -Wl,-z,now
|
||||
* -Wl,-z,relro
|
||||
* -fPIE
|
||||
* -pie
|
||||
*/
|
||||
#define EXCLUSIVE_ARGS 10
|
||||
#define EXCLUSIVE_ARGS 6
|
||||
|
||||
static char *predef_args[] = {
|
||||
#ifdef BR_CCACHE
|
||||
@@ -129,8 +125,6 @@ static const struct str_len_s unsafe_paths[] = {
|
||||
STR_LEN(/usr/lib),
|
||||
STR_LEN(/usr/local/include),
|
||||
STR_LEN(/usr/local/lib),
|
||||
STR_LEN(/usr/X11R6/include),
|
||||
STR_LEN(/usr/X11R6/lib),
|
||||
{ NULL, 0 },
|
||||
};
|
||||
|
||||
@@ -179,7 +173,6 @@ static void check_unsafe_path(const char *arg,
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef BR_NEED_SOURCE_DATE_EPOCH
|
||||
/* Returns false if SOURCE_DATE_EPOCH was not defined in the environment.
|
||||
*
|
||||
* Returns true if SOURCE_DATE_EPOCH is in the environment and represent
|
||||
@@ -233,15 +226,6 @@ bool parse_source_date_epoch_from_env(void)
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#else
|
||||
bool parse_source_date_epoch_from_env(void)
|
||||
{
|
||||
/* The compiler is recent enough to handle SOURCE_DATE_EPOCH itself
|
||||
* so we do not need to do anything here.
|
||||
*/
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
@@ -252,24 +236,7 @@ int main(int argc, char **argv)
|
||||
char *env_debug;
|
||||
char *paranoid_wrapper;
|
||||
int paranoid;
|
||||
int ret, i, count = 0, debug = 0, found_shared = 0;
|
||||
|
||||
/* Debug the wrapper to see arguments it was called with.
|
||||
* If environment variable BR2_DEBUG_WRAPPER is:
|
||||
* unset, empty, or 0: do not trace
|
||||
* set to 1 : trace all arguments on a single line
|
||||
* set to 2 : trace one argument per line
|
||||
*/
|
||||
if ((env_debug = getenv("BR2_DEBUG_WRAPPER"))) {
|
||||
debug = atoi(env_debug);
|
||||
}
|
||||
if (debug > 0) {
|
||||
fprintf(stderr, "Toolchain wrapper was called with:");
|
||||
for (i = 0; i < argc; i++)
|
||||
fprintf(stderr, "%s'%s'",
|
||||
(debug == 2) ? "\n " : " ", argv[i]);
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
int ret, i, count = 0, debug;
|
||||
|
||||
/* Calculate the relative paths */
|
||||
basename = strrchr(progpath, '/');
|
||||
@@ -396,80 +363,6 @@ int main(int argc, char **argv)
|
||||
*cur++ = "-Wno-builtin-macro-redefined";
|
||||
}
|
||||
|
||||
#ifdef BR2_PIC_PIE
|
||||
/* Patterned after Fedora/Gentoo hardening approaches.
|
||||
* https://fedoraproject.org/wiki/Changes/Harden_All_Packages
|
||||
* https://wiki.gentoo.org/wiki/Hardened/Toolchain#Position_Independent_Executables_.28PIEs.29
|
||||
*
|
||||
* A few checks are added to allow disabling of PIE
|
||||
* 1) -fno-pie and -no-pie are used by other distros to disable PIE in
|
||||
* cases where the compiler enables it by default. The logic below
|
||||
* maintains that behavior.
|
||||
* Ref: https://wiki.ubuntu.com/SecurityTeam/PIE
|
||||
* 2) A check for -fno-PIE has been used in older Linux Kernel builds
|
||||
* in a similar way to -fno-pie or -no-pie.
|
||||
* 3) A check is added for Kernel and U-boot defines
|
||||
* (-D__KERNEL__ and -D__UBOOT__).
|
||||
*/
|
||||
for (i = 1; i < argc; i++) {
|
||||
/* Apply all incompatible link flag and disable checks first */
|
||||
if (!strcmp(argv[i], "-r") ||
|
||||
!strcmp(argv[i], "-Wl,-r") ||
|
||||
!strcmp(argv[i], "-static") ||
|
||||
!strcmp(argv[i], "-D__KERNEL__") ||
|
||||
!strcmp(argv[i], "-D__UBOOT__") ||
|
||||
!strcmp(argv[i], "-fno-pie") ||
|
||||
!strcmp(argv[i], "-fno-PIE") ||
|
||||
!strcmp(argv[i], "-no-pie"))
|
||||
break;
|
||||
/* Record that shared was present which disables -pie but don't
|
||||
* break out of loop as a check needs to occur that possibly
|
||||
* still allows -fPIE to be set
|
||||
*/
|
||||
if (!strcmp(argv[i], "-shared"))
|
||||
found_shared = 1;
|
||||
}
|
||||
|
||||
if (i == argc) {
|
||||
/* Compile and link condition checking have been kept split
|
||||
* between these two loops, as there maybe already are valid
|
||||
* compile flags set for position independence. In that case
|
||||
* the wrapper just adds the -pie for link.
|
||||
*/
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (!strcmp(argv[i], "-fpie") ||
|
||||
!strcmp(argv[i], "-fPIE") ||
|
||||
!strcmp(argv[i], "-fpic") ||
|
||||
!strcmp(argv[i], "-fPIC"))
|
||||
break;
|
||||
}
|
||||
/* Both args below can be set at compile/link time
|
||||
* and are ignored correctly when not used
|
||||
*/
|
||||
if (i == argc)
|
||||
*cur++ = "-fPIE";
|
||||
|
||||
if (!found_shared)
|
||||
*cur++ = "-pie";
|
||||
}
|
||||
#endif
|
||||
/* Are we building the Linux Kernel or U-Boot? */
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (!strcmp(argv[i], "-D__KERNEL__") ||
|
||||
!strcmp(argv[i], "-D__UBOOT__"))
|
||||
break;
|
||||
}
|
||||
if (i == argc) {
|
||||
/* https://wiki.gentoo.org/wiki/Hardened/Toolchain#Mark_Read-Only_Appropriate_Sections */
|
||||
#ifdef BR2_RELRO_PARTIAL
|
||||
*cur++ = "-Wl,-z,relro";
|
||||
#endif
|
||||
#ifdef BR2_RELRO_FULL
|
||||
*cur++ = "-Wl,-z,now";
|
||||
*cur++ = "-Wl,-z,relro";
|
||||
#endif
|
||||
}
|
||||
|
||||
paranoid_wrapper = getenv("BR_COMPILER_PARANOID_UNSAFE_PATH");
|
||||
if (paranoid_wrapper && strlen(paranoid_wrapper) > 0)
|
||||
paranoid = 1;
|
||||
@@ -512,21 +405,29 @@ int main(int argc, char **argv)
|
||||
exec_args++;
|
||||
#endif
|
||||
|
||||
/* Debug the wrapper to see final arguments passed to the real compiler. */
|
||||
if (debug > 0) {
|
||||
fprintf(stderr, "Toolchain wrapper executing:");
|
||||
/* Debug the wrapper to see actual arguments passed to
|
||||
* the compiler:
|
||||
* unset, empty, or 0: do not trace
|
||||
* set to 1 : trace all arguments on a single line
|
||||
* set to 2 : trace one argument per line
|
||||
*/
|
||||
if ((env_debug = getenv("BR2_DEBUG_WRAPPER"))) {
|
||||
debug = atoi(env_debug);
|
||||
if (debug > 0) {
|
||||
fprintf(stderr, "Toolchain wrapper executing:");
|
||||
#ifdef BR_CCACHE_HASH
|
||||
fprintf(stderr, "%sCCACHE_COMPILERCHECK='string:" BR_CCACHE_HASH "'",
|
||||
(debug == 2) ? "\n " : " ");
|
||||
fprintf(stderr, "%sCCACHE_COMPILERCHECK='string:" BR_CCACHE_HASH "'",
|
||||
(debug == 2) ? "\n " : " ");
|
||||
#endif
|
||||
#ifdef BR_CCACHE_BASEDIR
|
||||
fprintf(stderr, "%sCCACHE_BASEDIR='" BR_CCACHE_BASEDIR "'",
|
||||
(debug == 2) ? "\n " : " ");
|
||||
fprintf(stderr, "%sCCACHE_BASEDIR='" BR_CCACHE_BASEDIR "'",
|
||||
(debug == 2) ? "\n " : " ");
|
||||
#endif
|
||||
for (i = 0; exec_args[i]; i++)
|
||||
fprintf(stderr, "%s'%s'",
|
||||
(debug == 2) ? "\n " : " ", exec_args[i]);
|
||||
fprintf(stderr, "\n");
|
||||
for (i = 0; exec_args[i]; i++)
|
||||
fprintf(stderr, "%s'%s'",
|
||||
(debug == 2) ? "\n " : " ", exec_args[i]);
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef BR_CCACHE_HASH
|
||||
|
||||
Reference in New Issue
Block a user