Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 674617 Details for
Bug 693444
sys-devel/binutils-apple-8.2.1-r1: Gentoo Prefix bootstrap failure in stage 2 on macos Mojave 10.14.6
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Updated binutils-apple llvm prefix patch
binutils-apple-11.3.1-llvm-prefix.patch (text/plain), 10.82 KB, created by
Jacob Floyd
on 2020-11-24 05:49:49 UTC
(
hide
)
Description:
Updated binutils-apple llvm prefix patch
Filename:
MIME Type:
Creator:
Jacob Floyd
Created:
2020-11-24 05:49:49 UTC
Size:
10.82 KB
patch
obsolete
>Make LTO and LLVM support in cctools optional. >Try hard to find the llvm libraries and binaries in prefix. >Disable some curft that gets in the way. > >--- libstuff/llvm.c 2020-02-28 12:02:43.000000000 -0600 >+++ libstuff/llvm.c.nollvm 2020-11-23 15:48:27.000000000 -0600 >@@ -1,3 +1,5 @@ >+#ifdef LLVM_SUPPORT >+ > #include <stdio.h> > #include <stdlib.h> > #include <libc.h> >@@ -6,6 +8,7 @@ > #include "llvm-c/Disassembler.h" > #include "stuff/llvm.h" > #include "stuff/allocate.h" >+#include "stuff/execute.h" > #include <mach-o/dyld.h> > > /* >@@ -65,6 +68,12 @@ > if(llvm_handle == NULL){ > free(llvm_path); > llvm_path = NULL; >+ try_hard_to_find_llvm_tool_in_prefix(&llvm_path, "lib", LIB_LLVM); >+ llvm_handle = dlopen(llvm_path, RTLD_NOW); >+ } >+ if(llvm_handle == NULL){ >+ free(llvm_path); >+ llvm_path = NULL; > llvm_handle = dlopen("/Applications/Xcode.app/Contents/" > "Developer/Toolchains/XcodeDefault." > "xctoolchain/usr/lib/" LIB_LLVM, >@@ -202,3 +211,4 @@ > return(NULL); > return(version()); > } >+#endif /* LLVM_SUPPORT */ >\ No newline at end of file >--- libstuff/lto.c 2020-02-28 12:02:43.000000000 -0600 >+++ libstuff/lto.c.nollvm 2020-11-23 15:49:25.000000000 -0600 >@@ -9,6 +9,7 @@ > #include "stuff/ofile.h" > #include "stuff/lto.h" > #include "stuff/allocate.h" >+#include "stuff/execute.h" > #include <mach-o/nlist.h> > #include <mach-o/dyld.h> > >@@ -118,6 +119,12 @@ > if(lto_handle == NULL){ > free(lto_path); > lto_path = NULL; >+ try_hard_to_find_llvm_tool_in_prefix(<o_path, "lib", "libLTO.dylib"); >+ lto_handle = dlopen(lto_path, RTLD_NOW); >+ } >+ 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", >--- otool/arm64_disasm.c 2020-02-28 12:02:48.000000000 -0600 >+++ otool/arm64_disasm.c.nollvm 2020-11-23 15:51:19.000000000 -0600 >@@ -1,3 +1,4 @@ >+#ifdef LLVM_SUPPORT > #include <stdio.h> > #include <string.h> > #include <stdlib.h> >@@ -964,3 +965,4 @@ > printf("\t.long\t0x%08x\n", opcode); > return(4); > } >+#endif /* LLVM_SUPPORT */ >\ No newline at end of file >--- otool/i386_disasm.c 2020-02-28 12:02:48.000000000 -0600 >+++ otool/i386_disasm.c.nollvm 2020-11-23 15:51:19.000000000 -0600 >@@ -54,6 +54,7 @@ > NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION > WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. > */ >+#ifdef LLVM_SUPPORT > #include <stdio.h> > #include <stdlib.h> > #include <string.h> >@@ -5363,3 +5364,4 @@ > { > llvm_disasm_dispose(dc); > } >+#endif /* LLVM_SUPPORT */ >\ No newline at end of file >--- otool/arm_disasm.c 2020-02-28 12:02:48.000000000 -0600 >+++ otool/arm_disasm.c.nollvm 2020-11-23 15:51:19.000000000 -0600 >@@ -22,6 +22,7 @@ > USA. > */ > >+#ifdef LLVM_SUPPORT > #include <stdlib.h> > #include <string.h> > #include "stuff/arch.h" >@@ -5948,3 +5949,4 @@ > } > } > } >+#endif /* LLVM_SUPPORT */ >\ No newline at end of file >--- otool/main.c 2020-02-28 12:02:49.000000000 -0600 >+++ otool/main.c.nollvm 2020-11-23 16:10:10.000000000 -0600 >@@ -41,7 +41,9 @@ > #include "stuff/allocate.h" > #include "stuff/symbol.h" > #include "stuff/symbol.h" >+#ifdef LLVM_SUPPORT > #include "stuff/llvm.h" >+#endif /* LLVM_SUPPORT */ > #include "stuff/guess_short_name.h" > #include "stuff/execute.h" > #include "otool.h" >@@ -394,7 +396,7 @@ > uint32_t narch_flags; > enum bool all_archs, use_member_syntax, version; > char **files; >-#ifndef LLVM_OTOOL >+#if !defined(LLVM_OTOOL) && defined(LLVM_SUPPORT) > const char *disssembler_version; > #endif /* !defined(LLVM_OTOOL) */ > >@@ -433,7 +435,7 @@ > "llvm-otool(1):" > #endif /* LLVM_OTOOL */ > " Apple Inc. version %s\n", apple_version); >-#ifndef LLVM_OTOOL >+#if !defined(LLVM_OTOOL) && defined(LLVM_SUPPORT) > disssembler_version = llvm_disasm_version_string(); > if(disssembler_version != NULL) > fprintf(stderr, "disassmbler: %s\n", disssembler_version); >@@ -819,6 +821,8 @@ > objdump = cmd_with_prefix("objdump"); > if(stat(objdump, &stat_buf) == -1) > objdump = cmd_with_prefix("llvm-objdump"); >+ if(stat(objdump, &stat_buf) == -1) >+ try_hard_to_find_llvm_tool_in_prefix(&objdump, "bin", "llvm-objdump"); > > reset_execute_list(); > add_execute_list(objdump); >@@ -3945,19 +3949,23 @@ > uint64_t cur_addr; > unsigned short short_word; > unsigned char byte_word; >+#ifdef LLVM_SUPPORT > LLVMDisasmContextRef arm64_dc; > LLVMDisasmContextRef arm_dc, thumb_dc, i386_dc, x86_64_dc; >+#endif /* LLVM_SUPPORT */ > uint32_t n, ninsts; > struct inst *insts; > char *sect_start; > > host_byte_sex = get_host_byte_sex(); > swapped = host_byte_sex != object_byte_sex; >+#ifdef LLVM_SUPPORT > arm_dc = NULL; > thumb_dc = NULL; > i386_dc = NULL; > x86_64_dc = NULL; > arm64_dc = NULL; >+#endif /* LLVM_SUPPORT */ > n = 0; > ninsts = 0; > insts = NULL; >@@ -3994,6 +4002,7 @@ > cur_addr = addr; > sect_start = sect; > } >+#ifdef LLVM_SUPPORT > if(cputype == CPU_TYPE_ARM && > (cpusubtype == CPU_SUBTYPE_ARM_V7 || > cpusubtype == CPU_SUBTYPE_ARM_V7F || >@@ -4075,6 +4084,7 @@ > llvm_disasm_set_options(arm64_dc, > LLVMDisassembler_Option_PrintLatency); > } >+#endif /* LLVM_SUPPORT */ > if(gflag){ > ninsts = 100; > insts = allocate(sizeof(struct inst) * ninsts); >@@ -4120,6 +4130,7 @@ > nsorted_symbols, strings, strings_size, > indirect_symbols, nindirect_symbols, > load_commands, ncmds, sizeofcmds, verbose); >+#ifdef LLVM_SUPPORT > else if(cputype == CPU_TYPE_X86_64) > j = i386_disassemble(sect, (uint32_t)size - i, cur_addr, addr, > object_byte_sex, relocs, nrelocs, ext_relocs, >@@ -4130,6 +4141,7 @@ > load_commands, ncmds, sizeofcmds, verbose, > llvm_mc, i386_dc, x86_64_dc , object_addr, > object_size, &(insts[n]), NULL, 0); >+#endif /* LLVM_SUPPORT */ > else if(cputype == CPU_TYPE_MC680x0) > j = m68k_disassemble(sect, (uint32_t)size - i, > (uint32_t)cur_addr, (uint32_t)addr, >@@ -4144,6 +4156,7 @@ > object_byte_sex, relocs, nrelocs, symbols, > nsymbols, sorted_symbols, nsorted_symbols, > strings, strings_size, verbose); >+#ifdef LLVM_SUPPORT > else if(cputype == CPU_TYPE_I386) > j = i386_disassemble(sect, (uint32_t)size - i,cur_addr,addr, > object_byte_sex, relocs, nrelocs, ext_relocs, >@@ -4154,6 +4167,7 @@ > load_commands, ncmds, sizeofcmds, verbose, > llvm_mc, i386_dc, x86_64_dc, object_addr, > object_size, &(insts[n]), NULL, 0); >+#endif /* LLVM_SUPPORT */ > else if(cputype == CPU_TYPE_MC88000) > j = m88k_disassemble(sect, (uint32_t)size - i, > (uint32_t)cur_addr, (uint32_t)addr, >@@ -4183,6 +4197,7 @@ > strings, strings_size, indirect_symbols, > nindirect_symbols, load_commands, ncmds, > sizeofcmds, verbose); >+#ifdef LLVM_SUPPORT > else if(cputype == CPU_TYPE_ARM) > j = arm_disassemble(sect, (uint32_t)size - i, > (uint32_t)cur_addr, (uint32_t)addr, >@@ -4203,6 +4218,7 @@ > strings_size, indirect_symbols, nindirect_symbols, > cputype, load_commands, ncmds, sizeofcmds, > object_addr, object_size, verbose, arm64_dc); >+#endif /* LLVM_SUPPORT */ > > else{ > printf("Can't disassemble unknown cputype %d\n", cputype); >@@ -4250,6 +4266,7 @@ > cur_addr = insts[i].address; > offset = (uint32_t)(cur_addr - addr); > sect = sect_start + offset; >+#ifdef LLVM_SUPPORT > if(cputype == CPU_TYPE_X86_64 || cputype == CPU_TYPE_I386) > j = i386_disassemble(sect, (uint32_t)size - offset, > cur_addr, >@@ -4272,6 +4289,7 @@ > sizeofcmds, cpusubtype, verbose, arm_dc, > thumb_dc, object_addr, object_size, dices, > ndices, seg_addr, &(insts[i]), insts, n); >+#endif /* LLVM_SUPPORT */ > } > > /* Free up allocated space */ >@@ -4281,6 +4299,7 @@ > } > free(insts); > } >+#ifdef LLVM_SUPPORT > if(i386_dc != NULL) > delete_arm_llvm_disassembler(i386_dc); > if(x86_64_dc != NULL) >@@ -4291,6 +4310,7 @@ > delete_arm_llvm_disassembler(thumb_dc); > if(arm64_dc != NULL) > delete_arm64_llvm_disassembler(arm64_dc); >+#endif /* LLVM_SUPPORT */ > } > else{ > if(cputype == CPU_TYPE_I386 || cputype == CPU_TYPE_X86_64){ >--- as/driver.c 2020-11-23 15:28:19.000000000 -0600 >+++ as/driver.c.nollvm 2020-11-23 15:56:25.000000000 -0600 >@@ -296,6 +296,8 @@ > arch_flag.cputype == CPU_TYPE_ARM64_32 || > arch_flag.cputype == CPU_TYPE_ARM)){ > as = makestr(prefix, CLANG, NULL); >+ if(access(as, F_OK) != 0) >+ try_hard_to_find_llvm_tool_in_prefix(&as, "bin", CLANG); > if(access(as, F_OK) != 0){ > printf("%s: assembler (%s) not installed\n", progname, as); > exit(1); >--- libstuff/execute.c 2020-02-28 12:02:42.000000000 -0600 >+++ libstuff/execute.c.nollvm 2020-11-23 15:57:56.000000000 -0600 >@@ -194,4 +194,51 @@ > { > return(execute(runlist.strings, verbose)); > } >+/* try really, really hard to find an LLVM tool or library in prefix */ >+__private_extern__ >+void >+try_hard_to_find_llvm_tool_in_prefix( >+char **dest, >+const char *subdir, >+const char *file) >+{ >+ char *path; >+ int most_likely_llvm_major = 5; >+ int llvm_majors[][2] = { >+ /* llvm 3 and below weren't slotted */ >+ {most_likely_llvm_major, 4}, >+ {10, most_likely_llvm_major + 1} >+ }; >+ int i, j; >+ char buf[10]; >+ >+ if (strcmp("@GENTOO_PORTAGE_EPREFIX@", "") == 0) >+ return; >+ >+ /* prefer prefix /usr for llvm 3 and older as well as in case some >+ * gcc-config-ish scheme emrges for llvm as well */ >+ path = makestr("@GENTOO_PORTAGE_EPREFIX@/usr/", subdir, "/", file, NULL); >+ if (access(path, F_OK) == 0) { >+ *dest = path; >+ return; >+ } >+ >+ free(path); >+ >+ for (i = 0; i < sizeof(llvm_majors)/sizeof(llvm_majors[0]); ++i) { >+ for (j = llvm_majors[i][0]; j >= llvm_majors[i][1]; --j) { >+ snprintf(buf, sizeof(buf), "%d", j); >+ path = makestr("@GENTOO_PORTAGE_EPREFIX@/usr/lib/llvm/", buf, "/", subdir, "/", file, NULL); >+ if (access(path, F_OK) == 0) { >+ *dest = path; >+ return; >+ } >+ >+ free(path); >+ } >+ } >+ >+ /* not found, *dest untouched */ >+ return; >+} > #endif /* !defined(RLD) */ >--- otool/otool.h 2020-02-28 12:02:49.000000000 -0600 >+++ otool/otool.h.nollvm 2020-11-23 15:54:34.000000000 -0600 >@@ -29,7 +29,6 @@ > * @APPLE_LICENSE_HEADER_END@ > */ > #include <stuff/bool.h> >-#include "llvm-c/Disassembler.h" > > /* Name of this program for error messages (argv[0]) */ > extern char *progname; >--- include/stuff/execute.h 2020-02-28 12:02:40.000000000 -0600 >+++ include/stuff/execute.h.nollvm 2020-11-23 15:55:32.000000000 -0600 >@@ -47,3 +47,6 @@ > > __private_extern__ int execute_list( > int verbose); >+ >+__private_extern__ void try_hard_to_find_llvm_tool_in_prefix( >+ char **, const char *, const char *); >\ No newline at end of file >--- include/architecture/sparc/reg.h 2020-02-28 12:02:41.000000000 -0600 >+++ include/architecture/sparc/reg.h.nollvm 2020-11-23 15:54:20.000000000 -0600 >@@ -40,7 +40,8 @@ > * Usage is u.u_ar0[XX]. > */ > #define PSR (0) >-#define PC (1) >+/* not used anywhere and breaks llvm-c/Disassembler.h >+#define PC (1) */ > #define nPC (2) > #define SPARC_Y (3) > #define G1 (4)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 693444
:
589012
|
589014
|
589078
|
674602
|
674605
|
674608
|
674611
|
674614
| 674617 |
675244
|
675247
|
675292
|
675295
|
675376
|
675382
|
675385