Skip to content

Commit

Permalink
ld64 with ppc
Browse files Browse the repository at this point in the history
  • Loading branch information
iains committed Jul 3, 2019
2 parents 0a6ebd8 + b852e0d commit 2932bca
Show file tree
Hide file tree
Showing 1,260 changed files with 104,617 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ld64/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
build
DerivedData
367 changes: 367 additions & 0 deletions ld64/APPLE_LICENSE

Large diffs are not rendered by default.

51 changes: 51 additions & 0 deletions ld64/compile_stubs
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/bin/csh

# Attempt to find the architecture.
# First look through the command line args.
set arch=unknown
set link_cmd=(`cat link_command`)
while ( $#link_cmd > 0 )
if ( "$link_cmd[1]" == "-arch" ) then
set arch=$link_cmd[2]
endif
shift link_cmd
end

# look for an explicit arch file
if ( "$arch" == "unknown" ) then
if ( -e arch ) then
set arch=`cat arch`
endif
endif

if ( "$arch" == "unknown" ) then
echo "***** Unable to determine architecture."
exit 1
endif

# Create .dylibs for each file in the dylib_stubs directory.
if ( -e dylib_stubs ) then
set files=`cd dylib_stubs ; echo *`
mkdir -p dylibs
foreach file ($files)
if ( ! -e dylibs/$file ) then
clang -arch $arch -c -fno-builtin -o tmp_object.o -x c dylib_stubs/$file
ld -arch $arch -dylib -macosx_version_min 10.1 -no_version_load_command -o dylibs/$file tmp_object.o
endif
end
endif

# Create .frameworks for each file in the framework_stubs directory.
if ( -e framework_stubs ) then
set files=`cd framework_stubs ; echo *`
foreach file ($files)
if ( ! -e frameworks/$file.framework ) then
clang -arch $arch -c -fno-builtin -o tmp_object.o -x c framework_stubs/$file
mkdir -p frameworks/$file.framework
ld -arch $arch -dylib -macosx_version_min 10.1 -no_version_load_command -o frameworks/$file.framework/$file tmp_object.o
endif
end
endif

# Clean up.
rm -f tmp_object.o
Binary file added ld64/doc/design/bindings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ld64/doc/design/hello.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
423 changes: 423 additions & 0 deletions ld64/doc/design/linker.html

Large diffs are not rendered by default.

53 changes: 53 additions & 0 deletions ld64/doc/man/man1/dyldinfo.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
.Dd November 10, 2010
.Dt dyldinfo 1
.Os Darwin
.Sh NAME
.Nm dyldinfo
.Nd "Displays information used by dyld in an executable"
.Sh SYNOPSIS
.Nm
.Op Fl arch Ar arch-name
.Op Fl dylibs
.Op Fl rebase
.Op Fl bind
.Op Fl weak_bind
.Op Fl lazy_bind
.Op Fl export
.Op Fl opcodes
.Op Fl function_starts
.Ar file(s)
.Sh DESCRIPTION
Executables built for Mac OS X 10.6 and later have a new format for the
information in the __LINKEDIT segment. The dyldinfo tool will display
that information.
.Pp
The options are as follows:
.Bl -tag -width indent
.It Fl arch Ar arch
Only display the specified architecture. Other architectures in a universal image are ignored.
.It Fl dylibs
Display the table of dylibs on which this image depends.
.It Fl rebase
Display the table of rebasing information. Rebasing is what dyld does when an image is
not loaded at its preferred address. Typically, this involves updating pointers in the __DATA
segment which point within the image.
.It Fl bind
Display the table of binding information. These are the symbolic fix ups that dyld must
do when an image is loaded.
.It Fl weak_bind
Display the table of weak binding information. Typically, only C++ progams will have any
weak binding. These are symbols which dyld must unique accross all images.
.It Fl lazy_bind
Display the table of lazy binding information. These are symbols which dyld delays binding
until they are first used. Lazy binding is automatically used for all function calls to
functions in some external dylib.
.It Fl export
Display the table symbols which this image exports.
.It Fl opcodes
Display the low level opcodes used to encode all rebase and binding information.
.It Fl function_starts
Decodes the list of function start addresses.
.El
.Sh SEE ALSO
.Xr otool 1
.Xr nm 1
Loading

0 comments on commit 2932bca

Please sign in to comment.