Skip to content
This repository has been archived by the owner on Sep 14, 2018. It is now read-only.

Commit

Permalink
ld64 253.3
Browse files Browse the repository at this point in the history
  • Loading branch information
tpoechtrager committed Oct 23, 2015
1 parent 65e0835 commit 2c4a250
Show file tree
Hide file tree
Showing 53 changed files with 5,069 additions and 755 deletions.
82 changes: 80 additions & 2 deletions .merge.log
Original file line number Diff line number Diff line change
@@ -1,4 +1,80 @@
## ld64-242 -> ld64-242.2 ##
## ld64 242.2 -> ld64 253.3 ##

patching file ./doc/man/man1/ld.1
can't find file to patch at input line 78
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff -Naur '--exclude=unit-tests' ../ld64-242.2/ld64.xcodeproj/project.pbxproj ./ld64.xcodeproj/project.pbxproj
|--- ../ld64-242.2/ld64.xcodeproj/project.pbxproj 2014-08-20 00:19:03.000000000 +0200
|+++ ./ld64.xcodeproj/project.pbxproj 2015-05-20 08:11:58.000000000 +0200
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.
22 out of 22 hunks ignored
patching file ./src/abstraction/MachOFileAbstraction.hpp
patching file ./src/create_configure
patching file ./src/ld/Bitcode.hpp
patching file ./src/ld/HeaderAndLoadCommands.hpp
patching file ./src/ld/InputFiles.cpp
Hunk #3 merged at 334.
Hunk #10 merged at 858, NOT MERGED at 861-870.
patching file ./src/ld/LinkEdit.hpp
patching file ./src/ld/LinkEditClassic.hpp
patching file ./src/ld/Options.cpp
Hunk #1 merged at 39-40, NOT MERGED at 47-54.
Hunk #18 NOT MERGED at 1958-1962.
patching file ./src/ld/Options.h
Hunk #13 merged at 481.
patching file ./src/ld/OutputFile.cpp
patching file ./src/ld/OutputFile.h
patching file ./src/ld/Resolver.cpp
patching file ./src/ld/Resolver.h
patching file ./src/ld/SymbolTable.cpp
patching file ./src/ld/SymbolTable.h
patching file ./src/ld/code-sign-blobs/memutils.h
Hunk #1 NOT MERGED at 56-66.
patching file ./src/ld/ld.cpp
patching file ./src/ld/ld.hpp
Hunk #1 merged at 35-36,38,45-47.
The next patch would delete the file ./src/ld/lto_file.hpp,
which does not exist! Assume -R? [n]
Apply anyway? [n]
Skipping patch.
1 out of 1 hunk ignored
patching file ./src/ld/parsers/lto_file.cpp
Hunk #1 merged at 39.
Hunk #9 NOT MERGED at 551-558.
patching file ./src/ld/parsers/lto_file.h
patching file ./src/ld/parsers/macho_dylib_file.cpp
patching file ./src/ld/parsers/macho_relocatable_file.cpp
Hunk #1 merged at 45,51.
patching file ./src/ld/parsers/macho_relocatable_file.h
patching file ./src/ld/parsers/opaque_section_file.cpp
patching file ./src/ld/parsers/textstub_dylib_file.cpp
patching file ./src/ld/parsers/textstub_dylib_file.hpp
patching file ./src/ld/passes/bitcode_bundle.cpp
patching file ./src/ld/passes/bitcode_bundle.h
patching file ./src/ld/passes/branch_island.cpp
Hunk #1 NOT MERGED at 555-559.
patching file ./src/ld/passes/branch_shim.cpp
patching file ./src/ld/passes/dylibs.cpp
patching file ./src/ld/passes/got.cpp
patching file ./src/ld/passes/huge.cpp
patching file ./src/ld/passes/objc.cpp
patching file ./src/ld/passes/order.cpp
patching file ./src/ld/passes/stubs/stub_arm.hpp
patching file ./src/ld/passes/stubs/stub_arm64.hpp
patching file ./src/ld/passes/stubs/stubs.cpp
patching file ./src/ld/passes/tlvp.cpp
patching file ./src/other/ObjectDump.cpp
patching file ./src/other/dyldinfo.cpp
Hunk #10 NOT MERGED at 1892-1895.

--------------------------------------------------------------------------------------------------------------------------------------------------------------

## ld64 242 -> ld64 242.2 ##

patching file ./src/ld/passes/branch_island.cpp
patching file ./src/ld/passes/compact_unwind.cpp
Expand All @@ -16,6 +92,8 @@ Skip this patch? [y]
Skipping patch.
1 out of 1 hunk ignored

--------------------------------------------------------------------------------------------------------------------------------------------------------------

## cctools 862 -> 870 ##

patching file ./as/arm.c
Expand Down Expand Up @@ -83,7 +161,7 @@ patching file ./otool/otool.h
patching file ./otool/print_objc2_32bit.c
patching file ./otool/print_objc2_64bit.c

## ld64-241.9 -> ld64-242 ##
## ld64 241.9 -> ld64 242 ##

can't find file to patch at input line 4
Perhaps you used the wrong -p or --strip option?
Expand Down
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ compiler:
- clang

before_install:
- if [ $TRAVIS_OS_NAME == linux ]; then sudo apt-get update -qq && sudo apt-get install -y gcc g++ gobjc llvm-dev; fi
- if [ $TRAVIS_OS_NAME == linux ]; then sudo apt-get update -qq && sudo apt-get install -y gcc-4.7 g++-4.7 gobjc llvm-dev; fi
- if [ $CXX == "g++" ]; then export CC=gcc-4.7 && export CXX=g++-4.7; fi

script:
- cd cctools && ./autogen.sh && ./configure && make
19 changes: 15 additions & 4 deletions cctools/configure.ac
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
AC_INIT([cctools], [870], [t.poechtrager@gmail.com])
AC_INIT([cctools], [877.5], [t.poechtrager@gmail.com])

AC_CANONICAL_BUILD
AC_CANONICAL_HOST
Expand Down Expand Up @@ -259,11 +259,12 @@ AC_SUBST(DL_LIB)
AC_CHECK_LIB([pthread],[pthread_create],[PTHREAD_FLAGS=-pthread])
AC_SUBST(PTHREAD_FLAGS)

AC_CHECK_LIB([execinfo],[backtrace],[DL_LIB=-lexecinfo])
AC_CHECK_HEADERS([execinfo.h], [
AC_CHECK_LIB([execinfo],[backtrace],[EXECINFO_LIB=-lexecinfo])], [])
AC_SUBST(EXECINFO_LIB)

AC_CHECK_HEADERS([uuid/uuid.h], [
AC_CHECK_LIB([uuid],[uuid_generate_random],[UUID_LIB=-luuid])], [])
AC_CHECK_LIB([uuid],[uuid_generate_random],[
AC_CHECK_HEADERS([uuid/uuid.h], [UUID_LIB=-luuid])], [])
AC_SUBST(UUID_LIB)

AC_CHECK_FUNCS([strmode])
Expand Down Expand Up @@ -313,6 +314,16 @@ CHECK_LLVM

LDFLAGS="$LDFLAGS $LTO_RPATH"

### Check for libxar ###

if test "x$LLVM_CONFIG" != "xno"; then

AC_CHECK_LIB([xar],[xar_prop_create],[
AC_CHECK_HEADERS([xar/xar.h], [XAR_LIB=-lxar])], [])
AC_SUBST(XAR_LIB)

fi

### Check endianness ###

AC_C_BIGENDIAN([AC_SUBST([ENDIAN_FLAG],[-D__BIG_ENDIAN__=1])],
Expand Down
32 changes: 30 additions & 2 deletions cctools/ld64/doc/man/man1/ld.1
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ Produce a mach-o dylinker that has file type MH_DYLINKER. Only used when buildi
The default. Implied by -dylib, -bundle, or -execute
.It Fl static
Produces a mach-o file that does not use the dyld. Only used building the kernel.
.It Fl preload
Produces a mach-o file in which the mach_header, load commands, and symbol table are
not in any segment. This output type is used for firmware or embedded development
where the segments are copied out of the mach-o into ROM/Flash.
.It Fl arch Ar arch_name
Specifies which architecture (e.g. ppc, ppc64, i386, x86_64) the output file should be.
.It Fl o Ar path
Expand Down Expand Up @@ -480,6 +484,7 @@ Logs a chain of references to
.Ar symbol_name .
Only applicable with -dead_strip .
It can help debug why something that you think should be dead strip removed is not removed.
See -exported_symbols_list for syntax and use of wildcards.
.It Fl print_statistics
Logs information about the amount of memory and time the linker used.
.It Fl t
Expand Down Expand Up @@ -515,10 +520,31 @@ contains a list of non-global symbol names that should be remain in the output f
symbol names will be removed from the output file's symbol table. See -exported_symbols_list for syntax and use
of wildcards.
.El
.Ss Options for Bitcode build flow
.Bl -tag
.It Fl bitcode_bundle
Generates an embedded bitcode bundle in the output binary. The bitcode bundle is embedded in __LLVM, __bundle section.
This option requires all the object files, static libraries and user frameworks/dylibs contain bitcode.
Note: not all the linker options are supported to use together with -bitcode_bundle.
.It Fl bitcode_hide_symbol
Specifies this option together with -bitcode_bundle to hide all non-exported symbols from output bitcode bundle.
The hide symbol process might not be reversible. To obtain a reverse mapping file to recover all the symbols, use
-bitcode_symbol_map option.
.It Fl bitcode_symbol_map Ar path
Specifies the output for bitcode symbol reverse mapping (.bcsymbolmap). If
.Ar path
is an existing directory, UUID.bcsymbolmap will be written to that directory.
Otherwise, the reverse map will be written to a file at
.Ar path .
.El
.Ss Rarely used Options
.Bl -tag
.It Fl v
Prints the version of the linker.
.It Fl dirty_data_list Ar filename
Specifies a file containing the names of data symbols likely to be dirtied.
If the linker is creating a __DATA_DIRTY segment, those symbols will be moved
to that segment.
.It Fl move_to_rw_segment Ar segment_name Ar filename
Moves data symbols to another segment. The command line option specifies the
target segment name and a path to a file containing a list of symbols to move.
Expand Down Expand Up @@ -738,6 +764,10 @@ info in the temporary object file.
During development, this option can be used to space out all global variables so each is on a separate page.
This is useful when analyzing dirty and resident pages. The information can then be used to create an
order file to cluster commonly used/dirty globals onto the same page(s).
.It Fl not_for_dyld_shared_cache
Normally, the linker will add extra info to dylibs with -install_name starting with /usr/lib or
/System/Library/ that allows the dylib to be placed into the dyld shared cache. Adding this option
tells the linker to not add that extra info.
.El
.Ss Obsolete Options
.Bl -tag
Expand All @@ -749,8 +779,6 @@ Object files (MH_OBJECT) with a LINKEDIT segment are no longer supported. This o
This is the default. This option is obsolete.
.It Fl fvmlib
Fixed VM shared libraries (MH_FVMLIB) are no longer supported. This option is obsolete.
.It Fl preload
Preload executables (MH_PRELOAD) are no longer supported.
.It Fl sectobjectsymbols Ar segname Ar sectname
Adding a local label at a section start is no longer supported. This option is obsolete.
.It Fl nofixprebinding
Expand Down
41 changes: 24 additions & 17 deletions cctools/ld64/src/3rd/helper.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const char ldVersionString[] = "242.2\n";
const char ldVersionString[] = "253.3\n";

#ifndef __APPLE__

Expand Down Expand Up @@ -41,7 +41,6 @@ void __assert_rtn(const char *func, const char *file, int line, const char *msg)
#endif /* __FreeBSD__ */
}


int _NSGetExecutablePath(char *epath, unsigned int *size)
{
#if defined(__FreeBSD__) || defined(__DragonFly__)
Expand Down Expand Up @@ -72,23 +71,29 @@ int _NSGetExecutablePath(char *epath, unsigned int *size)
if (sysctl(mib, 4, argv, &len, NULL, 0) < 0)
abort();
comm = argv[0];
if (*comm == '/' || *comm == '.') {
if (*comm == '/' || *comm == '.')
{
char *rpath;
if ((rpath = realpath(comm, NULL))) {
if ((rpath = realpath(comm, NULL)))
{
strlcpy(epath, rpath, *size);
free(rpath);
ok = 1;
}
} else {
}
else
{
char *sp;
char *xpath = strdup(getenv("PATH"));
char *path = strtok_r(xpath, ":", &sp);
struct stat st;
if (!xpath)
abort();
while (path) {
while (path)
{
snprintf(epath, *size, "%s/%s", path, comm);
if (!stat(epath, &st) && (st.st_mode & S_IXUSR)) {
if (!stat(epath, &st) && (st.st_mode & S_IXUSR))
{
ok = 1;
break;
}
Expand All @@ -97,7 +102,8 @@ int _NSGetExecutablePath(char *epath, unsigned int *size)
free(xpath);
}
free(argv);
if (ok) {
if (ok)
{
*size = strlen(epath);
return 0;
}
Expand All @@ -117,7 +123,7 @@ int _NSGetExecutablePath(char *epath, unsigned int *size)
#endif
}

int _dyld_find_unwind_sections(void* i, struct dyld_unwind_sections* sec)
int _dyld_find_unwind_sections(void *i, struct dyld_unwind_sections* sec)
{
return 0;
}
Expand All @@ -127,23 +133,24 @@ mach_port_t mach_host_self(void)
return 0;
}

kern_return_t host_statistics ( host_t host_priv, host_flavor_t flavor, host_info_t host_info_out, mach_msg_type_number_t *host_info_outCnt)
kern_return_t host_statistics(host_t host_priv, host_flavor_t flavor,
host_info_t host_info_out,
mach_msg_type_number_t *host_info_outCnt)
{
return ENOTSUP;
}

uint64_t mach_absolute_time(void)
uint64_t mach_absolute_time(void)
{
uint64_t t = 0;
struct timeval tv;
if (gettimeofday(&tv,NULL)) return t;
t = ((uint64_t)tv.tv_sec << 32) | tv.tv_usec;
return t;
if (gettimeofday(&tv, NULL))
return 0;
return (tv.tv_sec*1000000ULL)+tv.tv_usec;
}

kern_return_t mach_timebase_info( mach_timebase_info_t info)
kern_return_t mach_timebase_info(mach_timebase_info_t info)
{
info->numer = 1;
info->numer = 1000;
info->denom = 1;
return 0;
}
Expand Down
5 changes: 5 additions & 0 deletions cctools/ld64/src/3rd/helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ extern "C" {
#define __USE_GNU
#endif

#ifndef __APPLE__
typedef char uuid_string_t__[37];
#define uuid_string_t uuid_string_t__
#endif

#include <dlfcn.h>

struct dyld_unwind_sections
Expand Down
8 changes: 4 additions & 4 deletions cctools/ld64/src/3rd/include/CommonCrypto/CommonDigest.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ static int CC_MD5_Init(CC_MD5_CTX *c) {
return 1;
}

static int CC_MD5_Update(CC_MD5_CTX *c, const unsigned char *data,
static int CC_MD5_Update(CC_MD5_CTX *c, const void *data,
unsigned long nbytes) {
assert(nbytes <= 0x7fffffff && "would overflow");
md5_append(c, data, nbytes);
md5_append(c, (const unsigned char*)data, nbytes);
return 1;
}

Expand All @@ -28,8 +28,8 @@ static int CC_MD5_Final(unsigned char digest[CC_MD5_DIGEST_LENGTH],
return 1;
}

static unsigned char *CC_MD5(const unsigned char *data,
unsigned long nbytes, unsigned char *md) {
static unsigned char *CC_MD5(const void *data, unsigned long nbytes,
unsigned char *md) {
static unsigned char smd[CC_MD5_DIGEST_LENGTH];

if (!md)
Expand Down
Loading

0 comments on commit 2c4a250

Please sign in to comment.