Fix bugs in cosmocc toolchain

This change integrates e58abc1110b335a3341e8ad5821ad8e3880d9bb2 from
https://github.com/ahgamut/musl-cross-make/ which fixes the issues we
were having with our C language extension for symbolic constants. This
change also performs some code cleanup and bug fixes to getaddrinfo().
It's now possible to compile projects like ncurses, readline and python
without needing to patch anything upstream, except maybe a line or two.
Pretty soon it should be possible to build a Linux distro on Cosmo.
This commit is contained in:
Justine Tunney 2023-06-08 23:44:03 -07:00
parent 22f81a8d50
commit 23e235b7a5
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
272 changed files with 3491 additions and 4350 deletions

View file

@ -15,6 +15,7 @@
See the License for the specific language governing permissions and
limitations under the License.
*/
#include "third_party/maxmind/maxminddb.h"
#include "libc/assert.h"
#include "libc/calls/calls.h"
#include "libc/calls/struct/stat.h"
@ -35,7 +36,6 @@
#include "libc/sysv/consts/o.h"
#include "libc/sysv/consts/prot.h"
#include "libc/sysv/consts/sock.h"
#include "third_party/maxmind/maxminddb.h"
#include "tool/build/lib/case.h"
asm(".ident\t\"\\n\\n\
@ -45,7 +45,7 @@ asm(".include \"libc/disclaimer.inc\"");
#define METADATA_MARKER "\xab\xcd\xefMaxMind.com"
#define METADATA_BLOCK_MAX_SIZE 131072 /* This is 128kb */
#define MMDB_POOL_INIT_SIZE 64 /* 64 means 4kb on 64bit */
#define MMDB_POOL_INIT_SIZE 64 /* 64 means 4kb on 64bit */
#define MMDB_DATA_SECTION_SEPARATOR 16
#define MAXIMUM_DATA_STRUCTURE_DEPTH 512
@ -269,7 +269,7 @@ static inline uint32_t get_ptr_from(uint8_t ctrl, uint8_t const *const ptr,
case 4:
return READ32BE(ptr);
default:
unreachable;
__builtin_unreachable();
}
}
@ -686,7 +686,7 @@ static record_info_s record_info_for_database(const MMDB_s *const mmdb) {
record_info.right_record_getter = &get_uint32;
record_info.right_record_offset = 4;
} else {
unreachable;
__builtin_unreachable();
}
return record_info;
}