This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Support -rdynamic on darwin12 and later


     The attached patch adds support for the -rdynamic compiler flag
on darwin12 and later. The darwin linker, starting with Xcode 5 on
darwin12, added support for the associated new -export_dynamic linker
flag.

     -export_dynamic
                 Preserves all global symbols in main executables
during LTO.  Without this option, Link Time Optimization is
                 allowed to inline and remove global functions. This
option is used when a main executable may load a plug-in
                 which requires certain symbols from the main executable.

This patch emulates the behavior of clang from Xcode 5 and later which
accepts the -rdynamic flag. Note that the emission of -export_dynamic
by -rdynamic is unaffected by the use of -mmacosx-version-min.
       These changes are achieved by the addition of rdynamic to
gcc/config/darwin.opt, addition of a   new gcc/config/darwin12.h file
with additional spec handling for rdynamic in LINK_GCC_C_SEQUENCE_SPEC
and changes to gcc/config.gcc to use this new file on darwin12 or
later. Bootstrap tested on both x86_64-apple-darwin11 and
x86_64-apple-darwin14. Confirmed that on darwin11, the -rdynamic flag
retains the current behavior of issuing the compiler error "error:
unrecognized command line option â-rdynamicâ". Confirmed that on
darwin12 and later, invoking -rdynamic emits the expected
-export_dynamc linker flag. Okay for gcc trunk?
            Jack

Attachment: darwin12_rdynamic.patch
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]