Skip to content

Commit

Permalink
cctools: Imported from macports-ports
Browse files Browse the repository at this point in the history
Added new variant cctools_973 to install cctools-973 currently used for macOS Sonoma beta
  • Loading branch information
Gcenx committed Aug 3, 2023
1 parent 816a1ed commit f49171b
Show file tree
Hide file tree
Showing 16 changed files with 964 additions and 0 deletions.
400 changes: 400 additions & 0 deletions devel/cctools/Portfile

Large diffs are not rendered by default.

35 changes: 35 additions & 0 deletions devel/cctools/files/PR-12400897.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
--- misc/nm.c.orig
+++ misc/nm.c
@@ -519,7 +519,7 @@ void *cookie)
uint32_t nsymbols;
struct value_diff *value_diffs;

- char *short_name, *has_suffix;
+ char *short_name, *suffix;
enum bool is_framework;
#ifdef LTO_SUPPORT
char *llvm_bundle_pointer;
@@ -755,9 +755,20 @@ void *cookie)
process_flags.lib_names[j] =
(char *)dl + dl->dylib.name.offset;
short_name = guess_short_name(process_flags.lib_names[j],
- &is_framework, &has_suffix);
- if(short_name != NULL)
- process_flags.lib_names[j] = short_name;
+ &is_framework, &suffix);
+ if(short_name != NULL) {
+ if (suffix) {
+ char *combined_name;
+ asprintf(&combined_name, "%s%s", short_name, suffix);
+ if (combined_name) {
+ process_flags.lib_names[j] = combined_name;
+ free(short_name);
+ free(suffix);
+ }
+ } else {
+ process_flags.lib_names[j] = short_name;
+ }
+ }
j++;
}
lc = (struct load_command *)
36 changes: 36 additions & 0 deletions devel/cctools/files/PR-37520.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
--- as/m88k.c.orig 1969-12-31 16:00:00.000000000 -0800
+++ as/m88k.c 2013-07-05 10:32:19.000000000 -0700
@@ -600,6 +600,10 @@ char *op)

/* if this instruction requires labels mark it for later */
switch (insn.reloc) {
+
+ case NO_RELOC:
+ break;
+
case M88K_RELOC_LO16:
case M88K_RELOC_HI16:
fix_new(
--- as/sparc.c.orig 1969-12-31 16:00:00.000000000 -0800
+++ as/sparc.c 2013-07-05 10:32:14.000000000 -0700
@@ -851,6 +851,20 @@ sparc_ip (str)
/* plug absolutes directly into opcode */

switch(the_insn.reloc) {
+ case SPARC_RELOC_13:
+ if (the_insn.exp.X_seg == SEG_BIG)
+ opcode |= (*(int *) generic_bignum) & 0x1fff;
+ else
+ opcode |= the_insn.exp.X_add_number & 0x1fff;
+ the_insn.reloc = SPARC_RELOC_NONE;
+ break;
+ case SPARC_RELOC_22:
+ if (the_insn.exp.X_seg == SEG_BIG)
+ opcode |= (*(int *) generic_bignum) & 0x3fffff;
+ else
+ opcode |= the_insn.exp.X_add_number & 0x3fffff;
+ the_insn.reloc = SPARC_RELOC_NONE;
+ break;
case SPARC_RELOC_HI22:
/* extract upper 22 bits from constant */
opcode |= (the_insn.exp.X_add_number >> 10) & 0x3fffff;
66 changes: 66 additions & 0 deletions devel/cctools/files/as-try-clang.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
--- as/driver.c.orig 2019-05-25 16:26:59.000000000 +0100
+++ as/driver.c 2020-03-13 11:22:45.000000000 +0000
@@ -31,15 +31,15 @@
const char *LOCALLIB = "../local/libexec/as/";
const char *AS = "/as";

- int i, j;
- uint32_t count, verbose, run_clang;
- char *p, c, *arch_name, *as, *as_local;
+ int i=0, j=0;
+ uint32_t count=0, verbose=0, run_clang=0;
+ char *p=NULL, c=NULL, *arch_name=NULL, *as=NULL, *as_local=NULL;
char **new_argv;
const char *CLANG = "clang";
- char *prefix, buf[MAXPATHLEN], resolved_name[PATH_MAX];
- uint32_t bufsize;
+ char *prefix=NULL, buf[MAXPATHLEN], resolved_name[PATH_MAX];
+ uint32_t bufsize=0;
struct arch_flag arch_flag;
- const struct arch_flag *arch_flags, *family_arch_flag;
+ const struct arch_flag *arch_flags=NULL, *family_arch_flag=NULL;
enum bool oflag_specified, qflag, Qflag, some_input_files;

progname = argv[0];
@@ -295,11 +295,28 @@
arch_flag.cputype == CPU_TYPE_ARM64 ||
arch_flag.cputype == CPU_TYPE_ARM64_32 ||
arch_flag.cputype == CPU_TYPE_ARM)){
- as = makestr(prefix, CLANG, NULL);
- if(access(as, F_OK) != 0){
- printf("%s: assembler (%s) not installed\n", progname, as);
- exit(1);
- }
+ if ( NULL == getenv("DISABLE_MACPORTS_AS_CLANG_SEARCH") ) {
+ const char * mp_comps[] = { __MP_CLANG_NAMES__ };
+ const size_t n_comps = sizeof(mp_comps) / sizeof(mp_comps[0]);
+ for ( size_t i = 0; i < n_comps; ++i ) {
+ as = makestr(prefix, mp_comps[i], NULL);
+ if(access(as, F_OK) == 0){
+ // found working compiler so break
+ break;
+ } else {
+ as = NULL;
+ }
+ }
+ }
+#if __TRY_SYSTEM_CLANG__
+ if ( NULL == as && NULL == getenv("DISABLE_XCODE_AS_CLANG_SEARCH") ) {
+ as = "/usr/bin/clang";
+ if(access(as, F_OK) != 0){
+ as = NULL;
+ }
+ }
+#endif
+ if (as != NULL) {
new_argv = allocate((argc + 8) * sizeof(char *));
new_argv[0] = as;
j = 1;
@@ -360,6 +377,7 @@
exit(0);
else
exit(1);
+ } /* as != NULL */
}

/*
39 changes: 39 additions & 0 deletions devel/cctools/files/cctools-829-lto.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
--- libstuff/lto.c.orig
+++ libstuff/lto.c
@@ -115,13 +115,21 @@
lto_path = makestr(prefix, "../lib/libLTO.dylib", NULL);

lto_handle = dlopen(lto_path, RTLD_NOW);
+ free(lto_path);
+ lto_path = NULL;
if(lto_handle == NULL){
- free(lto_path);
- lto_path = NULL;
- lto_handle = dlopen("/Applications/Xcode.app/Contents/"
- "Developer/Toolchains/XcodeDefault."
- "xctoolchain/usr/lib/libLTO.dylib",
- RTLD_NOW);
+ const char *lto_paths[] = {
+ "@@LLVM_LIBDIR@@/libLTO.dylib",
+ "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libLTO.dylib",
+ "/usr/lib/libLTO.dylib",
+ "/Applications/Xcode.app/usr/lib/libLTO.dylib",
+ "/Developer/usr/lib/libLTO.dylib",
+ NULL
+ };
+ const char **p;
+ for(p = lto_paths; *p && !lto_handle ; p++) {
+ lto_handle = dlopen(*p, RTLD_NOW);
+ }
}
if(lto_handle == NULL)
return(0);
@@ -147,8 +155,6 @@
lto_get_sym_attr == NULL ||
lto_get_sym_name == NULL){
dlclose(lto_handle);
- if(lto_path != NULL)
- free(lto_path);
return(0);
}
}
34 changes: 34 additions & 0 deletions devel/cctools/files/cctools-862-prunetrie.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
--- misc/Makefile.orig
+++ misc/Makefile
@@ -203,14 +203,18 @@
$(OFILE_DIR)/indr.private.o
$(DSYMUTIL) $(SYMROOT)/indr.NEW

-strip.NEW: strip.o
+strip.NEW: strip.o PruneTrie.o
$(CC) $(RC_CFLAGS) -nostdlib -r \
-o $(OBJROOT)/strip.private.o \
$(OFILE_DIR)/strip.o $(LIBSTUFF)
$(CXX) $(RC_CFLAGS) $(SDK) -o $(SYMROOT)/strip.NEW \
- $(OFILE_DIR)/strip.private.o $(LIB_PRUNETRIE) $(CXXLIB)
+ $(OFILE_DIR)/strip.private.o $(OFILE_DIR)/PruneTrie.o $(CXXLIB)
$(DSYMUTIL) $(SYMROOT)/strip.NEW

+PruneTrie.o: PruneTrie.cpp
+ $(CXX) $(CXXFLAGS) $(RC_CFLAGS) $(SDK) $(CXXLIB) -c -o \
+ $(OBJROOT)/PruneTrie.o $(SRCROOT)/PruneTrie.cpp
+
nmedit.NEW: nmedit.o
$(CC) $(RC_CFLAGS) -nostdlib -r \
-o $(OBJROOT)/nmedit.private.o \
--- misc/strip.c.orig
+++ misc/strip.c
@@ -48,7 +48,7 @@
#include "stuff/execute.h"
#include "stuff/write64.h"
#ifdef TRIE_SUPPORT
-#include <mach-o/prune_trie.h>
+#include "prune_trie.h"
#endif /* TRIE_SUPPORT */

/* These are set from the command line arguments */
70 changes: 70 additions & 0 deletions devel/cctools/files/cctools-921-noavx512.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
--- include/mach/i386/thread_status.h.orig
+++ include/mach/i386/thread_status.h
@@ -115,9 +115,6 @@
#define x86_AVX_STATE32 16
#define x86_AVX_STATE64 (x86_AVX_STATE32 + 1)
#define x86_AVX_STATE (x86_AVX_STATE32 + 2)
-#define x86_AVX512_STATE32 19
-#define x86_AVX512_STATE64 (x86_AVX512_STATE32 + 1)
-#define x86_AVX512_STATE (x86_AVX512_STATE32 + 2)

/*
* Largest state on this machine:
@@ -147,9 +144,6 @@
(x == x86_AVX_STATE32) || \
(x == x86_AVX_STATE64) || \
(x == x86_AVX_STATE) || \
- (x == x86_AVX512_STATE32) || \
- (x == x86_AVX512_STATE64) || \
- (x == x86_AVX512_STATE) || \
(x == THREAD_STATE_NONE))

struct x86_state_hdr {
@@ -193,10 +187,6 @@
#define x86_AVX_STATE32_COUNT ((mach_msg_type_number_t) \
(sizeof(x86_avx_state32_t)/sizeof(unsigned int)))

-typedef _STRUCT_X86_AVX512_STATE32 x86_avx512_state32_t;
-#define x86_AVX512_STATE32_COUNT ((mach_msg_type_number_t) \
- (sizeof(x86_avx512_state32_t)/sizeof(unsigned int)))
-
/*
* to be deprecated in the future
*/
@@ -228,10 +218,6 @@
#define x86_AVX_STATE64_COUNT ((mach_msg_type_number_t) \
(sizeof(x86_avx_state64_t)/sizeof(unsigned int)))

-typedef _STRUCT_X86_AVX512_STATE64 x86_avx512_state64_t;
-#define x86_AVX512_STATE64_COUNT ((mach_msg_type_number_t) \
- (sizeof(x86_avx512_state64_t)/sizeof(unsigned int)))
-
typedef _STRUCT_X86_EXCEPTION_STATE64 x86_exception_state64_t;
#define x86_EXCEPTION_STATE64_COUNT ((mach_msg_type_number_t) \
( sizeof (x86_exception_state64_t) / sizeof (int) ))
@@ -287,14 +273,6 @@
} ufs;
};

-struct x86_avx512_state {
- x86_state_hdr_t ash;
- union {
- x86_avx512_state32_t as32;
- x86_avx512_state64_t as64;
- } ufs;
-};
-
typedef struct x86_thread_state x86_thread_state_t;
#define x86_THREAD_STATE_COUNT ((mach_msg_type_number_t) \
( sizeof (x86_thread_state_t) / sizeof (int) ))
@@ -315,10 +293,6 @@
#define x86_AVX_STATE_COUNT ((mach_msg_type_number_t) \
(sizeof(x86_avx_state_t)/sizeof(unsigned int)))

-typedef struct x86_avx512_state x86_avx512_state_t;
-#define x86_AVX512_STATE_COUNT ((mach_msg_type_number_t) \
- (sizeof(x86_avx512_state_t)/sizeof(unsigned int)))
-
/*
* Machine-independent way for servers and Mach's exception mechanism to
* choose the most efficient state flavor for exception RPC's:
Loading

0 comments on commit f49171b

Please sign in to comment.