Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 679937 Details for
Bug 762095
sys-devel/binutils-apple: fix llvm patches to avoid exec loop
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
modified llvm-shim patch
binutils-apple-11.3.1-llvm-shim.patch (text/plain), 4.03 KB, created by
Jacob Floyd
on 2020-12-28 02:41:37 UTC
(
hide
)
Description:
modified llvm-shim patch
Filename:
MIME Type:
Creator:
Jacob Floyd
Created:
2020-12-28 02:41:37 UTC
Size:
4.03 KB
patch
obsolete
>Provide a small shim binary that tries to find the actual tool and exec() it. >Prefers the llvm version but falls back to the classic version if necessary. > >--- cctools-895/misc/llvm-shim.c.orig 2017-12-26 14:10:13.019362000 +0100 >+++ cctools-895/misc/llvm-shim.c 2017-12-26 14:12:25.590790515 +0100 >@@ -0,0 +1,68 @@ >+#include <unistd.h> >+#include <string.h> >+#include "stuff/allocate.h" >+#include "stuff/execute.h" >+#include "stuff/errors.h" >+ >+/* used by system_fatal */ >+char *progname = NULL; >+ >+int main(int argc, char **argv) >+{ >+ char *prog2, *prog2_path; >+ >+ progname = argv[0]; >+ prog2 = strrchr(argv[0], '/'); >+ if (prog2 != NULL) >+ progname = prog2 + 1; >+ >+ /* looks like we've been called with CTARGET in our name - let's try to >+ * get rid of it */ >+ prog2 = strstr(progname, "-apple-darwin"); >+ if (prog2 != NULL) { >+ /* x86_64-apple-darwin16-nm >+ * ^ p */ >+ prog2 += strlen("-apple-darwin"); >+ >+ /* ^ */ >+ prog2 = strchr(prog2, '-'); >+ /* ^ */ >+ if (prog2 != NULL) { >+ /* ^ */ >+ progname = prog2+1; >+ } >+ } >+ >+ /* try ./llvm-<tool> */ >+ prog2 = makestr("llvm-", progname, NULL); >+ prog2_path = cmd_with_prefix(prog2); >+ if(access(prog2_path, F_OK) == -1) { >+ /* try to find llvm-<tool> in prefix (eg llvm-nm) */ >+ try_hard_to_find_llvm_tool_in_prefix(&prog2_path, "bin", prog2, argv[0]); >+ if (access(prog2_path, F_OK) == -1) { >+ /* try to find llvm's ./<tool> in prefix (eg dsymutil) */ >+ try_hard_to_find_llvm_tool_in_prefix(&prog2_path, "bin", progname, argv[0]); >+ if (access(prog2_path, F_OK) == -1) { >+ /* try ./<tool>-classic (eg nm-classic) */ >+ prog2 = makestr(progname, "-classic", NULL); >+ prog2_path = cmd_with_prefix(prog2); >+ if(access(prog2_path, F_OK) == -1) { >+ /* bail out */ >+ system_fatal("can't find: %s", progname); >+ } >+ } >+ } >+ } >+ >+ /* give the new program its full path in argv[0], just as if it had >+ * been called directly */ >+ argv[0] = prog2_path; >+ >+ /* will not normally return */ >+ execvp(prog2_path, argv); >+ >+ /* will exit(1) */ >+ system_fatal("can't exec: %s", progname); >+ >+ return 1; >+} >--- cctools-895/misc/Makefile.orig 2017-12-25 13:29:59.700143547 +0100 >+++ cctools-895/misc/Makefile 2017-12-25 13:33:18.817740929 +0100 >@@ -39,7 +39,7 @@ > LOCBINDIR = /usr/local/bin > LOCLIBDIR = /usr/local/lib > >-CFILES1 = libtool.c >+CFILES1 = libtool.c llvm-shim.c > CFILES2 = lipo.c size.c strings.c nm.c checksyms.c inout.c \ > indr.c strip.c segedit.c cmpdylib.c \ > pagestuff.c redo_prebinding.c seg_addr_table.c \ >@@ -53,6 +53,7 @@ > indr.NEW strip.NEW nmedit.NEW segedit.NEW cmpdylib.NEW \ > pagestuff.NEW redo_prebinding.NEW seg_addr_table.NEW check_dylib.NEW \ > seg_hack.NEW install_name_tool.NEW codesign_allocate.NEW \ >+ llvm-shim.NEW \ > ctf_insert.NEW bitcode_strip.NEW > > all: $(PROGS) lib_ofiles >@@ -246,6 +247,14 @@ > $(OFILE_DIR)/bitcode_strip.private.o > $(DSYMUTIL) $(SYMROOT)/bitcode_strip.NEW > >+llvm-shim.NEW: llvm-shim.o $(OBJROOT)/.created.dir.stamp $(SYMROOT)/.created.dir.stamp >+ $(CC) $(RC_CFLAGS) -nostdlib -r \ >+ -o $(OBJROOT)/llvm-shim.private.o \ >+ $(OFILE_DIR)/llvm-shim.o $(LIBSTUFF) >+ $(CC) $(RC_CFLAGS) $(SDK) -o $(SYMROOT)/llvm-shim.NEW \ >+ $(OFILE_DIR)/llvm-shim.private.o >+ $(DSYMUTIL) $(SYMROOT)/llvm-shim.NEW >+ > > clean: shlib_clean > -rm -f \ >@@ -271,6 +280,7 @@ > $(SYMROOT)/redo_prebinding.NEW \ > $(SYMROOT)/libredo_prebinding.a \ > $(SYMROOT)/cmpdylib.NEW \ >+ $(SYMROOT)/llvm-shim.NEW \ > $(SYMROOT)/bitcode_strip.NEW > > shlib_clean: >@@ -319,6 +329,7 @@ > $(OFILE_DIR)/cmpdylib.private.o \ > $(OFILE_DIR)/nmedit.private.o \ > $(OFILE_DIR)/strip.private.o \ >+ $(OFILE_DIR)/llvm-shim.private.o \ > $(OFILE_DIR)/bitcode_strip.private.o > -rm -f make.out > -rm -r -f *dSYM >@@ -360,6 +371,8 @@ > $(DSTROOT)$(USRBINDIR)/ctf_insert > install -m 555 $(SYMROOT)/bitcode_strip.NEW \ > $(DSTROOT)$(USRBINDIR)/bitcode_strip >+ install -m 555 $(SYMROOT)/llvm-shim.NEW \ >+ $(DSTROOT)$(USRBINDIR)/llvm-shim > $(MKDIRS) $(DSTROOT)$(LOCBINDIR) > install -m 555 $(SYMROOT)/checksyms.NEW \ > $(DSTROOT)$(LOCBINDIR)/checksyms
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 762095
:
679934
| 679937