Skip to content

Commit a93872b

Browse files
gcc-5488
Imported from gcc-5488.tar.gz
1 parent fbe5be5 commit a93872b

File tree

15 files changed

+321
-33
lines changed

15 files changed

+321
-33
lines changed

gcc/ChangeLog.apple

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,47 @@
1+
2008-07-15 Josh Conner <[email protected]>
2+
3+
Radar 6067743
4+
* config/arm/arm.c (arm_reorg): Move label pad logic into...
5+
(get_label_pad): ...here...
6+
(create_fix_barrier): ...and call it here, too.
7+
8+
2008-06-30 Josh Conner <[email protected]>
9+
10+
Radar 6040239
11+
* config.gcc: Split powerpc-darwin logic into <=9 and >=10
12+
cases.
13+
* config/rs6000/t-darwin (MULTILIB_EXTRA_OPTS): Move to...
14+
* config/rs6000/t-darwin10 (MULTILIB_EXTRA_OPTS): ...here.
15+
16+
2008-06-23 Josh Conner <[email protected]>
17+
18+
Radar 6008578
19+
* final.c (label_to_max_skip): New function.
20+
* output.h (label_to_max_skip): New proto.
21+
* config/arm/arm.c (arm_reorg): Consider alignment of labels.
22+
(arm_function_boundary): New function...
23+
* config/arm/arm.h (FUNCTION_BOUNDARY): ...use it.
24+
25+
2008-05-15 Josh Conner <[email protected]>
26+
27+
Radar 5920116
28+
* config/arm/arm.c (arm_output_mi_thunk): Add longcall
29+
handling. When indirecting, use a non-lazy ptr for weak
30+
calls.
31+
32+
2008-05-08 Josh Conner <[email protected]>
33+
34+
Radar 5901604
35+
* config/rs6000/t-darwin (MULTILIB_EXTRA_OPTS): Define.
36+
37+
2008-05-08 Josh Conner <[email protected]>
38+
39+
Radar 5914860
40+
* config/arm/t-darwin (MULTILIB_OPTIONS, MULTILIB_DIRNAMES):
41+
Add armv6.
42+
(TARGET_LIBGCC2_CFLAGS): Remove armv6.
43+
(DARWIN_EXTRA_CRT_BUILD_FLAGS): Remove.
44+
145
2008-05-02 Josh Conner <[email protected]>
246

347
Radar 5905142

gcc/config.gcc

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1615,8 +1615,14 @@ powerpc-*-darwin*)
16151615
extra_parts="${extra_parts} crt2.o"
16161616
# APPLE LOCAL end mainline candidate 2006-06-22 4512244
16171617
case ${target} in
1618+
# APPLE LOCAL begin 5901604
1619+
*-darwin1[0-9]*)
1620+
tmake_file="${tmake_file} rs6000/t-darwin8 rs6000/t-darwin10"
1621+
tm_file="${tm_file} rs6000/darwin8.h"
1622+
;;
1623+
# APPLE LOCAL end 5901604
16181624
# APPLE LOCAL begin mainline 2005-09-01 3449986
1619-
*-darwin1[0-9]* | *-darwin[8-9]*)
1625+
*-darwin[8-9]*)
16201626
tmake_file="${tmake_file} rs6000/t-darwin8"
16211627
tm_file="${tm_file} rs6000/darwin8.h"
16221628
;;

gcc/config/arm/arm.c

Lines changed: 87 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,8 @@ static unsigned HOST_WIDE_INT arm_shift_truncation_mask (enum machine_mode);
237237
static bool arm_cannot_force_const_mem (rtx x);
238238
/* APPLE LOCAL ARM 5602348 */
239239
static rtx arm_delegitimize_address (rtx);
240+
/* APPLE LOCAL ARM 6008578 */
241+
static HOST_WIDE_INT get_label_pad (rtx, HOST_WIDE_INT);
240242

241243
/* Initialize the GCC target structure. */
242244
#if TARGET_DLLIMPORT_DECL_ATTRIBUTES
@@ -8522,6 +8524,11 @@ create_fix_barrier (Mfix *fix, HOST_WIDE_INT max_address)
85228524
/* Count the length of this insn. */
85238525
count += get_attr_length (from);
85248526

8527+
/* APPLE LOCAL begin ARM 6008578 */
8528+
if (LABEL_P (from))
8529+
count += get_label_pad (from, fix->address + count);
8530+
/* APPLE LOCAL end ARM 6008578 */
8531+
85258532
/* If there is a jump table, add its length. */
85268533
tmp = is_jump_table (from);
85278534
if (tmp != NULL)
@@ -8967,6 +8974,37 @@ static int clear_npools (void **slot, void *info ATTRIBUTE_UNUSED)
89678974
/* APPLE LOCAL end ARM strings in code */
89688975
/* APPLE LOCAL end ARM 20060306 merge these from mainline */
89698976

8977+
/* APPLE LOCAL begin ARM 6008578 */
8978+
/* Return the bytes of padding that will be inserted to align
8979+
the label INSN given the current pc ADDRESS. */
8980+
static HOST_WIDE_INT
8981+
get_label_pad (rtx insn, HOST_WIDE_INT address)
8982+
{
8983+
int label_align, max_skip;
8984+
unsigned HOST_WIDE_INT align_mask;
8985+
int pad_needed;
8986+
8987+
gcc_assert (LABEL_P (insn));
8988+
8989+
label_align = label_to_alignment (insn);
8990+
max_skip = label_to_max_skip (insn);
8991+
align_mask = ((unsigned int) 1 << label_align) - 1;
8992+
8993+
/* Already aligned. */
8994+
if ((address & align_mask) == 0)
8995+
return 0;
8996+
8997+
pad_needed = ((address | align_mask) + 1) - address;
8998+
8999+
/* We would have to insert more than max_skip bytes to
9000+
align this label. */
9001+
if (max_skip && (pad_needed > max_skip))
9002+
return 0;
9003+
9004+
return pad_needed;
9005+
}
9006+
/* APPLE LOCAL end ARM 6008578 */
9007+
89709008
/* Gcc puts the pool in the wrong place for ARM, since we can only
89719009
load addresses a limited distance around the pc. We do some
89729010
special munging to move the constant pool values to the correct
@@ -9008,6 +9046,10 @@ arm_reorg (void)
90089046

90099047
if (GET_CODE (insn) == BARRIER)
90109048
push_minipool_barrier (insn, address);
9049+
/* APPLE LOCAL begin ARM 6008578 */
9050+
else if (LABEL_P (insn))
9051+
address += get_label_pad (insn, address);
9052+
/* APPLE LOCAL end ARM 6008578 */
90119053
else if (INSN_P (insn))
90129054
{
90139055
rtx table;
@@ -15992,41 +16034,44 @@ arm_output_mi_thunk (FILE *file, tree thunk ATTRIBUTE_UNUSED,
1599216034
HOST_WIDE_INT vcall_offset ATTRIBUTE_UNUSED,
1599316035
tree function)
1599416036
{
16037+
/* APPLE LOCAL begin ARM 4620953 4745175 5920116 */
1599516038
static int thunk_label = 0;
1599616039
char label[256];
15997-
/* APPLE LOCAL ARM mainline 2006-07-25 4620953 */
1599816040
char labelpc[256];
1599916041
int mi_delta = delta;
1600016042
const char *const mi_op = mi_delta < 0 ? "sub" : "add";
1600116043
int shift = 0;
1600216044
int this_regno = (aggregate_value_p (TREE_TYPE (TREE_TYPE (function)), function)
1600316045
? 1 : 0);
16004-
/* APPLE LOCAL begin ARM 4745175 */
1600516046
rtx function_rtx = XEXP (DECL_RTL (function), 0);
1600616047
const char *function_name;
16048+
bool is_longcall = arm_is_longcall_p (function_rtx,
16049+
SYMBOL_REF_FLAGS (function_rtx),
16050+
1);
16051+
bool is_indirected = false;
1600716052

1600816053
/* Darwin/mach-o: use a stub for dynamic references. */
1600916054
#if TARGET_MACHO
1601016055
if (TARGET_MACHO
16011-
&& (flag_pic || MACHO_DYNAMIC_NO_PIC_P)
16012-
&& ! machopic_data_defined_p (function_rtx))
16013-
function_name =
16014-
machopic_indirection_name (function_rtx, true);
16056+
&& MACHOPIC_INDIRECT
16057+
&& (! machopic_data_defined_p (function_rtx)))
16058+
{
16059+
function_name = machopic_indirection_name (function_rtx, !is_longcall);
16060+
is_indirected = true;
16061+
}
1601516062
else
1601616063
#endif
1601716064
function_name = XSTR (function_rtx, 0);
16018-
/* APPLE LOCAL end ARM 4745175 */
1601916065

1602016066
if (mi_delta < 0)
1602116067
mi_delta = - mi_delta;
16022-
if (TARGET_THUMB)
16068+
if (TARGET_THUMB || is_longcall)
1602316069
{
1602416070
int labelno = thunk_label++;
1602516071
ASM_GENERATE_INTERNAL_LABEL (label, "LTHUMBFUNC", labelno);
1602616072
fputs ("\tldr\tr12, ", file);
1602716073
assemble_name (file, label);
1602816074
fputc ('\n', file);
16029-
/* APPLE LOCAL begin ARM mainline 2006-07-25 4620953 */
1603016075
if (flag_pic)
1603116076
{
1603216077
/* If we are generating PIC, the ldr instruction below loads
@@ -16044,7 +16089,8 @@ arm_output_mi_thunk (FILE *file, tree thunk ATTRIBUTE_UNUSED,
1604416089
fputs (":\n", file);
1604516090
fputs ("\tadd\tr12, pc, r12\n", file);
1604616091
}
16047-
/* APPLE LOCAL end ARM mainline 2006-07-25 4620953 */
16092+
if (is_indirected)
16093+
fputs ("\tldr\tr12, [r12]\n", file);
1604816094
}
1604916095
while (mi_delta != 0)
1605016096
{
@@ -16059,29 +16105,25 @@ arm_output_mi_thunk (FILE *file, tree thunk ATTRIBUTE_UNUSED,
1605916105
shift += 8;
1606016106
}
1606116107
}
16062-
if (TARGET_THUMB)
16108+
if (TARGET_THUMB || is_longcall)
1606316109
{
1606416110
fprintf (file, "\tbx\tr12\n");
1606516111
ASM_OUTPUT_ALIGN (file, 2);
1606616112
assemble_name (file, label);
1606716113
fputs (":\n", file);
16068-
/* APPLE LOCAL begin ARM mainline 2006-07-25 4620953 */
1606916114
if (flag_pic)
1607016115
{
16071-
/* APPLE LOCAL begin ARM 4745175 */
16072-
/* If we're branching to a local routine, output:
16116+
/* If we're branching to a local Thumb routine, output:
1607316117
".word .LTHUNKn-7-.LTHUNKPCn".
1607416118
Otherwise, output:
1607516119
".word .LTHUNKn-8-.LTHUNKPCn".
1607616120
(inter-module thumbness is fixed up by the linker). */
1607716121
rtx tem = gen_rtx_SYMBOL_REF (Pmode, function_name);
1607816122

16079-
if (TARGET_MACHO
16080-
&& ! machopic_data_defined_p (function_rtx))
16123+
if (TARGET_MACHO && (TARGET_ARM || is_indirected))
1608116124
tem = gen_rtx_PLUS (GET_MODE (tem), tem, GEN_INT (-8));
1608216125
else
1608316126
tem = gen_rtx_PLUS (GET_MODE (tem), tem, GEN_INT (-7));
16084-
/* APPLE LOCAL end ARM 4745175 */
1608516127

1608616128
tem = gen_rtx_MINUS (GET_MODE (tem),
1608716129
tem,
@@ -16091,21 +16133,18 @@ arm_output_mi_thunk (FILE *file, tree thunk ATTRIBUTE_UNUSED,
1609116133
}
1609216134
else
1609316135
/* Output ".word .LTHUNKn". */
16094-
/* APPLE LOCAL begin ARM 4745175 */
1609516136
assemble_integer (gen_rtx_SYMBOL_REF (Pmode, function_name),
1609616137
4, BITS_PER_WORD, 1);
16097-
/* APPLE LOCAL end ARM 4745175 */
16098-
/* APPLE LOCAL end ARM mainline 2006-07-25 4620953 */
1609916138
}
1610016139
else
1610116140
{
1610216141
fputs ("\tb\t", file);
16103-
/* APPLE LOCAL ARM 4745175 */
1610416142
assemble_name (file, function_name);
1610516143
if (NEED_PLT_RELOC)
1610616144
fputs ("(PLT)", file);
1610716145
fputc ('\n', file);
1610816146
}
16147+
/* APPLE LOCAL end ARM 4620953 4745175 5920116 */
1610916148
}
1611016149

1611116150
int
@@ -17471,3 +17510,30 @@ arm_delegitimize_address (rtx addr)
1747117510
return addr;
1747217511
}
1747317512
/* APPLE LOCAL end ARM 5602348 */
17513+
/* APPLE LOCAL begin ARM 6008578 */
17514+
/* Minimum alignment of a function entry point, in bits. */
17515+
int
17516+
arm_function_boundary (void)
17517+
{
17518+
int min_align = TARGET_ARM ? 32 : 16;
17519+
17520+
/* Even in Thumb mode, thunks are output as ARM functions. */
17521+
if (cfun && current_function_is_thunk)
17522+
min_align = MAX (min_align, 32);
17523+
17524+
/* e.g., Thumb functions with jump tables. */
17525+
if (cfun && cfun->needs_4byte_alignment)
17526+
min_align = MAX (min_align, 32);
17527+
17528+
/* If -falign-loops was specified, use that alignment. This is _not_
17529+
needed to guarantee that loop alignments within the function are
17530+
honored -- that's handled by the assembler and linker. However,
17531+
if we don't align the function, then our address calculations (in
17532+
arm_reorg) are incorrect, potentially wreaking havoc on the
17533+
constant pool calculations. */
17534+
min_align = MAX (min_align, align_loops * BITS_PER_UNIT);
17535+
17536+
return min_align;
17537+
}
17538+
/* APPLE LOCAL end ARM 6008578 */
17539+

gcc/config/arm/arm.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -708,11 +708,10 @@ extern int arm_cpp_interwork;
708708
#define PREFERRED_STACK_BOUNDARY \
709709
(arm_abi == ARM_ABI_ATPCS ? 64 : STACK_BOUNDARY)
710710

711-
/* APPLE LOCAL begin ARM 20060428 adjust function alignment for Thumb */
712-
#define FUNCTION_BOUNDARY \
713-
((TARGET_ARM || (cfun && current_function_is_thunk) \
714-
|| (cfun && cfun->needs_4byte_alignment)) ? 32 : 16)
715-
/* APPLE LOCAL end ARM 20060428 adjust function alignment for Thumb */
711+
/* APPLE LOCAL begin ARM 6008578 */
712+
#define FUNCTION_BOUNDARY arm_function_boundary ()
713+
extern int arm_function_boundary (void);
714+
/* APPLE LOCAL end ARM 6008578 */
716715

717716
/* The lowest bit is used to indicate Thumb-mode functions, so the
718717
vbit must go into the delta field of pointers to member

gcc/config/arm/t-darwin

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,9 @@ LIB2FUNCS_EXTRA = $(srcdir)/config/arm/_fixdfdi.c \
2525
$(srcdir)/config/arm/_fixunssfdi.c
2626
# APPLE LOCAL end 5316398 improved float/double -> int64 functions
2727

28-
MULTILIB_OPTIONS =
29-
MULTILIB_DIRNAMES =
28+
MULTILIB_OPTIONS = march=armv6k
29+
MULTILIB_DIRNAMES = v6
3030
MULTILIB_EXCEPTIONS =
3131
MULTILIB_MATCHES =
32-
TARGET_LIBGCC2_CFLAGS = -fno-inline -march=armv6k
33-
DARWIN_EXTRA_CRT_BUILD_CFLAGS = -march=armv6k
32+
TARGET_LIBGCC2_CFLAGS = -fno-inline
3433

gcc/final.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,16 @@ label_to_alignment (rtx label)
547547
return LABEL_TO_ALIGNMENT (label);
548548
}
549549

550+
/* APPLE LOCAL begin ARM 6008578 */
551+
/* For the benefit of port specific code do this also as a function. */
552+
553+
int
554+
label_to_max_skip (rtx label)
555+
{
556+
return LABEL_TO_MAX_SKIP (label);
557+
}
558+
/* APPLE LOCAL end ARM 6008578 */
559+
550560
#ifdef HAVE_ATTR_length
551561
/* The differences in addresses
552562
between a branch and its target might grow or shrink depending on

gcc/objc/ChangeLog.apple

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
2008-05-15 Josh Conner <[email protected]>
2+
3+
Radar 5926171
4+
* objc-act.c (objc_build_incr_decr_setter_call): Don't call
5+
objc_v2_build_incr_decl_setter_call if flag_objc_legacy_dispatch
6+
is set.
7+
18
2008-02-14 Josh Conner <[email protected]>
29

310
Radar 5694615

gcc/objc/objc-act.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19025,7 +19025,7 @@ objc_build_incr_decr_setter_call (enum tree_code code, tree lhs, tree inc)
1902519025
{
1902619026
tree expr;
1902719027

19028-
if (flag_objc_abi == 2)
19028+
if (flag_objc_abi == 2 && !flag_objc_legacy_dispatch)
1902919029
return objc_v2_build_incr_decl_setter_call (code, lhs, inc);
1903019030

1903119031
expr = lhs;

gcc/output.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,12 @@ extern int insn_current_reference_address (rtx);
9494
Defined in final.c. */
9595
extern int label_to_alignment (rtx);
9696

97+
/* APPLE LOCAL begin ARM 6008578 */
98+
/* Maximum number of bytes to skip to achieve label alignment.
99+
Defined in final.c. */
100+
extern int label_to_max_skip (rtx);
101+
/* APPLE LOCAL end ARM 6008578 */
102+
97103
/* Output a LABEL_REF, or a bare CODE_LABEL, as an assembler symbol. */
98104
extern void output_asm_label (rtx);
99105

gcc/testsuite/ChangeLog.apple

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
2008-05-15 Josh Conner <[email protected]>
2+
3+
Radar 5920116
4+
* g++.apple/thunks[1-4].C: New tests.
5+
16
2008-04-01 Jon Ziegler <[email protected]>
27

38
Radar 5706927

0 commit comments

Comments
 (0)