aboutsummaryrefslogtreecommitdiff
path: root/newlib
AgeCommit message (Collapse)AuthorFilesLines
2022-02-03newlib: arm & v850: simplify build rulesMike Frysinger4-78/+60
Let automake manage whether the objects are included in lib.a. This fixes failures after to commit 71086e8b2d70c1e71a8372f35d9901505fc72905 ("newlib: delete (most) redundant lib_a_CCASFLAGS=$(AM_CCASFLAGS)") due to automake generating different set of implicit rules, and the code in here assuming the names of the generated objects.
2022-02-01newlib: rename libc_cv_ prefix to newlib_cv_Mike Frysinger3-23/+23
We've been using both libc_cv_ and newlib_cv_ for our cache vars. Let's consolidate on newlib_cv_ to avoid conflicts with glibc which is already using the libc_cv_ prefix.
2022-02-01newlib: drop unused cache vars from MakefilesMike Frysinger3-10/+2
These aren't used in any of the makefiles, so there's no point in exporting these. These are only checked in the configure script.
2022-02-01newlib: add AC_CACHE_CHECK sugar around preprocessor checksMike Frysinger6-39/+78
This isn't strictly necessary, but it makes for much clearer logs as to what the target is doing, and provides cache vars for anyone who wants to force the test a different way, and it lets the build cache its own results when rerunning config.status.
2022-02-01newlib: delete unused iconvdata subdir configMike Frysinger2-7/+3
Since commit dcbff9eea71d06454e7d55d6b7e72672c0987d6d ("newlib: merge iconvdata into top-level Makefile"), there is no configure script in the iconvdata/ subdir, so this call will just issue a warning and not do anything useful. Punt it.
2022-01-31newlib: fix preprocessor checksMike Frysinger4-742/+974
Restore the call to AC_NO_EXECUTABLES -- I naively assumed in commit 2e9aa5f56cc26a411014a7f788423c670cfb5646 ("newlib: update preprocessor configure checks") that checking for a preprocessor would not involve linking code. Unfortunately, autoconf will implicitly check that the compiler "works" before allowing it to be used, and that involves a link test, and that fails because newlib provides the C library which is needed to pass a link test. There is some code in NEWLIB_CONFIGURE specifically to help mitigate these, but it's not kicking in here for some reason, so let's just add the AC_NO_EXECUTABLES call back until we can unwind that custom logic. Additionally, we have to call AC_PROG_CPP explicitly. This was being invoked later on, but only in the use_libtool=yes codepath, and that is almost never enabled.
2022-01-29newlib: fix cygwin -I pathMike Frysinger1-1/+1
This code snippet assumed it was only ever run in the top configure script where srcdir would point to newlib/ which is parallel to the winsup/ tree. This is incorrect for all of the subdir configure scripts leading to bad -I flags in $(CC). Switch it over to the new abs_newlib_basedir which should work in all subdirs.
2022-01-29newlib: use abs_newlib_basedir for -I pathsMike Frysinger28-30/+30
When we had configure scripts in subdirs, the newlib_basedir value was computed relative to that, and it'd be the same when used in the Makefile in the same dir. With many subdir configure scripts removed, the top-level configure & Makefile can't use the same relative path. So switch the subdir Makefiles over to abs_newlib_basedir when they use -I to find source headers. Do this for all subdirs, even ones with configure scripts and where newlib_basedir works. This makes the code consistent, and avoids surprises if the configure script is ever removed in the future as part of merging to the higher level. Some of the subdirs were using -I$(newlib_basedir)/../newlib/ for some reason. Collapse those too since newlib_basedir points to the newlib source tree already.
2022-01-29newlib: export abs_newlib_basedir for all subdirsMike Frysinger156-20/+211
When using the top-level configure script but subdir Makefiles, the newlib_basedir value gets a bit out of sync: it's relative to where configure lives, not where the Makefile lives. Move the abs setting from the top-level configure script into acinclude.m4 so we can rely on it being available everywhere. Although this commit doesn't use it anywhere, just lays the groundwork.
2022-01-28newlib: hoist crt0 install up another dirMike Frysinger2-2/+2
Commit dd23de27c8e45513ad276f503a0036c3bc4e487b ("newlib: libc: install CRT0 straight out of subdir") got rid of the libc/sys/ intermediate for copying the file up, but the top-level newlib/ dir was still expecting a libc/crt0.o to exist so it could install. Update that to also look for the crt0 file directly under libc/ like we already do for crt1.
2022-01-27newlib: merge iconvdata into top-level MakefileMike Frysinger10-16069/+196
Avoid a recursive make with this tiny subdir to speed things up a bit.
2022-01-27newlib: drop unused saber fileMike Frysinger1-184/+0
I can't find any references to this, and it looks like a generated build log from a specific old sparc system.
2022-01-26newlib: fix info+man page buildsMike Frysinger2-4/+4
The work to merge libc/machine/ up a dir lost the stub doc targets. So when libc/ recursed into machine/, it would stop going deeper as the doc rules were empty. But now that libc/ goes directly into the libc/machine/$arch/ and those have never had doc stubs, the build fails. Add a quick hack to the top dir to ignore all machine/$arch/ dirs when generating docs. A follow up series will delete all of this code as it merges all the doc rules into the top newlib dir.
2022-01-26Fix null-pointer dereference in nano-mallocCyril Yared1-1/+1
If p is NULL, then the free_list is empty and we should return the correct failure values.
2022-01-26newlib: switch to multilib.amMike Frysinger2-74/+53
We use the common config-ml.in for configure, so switch the makefile over to the common multilib.am. It's almost exactly the same code, but there are two differences: * Common code hooks install-exec-local for install-multi, but newlib doesn't currently install any executables, so that doesn't fire. Newlib already has install-data-local that inlined install-multi, so switch that to the common install-multi. * Common code doesn't provide a check-multi at all. Keep ours for now. Some day common code might get it. Or not. Who knows.
2022-01-26newlib: libc: merge machine/ configure scripts up a levelMike Frysinger355-380098/+6795
The machine configure scripts are all effectively stub scripts that pass the higher level options to its own makefile. There were only three doing custom tests. The rest were all effectively the same as the libc/ configure script. So instead of recursively running configure in all of these subdirs, generate their makefiles from the top-level configure. For the few unique ones, deploy a pattern of including subdir logic via m4: m4_include([machine/nds32/acinclude.m4]) Some of the generated machine makefiles have a bunch of extra stuff added to them, but that's because they were inconsistent in their configure libtool calls. The top-level has it, so it exports some new vars to the ones that weren't already.
2022-01-26newlib: libc: merge most sys/ configure scripts up a levelMike Frysinger132-159285/+2726
The sys configure scripts are almost all effectively stub scripts that pass the higher level options to its own makefile. The phoenix & linux ones are a bit more complicated with nested subdirs, so those have been left alone for now. Plus, I don't really have a way of testing them.
2022-01-26newlib: libc: install CRT0 straight out of subdirMike Frysinger6-491/+10
There's no need to have a sys/ subdir just to copy the sys/$arch/crt0.o up to sys/crt0.o, and then have libc/ copy sys/crt0.o up again. Just have libc/ refer to sys/$arch/crt0.o directly and drop the intermediate makefile entirely.
2022-01-26newlib: libc: merge sys/ trampoline up a levelMike Frysinger32-16005/+269
The sys/{configure,Makefile} files exist to fan out to the specific sys/$arch/ subdir, and to possibly generate a crt0. We already have all that same info in the libc/ dir itself, so by moving the recursive configure and make calls into it, we can cut off some of this logic entirely and save the overhead. For arches that don't have a sys subdir, it means they can skip the logic entirely. The sys subdir itself is kept for the crt0 logic, for now. We'll try and clean that up next.
2022-01-26newlib: libc: merge machine/ trampoline up a levelMike Frysinger32-16473/+316
The machine/{configure,Makefile} files exist only to fan out to the specific machine/$arch/ subdir. We already have all that same info in the libc/ dir itself, so by moving the recursive configure and make calls into it, we can cut off this logic entirely and save the overhead. For arches that don't have a machine subdir, it means they can skip the logic entirely. Although there's prob not too many of those.
2022-01-26newlib: libm: merge machine/ configure scripts up a levelMike Frysinger64-87289/+924
The machine configure scripts are all effectively stub scripts that pass the higher level options to its own makefile. The only one doing any custom tests was nds32. The rest were all effectively the same as the libm/ configure script. So instead of recursively running configure in all of these subdirs, generate their makefiles from the top-level configure. For nds32, deploy a pattern of including subdir logic via m4: m4_include([machine/nds32/acinclude.m4]) Even its set of checks are very small -- it does 2 preprocessor tests and sets up 2 makefile conditionals. Some of the generated machine makefiles have a bunch of extra stuff added to them, but that's because they were inconsistent in their configure libtool calls. The top-level has it, so it exports some new vars to the ones that weren't already.
2022-01-26newlib: libm: merge machine/ trampoline up a levelMike Frysinger14-16309/+93
The machine/{configure,Makefile} files exist only to fan out to the specific machine/$arch/ subdir. We already have all that same info in the libm/ dir itself, so by moving the recursive configure and make calls into it, we can cut off this logic entirely and save the overhead. For arches that don't have a machine subdir, it means they can skip the logic entirely.
2022-01-25newlib: libm: drop unused config.h.in fileMike Frysinger1-1/+0
Not sure how this snuck in. It's never been used in libm/, so punt it.
2022-01-23newlib: powerpc: move libc machine list to MakefileMike Frysinger4-21/+101
This makes the makefile logic a bit cleaner so we don't have two files maintaining lists of sources & objects. Since the logic is tied to cpu capabilities, past those boolean settings down from the configure logic to the makefile logic. This will also make it easier to throw away the configure script in a follow up commit and just keep the makefile.
2022-01-23newlib: update preprocessor configure checksMike Frysinger13-434/+1537
The nds32 & spu dirs are using compile tests to look for some preprocessor defines, but we don't need to compile the code, just preprocess it. So switch to AC_PREPROC_IFELSE. The sh dir is using a preprocessor test via grep, but let's switch it to AC_PREPROC_IFELSE too to be consistent. This should allow us to drop the uncommon AC_NO_EXECUTABLES call.
2022-01-21newlib: punt unused LIBC_EXTRA_LIB settingsMike Frysinger28-142/+21
This was added decades ago, but the commit message lacks any explanation, and it was unused when it was merged. It's still unused today. So punt it all.
2022-01-21newlib: stop making .def generation conditionalMike Frysinger4-53/+28
Generating these files is very cheap, so let's just do it all the time. This makes the build logic simpler, and keeps errors for slipping in in codepaths that are not well tested. Creating these files doesn't mean they'll be included in the manual implicitly. For example, some of the nano stdio files break documentation because they don't have any chew directives in them. But no one noticed since that code path is rarely enabled. So drop the _i and _float def files.
2022-01-21newlib: drop redundant CFLAGS exportMike Frysinger2-4/+0
This is already handled by autotools for us automatically. You can tell as the generated output is exactly the same other than deleting a few blank lines.
2022-01-21newlib: stop clobbering LDFLAGS with non-standard $ldflagsMike Frysinger209-583/+53
It's unclear why this was added originally, but assuming it was needed 20 years ago, it shouldn't be explicitly required nowadays. Current versions of autotools already take care of exporting LDFLAGS to the Makefile as needed (things are actually getting linked). That's why the configure diffs show LDFLAGS still here, but shifted to a diff place in the output list. A few dirs stop exporting LDFLAGS, but that's because they don't do any linking, only compiling, so it's correct. As for the use of $ldflags instead of the standard $LDFLAGS, I can't really explain that at all. Just use the right name so users don't have to dig into why their setting isn't respected, and then use a non-standard name instead. Adjust the testsuite to match.
2022-01-21newlib: stop checking --enable-multilib in subdirsMike Frysinger115-1534/+68
None of the subdirs actually use the multilib arg, so include the logic only in the top-level configure.
2022-01-21newlib: move to ../config/multi.m4 for multilib logicMike Frysinger5-44/+61
The current newlib multilib logic is almost exactly the same as the config/multi.m4, and the differences should be minor, so switch over to that to delete custom logic on ourside.
2022-01-21newlib: punt unused template fileMike Frysinger1-1/+0
This was needed by ancient versions of automake, but that hasn't been the case since at least automake-1.5, so punt this unused stub.
2022-01-21newlib: switch to autoconf long double macroMike Frysinger5-101/+84
Now that we require a recent version of autoconf, we can rely on this macro working. This change was already made to libm, but these other dirs were missed as I didn't notice it being duplicated in 3 places.
2022-01-19newlib: switch newlib.h to autoheaderMike Frysinger4-22/+100
Now that newlib.hin has been brought up to date and all of its defines are produced by configure, we can switch it to using autoheader without manual editing. This relies on a few pieces: * Moving the header & footer into configure.ac via AH_TOP & AH_BOTTOM. * Running a post-process step on newlib.h to delete all the defines we didn't export ourselves. Basically, anything without a _ prefix. This will leave behind some spurious comments in newlib.h related to the defines we filtered out, but should be harmless, so it's probably not worth the effort to construct a more complicated sed expression to also strip those out.
2022-01-19newlib: iconv: autogenerate iconv define listMike Frysinger7-28/+1055
The list of iconv to/from defines is hand maintained in newlib.hin. Lets leverage mkdeps.pl to generate this list automatically from the list of known encodings. The newlib.hin list is up-to-date, so the list in iconv.m4 matches the list already generated.
2022-01-19newlib: add missing _NANO_MALLOC to newlib.hinMike Frysinger1-0/+3
This was added to configure, but never to the header file. Nothing uses this currently, so it's not a big deal (as all the dynamic logic is via automake conditionals), but might as well restore it now to keep autoheader output in sync.
2022-01-19newlib: move version defines out of the config headersMike Frysinger4-19/+27
This will make it easier to move newlib.h to use autoheader directly. We only want the newlib version defines in our hand curated version file, _newlib_version.h, not in the template header, newlib.h, so using AC_DEFINE doesn't make much sense.
2022-01-19newlib: sort newlib.h outputMike Frysinger1-134/+132
Sort the symbols lexically like autoheader does. There are no other changes in here. This will make it easier to sync with autoheader.
2022-01-19newlib: clean up autoheader templatesMike Frysinger3-161/+127
Sync these back from newlib.hin to configure.ac, and touchup some of the forms to be consistent (like being full sentences). Also use the AC_DEFINE-vs-AC_DEFINE_UNQUOTED macros correctly. This will make it easier to re-enable autoheader for managing newlib.hin.
2022-01-19newlib: merge acconfig.h changes into newlib.hinMike Frysinger3-194/+3
The acconfig.h header was used to run autoheader and then manually sync the output into newlib.hin. Based on how the files have fallen out of sync (with newlib.hin having many more templates), this has not been run in a long time, and attempts to do so now would break newlib.hin. Further, if you try to run autoheader now, it will automatically replace _newlib_version.hin since it's the first entry in the call to AC_CONFIG_HEADERS. So let's throw away acconfig.h entirely. It only had 2 slightly better comments, and the rest were either worse, missing, or stale. This has the side benefit of avoiding autoheader warning about the deprecated use of acconfig.h since newer autoconf only wants macro calls in configure.ac.
2022-01-19newlib: internalize HAVE_INITFINI_ARRAYMike Frysinger8-12/+12
This define is only used by newlib internally, so stop exporting it as HAVE_INITFINI_ARRAY since this can conflict with defines packages use themselves. We don't really need to add _ to HAVE_INIT_FINI too since it isn't exported in newlib.h, but might as well be consistent here. We can't (easily) add this to newlib_cflags like HAVE_INIT_FINI is because this is based on a compile-time test in the top configure, not on plain shell code in configure.host. We'd have to replicate the test in every subdir in order to have it passed down.
2022-01-19newlib: libm: switch to autoconf long double macroMike Frysinger2-63/+62
Now that we require a recent version of autoconf, we can rely on this macro working. We shift the call in configure.ac down a little to help keep the generated diff minimal -- there should be no functional difference otherwise. This is because the autoconf macros will call a bunch of standard toolchain macros first, and arguably the current code is incorrect in how it does its testing.
2022-01-18newlib: iconv: sort ccsbi.c contentsMike Frysinger2-94/+94
The current output doesn't happen to match what is produced on my system, so force _iconv_ccs to be sorted like is already done in the ccsbi.h header.
2022-01-18newlib: iconv: sync mkdeps.pl with aliasesbi.c changesMike Frysinger1-3/+3
Some changes were made to aliasesbi.c, but not to this file which dynamically generates it. Add those fixes to this file too.
2022-01-18newlib: drop autoconf-2.59 workaroundMike Frysinger1-127/+0
As the file comments say, this was a backport of an autoconf-2.60 fix, and shouldn't matter for >autoconf-2.59 versions. Drop it since we use and require autoconf-2.69 now.
2022-01-18newlib: enable automake subdir-objects in all dirsMike Frysinger4-107/+141
Currently this is only enabled in the top-level as that's the only place where it seemed to be used. But the libc/sys/phoenix/ dir also uses this functionality, but fails to explicitly enable it. Automake workedaround it, but generated warnings. Move the option to NEWLIB_CONFIGURE so all dirs get it automatically iff they end up using the option. If they don't use the option, there's no difference to the generated code.
2022-01-18newlib: avoid duplicate awk checksMike Frysinger119-361/+36
Since AM_INIT_AUTOMAKE calls AC_PROG_AWK, and some configure.ac scripts call it too, we end up testing for awk multiple times. If we change NEWLIB_CONFIGURE to require the macro instead, then it makes sure it's always expanded, but only once. While we're here, do the same thing with AC_PROG_INSTALL since it is also called by AM_INIT_AUTOMAKE, although it doesn't currently result in duplicate configure checks.
2022-01-18newlib: merge old AC_LIBTOOL_WIN32_DLL macro into LT_INITMike Frysinger32-5008/+4944
The AC_LIBTOOL_WIN32_DLL macro has been deprecated for a while and code should call LT_INIT with win32-dll instead. Update the calls to match. The generated code is noisy not because of substantial differences, but because the order of some macros change (i.e. instead of calling AS and then CC, CC is called first and then AS).
2022-01-18newlib: update libtool macro nameMike Frysinger16-26/+26
Replace old AM_PROG_LIBTOOL name with LT_INIT. There's no change to the generated files since they're aliases internally.
2022-01-18newlib: delete (most) redundant lib_a_CCASFLAGS=$(AM_CCASFLAGS)Mike Frysinger181-2473/+320
Since automake already sets per-library CCASFLAGS to $(AM_CCASFLAGS) by default, there's no need to explicitly set it here. Many of these dirs don't have .S files in the first place, so the rule doesn't even do anything. That can easily be seen when Makefile.in has no changes as a result. For the dirs with .S files, the custom rules are the same as the pattern .S.o rules, so this is a nice cleanup. The only dir that was adding extra flags (newlib/libc/machine/mn10300/) to the per-library setting can have it moved to the global AM_CCASFLAGS since the subdir only has one target. Although the setting just adds extra debugging flags, so maybe it should be deleted in general. There are a few dirs that we leave the redundant setting in place. This is to workaround an automake limitation in subdirs that support building with & w/out libtool: https://www.gnu.org/software/automake/manual/html_node/Objects-created-both-with-libtool-and-without.html