mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-12 14:09:12 +00:00
Create ELF aliases for identical symbols
This change greatly reduces the number of modules that need to be compiled. The only issue right now is that sometimes when viewing symbol table entries, the aliased symbol is chosen.
This commit is contained in:
parent
e1b83399bd
commit
b8a6a989c0
191 changed files with 414 additions and 2190 deletions
2
third_party/make/ar.c
vendored
2
third_party/make/ar.c
vendored
|
@ -193,7 +193,7 @@ ar_glob_match (int desc UNUSED, const char *mem, int truncated UNUSED,
|
|||
if (fnmatch (state->pattern, mem, FNM_PATHNAME|FNM_PERIOD) == 0)
|
||||
{
|
||||
/* We have a match. Add it to the chain. */
|
||||
struct nameseq *new = xcalloc (state->size);
|
||||
struct nameseq *new = xcalloc (1, state->size);
|
||||
new->name = strcache_add(concat(4, state->arname, "(", mem, ")"));
|
||||
new->next = state->chain;
|
||||
state->chain = new;
|
||||
|
|
3
third_party/make/dep.h
vendored
3
third_party/make/dep.h
vendored
|
@ -15,6 +15,7 @@ A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|||
You should have received a copy of the GNU General Public License along with
|
||||
this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include "libc/x/x.h"
|
||||
|
||||
/* Structure used in chains of names, for parsing and globbing. */
|
||||
|
||||
|
@ -98,7 +99,7 @@ struct nameseq *ar_glob (const char *arname, const char *member_pattern, size_t
|
|||
|
||||
#define dep_name(d) ((d)->name ? (d)->name : (d)->file->name)
|
||||
|
||||
#define alloc_seq_elt(_t) xcalloc (sizeof (_t))
|
||||
#define alloc_seq_elt(_t) xcalloc (1, sizeof (_t))
|
||||
void free_ns_chain (struct nameseq *n);
|
||||
|
||||
#if defined(MAKE_MAINTAINER_MODE) && defined(__GNUC__) && !defined(__STRICT_ANSI__)
|
||||
|
|
3
third_party/make/dir.c
vendored
3
third_party/make/dir.c
vendored
|
@ -17,6 +17,7 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
|
|||
#include "third_party/make/makeint.inc"
|
||||
/**/
|
||||
#include "libc/calls/struct/dirent.h"
|
||||
#include "libc/x/x.h"
|
||||
#include "third_party/make/dep.h"
|
||||
#include "third_party/make/filedef.h"
|
||||
#include "third_party/make/hash.h"
|
||||
|
@ -584,7 +585,7 @@ void file_impossible(const char *filename) {
|
|||
if (dir->contents == 0)
|
||||
/* The directory could not be stat'd. We allocate a contents
|
||||
structure for it, but leave it out of the contents hash table. */
|
||||
dir->contents = xcalloc(sizeof(struct directory_contents));
|
||||
dir->contents = xcalloc(1, sizeof(struct directory_contents));
|
||||
|
||||
if (dir->contents->dirfiles.ht_vec == 0) {
|
||||
hash_init(&dir->contents->dirfiles, DIRFILE_BUCKETS, dirfile_hash_1,
|
||||
|
|
1
third_party/make/expand.c
vendored
1
third_party/make/expand.c
vendored
|
@ -21,6 +21,7 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
|
|||
#include "third_party/make/job.h"
|
||||
#include "third_party/make/commands.h"
|
||||
#include "third_party/make/variable.h"
|
||||
#include "libc/x/x.h"
|
||||
#include "third_party/make/rule.h"
|
||||
|
||||
/* Initially, any errors reported when expanding strings will be reported
|
||||
|
|
2
third_party/make/file.c
vendored
2
third_party/make/file.c
vendored
|
@ -130,7 +130,7 @@ enter_file (const char *name)
|
|||
return f;
|
||||
}
|
||||
|
||||
new = xcalloc (sizeof (struct file));
|
||||
new = xcalloc (1, sizeof (struct file));
|
||||
new->name = new->hname = name;
|
||||
new->update_status = us_none;
|
||||
|
||||
|
|
3
third_party/make/hash.c
vendored
3
third_party/make/hash.c
vendored
|
@ -21,10 +21,11 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
|
|||
#include "libc/intrin/bsr.h"
|
||||
#include "libc/intrin/likely.h"
|
||||
#include "libc/log/check.h"
|
||||
#include "libc/x/x.h"
|
||||
#include "third_party/make/hash.h"
|
||||
/* clang-format off */
|
||||
|
||||
#define CALLOC(t, n) ((t *) xcalloc (sizeof (t) * (n)))
|
||||
#define CALLOC(t, n) ((t *) xcalloc (1, sizeof (t) * (n)))
|
||||
#define MALLOC(t, n) ((t *) xmalloc (sizeof (t) * (n)))
|
||||
#define REALLOC(o, t, n) ((t *) xrealloc ((o), sizeof (t) * (n)))
|
||||
#define CLONE(o, t, n) ((t *) memcpy (MALLOC (t, (n)), (o), sizeof (t) * (n)))
|
||||
|
|
2
third_party/make/job.c
vendored
2
third_party/make/job.c
vendored
|
@ -1315,7 +1315,7 @@ new_job (struct file *file)
|
|||
/* Start the command sequence, record it in a new
|
||||
'struct child', and add that to the chain. */
|
||||
|
||||
c = xcalloc (sizeof (struct child));
|
||||
c = xcalloc (1, sizeof (struct child));
|
||||
output_init (&c->output);
|
||||
|
||||
c->file = file;
|
||||
|
|
3
third_party/make/makeint.inc
vendored
3
third_party/make/makeint.inc
vendored
|
@ -50,7 +50,6 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
|
|||
#include "libc/sysv/consts/w.h"
|
||||
#include "libc/time/struct/tm.h"
|
||||
#include "libc/time/time.h"
|
||||
#include "libc/x/x.h"
|
||||
#include "third_party/gdtoa/gdtoa.h"
|
||||
#include "third_party/musl/glob.h"
|
||||
/* clang-format off */
|
||||
|
@ -395,8 +394,6 @@ void pfatal_with_name (const char *) NORETURN;
|
|||
void perror_with_name (const char *, const char *);
|
||||
#define xstrlen(_s) ((_s)==NULL ? 0 : strlen (_s))
|
||||
void *xmalloc (size_t);
|
||||
// void *xcalloc (size_t);
|
||||
#define xcalloc(size) ((xcalloc)(1, (size)))
|
||||
void *xrealloc (void *, size_t);
|
||||
char *xstrdup (const char *);
|
||||
char *xstrndup (const char *, size_t);
|
||||
|
|
2
third_party/make/read.c
vendored
2
third_party/make/read.c
vendored
|
@ -3121,7 +3121,7 @@ parse_file_seq (char **stringp, size_t size, int stopmap,
|
|||
struct nameseq **newp = &new;
|
||||
#define NEWELT(_n) do { \
|
||||
const char *__n = (_n); \
|
||||
*newp = xcalloc (size); \
|
||||
*newp = xcalloc (1, size); \
|
||||
(*newp)->name = (cachep ? strcache_add (__n) : xstrdup (__n)); \
|
||||
newp = &(*newp)->next; \
|
||||
} while(0)
|
||||
|
|
4
third_party/make/variable.c
vendored
4
third_party/make/variable.c
vendored
|
@ -47,7 +47,7 @@ struct pattern_var *
|
|||
create_pattern_var (const char *target, const char *suffix)
|
||||
{
|
||||
size_t len = strlen (target);
|
||||
struct pattern_var *p = xcalloc (sizeof (struct pattern_var));
|
||||
struct pattern_var *p = xcalloc (1, sizeof (struct pattern_var));
|
||||
|
||||
if (pattern_vars != 0)
|
||||
{
|
||||
|
@ -235,7 +235,7 @@ define_variable_in_set (const char *name, size_t length,
|
|||
|
||||
/* Create a new variable definition and add it to the hash table. */
|
||||
|
||||
v = xcalloc (sizeof (struct variable));
|
||||
v = xcalloc (1, sizeof (struct variable));
|
||||
v->name = xstrndup (name, length);
|
||||
v->length = (unsigned int) length;
|
||||
hash_insert_at (&set->table, v, var_slot);
|
||||
|
|
2
third_party/sed/compile.c
vendored
2
third_party/sed/compile.c
vendored
|
@ -164,7 +164,7 @@ compile(void)
|
|||
fixuplabel(prog, NULL);
|
||||
uselabel();
|
||||
if (appendnum > 0)
|
||||
appends = xmalloc(sizeof(struct s_appends) * appendnum);
|
||||
appends_ = xmalloc(sizeof(struct s_appends) * appendnum);
|
||||
g_match = xmalloc((maxnsub + 1) * sizeof(regmatch_t));
|
||||
}
|
||||
|
||||
|
|
2
third_party/sed/extern.h
vendored
2
third_party/sed/extern.h
vendored
|
@ -9,7 +9,7 @@ COSMOPOLITAN_C_START_
|
|||
// clang-format off
|
||||
|
||||
extern struct s_command *prog;
|
||||
extern struct s_appends *appends;
|
||||
extern struct s_appends *appends_;
|
||||
extern regmatch_t *g_match;
|
||||
extern size_t maxnsub;
|
||||
extern u_long linenum;
|
||||
|
|
1
third_party/zip/osdep.h
vendored
1
third_party/zip/osdep.h
vendored
|
@ -33,7 +33,6 @@
|
|||
#include "libc/thread/thread.h"
|
||||
#include "libc/calls/typedef/u.h"
|
||||
#include "libc/calls/weirdtypes.h"
|
||||
#include "libc/intrin/newbie.h"
|
||||
#include "libc/sock/select.h"
|
||||
#include "libc/sysv/consts/endian.h"
|
||||
#include "libc/calls/calls.h"
|
||||
|
|
1
third_party/zip/unix.c
vendored
1
third_party/zip/unix.c
vendored
|
@ -702,7 +702,6 @@ char *d; /* directory to delete */
|
|||
|
||||
#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__386BSD__) || \
|
||||
defined(__OpenBSD__) || defined(__bsdi__)
|
||||
#include "libc/intrin/newbie.h"
|
||||
#include "libc/calls/calls.h"
|
||||
#include "libc/calls/struct/rlimit.h"
|
||||
#include "libc/calls/struct/rusage.h"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue