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]

darwin and pic/dynamic-no-pic


Since Apple does not provide static libraries and the pic references on
ppc are not done through RTOC and that pic is default on Darwin,
Apple came up with a way to do static (no-pic) like programs called
dynamic-no-pic but it never went into the FSF's gcc for some reason,
I do not know why but it looks stable to me. So I ripped it out and
patched the current mainline of the FSF's gcc (back in October and have
been updating it since) with it and it works.

I have bootstrapped with using the option -mdynamic-no-pic on and off
(Note I cannot bootstrap right now on darwin with c++ enabled,
the regression tester for the mainline just spewed a message at
Tue Mar 4, 2003  20:43:09 US/Pacific, but I have been bootstrapping
with this patch since October).
I cannot run the testsuite because there is a bug in Darwin's kernel
(unless it has been fixed in 6.4).
I have run SPEC 2000 with this patch and -mdynamic-no-pic enabled and
it ran with no miscompares.

Sorry that this patch is big.

Thanks,
Andrew Pinski
apinski at apple dot com

ChangeLog:
2002-11-04 Andrew Pinski <apinski at apple dot com>
* config/darwin.c (machopic_function_base_name): If dynamic-no-pic is
on should not get here. (machopic_indirect_data_reference): If
dynamic-no-pic is on just generate high/low parts of the address.
(machopic_legitimize_pic_address): Change MACHOPIC_PURE to
MACHOPIC_INDIRECT. Dynamic-no-pic uses 0 as the pic
base. Generate symbol and labels with a new reg.
Dynamic-no-pic does not have a pic_offset_table_rtx.
(machopic_select_section): Change references of flag_pic to
MACHOPIC_INDIRECT. (machopic_asm_out_constructor): Likewise.
(machopic_asm_out_destructor): Likewise.
* config/darwin.h (ASM_DECLARE_UNRESOLVED_REFERENCE): Change reference
of flag_pic to MACHOPIC_INDIRECT.
(MACHO_DYNAMIC_NO_PIC_P) Define as TARGET_DYNAMIC_NO_PIC.
(MACHOPIC_INDIRECT): Is also true when dynamic-no-pic is on.
(MACHOPIC_JUST_INDIRECT): Is also true when dynamic-no-pic is on.
(MACHOPIC_PURE): Is not pure when dynamic-no-pic is on.
* config/i386/darwin.h (MASK_MACHO_DYNAMIC_NO_PIC): Define as 0 for right
now as dynamic-no-pic is not implemented on Darwin/ia32.
* config/rs6000/darwin.h (MASK_MACHO_DYNAMIC_NO_PIC): Define.
(TARGET_DYNAMIC_NO_PIC): Define. (TARGET_DYNAMIC_NO_PIC): Define as (target_flags &
MASK_MACHO_DYNAMIC_NO_PIC)(SUBTARGET_SWITCHES): Define, have sub-target switches for
dynamic-no-pic. (SUBTARGET_OVERRIDE_OPTIONS): Move check for -fpic from
rs6000_override_options to here. Dynamic-no-pic overrides pic.(CC1_SPEC): Change
from not static then pic to not static and not dynamic-no-pic then pic.
* config/rs6000/rs6000.c (rs6000_override_options): Move the check for
-fpic and DARWIN_ABI to config/rs6000/darwin.h (rs6000_legiitimize_reload_address):
Add case for loading floating in dynamic-no-pic. (rs6000_emit_move): Add case for dynamic-no-pic.
(rs6000_emit_move): Change reference of flag_pic to MACHOPIC_INDIRECT.
(secondary_reload_class): Conditional change the reference of flag_pic to MACHOPIC_INDIRECT.
(rs6000_output_mi_thunk): Change reference of flag_pic to MACHOPIC_INDIRECT.
(output_profile_hook): Likewise. (machopic_output_stub): Non-pure (dynamic-no-pic) is now supported.
* config/rs6000/rs6000.md (movdf_low): Add the case for MACHO_DYNAMIC_NO_PIC_P.
(call): Change references for flag_pic in TARGET_MACHO to MACHOPIC_INDIRECT.
(SUBTARGET_OVERRIDE_OPTIONS): Add case where -fpic is on and -mdynamic-no-pic is on.
also the moved case for -fpic from rs6000.c
* doc/invoke.texi (dynamic-no-pic): Document.


Patch:

Attachment: dynamic-no-pic.nochanges.patch
Description: Binary data


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