From e552f4d994879b62d1504cdc9a6fdb4fa226cc25 Mon Sep 17 00:00:00 2001 From: Iain Sandoe Date: Wed, 13 May 2015 23:37:03 +0100 Subject: [PATCH] 123.2.1 --- ld64/ChangeLog | 12 ++++++++++-- ld64/doc/man/man1/ld.1 | 8 ++++---- ld64/src/ld/Options.cpp | 6 ++++-- ld64/src/ld/OutputFile.cpp | 2 +- 4 files changed, 19 insertions(+), 9 deletions(-) diff --git a/ld64/ChangeLog b/ld64/ChangeLog index bc918bb..e2d1d2c 100644 --- a/ld64/ChangeLog +++ b/ld64/ChangeLog @@ -1,4 +1,12 @@ +-------- tagged ld64-123.2.1 + +2010-03-07 Nick Kledzik + + enable i386 ASLR + +-------- tagged ld64-123.2 + 2010-12-10 Nick Kledzik Man page typo: "dysmutil" under object_path_lto @@ -71,7 +79,7 @@ 2010-11-01 Nick Kledzik - Durango is missing dof sections for armv7 slice + -------- tagged ld64-120.3 @@ -544,7 +552,7 @@ 2010-06-09 Nick Kledzik - Barolo: 'rebase' makes timestamps invalid/unreadable for GDB + 2010-06-09 Nick Kledzik diff --git a/ld64/doc/man/man1/ld.1 b/ld64/doc/man/man1/ld.1 index d4d1329..c1aa2bc 100644 --- a/ld64/doc/man/man1/ld.1 +++ b/ld64/doc/man/man1/ld.1 @@ -1,4 +1,4 @@ -.Dd Sept 2, 2010 +.Dd March 7, 2011 .Dt ld 1 .Os Darwin .Sh NAME @@ -331,9 +331,9 @@ This option is also called -dylib_current_version for compatibility. This makes a special kind of main executable that is position independent (PIE). On Mac OS X 10.5 and later, the OS the OS will load a PIE at a random address each time it is executed. You cannot create a PIE from .o files compiled with -mdynamic-no-pic. That means the codegen is less optimal, but the address randomization adds some -security. When targeting Mac OS X 10.7 or later PIE is the default for x86_64 main executables. +security. When targeting Mac OS X 10.7 or later PIE is the default for main executables. .It Fl no_pie -Do not make a position independent executable (PIE). This is the default, except for x86_64 for 10.7 or later. +Do not make a position independent executable (PIE). This is the default, when targeting 10.6 and earlier. .It Fl pagezero_size Ar size By default the linker creates an unreadable segment starting at address zero named __PAGEZERO. Its existence will cause a bus error if a NULL pointer is dereferenced. The argument @@ -516,7 +516,7 @@ This option causes the linker to instead produce traditional relocation informat .It Fl allow_heap_execute Normally i386 main executables will be marked so that the Mac OS X 10.7 and later kernel will only allow pages with the x-bit to execute instructions. This option overrides that -behavior and allows instructions on any page to be run. +behavior and allows instructions on any page to be executed. .It Fl no_eh_labels Normally in -r mode, the linker produces .eh labels on all FDEs in the __eh_frame section. This option suppresses those labels. Those labels are not needed by the Mac OS X 10.6 diff --git a/ld64/src/ld/Options.cpp b/ld64/src/ld/Options.cpp index 1de3379..c06e1f3 100644 --- a/ld64/src/ld/Options.cpp +++ b/ld64/src/ld/Options.cpp @@ -3454,8 +3454,10 @@ void Options::reconfigureDefaults() fCanUseUpwardDylib = true; // x86_64 for MacOSX 10.7 defaults to PIE - if ( (fArchitecture == CPU_TYPE_X86_64) && (fOutputKind == kDynamicExecutable) && (fMacVersionMin >= ld::mac10_7) ) { - fPositionIndependentExecutable = true; + if ( ((fArchitecture == CPU_TYPE_X86_64) || (fArchitecture == CPU_TYPE_I386)) + && (fOutputKind == kDynamicExecutable) + && (fMacVersionMin >= ld::mac10_7) ) { + fPositionIndependentExecutable = true; } // armv7 for iOS4.3 defaults to PIE diff --git a/ld64/src/ld/OutputFile.cpp b/ld64/src/ld/OutputFile.cpp index bb368c2..963e9e5 100644 --- a/ld64/src/ld/OutputFile.cpp +++ b/ld64/src/ld/OutputFile.cpp @@ -2583,7 +2583,7 @@ void OutputFile::noteTextReloc(const ld::Atom* atom, const ld::Atom* target) if ( _options.warnAboutTextRelocs() ) warning("text reloc in %s to %s", atom->name(), target->name()); } - else if ( _options.positionIndependentExecutable() && (_options.iphoneOSVersionMin() >= ld::iPhone4_3) ) { + else if ( _options.positionIndependentExecutable() && ((_options.iphoneOSVersionMin() >= ld::iPhone4_3) || (_options.macosxVersionMin() >= ld::mac10_7)) ) { if ( ! this->pieDisabled ) { warning("PIE disabled. Absolute addressing (perhaps -mdynamic-no-pic) not allowed in code signed PIE, " "but used in %s from %s. " -- 2.11.4.GIT