[92367] trunk/dports/devel/ld64
jeremyhu at macports.org
jeremyhu at macports.org
Thu Apr 26 10:50:26 PDT 2012
Revision: 92367
https://trac.macports.org/changeset/92367
Author: jeremyhu at macports.org
Date: 2012-04-26 10:50:26 -0700 (Thu, 26 Apr 2012)
Log Message:
-----------
ld64: Add support for -no_pie for ld64-85
Modified Paths:
--------------
trunk/dports/devel/ld64/Portfile
Added Paths:
-----------
trunk/dports/devel/ld64/files/ld64-85-no_pie.patch
Modified: trunk/dports/devel/ld64/Portfile
===================================================================
--- trunk/dports/devel/ld64/Portfile 2012-04-26 15:38:09 UTC (rev 92366)
+++ trunk/dports/devel/ld64/Portfile 2012-04-26 17:50:26 UTC (rev 92367)
@@ -67,13 +67,14 @@
# isn't UsingTheRightCompiler. We could use it for Leopard/ppc, but
# I don't want to support too many different versions.
version 85.2.1
- revision 5
+ revision 6
checksums rmd160 42c80bd4ad6e9f96a757245e6a2b95084c009ff1 \
sha256 4bcbcbdfd62efdc46c51700b8f5dae2cbd1638e9e50f649d5c7f242d32fca804
supported_archs i386 ppc
patchfiles-delete ld64-pbxproj.patch ld64-version.patch
- patchfiles-append patch-MATH85-ld.cpp.diff ld64-85-pbxproj.patch ld64-85-version.patch
+ patchfiles-append patch-MATH85-ld.cpp.diff ld64-85-pbxproj.patch \
+ ld64-85-version.patch ld64-85-no_pie.patch
} elseif {${os.major} < 11} {
# XCode 3.2.6
# This was the last XCode release that supported building for ppc.
Added: trunk/dports/devel/ld64/files/ld64-85-no_pie.patch
===================================================================
--- trunk/dports/devel/ld64/files/ld64-85-no_pie.patch (rev 0)
+++ trunk/dports/devel/ld64/files/ld64-85-no_pie.patch 2012-04-26 17:50:26 UTC (rev 92367)
@@ -0,0 +1,75 @@
+diff -Naurp ld64-85.2.1.orig/doc/man/man1/ld.1 ld64-85.2.1/doc/man/man1/ld.1
+--- doc/man/man1/ld.1 2008-03-04 17:53:18.000000000 -0800
++++ doc/man/man1/ld.1 2012-04-26 10:24:00.000000000 -0700
+@@ -289,10 +289,12 @@ This option is also called -dylib_curren
+ .Ss Options when creating a main executable
+ .Bl -tag
+ .It Fl pie
+-This makes a special kind of main executable that is position independent (PIE). On Mac OS X 10.5, the OS
++This makes a special kind of main executable that is position independent (PIE). On Mac OS X 10.5 and later, 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.
++.It Fl no_pie
++Do not make a position independent executable (PIE). This is the default.
+ .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
+diff -Naurp ld64-85.2.1.orig/src/Options.cpp ld64-85.2.1/src/Options.cpp
+--- src/Options.cpp 2012-04-26 10:23:14.000000000 -0700
++++ src/Options.cpp 2012-04-26 10:38:20.000000000 -0700
+@@ -95,7 +95,8 @@ Options::Options(int argc, const char* a
+ fVerbose(false), fKeepRelocations(false), fWarnStabs(false),
+ fTraceDylibSearching(false), fPause(false), fStatistics(false), fPrintOptions(false),
+ fSharedRegionEligible(false), fPrintOrderFileStatistics(false),
+- fReadOnlyx86Stubs(false), fPositionIndependentExecutable(false), fMaxMinimumHeaderPad(false),
++ fReadOnlyx86Stubs(false), fPositionIndependentExecutable(false),
++ fDisablePositionIndependentExecutable(false), fMaxMinimumHeaderPad(false),
+ fDeadStripDylibs(false), fAllowTextRelocs(false), fWarnTextRelocs(false),
+ fUsingLazyDylibLinking(false), fEncryptable(true), fSaveTempFiles(false)
+ {
+@@ -2286,6 +2287,9 @@ void Options::parse(int argc, const char
+ else if ( strcmp(arg, "-pie") == 0 ) {
+ fPositionIndependentExecutable = true;
+ }
++ else if ( strcmp(arg, "-no_pie") == 0 ) {
++ fDisablePositionIndependentExecutable = true;
++ }
+ else if ( strncmp(arg, "-reexport-l", 11) == 0 ) {
+ FileInfo info = findLibrary(&arg[11], true);
+ info.options.fReExport = true;
+@@ -2614,6 +2618,11 @@ void Options::reconfigureDefaults()
+ }
+ break;
+ }
++ // temporary until projects adopt -no_pie
++ if ( getenv("LD_NO_PIE") != NULL ) {
++ warning("LD_NO_PIE being used to disble building a position independent executable");
++ fDisablePositionIndependentExecutable = true;
++ }
+
+ // disable implicit dylibs when targetting 10.3
+ // <rdar://problem/5451987> add option to disable implicit load commands for indirectly used public dylibs
+@@ -3050,7 +3059,11 @@ void Options::checkIllegalOptionCombinat
+ }
+ }
+
++ // -no_pie anywhere on command line disable PIE
++ if ( fDisablePositionIndependentExecutable )
++ fPositionIndependentExecutable = false;
++
+ // check -pie is only used when building a dynamic main executable for 10.5
+ if ( fPositionIndependentExecutable ) {
+ if ( fOutputKind != Options::kDynamicExecutable )
+ throw "-pie can only be used when linking a main executable";
+diff -Naurp ld64-85.2.1.orig/src/Options.h ld64-85.2.1/src/Options.h
+--- src/Options.h 2008-07-10 18:15:14.000000000 -0700
++++ src/Options.h 2012-04-26 10:24:46.000000000 -0700
+@@ -341,6 +341,7 @@ private:
+ bool fPrintOrderFileStatistics;
+ bool fReadOnlyx86Stubs;
+ bool fPositionIndependentExecutable;
++ bool fDisablePositionIndependentExecutable;
+ bool fMaxMinimumHeaderPad;
+ bool fDeadStripDylibs;
+ bool fAllowTextRelocs;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20120426/cd7ff867/attachment-0001.html>
More information about the macports-changes
mailing list