diff options
| author | Khem Raj <raj.khem@gmail.com> | 2011-05-01 03:26:50 +0000 |
|---|---|---|
| committer | Koen Kooi <koen@dominion.thruhere.net> | 2011-04-30 21:44:25 +0200 |
| commit | 0d042143341c42d61db3e14f0b242648cdb7fc85 (patch) | |
| tree | 94f09d927fcce868b10f1029f4d946754fcea724 /meta-oe/recipes-devtools | |
| parent | 1e2b88cbc42ad6a461a3a65de1261615cb966977 (diff) | |
| download | meta-openembedded-0d042143341c42d61db3e14f0b242648cdb7fc85.tar.gz | |
gcc: Upgrade to 4.5.3 and bring in latest linaro updates
We base now off release tarball of 4.5.3 instead of svn
Get relevant new arm linaro patches
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
Diffstat (limited to 'meta-oe/recipes-devtools')
9 files changed, 2754 insertions, 199 deletions
diff --git a/meta-oe/recipes-devtools/gcc/gcc-4.5.inc b/meta-oe/recipes-devtools/gcc/gcc-4.5.inc index 519a1e7af5..4067d737d5 100644 --- a/meta-oe/recipes-devtools/gcc/gcc-4.5.inc +++ b/meta-oe/recipes-devtools/gcc/gcc-4.5.inc | |||
| @@ -13,21 +13,12 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552 \ | |||
| 13 | file://COPYING.RUNTIME;md5=fe60d87048567d4fe8c8a0ed2448bcc8" | 13 | file://COPYING.RUNTIME;md5=fe60d87048567d4fe8c8a0ed2448bcc8" |
| 14 | 14 | ||
| 15 | 15 | ||
| 16 | SRCREV = "170880" | ||
| 17 | PV = "4.5" | 16 | PV = "4.5" |
| 18 | INC_PR = "r35" | 17 | INC_PR = "r36" |
| 19 | 18 | # BINV should point to minor release | |
| 20 | # BINV should be incremented after updating to a revision | ||
| 21 | # after a minor gcc release (e.g. 4.5.1 or 4.5.2) has been made | ||
| 22 | # the value will be minor-release+1 e.g. if minor release was | ||
| 23 | # 4.5.1 then the value below will be 2 which will mean 4.5.2 | ||
| 24 | # which will be next minor release and so on. | ||
| 25 | |||
| 26 | BINV = "${PV}.3" | 19 | BINV = "${PV}.3" |
| 27 | BRANCH = "gcc-4_5-branch" | ||
| 28 | PR_append = "+svnr${SRCPV}" | ||
| 29 | 20 | ||
| 30 | SRC_URI = "svn://gcc.gnu.org/svn/gcc/branches;module=${BRANCH} \ | 21 | SRC_URI = "${GNU_MIRROR}/gcc/gcc-${BINV}/gcc-${BINV}.tar.bz2 \ |
| 31 | file://gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch \ | 22 | file://gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch \ |
| 32 | file://100-uclibc-conf.patch \ | 23 | file://100-uclibc-conf.patch \ |
| 33 | file://gcc-uclibc-locale-ctype_touplow_t.patch \ | 24 | file://gcc-uclibc-locale-ctype_touplow_t.patch \ |
| @@ -175,11 +166,15 @@ SRC_URI = "svn://gcc.gnu.org/svn/gcc/branches;module=${BRANCH} \ | |||
| 175 | file://linaro/gcc-4.5-linaro-r99478.patch \ | 166 | file://linaro/gcc-4.5-linaro-r99478.patch \ |
| 176 | file://linaro/gcc-4.5-linaro-r99479.patch \ | 167 | file://linaro/gcc-4.5-linaro-r99479.patch \ |
| 177 | file://linaro/gcc-4.5-linaro-r99480.patch \ | 168 | file://linaro/gcc-4.5-linaro-r99480.patch \ |
| 178 | file://linaro/gcc-4.5-linaro-r99481.patch \ | ||
| 179 | file://linaro/gcc-4.5-linaro-r99482.patch \ | ||
| 180 | file://linaro/gcc-4.5-linaro-r99483.patch \ | 169 | file://linaro/gcc-4.5-linaro-r99483.patch \ |
| 181 | file://linaro/gcc-4.5-linaro-r99488.patch \ | 170 | file://linaro/gcc-4.5-linaro-r99488.patch \ |
| 182 | file://linaro/gcc-4.5-linaro-r99489.patch \ | 171 | file://linaro/gcc-4.5-linaro-r99489.patch \ |
| 172 | file://linaro/gcc-4.5-linaro-r99491.patch \ | ||
| 173 | file://linaro/gcc-4.5-linaro-r99494.patch \ | ||
| 174 | file://linaro/gcc-4.5-linaro-r99495.patch \ | ||
| 175 | file://linaro/gcc-4.5-linaro-r99498.patch \ | ||
| 176 | # file://linaro/gcc-4.5-linaro-r99499.patch \ | ||
| 177 | file://linaro/gcc-4.5-linaro-r99502.patch \ | ||
| 183 | file://more-epilogues.patch \ | 178 | file://more-epilogues.patch \ |
| 184 | file://gcc-scalar-widening-pr45847.patch \ | 179 | file://gcc-scalar-widening-pr45847.patch \ |
| 185 | file://gcc-arm-volatile-bitfield-fix.patch \ | 180 | file://gcc-arm-volatile-bitfield-fix.patch \ |
| @@ -207,7 +202,7 @@ SRC_URI = "svn://gcc.gnu.org/svn/gcc/branches;module=${BRANCH} \ | |||
| 207 | FORTRAN = "" | 202 | FORTRAN = "" |
| 208 | JAVA = "" | 203 | JAVA = "" |
| 209 | 204 | ||
| 210 | S = "${WORKDIR}/${BRANCH}" | 205 | S = "${WORKDIR}/gcc-${BINV}" |
| 211 | 206 | ||
| 212 | #EXTRA_OECONF_BASE = " --enable-cheaders=c_std \ | 207 | #EXTRA_OECONF_BASE = " --enable-cheaders=c_std \ |
| 213 | # --enable-libssp \ | 208 | # --enable-libssp \ |
diff --git a/meta-oe/recipes-devtools/gcc/gcc-4.5/linaro/gcc-4.5-linaro-r99301.patch b/meta-oe/recipes-devtools/gcc/gcc-4.5/linaro/gcc-4.5-linaro-r99301.patch index 95907eeb87..0943130de6 100644 --- a/meta-oe/recipes-devtools/gcc/gcc-4.5/linaro/gcc-4.5-linaro-r99301.patch +++ b/meta-oe/recipes-devtools/gcc/gcc-4.5/linaro/gcc-4.5-linaro-r99301.patch | |||
| @@ -37,9 +37,11 @@ | |||
| 37 | gcc/ | 37 | gcc/ |
| 38 | 38 | ||
| 39 | === modified file 'gcc/config/arm/arm-modes.def' | 39 | === modified file 'gcc/config/arm/arm-modes.def' |
| 40 | --- old/gcc/config/arm/arm-modes.def 2009-06-18 11:24:10 +0000 | 40 | Index: gcc-4.5.3/gcc/config/arm/arm-modes.def |
| 41 | +++ new/gcc/config/arm/arm-modes.def 2010-07-29 16:58:56 +0000 | 41 | =================================================================== |
| 42 | @@ -35,10 +35,16 @@ | 42 | --- gcc-4.5.3.orig/gcc/config/arm/arm-modes.def |
| 43 | +++ gcc-4.5.3/gcc/config/arm/arm-modes.def | ||
| 44 | @@ -35,10 +35,16 @@ ADJUST_FLOAT_FORMAT (HF, ((arm_fp16_form | ||
| 43 | CC_NOOVmode should be used with SImode integer equalities. | 45 | CC_NOOVmode should be used with SImode integer equalities. |
| 44 | CC_Zmode should be used if only the Z flag is set correctly | 46 | CC_Zmode should be used if only the Z flag is set correctly |
| 45 | CC_Nmode should be used if only the N (sign) flag is set correctly | 47 | CC_Nmode should be used if only the N (sign) flag is set correctly |
| @@ -56,11 +58,11 @@ | |||
| 56 | CC_MODE (CC_SWP); | 58 | CC_MODE (CC_SWP); |
| 57 | CC_MODE (CCFP); | 59 | CC_MODE (CCFP); |
| 58 | CC_MODE (CCFPE); | 60 | CC_MODE (CCFPE); |
| 59 | 61 | Index: gcc-4.5.3/gcc/config/arm/arm-protos.h | |
| 60 | === modified file 'gcc/config/arm/arm-protos.h' | 62 | =================================================================== |
| 61 | --- old/gcc/config/arm/arm-protos.h 2009-11-11 14:23:03 +0000 | 63 | --- gcc-4.5.3.orig/gcc/config/arm/arm-protos.h |
| 62 | +++ new/gcc/config/arm/arm-protos.h 2010-07-29 16:58:56 +0000 | 64 | +++ gcc-4.5.3/gcc/config/arm/arm-protos.h |
| 63 | @@ -49,8 +49,7 @@ | 65 | @@ -49,8 +49,7 @@ extern int arm_hard_regno_mode_ok (unsig |
| 64 | extern int const_ok_for_arm (HOST_WIDE_INT); | 66 | extern int const_ok_for_arm (HOST_WIDE_INT); |
| 65 | extern int arm_split_constant (RTX_CODE, enum machine_mode, rtx, | 67 | extern int arm_split_constant (RTX_CODE, enum machine_mode, rtx, |
| 66 | HOST_WIDE_INT, rtx, rtx, int); | 68 | HOST_WIDE_INT, rtx, rtx, int); |
| @@ -70,7 +72,7 @@ | |||
| 70 | extern int legitimate_pic_operand_p (rtx); | 72 | extern int legitimate_pic_operand_p (rtx); |
| 71 | extern rtx legitimize_pic_address (rtx, enum machine_mode, rtx); | 73 | extern rtx legitimize_pic_address (rtx, enum machine_mode, rtx); |
| 72 | extern rtx legitimize_tls_address (rtx, rtx); | 74 | extern rtx legitimize_tls_address (rtx, rtx); |
| 73 | @@ -116,6 +115,7 @@ | 75 | @@ -116,6 +115,7 @@ extern void arm_reload_in_hi (rtx *); |
| 74 | extern void arm_reload_out_hi (rtx *); | 76 | extern void arm_reload_out_hi (rtx *); |
| 75 | extern int arm_const_double_inline_cost (rtx); | 77 | extern int arm_const_double_inline_cost (rtx); |
| 76 | extern bool arm_const_double_by_parts (rtx); | 78 | extern bool arm_const_double_by_parts (rtx); |
| @@ -78,11 +80,11 @@ | |||
| 78 | extern const char *fp_immediate_constant (rtx); | 80 | extern const char *fp_immediate_constant (rtx); |
| 79 | extern void arm_emit_call_insn (rtx, rtx); | 81 | extern void arm_emit_call_insn (rtx, rtx); |
| 80 | extern const char *output_call (rtx *); | 82 | extern const char *output_call (rtx *); |
| 81 | 83 | Index: gcc-4.5.3/gcc/config/arm/arm.c | |
| 82 | === modified file 'gcc/config/arm/arm.c' | 84 | =================================================================== |
| 83 | --- old/gcc/config/arm/arm.c 2010-07-29 15:59:12 +0000 | 85 | --- gcc-4.5.3.orig/gcc/config/arm/arm.c |
| 84 | +++ new/gcc/config/arm/arm.c 2010-07-29 16:58:56 +0000 | 86 | +++ gcc-4.5.3/gcc/config/arm/arm.c |
| 85 | @@ -3190,13 +3190,82 @@ | 87 | @@ -3191,13 +3191,82 @@ arm_gen_constant (enum rtx_code code, en |
| 86 | immediate value easier to load. */ | 88 | immediate value easier to load. */ |
| 87 | 89 | ||
| 88 | enum rtx_code | 90 | enum rtx_code |
| @@ -169,7 +171,7 @@ | |||
| 169 | switch (code) | 171 | switch (code) |
| 170 | { | 172 | { |
| 171 | case EQ: | 173 | case EQ: |
| 172 | @@ -9912,6 +9981,55 @@ | 174 | @@ -9913,6 +9982,55 @@ arm_select_cc_mode (enum rtx_code op, rt |
| 173 | && (rtx_equal_p (XEXP (x, 0), y) || rtx_equal_p (XEXP (x, 1), y))) | 175 | && (rtx_equal_p (XEXP (x, 0), y) || rtx_equal_p (XEXP (x, 1), y))) |
| 174 | return CC_Cmode; | 176 | return CC_Cmode; |
| 175 | 177 | ||
| @@ -225,18 +227,17 @@ | |||
| 225 | return CCmode; | 227 | return CCmode; |
| 226 | } | 228 | } |
| 227 | 229 | ||
| 228 | @@ -9921,10 +10039,39 @@ | 230 | @@ -9922,10 +10040,39 @@ arm_select_cc_mode (enum rtx_code op, rt |
| 229 | rtx | 231 | rtx |
| 230 | arm_gen_compare_reg (enum rtx_code code, rtx x, rtx y) | 232 | arm_gen_compare_reg (enum rtx_code code, rtx x, rtx y) |
| 231 | { | 233 | { |
| 232 | - enum machine_mode mode = SELECT_CC_MODE (code, x, y); | 234 | - enum machine_mode mode = SELECT_CC_MODE (code, x, y); |
| 233 | - rtx cc_reg = gen_rtx_REG (mode, CC_REGNUM); | 235 | - rtx cc_reg = gen_rtx_REG (mode, CC_REGNUM); |
| 234 | - | ||
| 235 | - emit_set_insn (cc_reg, gen_rtx_COMPARE (mode, x, y)); | ||
| 236 | + enum machine_mode mode; | 236 | + enum machine_mode mode; |
| 237 | + rtx cc_reg; | 237 | + rtx cc_reg; |
| 238 | + int dimode_comparison = GET_MODE (x) == DImode || GET_MODE (y) == DImode; | 238 | + int dimode_comparison = GET_MODE (x) == DImode || GET_MODE (y) == DImode; |
| 239 | + | 239 | |
| 240 | - emit_set_insn (cc_reg, gen_rtx_COMPARE (mode, x, y)); | ||
| 240 | + /* We might have X as a constant, Y as a register because of the predicates | 241 | + /* We might have X as a constant, Y as a register because of the predicates |
| 241 | + used for cmpdi. If so, force X to a register here. */ | 242 | + used for cmpdi. If so, force X to a register here. */ |
| 242 | + if (dimode_comparison && !REG_P (x)) | 243 | + if (dimode_comparison && !REG_P (x)) |
| @@ -269,7 +270,7 @@ | |||
| 269 | 270 | ||
| 270 | return cc_reg; | 271 | return cc_reg; |
| 271 | } | 272 | } |
| 272 | @@ -11253,6 +11400,34 @@ | 273 | @@ -11254,6 +11401,34 @@ arm_const_double_by_parts (rtx val) |
| 273 | return false; | 274 | return false; |
| 274 | } | 275 | } |
| 275 | 276 | ||
| @@ -304,7 +305,7 @@ | |||
| 304 | /* Scan INSN and note any of its operands that need fixing. | 305 | /* Scan INSN and note any of its operands that need fixing. |
| 305 | If DO_PUSHES is false we do not actually push any of the fixups | 306 | If DO_PUSHES is false we do not actually push any of the fixups |
| 306 | needed. The function returns TRUE if any fixups were needed/pushed. | 307 | needed. The function returns TRUE if any fixups were needed/pushed. |
| 307 | @@ -15097,8 +15272,18 @@ | 308 | @@ -15150,8 +15325,18 @@ arm_print_operand (FILE *stream, rtx x, |
| 308 | the value being loaded is big-wordian or little-wordian. The | 309 | the value being loaded is big-wordian or little-wordian. The |
| 309 | order of the two register loads can matter however, if the address | 310 | order of the two register loads can matter however, if the address |
| 310 | of the memory location is actually held in one of the registers | 311 | of the memory location is actually held in one of the registers |
| @@ -324,7 +325,7 @@ | |||
| 324 | if (GET_CODE (x) != REG || REGNO (x) > LAST_ARM_REGNUM) | 325 | if (GET_CODE (x) != REG || REGNO (x) > LAST_ARM_REGNUM) |
| 325 | { | 326 | { |
| 326 | output_operand_lossage ("invalid operand for code '%c'", code); | 327 | output_operand_lossage ("invalid operand for code '%c'", code); |
| 327 | @@ -15109,6 +15294,18 @@ | 328 | @@ -15162,6 +15347,18 @@ arm_print_operand (FILE *stream, rtx x, |
| 328 | return; | 329 | return; |
| 329 | 330 | ||
| 330 | case 'R': | 331 | case 'R': |
| @@ -343,7 +344,7 @@ | |||
| 343 | if (GET_CODE (x) != REG || REGNO (x) > LAST_ARM_REGNUM) | 344 | if (GET_CODE (x) != REG || REGNO (x) > LAST_ARM_REGNUM) |
| 344 | { | 345 | { |
| 345 | output_operand_lossage ("invalid operand for code '%c'", code); | 346 | output_operand_lossage ("invalid operand for code '%c'", code); |
| 346 | @@ -15801,6 +15998,28 @@ | 347 | @@ -15854,6 +16051,28 @@ get_arm_condition_code (rtx comparison) |
| 347 | default: gcc_unreachable (); | 348 | default: gcc_unreachable (); |
| 348 | } | 349 | } |
| 349 | 350 | ||
| @@ -372,11 +373,11 @@ | |||
| 372 | case CCmode: | 373 | case CCmode: |
| 373 | switch (comp_code) | 374 | switch (comp_code) |
| 374 | { | 375 | { |
| 375 | 376 | Index: gcc-4.5.3/gcc/config/arm/arm.h | |
| 376 | === modified file 'gcc/config/arm/arm.h' | 377 | =================================================================== |
| 377 | --- old/gcc/config/arm/arm.h 2009-12-23 16:36:40 +0000 | 378 | --- gcc-4.5.3.orig/gcc/config/arm/arm.h |
| 378 | +++ new/gcc/config/arm/arm.h 2010-07-29 16:58:56 +0000 | 379 | +++ gcc-4.5.3/gcc/config/arm/arm.h |
| 379 | @@ -2253,19 +2253,7 @@ | 380 | @@ -2253,19 +2253,7 @@ extern int making_const_table; |
| 380 | : reverse_condition (code)) | 381 | : reverse_condition (code)) |
| 381 | 382 | ||
| 382 | #define CANONICALIZE_COMPARISON(CODE, OP0, OP1) \ | 383 | #define CANONICALIZE_COMPARISON(CODE, OP0, OP1) \ |
| @@ -397,10 +398,10 @@ | |||
| 397 | 398 | ||
| 398 | /* The arm5 clz instruction returns 32. */ | 399 | /* The arm5 clz instruction returns 32. */ |
| 399 | #define CLZ_DEFINED_VALUE_AT_ZERO(MODE, VALUE) ((VALUE) = 32, 1) | 400 | #define CLZ_DEFINED_VALUE_AT_ZERO(MODE, VALUE) ((VALUE) = 32, 1) |
| 400 | 401 | Index: gcc-4.5.3/gcc/config/arm/arm.md | |
| 401 | === modified file 'gcc/config/arm/arm.md' | 402 | =================================================================== |
| 402 | --- old/gcc/config/arm/arm.md 2010-07-29 15:59:12 +0000 | 403 | --- gcc-4.5.3.orig/gcc/config/arm/arm.md |
| 403 | +++ new/gcc/config/arm/arm.md 2010-07-29 16:58:56 +0000 | 404 | +++ gcc-4.5.3/gcc/config/arm/arm.md |
| 404 | @@ -6718,17 +6718,45 @@ | 405 | @@ -6718,17 +6718,45 @@ |
| 405 | operands[3])); DONE;" | 406 | operands[3])); DONE;" |
| 406 | ) | 407 | ) |
| @@ -506,7 +507,7 @@ | |||
| 506 | ;; Cirrus SF compare instruction | 507 | ;; Cirrus SF compare instruction |
| 507 | (define_insn "*cirrus_cmpsf" | 508 | (define_insn "*cirrus_cmpsf" |
| 508 | [(set (reg:CCFP CC_REGNUM) | 509 | [(set (reg:CCFP CC_REGNUM) |
| 509 | @@ -8183,18 +8257,45 @@ | 510 | @@ -8183,17 +8257,44 @@ |
| 510 | operands[2], operands[3])); DONE;" | 511 | operands[2], operands[3])); DONE;" |
| 511 | ) | 512 | ) |
| 512 | 513 | ||
| @@ -519,13 +520,14 @@ | |||
| 519 | - "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK" | 520 | - "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK" |
| 520 | - "emit_insn (gen_cstore_cc (operands[0], operands[1], | 521 | - "emit_insn (gen_cstore_cc (operands[0], operands[1], |
| 521 | - operands[2], operands[3])); DONE;" | 522 | - operands[2], operands[3])); DONE;" |
| 523 | -) | ||
| 522 | + [(match_operand:DI 2 "cmpdi_operand" "") | 524 | + [(match_operand:DI 2 "cmpdi_operand" "") |
| 523 | + (match_operand:DI 3 "cmpdi_operand" "")]))] | 525 | + (match_operand:DI 3 "cmpdi_operand" "")]))] |
| 524 | + "TARGET_32BIT" | 526 | + "TARGET_32BIT" |
| 525 | + "{ | 527 | + "{ |
| 526 | + rtx swap = NULL_RTX; | 528 | + rtx swap = NULL_RTX; |
| 527 | + enum rtx_code code = GET_CODE (operands[1]); | 529 | + enum rtx_code code = GET_CODE (operands[1]); |
| 528 | + | 530 | |
| 529 | + /* We should not have two constants. */ | 531 | + /* We should not have two constants. */ |
| 530 | + gcc_assert (GET_MODE (operands[2]) == DImode | 532 | + gcc_assert (GET_MODE (operands[2]) == DImode |
| 531 | + || GET_MODE (operands[3]) == DImode); | 533 | + || GET_MODE (operands[3]) == DImode); |
| @@ -553,16 +555,14 @@ | |||
| 553 | + operands[3])); | 555 | + operands[3])); |
| 554 | + DONE; | 556 | + DONE; |
| 555 | + }" | 557 | + }" |
| 556 | ) | 558 | +) |
| 557 | 559 | ||
| 558 | - | ||
| 559 | (define_expand "cstoresi_eq0_thumb1" | 560 | (define_expand "cstoresi_eq0_thumb1" |
| 560 | [(parallel | 561 | [(parallel |
| 561 | [(set (match_operand:SI 0 "s_register_operand" "") | 562 | Index: gcc-4.5.3/gcc/config/arm/constraints.md |
| 562 | 563 | =================================================================== | |
| 563 | === modified file 'gcc/config/arm/constraints.md' | 564 | --- gcc-4.5.3.orig/gcc/config/arm/constraints.md |
| 564 | --- old/gcc/config/arm/constraints.md 2009-12-07 20:34:53 +0000 | 565 | +++ gcc-4.5.3/gcc/config/arm/constraints.md |
| 565 | +++ new/gcc/config/arm/constraints.md 2010-07-29 16:58:56 +0000 | ||
| 566 | @@ -29,7 +29,7 @@ | 566 | @@ -29,7 +29,7 @@ |
| 567 | ;; in Thumb-1 state: I, J, K, L, M, N, O | 567 | ;; in Thumb-1 state: I, J, K, L, M, N, O |
| 568 | 568 | ||
| @@ -586,11 +586,11 @@ | |||
| 586 | (define_constraint "Dn" | 586 | (define_constraint "Dn" |
| 587 | "@internal | 587 | "@internal |
| 588 | In ARM/Thumb-2 state a const_vector which can be loaded with a Neon vmov | 588 | In ARM/Thumb-2 state a const_vector which can be loaded with a Neon vmov |
| 589 | 589 | Index: gcc-4.5.3/gcc/config/arm/predicates.md | |
| 590 | === modified file 'gcc/config/arm/predicates.md' | 590 | =================================================================== |
| 591 | --- old/gcc/config/arm/predicates.md 2010-07-29 15:59:12 +0000 | 591 | --- gcc-4.5.3.orig/gcc/config/arm/predicates.md |
| 592 | +++ new/gcc/config/arm/predicates.md 2010-07-29 16:58:56 +0000 | 592 | +++ gcc-4.5.3/gcc/config/arm/predicates.md |
| 593 | @@ -86,6 +86,12 @@ | 593 | @@ -101,6 +101,12 @@ |
| 594 | (and (match_code "const_int") | 594 | (and (match_code "const_int") |
| 595 | (match_test "const_ok_for_arm (INTVAL (op))"))) | 595 | (match_test "const_ok_for_arm (INTVAL (op))"))) |
| 596 | 596 | ||
| @@ -603,7 +603,7 @@ | |||
| 603 | (define_predicate "arm_neg_immediate_operand" | 603 | (define_predicate "arm_neg_immediate_operand" |
| 604 | (and (match_code "const_int") | 604 | (and (match_code "const_int") |
| 605 | (match_test "const_ok_for_arm (-INTVAL (op))"))) | 605 | (match_test "const_ok_for_arm (-INTVAL (op))"))) |
| 606 | @@ -115,6 +121,10 @@ | 606 | @@ -130,6 +136,10 @@ |
| 607 | (ior (match_operand 0 "arm_rhs_operand") | 607 | (ior (match_operand 0 "arm_rhs_operand") |
| 608 | (match_operand 0 "arm_not_immediate_operand"))) | 608 | (match_operand 0 "arm_not_immediate_operand"))) |
| 609 | 609 | ||
| @@ -614,23 +614,23 @@ | |||
| 614 | ;; True if the operand is a memory reference which contains an | 614 | ;; True if the operand is a memory reference which contains an |
| 615 | ;; offsettable address. | 615 | ;; offsettable address. |
| 616 | (define_predicate "offsettable_memory_operand" | 616 | (define_predicate "offsettable_memory_operand" |
| 617 | @@ -522,4 +532,12 @@ | 617 | @@ -538,3 +548,12 @@ |
| 618 | (define_predicate "neon_lane_number" | ||
| 619 | (and (match_code "const_int") | 618 | (and (match_code "const_int") |
| 620 | (match_test "INTVAL (op) >= 0 && INTVAL (op) <= 7"))) | 619 | (match_test "INTVAL (op) >= 0 && INTVAL (op) <= 15"))) |
| 620 | |||
| 621 | +;; Predicates for named expanders that overlap multiple ISAs. | 621 | +;; Predicates for named expanders that overlap multiple ISAs. |
| 622 | + | 622 | + |
| 623 | +(define_predicate "cmpdi_operand" | 623 | +(define_predicate "cmpdi_operand" |
| 624 | + (if_then_else (match_test "TARGET_HARD_FLOAT && TARGET_MAVERICK") | 624 | + (if_then_else (match_test "TARGET_HARD_FLOAT && TARGET_MAVERICK") |
| 625 | + (and (match_test "TARGET_ARM") | 625 | + (and (match_test "TARGET_ARM") |
| 626 | + (match_operand 0 "cirrus_fp_register")) | 626 | + (match_operand 0 "cirrus_fp_register")) |
| 627 | + (and (match_test "TARGET_32BIT") | 627 | + (and (match_test "TARGET_32BIT") |
| 628 | + (match_operand 0 "arm_di_operand")))) | 628 | + (match_operand 0 "arm_di_operand")))) |
| 629 | 629 | + | |
| 630 | 630 | Index: gcc-4.5.3/gcc/testsuite/gcc.c-torture/execute/20100416-1.c | |
| 631 | === added file 'gcc/testsuite/gcc.c-torture/execute/20100416-1.c' | 631 | =================================================================== |
| 632 | --- old/gcc/testsuite/gcc.c-torture/execute/20100416-1.c 1970-01-01 00:00:00 +0000 | 632 | --- /dev/null |
| 633 | +++ new/gcc/testsuite/gcc.c-torture/execute/20100416-1.c 2010-07-29 16:58:56 +0000 | 633 | +++ gcc-4.5.3/gcc/testsuite/gcc.c-torture/execute/20100416-1.c |
| 634 | @@ -0,0 +1,40 @@ | 634 | @@ -0,0 +1,40 @@ |
| 635 | +void abort(void); | 635 | +void abort(void); |
| 636 | + | 636 | + |
| @@ -672,4 +672,3 @@ | |||
| 672 | + } | 672 | + } |
| 673 | + return 0; | 673 | + return 0; |
| 674 | +} | 674 | +} |
| 675 | |||
diff --git a/meta-oe/recipes-devtools/gcc/gcc-4.5/linaro/gcc-4.5-linaro-r99481.patch b/meta-oe/recipes-devtools/gcc/gcc-4.5/linaro/gcc-4.5-linaro-r99481.patch deleted file mode 100644 index db53255de8..0000000000 --- a/meta-oe/recipes-devtools/gcc/gcc-4.5/linaro/gcc-4.5-linaro-r99481.patch +++ /dev/null | |||
| @@ -1,40 +0,0 @@ | |||
| 1 | 2011-02-02 Richard Sandiford <richard.sandiford@linaro.org> | ||
| 2 | |||
| 3 | gcc/testsuite/ | ||
| 4 | PR target/47553 | ||
| 5 | * gcc.target/arm/neon-vld-1.c: New test. | ||
| 6 | gcc/ | ||
| 7 | PR target/47553 | ||
| 8 | * config/arm/predicates.md (neon_lane_number): Accept 0..15. | ||
| 9 | |||
| 10 | === modified file 'gcc/config/arm/predicates.md' | ||
| 11 | --- old/gcc/config/arm/predicates.md 2011-02-08 12:07:29 +0000 | ||
| 12 | +++ new/gcc/config/arm/predicates.md 2011-03-02 12:28:41 +0000 | ||
| 13 | @@ -607,7 +607,7 @@ | ||
| 14 | ;; TODO: We could check lane numbers more precisely based on the mode. | ||
| 15 | (define_predicate "neon_lane_number" | ||
| 16 | (and (match_code "const_int") | ||
| 17 | - (match_test "INTVAL (op) >= 0 && INTVAL (op) <= 7"))) | ||
| 18 | + (match_test "INTVAL (op) >= 0 && INTVAL (op) <= 15"))) | ||
| 19 | ;; Predicates for named expanders that overlap multiple ISAs. | ||
| 20 | |||
| 21 | (define_predicate "cmpdi_operand" | ||
| 22 | |||
| 23 | === added file 'gcc/testsuite/gcc.target/arm/neon-vld-1.c' | ||
| 24 | --- old/gcc/testsuite/gcc.target/arm/neon-vld-1.c 1970-01-01 00:00:00 +0000 | ||
| 25 | +++ new/gcc/testsuite/gcc.target/arm/neon-vld-1.c 2011-02-02 13:57:54 +0000 | ||
| 26 | @@ -0,0 +1,13 @@ | ||
| 27 | +/* { dg-do compile } */ | ||
| 28 | +/* { dg-require-effective-target arm_neon_ok } */ | ||
| 29 | +/* { dg-options "-O1" } */ | ||
| 30 | +/* { dg-add-options arm_neon } */ | ||
| 31 | + | ||
| 32 | +#include <arm_neon.h> | ||
| 33 | + | ||
| 34 | +uint8x16_t | ||
| 35 | +foo (uint8_t *a, uint8x16_t b) | ||
| 36 | +{ | ||
| 37 | + vst1q_lane_u8 (a, b, 14); | ||
| 38 | + return vld1q_lane_u8 (a + 0x100, b, 15); | ||
| 39 | +} | ||
| 40 | |||
diff --git a/meta-oe/recipes-devtools/gcc/gcc-4.5/linaro/gcc-4.5-linaro-r99482.patch b/meta-oe/recipes-devtools/gcc/gcc-4.5/linaro/gcc-4.5-linaro-r99482.patch deleted file mode 100644 index 334ac4ec1a..0000000000 --- a/meta-oe/recipes-devtools/gcc/gcc-4.5/linaro/gcc-4.5-linaro-r99482.patch +++ /dev/null | |||
| @@ -1,84 +0,0 @@ | |||
| 1 | 2011-02-02 Richard Sandiford <richard.sandiford@linaro.org> | ||
| 2 | |||
| 3 | gcc/ | ||
| 4 | Backport from mainline: | ||
| 5 | |||
| 6 | 2011-01-23 Bernd Schmidt <bernds@codesourcery.com> | ||
| 7 | Richard Sandiford <rdsandiford@googlemail.com> | ||
| 8 | |||
| 9 | PR rtl-optimization/47166 | ||
| 10 | * reload1.c (emit_reload_insns): Disable the spill_reg_store | ||
| 11 | mechanism for PRE_MODIFY and POST_MODIFY. | ||
| 12 | (inc_for_reload): For PRE_MODIFY, return the insn that sets the | ||
| 13 | reloadreg. | ||
| 14 | |||
| 15 | gcc/testsuite/ | ||
| 16 | * gcc.c-torture/execute/postmod-1.c: New test. | ||
| 17 | |||
| 18 | === added file 'gcc/testsuite/gcc.c-torture/execute/postmod-1.c' | ||
| 19 | --- old/gcc/testsuite/gcc.c-torture/execute/postmod-1.c 1970-01-01 00:00:00 +0000 | ||
| 20 | +++ new/gcc/testsuite/gcc.c-torture/execute/postmod-1.c 2011-02-02 14:23:10 +0000 | ||
| 21 | @@ -0,0 +1,62 @@ | ||
| 22 | +#define DECLARE_ARRAY(A) array##A[0x10] | ||
| 23 | +#define DECLARE_COUNTER(A) counter##A = 0 | ||
| 24 | +#define DECLARE_POINTER(A) *pointer##A = array##A + x | ||
| 25 | +/* Create a loop that allows post-modification of pointerA, followed by | ||
| 26 | + a use of the post-modified address. */ | ||
| 27 | +#define BEFORE(A) counter##A += *pointer##A, pointer##A += 3 | ||
| 28 | +#define AFTER(A) counter##A += pointer##A[x] | ||
| 29 | + | ||
| 30 | +/* Set up the arrays so that one iteration of the loop sets the counter | ||
| 31 | + to 3.0f. */ | ||
| 32 | +#define INIT_ARRAY(A) array##A[1] = 1.0f, array##A[5] = 2.0f | ||
| 33 | + | ||
| 34 | +/* Check that the loop worked correctly for all values. */ | ||
| 35 | +#define CHECK_ARRAY(A) exit_code |= (counter##A != 3.0f) | ||
| 36 | + | ||
| 37 | +/* Having 6 copies triggered the bug for ARM and Thumb. */ | ||
| 38 | +#define MANY(A) A (0), A (1), A (2), A (3), A (4), A (5) | ||
| 39 | + | ||
| 40 | +/* Each addendA should be allocated a register. */ | ||
| 41 | +#define INIT_VOLATILE(A) addend##A = vol | ||
| 42 | +#define ADD_VOLATILE(A) vol += addend##A | ||
| 43 | + | ||
| 44 | +/* Having 5 copies triggered the bug for ARM and Thumb. */ | ||
| 45 | +#define MANY2(A) A (0), A (1), A (2), A (3), A (4) | ||
| 46 | + | ||
| 47 | +float MANY (DECLARE_ARRAY); | ||
| 48 | +float MANY (DECLARE_COUNTER); | ||
| 49 | + | ||
| 50 | +volatile int stop = 1; | ||
| 51 | +volatile int vol; | ||
| 52 | + | ||
| 53 | +void __attribute__((noinline)) | ||
| 54 | +foo (int x) | ||
| 55 | +{ | ||
| 56 | + float MANY (DECLARE_POINTER); | ||
| 57 | + int i; | ||
| 58 | + | ||
| 59 | + do | ||
| 60 | + { | ||
| 61 | + MANY (BEFORE); | ||
| 62 | + MANY (AFTER); | ||
| 63 | + /* Create an inner loop that should ensure the code above | ||
| 64 | + has registers free for reload inheritance. */ | ||
| 65 | + { | ||
| 66 | + int MANY2 (INIT_VOLATILE); | ||
| 67 | + for (i = 0; i < 10; i++) | ||
| 68 | + MANY2 (ADD_VOLATILE); | ||
| 69 | + } | ||
| 70 | + } | ||
| 71 | + while (!stop); | ||
| 72 | +} | ||
| 73 | + | ||
| 74 | +int | ||
| 75 | +main (void) | ||
| 76 | +{ | ||
| 77 | + int exit_code = 0; | ||
| 78 | + | ||
| 79 | + MANY (INIT_ARRAY); | ||
| 80 | + foo (1); | ||
| 81 | + MANY (CHECK_ARRAY); | ||
| 82 | + return exit_code; | ||
| 83 | +} | ||
| 84 | |||
diff --git a/meta-oe/recipes-devtools/gcc/gcc-4.5/linaro/gcc-4.5-linaro-r99491.patch b/meta-oe/recipes-devtools/gcc/gcc-4.5/linaro/gcc-4.5-linaro-r99491.patch new file mode 100644 index 0000000000..a2d6c6a69a --- /dev/null +++ b/meta-oe/recipes-devtools/gcc/gcc-4.5/linaro/gcc-4.5-linaro-r99491.patch | |||
| @@ -0,0 +1,309 @@ | |||
| 1 | 2011-04-08 Richard Sandiford <richard.sandiford@linaro.org> | ||
| 2 | |||
| 3 | Backport from mainline: | ||
| 4 | gcc/ | ||
| 5 | * dwarf2out.c (dw_loc_list_node): Add resolved_addr and replaced. | ||
| 6 | (cached_dw_loc_list_def): New structure. | ||
| 7 | (cached_dw_loc_list): New typedef. | ||
| 8 | (cached_dw_loc_list_table): New variable. | ||
| 9 | (cached_dw_loc_list_table_hash): New function. | ||
| 10 | (cached_dw_loc_list_table_eq): Likewise. | ||
| 11 | (add_location_or_const_value_attribute): Take a bool cache_p. | ||
| 12 | Cache the list when the parameter is true. | ||
| 13 | (gen_formal_parameter_die): Update caller. | ||
| 14 | (gen_variable_die): Likewise. | ||
| 15 | (dwarf2out_finish): Likewise. | ||
| 16 | (dwarf2out_abstract_function): Nullify cached_dw_loc_list_table | ||
| 17 | while generating debug info for the decl. | ||
| 18 | (dwarf2out_function_decl): Clear cached_dw_loc_list_table. | ||
| 19 | (dwarf2out_init): Initialize cached_dw_loc_list_table. | ||
| 20 | (resolve_addr): Cache the result of resolving a chain of | ||
| 21 | location lists. | ||
| 22 | |||
| 23 | From: 2010-10-12 Jakub Jelinek <jakub@redhat.com> | ||
| 24 | * dwarf2out.c (dw_loc_list_node): Add emitted field. | ||
| 25 | (output_loc_list): Return immediately if emitted is set, set it. | ||
| 26 | |||
| 27 | === modified file 'gcc/dwarf2out.c' | ||
| 28 | --- old/gcc/dwarf2out.c 2011-03-10 14:55:10 +0000 | ||
| 29 | +++ new/gcc/dwarf2out.c 2011-03-28 09:43:50 +0000 | ||
| 30 | @@ -4256,6 +4256,12 @@ | ||
| 31 | Only on head of list */ | ||
| 32 | const char *section; /* Section this loclist is relative to */ | ||
| 33 | dw_loc_descr_ref expr; | ||
| 34 | + /* True if all addresses in this and subsequent lists are known to be | ||
| 35 | + resolved. */ | ||
| 36 | + bool resolved_addr; | ||
| 37 | + /* True if this list has been replaced by dw_loc_next. */ | ||
| 38 | + bool replaced; | ||
| 39 | + bool emitted; | ||
| 40 | } dw_loc_list_node; | ||
| 41 | |||
| 42 | #if defined (DWARF2_DEBUGGING_INFO) || defined (DWARF2_UNWIND_INFO) | ||
| 43 | @@ -5759,6 +5765,19 @@ | ||
| 44 | /* Table of decl location linked lists. */ | ||
| 45 | static GTY ((param_is (var_loc_list))) htab_t decl_loc_table; | ||
| 46 | |||
| 47 | +/* A cached location list. */ | ||
| 48 | +struct GTY (()) cached_dw_loc_list_def { | ||
| 49 | + /* The DECL_UID of the decl that this entry describes. */ | ||
| 50 | + unsigned int decl_id; | ||
| 51 | + | ||
| 52 | + /* The cached location list. */ | ||
| 53 | + dw_loc_list_ref loc_list; | ||
| 54 | +}; | ||
| 55 | +typedef struct cached_dw_loc_list_def cached_dw_loc_list; | ||
| 56 | + | ||
| 57 | +/* Table of cached location lists. */ | ||
| 58 | +static GTY ((param_is (cached_dw_loc_list))) htab_t cached_dw_loc_list_table; | ||
| 59 | + | ||
| 60 | /* A pointer to the base of a list of references to DIE's that | ||
| 61 | are uniquely identified by their tag, presence/absence of | ||
| 62 | children DIE's, and list of attribute/value pairs. */ | ||
| 63 | @@ -6112,7 +6131,7 @@ | ||
| 64 | static void insert_int (HOST_WIDE_INT, unsigned, unsigned char *); | ||
| 65 | static void insert_float (const_rtx, unsigned char *); | ||
| 66 | static rtx rtl_for_decl_location (tree); | ||
| 67 | -static bool add_location_or_const_value_attribute (dw_die_ref, tree, | ||
| 68 | +static bool add_location_or_const_value_attribute (dw_die_ref, tree, bool, | ||
| 69 | enum dwarf_attribute); | ||
| 70 | static bool tree_add_const_value_attribute (dw_die_ref, tree); | ||
| 71 | static bool tree_add_const_value_attribute_for_decl (dw_die_ref, tree); | ||
| 72 | @@ -7731,6 +7750,24 @@ | ||
| 73 | htab_find_with_hash (decl_loc_table, decl, DECL_UID (decl)); | ||
| 74 | } | ||
| 75 | |||
| 76 | +/* Returns a hash value for X (which really is a cached_dw_loc_list_list). */ | ||
| 77 | + | ||
| 78 | +static hashval_t | ||
| 79 | +cached_dw_loc_list_table_hash (const void *x) | ||
| 80 | +{ | ||
| 81 | + return (hashval_t) ((const cached_dw_loc_list *) x)->decl_id; | ||
| 82 | +} | ||
| 83 | + | ||
| 84 | +/* Return nonzero if decl_id of cached_dw_loc_list X is the same as | ||
| 85 | + UID of decl *Y. */ | ||
| 86 | + | ||
| 87 | +static int | ||
| 88 | +cached_dw_loc_list_table_eq (const void *x, const void *y) | ||
| 89 | +{ | ||
| 90 | + return (((const cached_dw_loc_list *) x)->decl_id | ||
| 91 | + == DECL_UID ((const_tree) y)); | ||
| 92 | +} | ||
| 93 | + | ||
| 94 | /* Equate a DIE to a particular declaration. */ | ||
| 95 | |||
| 96 | static void | ||
| 97 | @@ -10355,6 +10392,10 @@ | ||
| 98 | { | ||
| 99 | dw_loc_list_ref curr = list_head; | ||
| 100 | |||
| 101 | + if (list_head->emitted) | ||
| 102 | + return; | ||
| 103 | + list_head->emitted = true; | ||
| 104 | + | ||
| 105 | ASM_OUTPUT_LABEL (asm_out_file, list_head->ll_symbol); | ||
| 106 | |||
| 107 | /* Walk the location list, and output each range + expression. */ | ||
| 108 | @@ -15920,15 +15961,22 @@ | ||
| 109 | these things can crop up in other ways also.) Note that one type of | ||
| 110 | constant value which can be passed into an inlined function is a constant | ||
| 111 | pointer. This can happen for example if an actual argument in an inlined | ||
| 112 | - function call evaluates to a compile-time constant address. */ | ||
| 113 | + function call evaluates to a compile-time constant address. | ||
| 114 | + | ||
| 115 | + CACHE_P is true if it is worth caching the location list for DECL, | ||
| 116 | + so that future calls can reuse it rather than regenerate it from scratch. | ||
| 117 | + This is true for BLOCK_NONLOCALIZED_VARS in inlined subroutines, | ||
| 118 | + since we will need to refer to them each time the function is inlined. */ | ||
| 119 | |||
| 120 | static bool | ||
| 121 | -add_location_or_const_value_attribute (dw_die_ref die, tree decl, | ||
| 122 | +add_location_or_const_value_attribute (dw_die_ref die, tree decl, bool cache_p, | ||
| 123 | enum dwarf_attribute attr) | ||
| 124 | { | ||
| 125 | rtx rtl; | ||
| 126 | dw_loc_list_ref list; | ||
| 127 | var_loc_list *loc_list; | ||
| 128 | + cached_dw_loc_list *cache; | ||
| 129 | + void **slot; | ||
| 130 | |||
| 131 | if (TREE_CODE (decl) == ERROR_MARK) | ||
| 132 | return false; | ||
| 133 | @@ -15964,7 +16012,34 @@ | ||
| 134 | && add_const_value_attribute (die, rtl)) | ||
| 135 | return true; | ||
| 136 | } | ||
| 137 | - list = loc_list_from_tree (decl, decl_by_reference_p (decl) ? 0 : 2); | ||
| 138 | + /* If this decl is from BLOCK_NONLOCALIZED_VARS, we might need its | ||
| 139 | + list several times. See if we've already cached the contents. */ | ||
| 140 | + list = NULL; | ||
| 141 | + if (loc_list == NULL || cached_dw_loc_list_table == NULL) | ||
| 142 | + cache_p = false; | ||
| 143 | + if (cache_p) | ||
| 144 | + { | ||
| 145 | + cache = (cached_dw_loc_list *) | ||
| 146 | + htab_find_with_hash (cached_dw_loc_list_table, decl, DECL_UID (decl)); | ||
| 147 | + if (cache) | ||
| 148 | + list = cache->loc_list; | ||
| 149 | + } | ||
| 150 | + if (list == NULL) | ||
| 151 | + { | ||
| 152 | + list = loc_list_from_tree (decl, decl_by_reference_p (decl) ? 0 : 2); | ||
| 153 | + /* It is usually worth caching this result if the decl is from | ||
| 154 | + BLOCK_NONLOCALIZED_VARS and if the list has at least two elements. */ | ||
| 155 | + if (cache_p && list && list->dw_loc_next) | ||
| 156 | + { | ||
| 157 | + slot = htab_find_slot_with_hash (cached_dw_loc_list_table, decl, | ||
| 158 | + DECL_UID (decl), INSERT); | ||
| 159 | + cache = (cached_dw_loc_list *) | ||
| 160 | + ggc_alloc_cleared (sizeof (cached_dw_loc_list)); | ||
| 161 | + cache->decl_id = DECL_UID (decl); | ||
| 162 | + cache->loc_list = list; | ||
| 163 | + *slot = cache; | ||
| 164 | + } | ||
| 165 | + } | ||
| 166 | if (list) | ||
| 167 | { | ||
| 168 | add_AT_location_description (die, attr, list); | ||
| 169 | @@ -17532,7 +17607,7 @@ | ||
| 170 | equate_decl_number_to_die (node, parm_die); | ||
| 171 | if (! DECL_ABSTRACT (node_or_origin)) | ||
| 172 | add_location_or_const_value_attribute (parm_die, node_or_origin, | ||
| 173 | - DW_AT_location); | ||
| 174 | + node == NULL, DW_AT_location); | ||
| 175 | |||
| 176 | break; | ||
| 177 | |||
| 178 | @@ -17712,6 +17787,7 @@ | ||
| 179 | tree context; | ||
| 180 | int was_abstract; | ||
| 181 | htab_t old_decl_loc_table; | ||
| 182 | + htab_t old_cached_dw_loc_list_table; | ||
| 183 | |||
| 184 | /* Make sure we have the actual abstract inline, not a clone. */ | ||
| 185 | decl = DECL_ORIGIN (decl); | ||
| 186 | @@ -17725,7 +17801,9 @@ | ||
| 187 | DIE. Be sure to not clobber the outer location table nor use it or we would | ||
| 188 | get locations in abstract instantces. */ | ||
| 189 | old_decl_loc_table = decl_loc_table; | ||
| 190 | + old_cached_dw_loc_list_table = cached_dw_loc_list_table; | ||
| 191 | decl_loc_table = NULL; | ||
| 192 | + cached_dw_loc_list_table = NULL; | ||
| 193 | |||
| 194 | /* Be sure we've emitted the in-class declaration DIE (if any) first, so | ||
| 195 | we don't get confused by DECL_ABSTRACT. */ | ||
| 196 | @@ -17750,6 +17828,7 @@ | ||
| 197 | |||
| 198 | current_function_decl = save_fn; | ||
| 199 | decl_loc_table = old_decl_loc_table; | ||
| 200 | + cached_dw_loc_list_table = old_cached_dw_loc_list_table; | ||
| 201 | pop_cfun (); | ||
| 202 | } | ||
| 203 | |||
| 204 | @@ -18431,9 +18510,8 @@ | ||
| 205 | && !TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl_or_origin))) | ||
| 206 | defer_location (decl_or_origin, var_die); | ||
| 207 | else | ||
| 208 | - add_location_or_const_value_attribute (var_die, | ||
| 209 | - decl_or_origin, | ||
| 210 | - DW_AT_location); | ||
| 211 | + add_location_or_const_value_attribute (var_die, decl_or_origin, | ||
| 212 | + decl == NULL, DW_AT_location); | ||
| 213 | add_pubname (decl_or_origin, var_die); | ||
| 214 | } | ||
| 215 | else | ||
| 216 | @@ -20049,6 +20127,7 @@ | ||
| 217 | dwarf2out_decl (decl); | ||
| 218 | |||
| 219 | htab_empty (decl_loc_table); | ||
| 220 | + htab_empty (cached_dw_loc_list_table); | ||
| 221 | } | ||
| 222 | |||
| 223 | /* Output a marker (i.e. a label) for the beginning of the generated code for | ||
| 224 | @@ -20649,6 +20728,11 @@ | ||
| 225 | decl_loc_table = htab_create_ggc (10, decl_loc_table_hash, | ||
| 226 | decl_loc_table_eq, NULL); | ||
| 227 | |||
| 228 | + /* Allocate the cached_dw_loc_list_table. */ | ||
| 229 | + cached_dw_loc_list_table | ||
| 230 | + = htab_create_ggc (10, cached_dw_loc_list_table_hash, | ||
| 231 | + cached_dw_loc_list_table_eq, NULL); | ||
| 232 | + | ||
| 233 | /* Allocate the initial hunk of the decl_scope_table. */ | ||
| 234 | decl_scope_table = VEC_alloc (tree, gc, 256); | ||
| 235 | |||
| 236 | @@ -21278,30 +21362,53 @@ | ||
| 237 | { | ||
| 238 | dw_die_ref c; | ||
| 239 | dw_attr_ref a; | ||
| 240 | - dw_loc_list_ref *curr; | ||
| 241 | + dw_loc_list_ref *curr, *start, loc; | ||
| 242 | unsigned ix; | ||
| 243 | |||
| 244 | for (ix = 0; VEC_iterate (dw_attr_node, die->die_attr, ix, a); ix++) | ||
| 245 | switch (AT_class (a)) | ||
| 246 | { | ||
| 247 | case dw_val_class_loc_list: | ||
| 248 | - curr = AT_loc_list_ptr (a); | ||
| 249 | - while (*curr) | ||
| 250 | + start = curr = AT_loc_list_ptr (a); | ||
| 251 | + loc = *curr; | ||
| 252 | + gcc_assert (loc); | ||
| 253 | + /* The same list can be referenced more than once. See if we have | ||
| 254 | + already recorded the result from a previous pass. */ | ||
| 255 | + if (loc->replaced) | ||
| 256 | + *curr = loc->dw_loc_next; | ||
| 257 | + else if (!loc->resolved_addr) | ||
| 258 | { | ||
| 259 | - if (!resolve_addr_in_expr ((*curr)->expr)) | ||
| 260 | + /* As things stand, we do not expect or allow one die to | ||
| 261 | + reference a suffix of another die's location list chain. | ||
| 262 | + References must be identical or completely separate. | ||
| 263 | + There is therefore no need to cache the result of this | ||
| 264 | + pass on any list other than the first; doing so | ||
| 265 | + would lead to unnecessary writes. */ | ||
| 266 | + while (*curr) | ||
| 267 | { | ||
| 268 | - dw_loc_list_ref next = (*curr)->dw_loc_next; | ||
| 269 | - if (next && (*curr)->ll_symbol) | ||
| 270 | + gcc_assert (!(*curr)->replaced && !(*curr)->resolved_addr); | ||
| 271 | + if (!resolve_addr_in_expr ((*curr)->expr)) | ||
| 272 | { | ||
| 273 | - gcc_assert (!next->ll_symbol); | ||
| 274 | - next->ll_symbol = (*curr)->ll_symbol; | ||
| 275 | + dw_loc_list_ref next = (*curr)->dw_loc_next; | ||
| 276 | + if (next && (*curr)->ll_symbol) | ||
| 277 | + { | ||
| 278 | + gcc_assert (!next->ll_symbol); | ||
| 279 | + next->ll_symbol = (*curr)->ll_symbol; | ||
| 280 | + } | ||
| 281 | + *curr = next; | ||
| 282 | } | ||
| 283 | - *curr = next; | ||
| 284 | + else | ||
| 285 | + curr = &(*curr)->dw_loc_next; | ||
| 286 | } | ||
| 287 | + if (loc == *start) | ||
| 288 | + loc->resolved_addr = 1; | ||
| 289 | else | ||
| 290 | - curr = &(*curr)->dw_loc_next; | ||
| 291 | + { | ||
| 292 | + loc->replaced = 1; | ||
| 293 | + loc->dw_loc_next = *start; | ||
| 294 | + } | ||
| 295 | } | ||
| 296 | - if (!AT_loc_list (a)) | ||
| 297 | + if (!*start) | ||
| 298 | { | ||
| 299 | remove_AT (die, a->dw_attr); | ||
| 300 | ix--; | ||
| 301 | @@ -21361,6 +21468,7 @@ | ||
| 302 | add_location_or_const_value_attribute ( | ||
| 303 | VEC_index (deferred_locations, deferred_locations_list, i)->die, | ||
| 304 | VEC_index (deferred_locations, deferred_locations_list, i)->variable, | ||
| 305 | + false, | ||
| 306 | DW_AT_location); | ||
| 307 | } | ||
| 308 | |||
| 309 | |||
diff --git a/meta-oe/recipes-devtools/gcc/gcc-4.5/linaro/gcc-4.5-linaro-r99494.patch b/meta-oe/recipes-devtools/gcc/gcc-4.5/linaro/gcc-4.5-linaro-r99494.patch new file mode 100644 index 0000000000..56897e984b --- /dev/null +++ b/meta-oe/recipes-devtools/gcc/gcc-4.5/linaro/gcc-4.5-linaro-r99494.patch | |||
| @@ -0,0 +1,1272 @@ | |||
| 1 | 2011-04-09 Andrew Stubbs <ams@codesourcery.com> | ||
| 2 | |||
| 3 | Backport from mainline: | ||
| 4 | |||
| 5 | Maxim Kuvyrkov <maxim@codesourcery.com> | ||
| 6 | |||
| 7 | * config.sub: Recognize *-linux-android*. | ||
| 8 | |||
| 9 | 2010-05-27 Maxim Kuvyrkov <maxim@codesourcery.com> | ||
| 10 | |||
| 11 | Add support for Bionic C library | ||
| 12 | gcc/ | ||
| 13 | * config.gcc (LIBC_GLIBC, LIBC_BIONIC, LIBC_UCLIBC): New tm_define | ||
| 14 | macro. | ||
| 15 | (DEFAULT_LIBC): New tm_define macro set to one of LIBC_*. | ||
| 16 | (bfin*-uclinux, moxie-*-uclinux*, m68k-*-uclinux*): Update. | ||
| 17 | |||
| 18 | * config/linux.h (OPTION_GLIBC, OPTION_UCLIBC, OPTION_BIONIC): Define. | ||
| 19 | (LINUX_TARGET_OS_CPP_BUILTINS): Define __gnu_linux__ only for GLIBC. | ||
| 20 | (CHOOSE_DYNAMIC_LINKER1, CHOOSE_DYNAMIC_LINKER): Make it easier | ||
| 21 | to support multiple C libraries. Handle Bionic. | ||
| 22 | (BIONIC_DYNAMIC_LINKER, BIONIC_DYNAMIC_LINKER32,) | ||
| 23 | (BIONIC_DYNAMIC_LINKER64): Define. | ||
| 24 | (LINUX_DYNAMIC_LINKER, LINUX_DYNAMIC_LINKER32, LINUX_DYNAMIC_LINKER64): | ||
| 25 | Update. | ||
| 26 | (TARGET_HAS_SINCOS): Enable for Bionic. | ||
| 27 | |||
| 28 | * config/linux.opt: Rewrite to handle more than 2 C libraries. Make | ||
| 29 | the last option specified on command line take effect. | ||
| 30 | (linux_uclibc): Rename to linux_libc, initialize using DEFAULT_LIBC. | ||
| 31 | (mbionic): New. | ||
| 32 | (mglibc, muclibc): Update. | ||
| 33 | |||
| 34 | * config/alpha/linux-elf.h, config/rs6000/linux64.h, | ||
| 35 | * config/rs6000/sysv4.h (CHOOSE_DYNAMIC_LINKER): Update to use | ||
| 36 | DEFAULT_LIBC. | ||
| 37 | |||
| 38 | * doc/invoke.texi (-mglibc, -muclibc): Update. | ||
| 39 | (-mbionic): Document. | ||
| 40 | |||
| 41 | gcc/testsuite/ | ||
| 42 | * gcc.dg/glibc-uclibc-1.c, gcc.dg/glibc-uclibc-2.c: Remove, no longer | ||
| 43 | necessary. | ||
| 44 | |||
| 45 | 2010-05-27 Maxim Kuvyrkov <maxim@codesourcery.com> | ||
| 46 | |||
| 47 | Support compilation for Android platform. Reimplement -mandroid. | ||
| 48 | gcc/ | ||
| 49 | * config.gcc (*linux*): Include linux-android.h and linux-android.opt. | ||
| 50 | (*android*): Set ANDROID_DEFAULT. | ||
| 51 | (arm*-*-linux*): Include linux-android.h. | ||
| 52 | (arm*-*-eabi*): Don't include previous -mandroid implementation. | ||
| 53 | * config/arm/eabi.h: Remove, move Android-specific parts ... | ||
| 54 | * config/linux-android.h: ... here. New file. | ||
| 55 | * config/arm/eabi.opt: Rename to ... | ||
| 56 | * config/linux-android.opt: ... this. | ||
| 57 | (mandroid): Allow -mno-android option. Initialize based on | ||
| 58 | ANDROID_DEFAULT. | ||
| 59 | * config/linux.h (STARTFILE_SPEC, ENDFILE_SPEC, CC1_SPEC, LIB_SPEC): | ||
| 60 | Move logic to corresponding LINUX_TARGET_* macros. | ||
| 61 | (TARGET_OS_CPP_BUILTINS): Define __ANDROID__, when appropriate. | ||
| 62 | * config/linux-eabi.h (LINK_SPEC, CC1_SPEC, CC1PLUS_SPEC, LIB_SPEC,) | ||
| 63 | (STARTFILE_SPEC, ENDFILE_SPEC): Define to choose between Linux and | ||
| 64 | Android definitions. | ||
| 65 | (LINUX_TARGET_OS_CPP_BUILTINS): Define __ANDROID__ if TARGET_ANDROID. | ||
| 66 | * doc/invoke.texi (-mandroid, -tno-android-cc, -tno-android-ld): | ||
| 67 | Document. | ||
| 68 | |||
| 69 | 2010-06-01 Maxim Kuvyrkov <maxim@codesourcery.com> | ||
| 70 | |||
| 71 | gcc/ | ||
| 72 | * config/arm/t-linux-androideabi: New. | ||
| 73 | * config.gcc (arm*-*-linux-androideabi): Include multilib configuration. | ||
| 74 | |||
| 75 | 2010-05-27 Maxim Kuvyrkov <maxim@codesourcery.com> | ||
| 76 | |||
| 77 | gcc/ | ||
| 78 | * gthr-posix.h (pthread_cancel): Don't declare if compiling against | ||
| 79 | Bionic C library. | ||
| 80 | (__gthread_active_p): Check for pthread_create if compiling against | ||
| 81 | Bionic C library. | ||
| 82 | |||
| 83 | 2010-06-01 Maxim Kuvyrkov <maxim@codesourcery.com> | ||
| 84 | |||
| 85 | libstdc++-v3/ | ||
| 86 | * acinclude.m4: Support Bionic C library. | ||
| 87 | Explicitly specify -fexceptions for exception check. | ||
| 88 | * configure.host: Support Bionic C library. | ||
| 89 | * configure: Regenerate. | ||
| 90 | * config/os/bionic/ctype_base.h, config/os/bionic/ctype_inline.h, | ||
| 91 | * config/os/bionic/ctype_noincline.h, config/os/bionic/os_defines.h: | ||
| 92 | New files, based on config/os/newlib/*. | ||
| 93 | |||
| 94 | === modified file 'config.sub' | ||
| 95 | Index: gcc-4.5.3/config.sub | ||
| 96 | =================================================================== | ||
| 97 | --- gcc-4.5.3.orig/config.sub | ||
| 98 | +++ gcc-4.5.3/config.sub | ||
| 99 | @@ -4,7 +4,7 @@ | ||
| 100 | # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 | ||
| 101 | # Free Software Foundation, Inc. | ||
| 102 | |||
| 103 | -timestamp='2010-03-22' | ||
| 104 | +timestamp='2010-04-23' | ||
| 105 | |||
| 106 | # This file is (in principle) common to ALL GNU software. | ||
| 107 | # The presence of a machine in this file suggests that SOME GNU software | ||
| 108 | @@ -124,8 +124,9 @@ esac | ||
| 109 | # Here we must recognize all the valid KERNEL-OS combinations. | ||
| 110 | maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` | ||
| 111 | case $maybe_os in | ||
| 112 | - nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ | ||
| 113 | - uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ | ||
| 114 | + nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ | ||
| 115 | + linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ | ||
| 116 | + knetbsd*-gnu* | netbsd*-gnu* | \ | ||
| 117 | kopensolaris*-gnu* | \ | ||
| 118 | storm-chaos* | os2-emx* | rtmk-nova*) | ||
| 119 | os=-$maybe_os | ||
| 120 | @@ -1307,7 +1308,8 @@ case $os in | ||
| 121 | | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | ||
| 122 | | -chorusos* | -chorusrdb* | -cegcc* \ | ||
| 123 | | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | ||
| 124 | - | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ | ||
| 125 | + | -mingw32* | -linux-gnu* | -linux-android* \ | ||
| 126 | + | -linux-newlib* | -linux-uclibc* \ | ||
| 127 | | -uxpv* | -beos* | -mpeix* | -udk* \ | ||
| 128 | | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | ||
| 129 | | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | ||
| 130 | Index: gcc-4.5.3/gcc/config.gcc | ||
| 131 | =================================================================== | ||
| 132 | --- gcc-4.5.3.orig/gcc/config.gcc | ||
| 133 | +++ gcc-4.5.3/gcc/config.gcc | ||
| 134 | @@ -513,26 +513,48 @@ case ${target} in | ||
| 135 | *-*-gnu*) | ||
| 136 | tmake_file="$tmake_file t-gnu";; | ||
| 137 | esac | ||
| 138 | - # glibc / uclibc switch. uclibc isn't usable for GNU/Hurd and neither for | ||
| 139 | - # GNU/k*BSD. | ||
| 140 | + # Common C libraries. | ||
| 141 | + tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3" | ||
| 142 | + # glibc / uclibc / bionic switch. | ||
| 143 | + # uclibc and bionic aren't usable for GNU/Hurd and neither for GNU/k*BSD. | ||
| 144 | case $target in | ||
| 145 | *linux*) | ||
| 146 | extra_options="$extra_options linux.opt";; | ||
| 147 | *) | ||
| 148 | tm_defines="$tm_defines OPTION_GLIBC=1";; | ||
| 149 | esac | ||
| 150 | - case ${target} in | ||
| 151 | + case $target in | ||
| 152 | + *-*-*android*) | ||
| 153 | + tm_defines="$tm_defines DEFAULT_LIBC=LIBC_BIONIC" | ||
| 154 | + ;; | ||
| 155 | *-*-*uclibc*) | ||
| 156 | - tm_defines="${tm_defines} UCLIBC_DEFAULT=1" | ||
| 157 | + tm_defines="$tm_defines DEFAULT_LIBC=LIBC_UCLIBC" | ||
| 158 | ;; | ||
| 159 | *) | ||
| 160 | - tm_defines="${tm_defines} UCLIBC_DEFAULT=0" | ||
| 161 | + tm_defines="$tm_defines DEFAULT_LIBC=LIBC_GLIBC" | ||
| 162 | ;; | ||
| 163 | esac | ||
| 164 | - # Assume that glibc or uClibc are being used and so __cxa_atexit is provided. | ||
| 165 | + # Assume that glibc or uClibc or Bionic are being used and so __cxa_atexit | ||
| 166 | + # is provided. | ||
| 167 | default_use_cxa_atexit=yes | ||
| 168 | use_gcc_tgmath=no | ||
| 169 | use_gcc_stdint=wrap | ||
| 170 | + # Add Android userspace support to Linux targets. | ||
| 171 | + case $target in | ||
| 172 | + *linux*) | ||
| 173 | + tm_file="$tm_file linux-android.h" | ||
| 174 | + extra_options="$extra_options linux-android.opt" | ||
| 175 | + ;; | ||
| 176 | + esac | ||
| 177 | + # Enable compilation for Android by default for *android* targets. | ||
| 178 | + case $target in | ||
| 179 | + *-*-*android*) | ||
| 180 | + tm_defines="$tm_defines ANDROID_DEFAULT=1" | ||
| 181 | + ;; | ||
| 182 | + *) | ||
| 183 | + tm_defines="$tm_defines ANDROID_DEFAULT=0" | ||
| 184 | + ;; | ||
| 185 | + esac | ||
| 186 | ;; | ||
| 187 | *-*-netbsd*) | ||
| 188 | tmake_file="t-slibgcc-elf-ver t-libc-ok t-netbsd t-libgcc-pic" | ||
| 189 | @@ -728,7 +750,7 @@ arm*-*-netbsd*) | ||
| 190 | use_collect2=yes | ||
| 191 | ;; | ||
| 192 | arm*-*-linux*) # ARM GNU/Linux with ELF | ||
| 193 | - tm_file="dbxelf.h elfos.h linux.h glibc-stdint.h arm/elf.h arm/linux-gas.h arm/linux-elf.h" | ||
| 194 | + tm_file="dbxelf.h elfos.h linux.h linux-android.h glibc-stdint.h arm/elf.h arm/linux-gas.h arm/linux-elf.h" | ||
| 195 | case $target in | ||
| 196 | arm*b-*) | ||
| 197 | tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1" | ||
| 198 | @@ -739,6 +761,12 @@ arm*-*-linux*) # ARM GNU/Linux with EL | ||
| 199 | arm*-*-linux-*eabi) | ||
| 200 | tm_file="$tm_file arm/bpabi.h arm/linux-eabi.h" | ||
| 201 | tmake_file="$tmake_file arm/t-arm-elf arm/t-bpabi arm/t-linux-eabi t-slibgcc-libgcc" | ||
| 202 | + # Define multilib configuration for arm-linux-androideabi. | ||
| 203 | + case ${target} in | ||
| 204 | + *-androideabi) | ||
| 205 | + tmake_file="$tmake_file arm/t-linux-androideabi" | ||
| 206 | + ;; | ||
| 207 | + esac | ||
| 208 | # The BPABI long long divmod functions return a 128-bit value in | ||
| 209 | # registers r0-r3. Correctly modeling that requires the use of | ||
| 210 | # TImode. | ||
| 211 | @@ -785,9 +813,8 @@ arm*-*-eabi* | arm*-*-symbianelf* ) | ||
| 212 | tmake_file="arm/t-arm arm/t-arm-elf" | ||
| 213 | case ${target} in | ||
| 214 | arm*-*-eabi*) | ||
| 215 | - tm_file="$tm_file arm/eabi.h newlib-stdint.h" | ||
| 216 | + tm_file="$tm_file newlib-stdint.h" | ||
| 217 | tmake_file="${tmake_file} arm/t-bpabi" | ||
| 218 | - extra_options="${extra_options} arm/eabi.opt" | ||
| 219 | use_gcc_stdint=wrap | ||
| 220 | ;; | ||
| 221 | arm*-*-symbianelf*) | ||
| 222 | @@ -843,7 +870,7 @@ bfin*-elf*) | ||
| 223 | bfin*-uclinux*) | ||
| 224 | tm_file="${tm_file} dbxelf.h elfos.h bfin/elf.h linux.h glibc-stdint.h bfin/uclinux.h" | ||
| 225 | tmake_file=bfin/t-bfin-uclinux | ||
| 226 | - tm_defines="${tm_defines} UCLIBC_DEFAULT=1" | ||
| 227 | + tm_defines="${tm_defines} DEFAULT_LIBC=LIBC_UCLIBC" | ||
| 228 | extra_options="${extra_options} linux.opt" | ||
| 229 | use_collect2=no | ||
| 230 | ;; | ||
| 231 | @@ -924,7 +951,7 @@ moxie-*-uclinux*) | ||
| 232 | tm_file="dbxelf.h elfos.h svr4.h ${tm_file} linux.h glibc-stdint.h moxie/uclinux.h" | ||
| 233 | extra_parts="crti.o crtn.o crtbegin.o crtend.o" | ||
| 234 | tmake_file="${tmake_file} moxie/t-moxie moxie/t-moxie-softfp soft-fp/t-softfp" | ||
| 235 | - tm_defines="${tm_defines} UCLIBC_DEFAULT=1" | ||
| 236 | + tm_defines="${tm_defines} DEFAULT_LIBC=LIBC_UCLIBC" | ||
| 237 | extra_options="${extra_options} linux.opt" | ||
| 238 | ;; | ||
| 239 | h8300-*-rtems*) | ||
| 240 | @@ -1644,7 +1671,7 @@ m68k-*-uclinux*) # Motorola m68k/ColdFi | ||
| 241 | default_m68k_cpu=68020 | ||
| 242 | default_cf_cpu=5206 | ||
| 243 | tm_file="${tm_file} dbxelf.h elfos.h svr4.h linux.h glibc-stdint.h flat.h m68k/linux.h m68k/uclinux.h ./sysroot-suffix.h" | ||
| 244 | - tm_defines="${tm_defines} MOTOROLA=1 UCLIBC_DEFAULT=1" | ||
| 245 | + tm_defines="${tm_defines} MOTOROLA=1 DEFAULT_LIBC=LIBC_UCLIBC" | ||
| 246 | extra_options="${extra_options} linux.opt" | ||
| 247 | tmake_file="m68k/t-floatlib m68k/t-uclinux m68k/t-mlibs" | ||
| 248 | ;; | ||
| 249 | Index: gcc-4.5.3/gcc/config/alpha/linux-elf.h | ||
| 250 | =================================================================== | ||
| 251 | --- gcc-4.5.3.orig/gcc/config/alpha/linux-elf.h | ||
| 252 | +++ gcc-4.5.3/gcc/config/alpha/linux-elf.h | ||
| 253 | @@ -29,10 +29,12 @@ along with GCC; see the file COPYING3. | ||
| 254 | |||
| 255 | #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2" | ||
| 256 | #define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" | ||
| 257 | -#if UCLIBC_DEFAULT | ||
| 258 | -#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:%{muclibc:%e-mglibc and -muclibc used together}" G ";:" U "}" | ||
| 259 | +#if DEFAULT_LIBC == LIBC_UCLIBC | ||
| 260 | +#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}" | ||
| 261 | +#elif DEFAULT_LIBC == LIBC_GLIBC | ||
| 262 | +#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}" | ||
| 263 | #else | ||
| 264 | -#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:%{mglibc:%e-mglibc and -muclibc used together}" U ";:" G "}" | ||
| 265 | +#error "Unsupported DEFAULT_LIBC" | ||
| 266 | #endif | ||
| 267 | #define LINUX_DYNAMIC_LINKER \ | ||
| 268 | CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER) | ||
| 269 | Index: gcc-4.5.3/gcc/config/arm/eabi.h | ||
| 270 | =================================================================== | ||
| 271 | --- gcc-4.5.3.orig/gcc/config/arm/eabi.h | ||
| 272 | +++ /dev/null | ||
| 273 | @@ -1,125 +0,0 @@ | ||
| 274 | -/* Configuration file for ARM EABI targets. | ||
| 275 | - Copyright (C) 2008 | ||
| 276 | - Free Software Foundation, Inc. | ||
| 277 | - Contributed by Doug Kwan (dougkwan@google.com) | ||
| 278 | - | ||
| 279 | - This file is part of GCC. | ||
| 280 | - | ||
| 281 | - GCC is free software; you can redistribute it and/or modify it | ||
| 282 | - under the terms of the GNU General Public License as published | ||
| 283 | - by the Free Software Foundation; either version 3, or (at your | ||
| 284 | - option) any later version. | ||
| 285 | - | ||
| 286 | - GCC is distributed in the hope that it will be useful, but WITHOUT | ||
| 287 | - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | ||
| 288 | - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public | ||
| 289 | - License for more details. | ||
| 290 | - | ||
| 291 | - You should have received a copy of the GNU General Public License | ||
| 292 | - along with GCC; see the file COPYING3. If not see | ||
| 293 | - <http://www.gnu.org/licenses/>. */ | ||
| 294 | - | ||
| 295 | -/* This file contains macro overrides for EABI targets. */ | ||
| 296 | - | ||
| 297 | -#undef TARGET_OS_CPP_BUILTINS | ||
| 298 | -#define TARGET_OS_CPP_BUILTINS() \ | ||
| 299 | - do \ | ||
| 300 | - { \ | ||
| 301 | - TARGET_BPABI_CPP_BUILTINS (); \ | ||
| 302 | - if (TARGET_ANDROID) \ | ||
| 303 | - builtin_define ("__ANDROID__"); \ | ||
| 304 | - } \ | ||
| 305 | - while (false) | ||
| 306 | - | ||
| 307 | -#undef SUBSUBTARGET_EXTRA_SPECS | ||
| 308 | -#define SUBSUBTARGET_EXTRA_SPECS \ | ||
| 309 | - { "link_android", ANDROID_LINK_SPEC }, \ | ||
| 310 | - { "link_default", BPABI_LINK_SPEC }, \ | ||
| 311 | - { "cc1_android", ANDROID_CC1_SPEC }, \ | ||
| 312 | - { "cc1_default", CC1_DEFAULT_SPEC }, \ | ||
| 313 | - { "cc1plus_android", ANDROID_CC1PLUS_SPEC }, \ | ||
| 314 | - { "cc1plus_default", CC1PLUS_DEFAULT_SPEC }, \ | ||
| 315 | - { "lib_android", ANDROID_LIB_SPEC }, \ | ||
| 316 | - { "lib_default", LIB_DEFAULT_SPEC }, \ | ||
| 317 | - { "startfile_android", ANDROID_STARTFILE_SPEC }, \ | ||
| 318 | - { "startfile_default", UNKNOWN_ELF_STARTFILE_SPEC }, \ | ||
| 319 | - { "endfile_android", ANDROID_ENDFILE_SPEC }, \ | ||
| 320 | - { "endfile_default", UNKNOWN_ELF_ENDFILE_SPEC }, \ | ||
| 321 | - | ||
| 322 | -#undef ANDROID_LINK_SPEC | ||
| 323 | -#define ANDROID_LINK_SPEC \ | ||
| 324 | -"%{mbig-endian:-EB} %{mlittle-endian:-EL} " \ | ||
| 325 | -"%{static:-Bstatic} %{shared:-shared} %{symbolic:-Bsymbolic} " \ | ||
| 326 | -"%{!static:" \ | ||
| 327 | - "%{shared: -Bsymbolic} " \ | ||
| 328 | - "%{!shared:" \ | ||
| 329 | - "%{rdynamic:-export-dynamic} " \ | ||
| 330 | - "%{!dynamic-linker:-dynamic-linker /system/bin/linker}}} " \ | ||
| 331 | -"-X" SUBTARGET_EXTRA_LINK_SPEC | ||
| 332 | - | ||
| 333 | -/* Override LINK_SPEC in bpabi.h. */ | ||
| 334 | -#undef LINK_SPEC | ||
| 335 | -#define LINK_SPEC \ | ||
| 336 | -"%{mandroid: %(link_android) ;" \ | ||
| 337 | -" : %(link_default)}" | ||
| 338 | - | ||
| 339 | -/* Android uses -fno-exceptions by default. */ | ||
| 340 | -#undef ANDROID_CC1_SPEC | ||
| 341 | -#define ANDROID_CC1_SPEC "%{!fexceptions:-fno-exceptions}" | ||
| 342 | - | ||
| 343 | -/* Default CC1_SPEC as in arm.h. */ | ||
| 344 | -#undef CC1_DEFAULT_SPEC | ||
| 345 | -#define CC1_DEFAULT_SPEC "" | ||
| 346 | - | ||
| 347 | -#undef CC1_SPEC | ||
| 348 | -#define CC1_SPEC \ | ||
| 349 | -"%{mandroid: %(cc1_android) ;" \ | ||
| 350 | -" : %(cc1_default)}" | ||
| 351 | - | ||
| 352 | -/* Android uses -fno-rtti by default. */ | ||
| 353 | -#undef ANDROID_CC1PLUS_SPEC | ||
| 354 | -#define ANDROID_CC1PLUS_SPEC "%{!frtti:-fno-rtti}" | ||
| 355 | - | ||
| 356 | -/* Default CC1PLUS_SPEC as in gcc.c. */ | ||
| 357 | -#undef CC1PLUS_DEFAULT_SPEC | ||
| 358 | -#define CC1PLUS_DEFAULT_SPEC "" | ||
| 359 | - | ||
| 360 | -#undef CC1PLUS_SPEC | ||
| 361 | -#define CC1PLUS_SPEC \ | ||
| 362 | -"%{mandroid: %(cc1plus_android) ;" \ | ||
| 363 | -" : %(cc1plus_default)}" | ||
| 364 | - | ||
| 365 | -#undef ANDROID_LIB_SPEC | ||
| 366 | -#define ANDROID_LIB_SPEC "-lc %{!static:-ldl}" | ||
| 367 | - | ||
| 368 | -/* Default LIB_SPEC as in gcc.c. */ | ||
| 369 | -#undef LIB_DEFAULT_SPEC | ||
| 370 | -#define LIB_DEFAULT_SPEC \ | ||
| 371 | -"%{!shared:%{g*:-lg} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}}" | ||
| 372 | - | ||
| 373 | -#undef LIB_SPEC | ||
| 374 | -#define LIB_SPEC \ | ||
| 375 | -"%{mandroid: %(lib_android) ;" \ | ||
| 376 | -" : %(lib_default)}" | ||
| 377 | - | ||
| 378 | -#undef ANDROID_STARTFILE_SPEC | ||
| 379 | -#define ANDROID_STARTFILE_SPEC \ | ||
| 380 | -"%{!shared:" \ | ||
| 381 | - "%{static: crtbegin_static%O%s ;" \ | ||
| 382 | - " : crtbegin_dynamic%O%s}}" | ||
| 383 | - | ||
| 384 | -/* Override STARTFILE_SPEC in unknown-elf.h. */ | ||
| 385 | -#undef STARTFILE_SPEC | ||
| 386 | -#define STARTFILE_SPEC \ | ||
| 387 | -"%{mandroid: %(startfile_android) ;" \ | ||
| 388 | -" : %(startfile_default)}" | ||
| 389 | - | ||
| 390 | -#undef ANDROID_ENDFILE_SPEC | ||
| 391 | -#define ANDROID_ENDFILE_SPEC "%{!shared:crtend_android%O%s}" | ||
| 392 | - | ||
| 393 | -/* Override ENDFILE_SPEC in unknown-elf.h. */ | ||
| 394 | -#undef ENDFILE_SPEC | ||
| 395 | -#define ENDFILE_SPEC \ | ||
| 396 | -"%{mandroid: %(endfile_android) ;" \ | ||
| 397 | -" : %(endfile_default)}" | ||
| 398 | - | ||
| 399 | Index: gcc-4.5.3/gcc/config/arm/eabi.opt | ||
| 400 | =================================================================== | ||
| 401 | --- gcc-4.5.3.orig/gcc/config/arm/eabi.opt | ||
| 402 | +++ /dev/null | ||
| 403 | @@ -1,23 +0,0 @@ | ||
| 404 | -; EABI specific options for ARM port of the compiler. | ||
| 405 | - | ||
| 406 | -; Copyright (C) 2008 Free Software Foundation, Inc. | ||
| 407 | -; | ||
| 408 | -; This file is part of GCC. | ||
| 409 | -; | ||
| 410 | -; GCC is free software; you can redistribute it and/or modify it under | ||
| 411 | -; the terms of the GNU General Public License as published by the Free | ||
| 412 | -; Software Foundation; either version 3, or (at your option) any later | ||
| 413 | -; version. | ||
| 414 | -; | ||
| 415 | -; GCC is distributed in the hope that it will be useful, but WITHOUT ANY | ||
| 416 | -; WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| 417 | -; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
| 418 | -; for more details. | ||
| 419 | -; | ||
| 420 | -; You should have received a copy of the GNU General Public License | ||
| 421 | -; along with GCC; see the file COPYING3. If not see | ||
| 422 | -; <http://www.gnu.org/licenses/>. | ||
| 423 | - | ||
| 424 | -mandroid | ||
| 425 | -Target Report RejectNegative Mask(ANDROID) | ||
| 426 | -Generate code for the Android operating system. | ||
| 427 | Index: gcc-4.5.3/gcc/config/arm/linux-eabi.h | ||
| 428 | =================================================================== | ||
| 429 | --- gcc-4.5.3.orig/gcc/config/arm/linux-eabi.h | ||
| 430 | +++ gcc-4.5.3/gcc/config/arm/linux-eabi.h | ||
| 431 | @@ -70,7 +70,30 @@ | ||
| 432 | /* At this point, bpabi.h will have clobbered LINK_SPEC. We want to | ||
| 433 | use the GNU/Linux version, not the generic BPABI version. */ | ||
| 434 | #undef LINK_SPEC | ||
| 435 | -#define LINK_SPEC LINUX_TARGET_LINK_SPEC BE8_LINK_SPEC TARGET_FIX_V4BX_SPEC | ||
| 436 | +#define LINK_SPEC BE8_LINK_SPEC TARGET_FIX_V4BX_SPEC \ | ||
| 437 | + LINUX_OR_ANDROID_LD (LINUX_TARGET_LINK_SPEC, \ | ||
| 438 | + LINUX_TARGET_LINK_SPEC " " ANDROID_LINK_SPEC) | ||
| 439 | + | ||
| 440 | +#undef CC1_SPEC | ||
| 441 | +#define CC1_SPEC \ | ||
| 442 | + LINUX_OR_ANDROID_CC (LINUX_TARGET_CC1_SPEC, \ | ||
| 443 | + LINUX_TARGET_CC1_SPEC " " ANDROID_CC1_SPEC) | ||
| 444 | + | ||
| 445 | +#define CC1PLUS_SPEC \ | ||
| 446 | + LINUX_OR_ANDROID_CC ("", ANDROID_CC1PLUS_SPEC) | ||
| 447 | + | ||
| 448 | +#undef LIB_SPEC | ||
| 449 | +#define LIB_SPEC \ | ||
| 450 | + LINUX_OR_ANDROID_LD (LINUX_TARGET_LIB_SPEC, \ | ||
| 451 | + LINUX_TARGET_LIB_SPEC " " ANDROID_LIB_SPEC) | ||
| 452 | + | ||
| 453 | +#undef STARTFILE_SPEC | ||
| 454 | +#define STARTFILE_SPEC \ | ||
| 455 | + LINUX_OR_ANDROID_LD (LINUX_TARGET_STARTFILE_SPEC, ANDROID_STARTFILE_SPEC) | ||
| 456 | + | ||
| 457 | +#undef ENDFILE_SPEC | ||
| 458 | +#define ENDFILE_SPEC \ | ||
| 459 | + LINUX_OR_ANDROID_LD (LINUX_TARGET_ENDFILE_SPEC, ANDROID_ENDFILE_SPEC) | ||
| 460 | |||
| 461 | /* Use the default LIBGCC_SPEC, not the version in linux-elf.h, as we | ||
| 462 | do not use -lfloat. */ | ||
| 463 | Index: gcc-4.5.3/gcc/config/arm/t-linux-androideabi | ||
| 464 | =================================================================== | ||
| 465 | --- /dev/null | ||
| 466 | +++ gcc-4.5.3/gcc/config/arm/t-linux-androideabi | ||
| 467 | @@ -0,0 +1,10 @@ | ||
| 468 | +MULTILIB_OPTIONS = march=armv7-a mthumb | ||
| 469 | +MULTILIB_DIRNAMES = armv7-a thumb | ||
| 470 | +MULTILIB_EXCEPTIONS = | ||
| 471 | +MULTILIB_MATCHES = | ||
| 472 | +MULTILIB_OSDIRNAMES = | ||
| 473 | + | ||
| 474 | +# The "special" multilib can be used to build native applications for Android, | ||
| 475 | +# as opposed to native shared libraries that are then called via JNI. | ||
| 476 | +#MULTILIB_OPTIONS += tno-android-cc | ||
| 477 | +#MULTILIB_DIRNAMES += special | ||
| 478 | Index: gcc-4.5.3/gcc/config/linux-android.h | ||
| 479 | =================================================================== | ||
| 480 | --- /dev/null | ||
| 481 | +++ gcc-4.5.3/gcc/config/linux-android.h | ||
| 482 | @@ -0,0 +1,53 @@ | ||
| 483 | +/* Configuration file for Linux Android targets. | ||
| 484 | + Copyright (C) 2010 | ||
| 485 | + Free Software Foundation, Inc. | ||
| 486 | + Contributed by CodeSourcery, Inc. | ||
| 487 | + | ||
| 488 | + This file is part of GCC. | ||
| 489 | + | ||
| 490 | + GCC is free software; you can redistribute it and/or modify it | ||
| 491 | + under the terms of the GNU General Public License as published | ||
| 492 | + by the Free Software Foundation; either version 3, or (at your | ||
| 493 | + option) any later version. | ||
| 494 | + | ||
| 495 | + GCC is distributed in the hope that it will be useful, but WITHOUT | ||
| 496 | + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | ||
| 497 | + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public | ||
| 498 | + License for more details. | ||
| 499 | + | ||
| 500 | + You should have received a copy of the GNU General Public License | ||
| 501 | + along with GCC; see the file COPYING3. If not see | ||
| 502 | + <http://www.gnu.org/licenses/>. */ | ||
| 503 | + | ||
| 504 | +#if ANDROID_DEFAULT | ||
| 505 | +# define NOANDROID "mno-android" | ||
| 506 | +#else | ||
| 507 | +# define NOANDROID "!mandroid" | ||
| 508 | +#endif | ||
| 509 | + | ||
| 510 | +#define LINUX_OR_ANDROID_CC(LINUX_SPEC, ANDROID_SPEC) \ | ||
| 511 | + "%{" NOANDROID "|tno-android-cc:" LINUX_SPEC ";:" ANDROID_SPEC "}" | ||
| 512 | + | ||
| 513 | +#define LINUX_OR_ANDROID_LD(LINUX_SPEC, ANDROID_SPEC) \ | ||
| 514 | + "%{" NOANDROID "|tno-android-ld:" LINUX_SPEC ";:" ANDROID_SPEC "}" | ||
| 515 | + | ||
| 516 | +#define ANDROID_LINK_SPEC \ | ||
| 517 | + "%{shared: -Bsymbolic}" | ||
| 518 | + | ||
| 519 | +#define ANDROID_CC1_SPEC \ | ||
| 520 | + "%{!mglibc:%{!muclibc:%{!mbionic: -mbionic}}} " \ | ||
| 521 | + "%{!fno-pic:%{!fno-PIC:%{!fpic:%{!fPIC: -fPIC}}}}" | ||
| 522 | + | ||
| 523 | +#define ANDROID_CC1PLUS_SPEC \ | ||
| 524 | + "%{!fexceptions:%{!fno-exceptions: -fno-exceptions}} " \ | ||
| 525 | + "%{!frtti:%{!fno-rtti: -fno-rtti}}" | ||
| 526 | + | ||
| 527 | +#define ANDROID_LIB_SPEC \ | ||
| 528 | + "%{!static: -ldl}" | ||
| 529 | + | ||
| 530 | +#define ANDROID_STARTFILE_SPEC \ | ||
| 531 | + "%{!shared:" \ | ||
| 532 | + " %{static: crtbegin_static%O%s;: crtbegin_dynamic%O%s}}" | ||
| 533 | + | ||
| 534 | +#define ANDROID_ENDFILE_SPEC \ | ||
| 535 | + "%{!shared: crtend_android%O%s}" | ||
| 536 | Index: gcc-4.5.3/gcc/config/linux-android.opt | ||
| 537 | =================================================================== | ||
| 538 | --- /dev/null | ||
| 539 | +++ gcc-4.5.3/gcc/config/linux-android.opt | ||
| 540 | @@ -0,0 +1,23 @@ | ||
| 541 | +; Android specific options. | ||
| 542 | + | ||
| 543 | +; Copyright (C) 2010 Free Software Foundation, Inc. | ||
| 544 | +; | ||
| 545 | +; This file is part of GCC. | ||
| 546 | +; | ||
| 547 | +; GCC is free software; you can redistribute it and/or modify it under | ||
| 548 | +; the terms of the GNU General Public License as published by the Free | ||
| 549 | +; Software Foundation; either version 3, or (at your option) any later | ||
| 550 | +; version. | ||
| 551 | +; | ||
| 552 | +; GCC is distributed in the hope that it will be useful, but WITHOUT ANY | ||
| 553 | +; WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| 554 | +; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
| 555 | +; for more details. | ||
| 556 | +; | ||
| 557 | +; You should have received a copy of the GNU General Public License | ||
| 558 | +; along with GCC; see the file COPYING3. If not see | ||
| 559 | +; <http://www.gnu.org/licenses/>. | ||
| 560 | + | ||
| 561 | +mandroid | ||
| 562 | +Target Report Mask(ANDROID) Var(flag_android) Init(ANDROID_DEFAULT ? OPTION_MASK_ANDROID : 0) | ||
| 563 | +Generate code for the Android platform. | ||
| 564 | Index: gcc-4.5.3/gcc/config/linux.h | ||
| 565 | =================================================================== | ||
| 566 | --- gcc-4.5.3.orig/gcc/config/linux.h | ||
| 567 | +++ gcc-4.5.3/gcc/config/linux.h | ||
| 568 | @@ -1,6 +1,6 @@ | ||
| 569 | /* Definitions for Linux-based GNU systems with ELF format | ||
| 570 | Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2003, 2004, 2005, 2006, | ||
| 571 | - 2007, 2009 Free Software Foundation, Inc. | ||
| 572 | + 2007, 2009, 2010 Free Software Foundation, Inc. | ||
| 573 | Contributed by Eric Youngdale. | ||
| 574 | Modified for stabs-in-ELF by H.J. Lu (hjl@lucon.org). | ||
| 575 | |||
| 576 | @@ -42,16 +42,17 @@ see the files COPYING3 and COPYING.RUNTI | ||
| 577 | provides part of the support for getting C++ file-scope static | ||
| 578 | object constructed before entering `main'. */ | ||
| 579 | |||
| 580 | -#undef STARTFILE_SPEC | ||
| 581 | #if defined HAVE_LD_PIE | ||
| 582 | -#define STARTFILE_SPEC \ | ||
| 583 | +#define LINUX_TARGET_STARTFILE_SPEC \ | ||
| 584 | "%{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} \ | ||
| 585 | crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}" | ||
| 586 | #else | ||
| 587 | -#define STARTFILE_SPEC \ | ||
| 588 | +#define LINUX_TARGET_STARTFILE_SPEC \ | ||
| 589 | "%{!shared: %{pg|p|profile:gcrt1.o%s;:crt1.o%s}} \ | ||
| 590 | crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}" | ||
| 591 | #endif | ||
| 592 | +#undef STARTFILE_SPEC | ||
| 593 | +#define STARTFILE_SPEC LINUX_TARGET_STARTFILE_SPEC | ||
| 594 | |||
| 595 | /* Provide a ENDFILE_SPEC appropriate for GNU/Linux. Here we tack on | ||
| 596 | the GNU/Linux magical crtend.o file (see crtstuff.c) which | ||
| 597 | @@ -59,33 +60,44 @@ see the files COPYING3 and COPYING.RUNTI | ||
| 598 | object constructed before entering `main', followed by a normal | ||
| 599 | GNU/Linux "finalizer" file, `crtn.o'. */ | ||
| 600 | |||
| 601 | -#undef ENDFILE_SPEC | ||
| 602 | -#define ENDFILE_SPEC \ | ||
| 603 | +#define LINUX_TARGET_ENDFILE_SPEC \ | ||
| 604 | "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s" | ||
| 605 | +#undef ENDFILE_SPEC | ||
| 606 | +#define ENDFILE_SPEC LINUX_TARGET_ENDFILE_SPEC | ||
| 607 | |||
| 608 | /* This is for -profile to use -lc_p instead of -lc. */ | ||
| 609 | +#define LINUX_TARGET_CC1_SPEC "%{profile:-p}" | ||
| 610 | #ifndef CC1_SPEC | ||
| 611 | -#define CC1_SPEC "%{profile:-p}" | ||
| 612 | +#define CC1_SPEC LINUX_TARGET_CC1_SPEC | ||
| 613 | #endif | ||
| 614 | |||
| 615 | /* The GNU C++ standard library requires that these macros be defined. */ | ||
| 616 | #undef CPLUSPLUS_CPP_SPEC | ||
| 617 | #define CPLUSPLUS_CPP_SPEC "-D_GNU_SOURCE %(cpp)" | ||
| 618 | |||
| 619 | -#undef LIB_SPEC | ||
| 620 | -#define LIB_SPEC \ | ||
| 621 | +#define LINUX_TARGET_LIB_SPEC \ | ||
| 622 | "%{pthread:-lpthread} \ | ||
| 623 | %{shared:-lc} \ | ||
| 624 | %{!shared:%{mieee-fp:-lieee} %{profile:-lc_p}%{!profile:-lc}}" | ||
| 625 | +#undef LIB_SPEC | ||
| 626 | +#define LIB_SPEC LINUX_TARGET_LIB_SPEC | ||
| 627 | + | ||
| 628 | +/* C libraries supported on Linux. */ | ||
| 629 | +#define OPTION_GLIBC (linux_libc == LIBC_GLIBC) | ||
| 630 | +#define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC) | ||
| 631 | +#define OPTION_BIONIC (linux_libc == LIBC_BIONIC) | ||
| 632 | |||
| 633 | #define LINUX_TARGET_OS_CPP_BUILTINS() \ | ||
| 634 | do { \ | ||
| 635 | - builtin_define ("__gnu_linux__"); \ | ||
| 636 | + if (OPTION_GLIBC) \ | ||
| 637 | + builtin_define ("__gnu_linux__"); \ | ||
| 638 | builtin_define_std ("linux"); \ | ||
| 639 | builtin_define_std ("unix"); \ | ||
| 640 | builtin_assert ("system=linux"); \ | ||
| 641 | builtin_assert ("system=unix"); \ | ||
| 642 | builtin_assert ("system=posix"); \ | ||
| 643 | + if (OPTION_ANDROID) \ | ||
| 644 | + builtin_define ("__ANDROID__"); \ | ||
| 645 | } while (0) | ||
| 646 | |||
| 647 | #if defined(HAVE_LD_EH_FRAME_HDR) | ||
| 648 | @@ -105,13 +117,24 @@ see the files COPYING3 and COPYING.RUNTI | ||
| 649 | #endif | ||
| 650 | |||
| 651 | /* Determine which dynamic linker to use depending on whether GLIBC or | ||
| 652 | - uClibc is the default C library and whether -muclibc or -mglibc has | ||
| 653 | - been passed to change the default. */ | ||
| 654 | -#if UCLIBC_DEFAULT | ||
| 655 | -#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:%{muclibc:%e-mglibc and -muclibc used together}" G ";:" U "}" | ||
| 656 | + uClibc or Bionic is the default C library and whether | ||
| 657 | + -muclibc or -mglibc or -mbionic has been passed to change the default. */ | ||
| 658 | + | ||
| 659 | +#define CHOOSE_DYNAMIC_LINKER1(LIBC1, LIBC2, LIBC3, LD1, LD2, LD3) \ | ||
| 660 | + "%{" LIBC2 ":" LD2 ";:%{" LIBC3 ":" LD3 ";:" LD1 "}}" | ||
| 661 | + | ||
| 662 | +#if DEFAULT_LIBC == LIBC_GLIBC | ||
| 663 | +#define CHOOSE_DYNAMIC_LINKER(G, U, B) \ | ||
| 664 | + CHOOSE_DYNAMIC_LINKER1 ("mglibc", "muclibc", "mbionic", G, U, B) | ||
| 665 | +#elif DEFAULT_LIBC == LIBC_UCLIBC | ||
| 666 | +#define CHOOSE_DYNAMIC_LINKER(G, U, B) \ | ||
| 667 | + CHOOSE_DYNAMIC_LINKER1 ("muclibc", "mglibc", "mbionic", U, G, B) | ||
| 668 | +#elif DEFAULT_LIBC == LIBC_BIONIC | ||
| 669 | +#define CHOOSE_DYNAMIC_LINKER(G, U, B) \ | ||
| 670 | + CHOOSE_DYNAMIC_LINKER1 ("mbionic", "mglibc", "muclibc", B, G, U) | ||
| 671 | #else | ||
| 672 | -#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:%{mglibc:%e-mglibc and -muclibc used together}" U ";:" G "}" | ||
| 673 | -#endif | ||
| 674 | +#error "Unsupported DEFAULT_LIBC" | ||
| 675 | +#endif /* DEFAULT_LIBC */ | ||
| 676 | |||
| 677 | /* For most targets the following definitions suffice; | ||
| 678 | GLIBC_DYNAMIC_LINKER must be defined for each target using them, or | ||
| 679 | @@ -120,18 +143,25 @@ see the files COPYING3 and COPYING.RUNTI | ||
| 680 | #define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" | ||
| 681 | #define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0" | ||
| 682 | #define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0" | ||
| 683 | -#define LINUX_DYNAMIC_LINKER \ | ||
| 684 | - CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER) | ||
| 685 | -#define LINUX_DYNAMIC_LINKER32 \ | ||
| 686 | - CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32) | ||
| 687 | -#define LINUX_DYNAMIC_LINKER64 \ | ||
| 688 | - CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64) | ||
| 689 | +#define BIONIC_DYNAMIC_LINKER "/system/bin/linker" | ||
| 690 | +#define BIONIC_DYNAMIC_LINKER32 "/system/bin/linker" | ||
| 691 | +#define BIONIC_DYNAMIC_LINKER64 "/system/bin/linker64" | ||
| 692 | + | ||
| 693 | +#define LINUX_DYNAMIC_LINKER \ | ||
| 694 | + CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, \ | ||
| 695 | + BIONIC_DYNAMIC_LINKER) | ||
| 696 | +#define LINUX_DYNAMIC_LINKER32 \ | ||
| 697 | + CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32, \ | ||
| 698 | + BIONIC_DYNAMIC_LINKER32) | ||
| 699 | +#define LINUX_DYNAMIC_LINKER64 \ | ||
| 700 | + CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64, \ | ||
| 701 | + BIONIC_DYNAMIC_LINKER64) | ||
| 702 | |||
| 703 | /* Determine whether the entire c99 runtime | ||
| 704 | is present in the runtime library. */ | ||
| 705 | #define TARGET_C99_FUNCTIONS (OPTION_GLIBC) | ||
| 706 | |||
| 707 | /* Whether we have sincos that follows the GNU extension. */ | ||
| 708 | -#define TARGET_HAS_SINCOS (OPTION_GLIBC) | ||
| 709 | +#define TARGET_HAS_SINCOS (OPTION_GLIBC | OPTION_BIONIC) | ||
| 710 | |||
| 711 | #define TARGET_POSIX_IO | ||
| 712 | Index: gcc-4.5.3/gcc/config/linux.opt | ||
| 713 | =================================================================== | ||
| 714 | --- gcc-4.5.3.orig/gcc/config/linux.opt | ||
| 715 | +++ gcc-4.5.3/gcc/config/linux.opt | ||
| 716 | @@ -1,6 +1,6 @@ | ||
| 717 | ; Processor-independent options for GNU/Linux. | ||
| 718 | ; | ||
| 719 | -; Copyright (C) 2006, 2007, 2009 Free Software Foundation, Inc. | ||
| 720 | +; Copyright (C) 2006, 2007, 2009, 2010 Free Software Foundation, Inc. | ||
| 721 | ; Contributed by CodeSourcery. | ||
| 722 | ; | ||
| 723 | ; This file is part of GCC. | ||
| 724 | @@ -19,10 +19,14 @@ | ||
| 725 | ; along with GCC; see the file COPYING3. If not see | ||
| 726 | ; <http://www.gnu.org/licenses/>. | ||
| 727 | |||
| 728 | +mbionic | ||
| 729 | +Target Report RejectNegative Var(linux_libc,LIBC_BIONIC) Init(DEFAULT_LIBC) Negative(mglibc) | ||
| 730 | +Use Bionic C library | ||
| 731 | + | ||
| 732 | mglibc | ||
| 733 | -Target RejectNegative Report InverseMask(UCLIBC, GLIBC) Var(linux_uclibc) Init(UCLIBC_DEFAULT ? OPTION_MASK_UCLIBC : 0) | ||
| 734 | -Use GNU libc instead of uClibc | ||
| 735 | +Target Report RejectNegative Var(linux_libc,LIBC_GLIBC) VarExists Negative(muclibc) | ||
| 736 | +Use GNU C library | ||
| 737 | |||
| 738 | muclibc | ||
| 739 | -Target RejectNegative Report Mask(UCLIBC) Var(linux_uclibc) VarExists | ||
| 740 | -Use uClibc instead of GNU libc | ||
| 741 | +Target Report RejectNegative Var(linux_libc,LIBC_UCLIBC) VarExists Negative(mbionic) | ||
| 742 | +Use uClibc C library | ||
| 743 | Index: gcc-4.5.3/gcc/config/rs6000/linux64.h | ||
| 744 | =================================================================== | ||
| 745 | --- gcc-4.5.3.orig/gcc/config/rs6000/linux64.h | ||
| 746 | +++ gcc-4.5.3/gcc/config/rs6000/linux64.h | ||
| 747 | @@ -344,10 +344,12 @@ extern int dot_symbols; | ||
| 748 | #define GLIBC_DYNAMIC_LINKER64 "/lib64/ld64.so.1" | ||
| 749 | #define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0" | ||
| 750 | #define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0" | ||
| 751 | -#if UCLIBC_DEFAULT | ||
| 752 | -#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:%{muclibc:%e-mglibc and -muclibc used together}" G ";:" U "}" | ||
| 753 | +#if DEFAULT_LIBC == LIBC_UCLIBC | ||
| 754 | +#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}" | ||
| 755 | +#elif DEFAULT_LIBC == LIBC_GLIBC | ||
| 756 | +#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}" | ||
| 757 | #else | ||
| 758 | -#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:%{mglibc:%e-mglibc and -muclibc used together}" U ";:" G "}" | ||
| 759 | +#error "Unsupported DEFAULT_LIBC" | ||
| 760 | #endif | ||
| 761 | #define LINUX_DYNAMIC_LINKER32 \ | ||
| 762 | CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32) | ||
| 763 | Index: gcc-4.5.3/gcc/config/rs6000/sysv4.h | ||
| 764 | =================================================================== | ||
| 765 | --- gcc-4.5.3.orig/gcc/config/rs6000/sysv4.h | ||
| 766 | +++ gcc-4.5.3/gcc/config/rs6000/sysv4.h | ||
| 767 | @@ -901,10 +901,12 @@ SVR4_ASM_SPEC \ | ||
| 768 | |||
| 769 | #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1" | ||
| 770 | #define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" | ||
| 771 | -#if UCLIBC_DEFAULT | ||
| 772 | -#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:%{muclibc:%e-mglibc and -muclibc used together}" G ";:" U "}" | ||
| 773 | +#if DEFAULT_LIBC == LIBC_UCLIBC | ||
| 774 | +#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}" | ||
| 775 | +#elif DEFAULT_LIBC == LIBC_GLIBC | ||
| 776 | +#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}" | ||
| 777 | #else | ||
| 778 | -#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:%{mglibc:%e-mglibc and -muclibc used together}" U ";:" G "}" | ||
| 779 | +#error "Unsupported DEFAULT_LIBC" | ||
| 780 | #endif | ||
| 781 | #define LINUX_DYNAMIC_LINKER \ | ||
| 782 | CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER) | ||
| 783 | Index: gcc-4.5.3/gcc/doc/invoke.texi | ||
| 784 | =================================================================== | ||
| 785 | --- gcc-4.5.3.orig/gcc/doc/invoke.texi | ||
| 786 | +++ gcc-4.5.3/gcc/doc/invoke.texi | ||
| 787 | @@ -565,7 +565,8 @@ Objective-C and Objective-C++ Dialects}. | ||
| 788 | -mcpu=@var{cpu}} | ||
| 789 | |||
| 790 | @emph{GNU/Linux Options} | ||
| 791 | -@gccoptlist{-muclibc} | ||
| 792 | +@gccoptlist{-mglibc -muclibc -mbionic -mandroid @gol | ||
| 793 | +-tno-android-cc -tno-android-ld} | ||
| 794 | |||
| 795 | @emph{H8/300 Options} | ||
| 796 | @gccoptlist{-mrelax -mh -ms -mn -mint32 -malign-300} | ||
| 797 | @@ -11469,13 +11470,41 @@ These @samp{-m} options are defined for | ||
| 798 | @table @gcctabopt | ||
| 799 | @item -mglibc | ||
| 800 | @opindex mglibc | ||
| 801 | -Use the GNU C library instead of uClibc. This is the default except | ||
| 802 | -on @samp{*-*-linux-*uclibc*} targets. | ||
| 803 | +Use the GNU C library. This is the default except | ||
| 804 | +on @samp{*-*-linux-*uclibc*} and @samp{*-*-linux-*android*} targets. | ||
| 805 | |||
| 806 | @item -muclibc | ||
| 807 | @opindex muclibc | ||
| 808 | -Use uClibc instead of the GNU C library. This is the default on | ||
| 809 | +Use uClibc C library. This is the default on | ||
| 810 | @samp{*-*-linux-*uclibc*} targets. | ||
| 811 | + | ||
| 812 | +@item -mbionic | ||
| 813 | +@opindex mbionic | ||
| 814 | +Use Bionic C library. This is the default on | ||
| 815 | +@samp{*-*-linux-*android*} targets. | ||
| 816 | + | ||
| 817 | +@item -mandroid | ||
| 818 | +@opindex mandroid | ||
| 819 | +Compile code compatible with Android platform. This is the default on | ||
| 820 | +@samp{*-*-linux-*android*} targets. | ||
| 821 | + | ||
| 822 | +When compiling, this option enables @option{-mbionic}, @option{-fPIC}, | ||
| 823 | +@option{-fno-exceptions} and @option{-fno-rtti} by default. When linking, | ||
| 824 | +this option makes the GCC driver pass Android-specific options to the linker. | ||
| 825 | +Finally, this option causes the preprocessor macro @code{__ANDROID__} | ||
| 826 | +to be defined. | ||
| 827 | + | ||
| 828 | +@item -tno-android-cc | ||
| 829 | +@opindex tno-android-cc | ||
| 830 | +Disable compilation effects of @option{-mandroid}, i.e., do not enable | ||
| 831 | +@option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and | ||
| 832 | +@option{-fno-rtti} by default. | ||
| 833 | + | ||
| 834 | +@item -tno-android-ld | ||
| 835 | +@opindex tno-android-ld | ||
| 836 | +Disable linking effects of @option{-mandroid}, i.e., pass standard Linux | ||
| 837 | +linking options to the linker. | ||
| 838 | + | ||
| 839 | @end table | ||
| 840 | |||
| 841 | @node H8/300 Options | ||
| 842 | Index: gcc-4.5.3/gcc/gthr-posix.h | ||
| 843 | =================================================================== | ||
| 844 | --- gcc-4.5.3.orig/gcc/gthr-posix.h | ||
| 845 | +++ gcc-4.5.3/gcc/gthr-posix.h | ||
| 846 | @@ -124,7 +124,9 @@ __gthrw(pthread_join) | ||
| 847 | __gthrw(pthread_equal) | ||
| 848 | __gthrw(pthread_self) | ||
| 849 | __gthrw(pthread_detach) | ||
| 850 | +#ifndef __BIONIC__ | ||
| 851 | __gthrw(pthread_cancel) | ||
| 852 | +#endif | ||
| 853 | __gthrw(sched_yield) | ||
| 854 | |||
| 855 | __gthrw(pthread_mutex_lock) | ||
| 856 | @@ -238,7 +240,15 @@ static inline int | ||
| 857 | __gthread_active_p (void) | ||
| 858 | { | ||
| 859 | static void *const __gthread_active_ptr | ||
| 860 | - = __extension__ (void *) &__gthrw_(pthread_cancel); | ||
| 861 | + = __extension__ (void *) &__gthrw_( | ||
| 862 | +/* Android's C library does not provide pthread_cancel, check for | ||
| 863 | + `pthread_create' instead. */ | ||
| 864 | +#ifndef __BIONIC__ | ||
| 865 | + pthread_cancel | ||
| 866 | +#else | ||
| 867 | + pthread_create | ||
| 868 | +#endif | ||
| 869 | + ); | ||
| 870 | return __gthread_active_ptr != 0; | ||
| 871 | } | ||
| 872 | |||
| 873 | Index: gcc-4.5.3/gcc/testsuite/gcc.dg/glibc-uclibc-1.c | ||
| 874 | =================================================================== | ||
| 875 | --- gcc-4.5.3.orig/gcc/testsuite/gcc.dg/glibc-uclibc-1.c | ||
| 876 | +++ /dev/null | ||
| 877 | @@ -1,6 +0,0 @@ | ||
| 878 | -/* Test -mglibc and -muclibc not allowed together. */ | ||
| 879 | -/* Origin: Joseph Myers <joseph@codesourcery.com> */ | ||
| 880 | -/* { dg-do link { target *-*-linux* } } */ | ||
| 881 | -/* { dg-options "-mglibc -muclibc" } */ | ||
| 882 | - | ||
| 883 | -/* { dg-message "-mglibc and -muclibc used together" "" { target *-*-* } 0 } */ | ||
| 884 | Index: gcc-4.5.3/gcc/testsuite/gcc.dg/glibc-uclibc-2.c | ||
| 885 | =================================================================== | ||
| 886 | --- gcc-4.5.3.orig/gcc/testsuite/gcc.dg/glibc-uclibc-2.c | ||
| 887 | +++ /dev/null | ||
| 888 | @@ -1,6 +0,0 @@ | ||
| 889 | -/* Test -mglibc and -muclibc not allowed together. */ | ||
| 890 | -/* Origin: Joseph Myers <joseph@codesourcery.com> */ | ||
| 891 | -/* { dg-do link { target *-*-linux* } } */ | ||
| 892 | -/* { dg-options "-muclibc -mglibc" } */ | ||
| 893 | - | ||
| 894 | -/* { dg-message "-mglibc and -muclibc used together" "" { target *-*-* } 0 } */ | ||
| 895 | Index: gcc-4.5.3/libstdc++-v3/acinclude.m4 | ||
| 896 | =================================================================== | ||
| 897 | --- gcc-4.5.3.orig/libstdc++-v3/acinclude.m4 | ||
| 898 | +++ gcc-4.5.3/libstdc++-v3/acinclude.m4 | ||
| 899 | @@ -95,7 +95,7 @@ AC_DEFUN([GLIBCXX_CONFIGURE], [ | ||
| 900 | ## (Right now, this only matters for enable_wchar_t, but nothing prevents | ||
| 901 | ## other macros from doing the same. This should be automated.) -pme | ||
| 902 | |||
| 903 | - # Check for uClibc since Linux platforms use different configuration | ||
| 904 | + # Check for C library flavor since Linux platforms use different configuration | ||
| 905 | # directories depending on the C library in use. | ||
| 906 | AC_EGREP_CPP([_using_uclibc], [ | ||
| 907 | #include <stdio.h> | ||
| 908 | @@ -104,6 +104,13 @@ AC_DEFUN([GLIBCXX_CONFIGURE], [ | ||
| 909 | #endif | ||
| 910 | ], uclibc=yes, uclibc=no) | ||
| 911 | |||
| 912 | + AC_EGREP_CPP([_using_bionic], [ | ||
| 913 | + #include <stdio.h> | ||
| 914 | + #if __BIONIC__ | ||
| 915 | + _using_bionic | ||
| 916 | + #endif | ||
| 917 | + ], bionic=yes, bionic=no) | ||
| 918 | + | ||
| 919 | # Find platform-specific directories containing configuration info. | ||
| 920 | # Also possibly modify flags used elsewhere, as needed by the platform. | ||
| 921 | GLIBCXX_CHECK_HOST | ||
| 922 | @@ -2722,7 +2729,7 @@ void foo() | ||
| 923 | } | ||
| 924 | EOF | ||
| 925 | old_CXXFLAGS="$CXXFLAGS" | ||
| 926 | - CXXFLAGS=-S | ||
| 927 | + CXXFLAGS="-S -fexceptions" | ||
| 928 | if AC_TRY_EVAL(ac_compile); then | ||
| 929 | if grep _Unwind_SjLj_Resume conftest.s >/dev/null 2>&1 ; then | ||
| 930 | enable_sjlj_exceptions=yes | ||
| 931 | Index: gcc-4.5.3/libstdc++-v3/config/os/bionic/ctype_base.h | ||
| 932 | =================================================================== | ||
| 933 | --- /dev/null | ||
| 934 | +++ gcc-4.5.3/libstdc++-v3/config/os/bionic/ctype_base.h | ||
| 935 | @@ -0,0 +1,57 @@ | ||
| 936 | +// Locale support -*- C++ -*- | ||
| 937 | + | ||
| 938 | +// Copyright (C) 2010 Free Software Foundation, Inc. | ||
| 939 | +// | ||
| 940 | +// This file is part of the GNU ISO C++ Library. This library is free | ||
| 941 | +// software; you can redistribute it and/or modify it under the | ||
| 942 | +// terms of the GNU General Public License as published by the | ||
| 943 | +// Free Software Foundation; either version 3, or (at your option) | ||
| 944 | +// any later version. | ||
| 945 | + | ||
| 946 | +// This library is distributed in the hope that it will be useful, | ||
| 947 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 948 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 949 | +// GNU General Public License for more details. | ||
| 950 | + | ||
| 951 | +// Under Section 7 of GPL version 3, you are granted additional | ||
| 952 | +// permissions described in the GCC Runtime Library Exception, version | ||
| 953 | +// 3.1, as published by the Free Software Foundation. | ||
| 954 | + | ||
| 955 | +// You should have received a copy of the GNU General Public License and | ||
| 956 | +// a copy of the GCC Runtime Library Exception along with this program; | ||
| 957 | +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see | ||
| 958 | +// <http://www.gnu.org/licenses/>. | ||
| 959 | + | ||
| 960 | +// | ||
| 961 | +// ISO C++ 14882: 22.1 Locales | ||
| 962 | +// | ||
| 963 | + | ||
| 964 | +// Information as gleaned from /usr/include/ctype.h, for solaris2.5.1 | ||
| 965 | + | ||
| 966 | +// Support for Solaris 2.5.1 | ||
| 967 | + | ||
| 968 | +_GLIBCXX_BEGIN_NAMESPACE(std) | ||
| 969 | + | ||
| 970 | + /// @brief Base class for ctype. | ||
| 971 | + struct ctype_base | ||
| 972 | + { | ||
| 973 | + // Non-standard typedefs. | ||
| 974 | + typedef const int* __to_type; | ||
| 975 | + | ||
| 976 | + // NB: Offsets into ctype<char>::_M_table force a particular size | ||
| 977 | + // on the mask type. Because of this, we don't use an enum. | ||
| 978 | + typedef char mask; | ||
| 979 | + static const mask upper = _U; | ||
| 980 | + static const mask lower = _L; | ||
| 981 | + static const mask alpha = _U | _L; | ||
| 982 | + static const mask digit = _N; | ||
| 983 | + static const mask xdigit = _X | _N; | ||
| 984 | + static const mask space = _S; | ||
| 985 | + static const mask print = _P | _U | _L | _N | _B; | ||
| 986 | + static const mask graph = _P | _U | _L | _N; | ||
| 987 | + static const mask cntrl = _C; | ||
| 988 | + static const mask punct = _P; | ||
| 989 | + static const mask alnum = _U | _L | _N; | ||
| 990 | + }; | ||
| 991 | + | ||
| 992 | +_GLIBCXX_END_NAMESPACE | ||
| 993 | Index: gcc-4.5.3/libstdc++-v3/config/os/bionic/ctype_inline.h | ||
| 994 | =================================================================== | ||
| 995 | --- /dev/null | ||
| 996 | +++ gcc-4.5.3/libstdc++-v3/config/os/bionic/ctype_inline.h | ||
| 997 | @@ -0,0 +1,71 @@ | ||
| 998 | +// Locale support -*- C++ -*- | ||
| 999 | + | ||
| 1000 | +// Copyright (C) 2010 Free Software Foundation, Inc. | ||
| 1001 | +// | ||
| 1002 | +// This file is part of the GNU ISO C++ Library. This library is free | ||
| 1003 | +// software; you can redistribute it and/or modify it under the | ||
| 1004 | +// terms of the GNU General Public License as published by the | ||
| 1005 | +// Free Software Foundation; either version 3, or (at your option) | ||
| 1006 | +// any later version. | ||
| 1007 | + | ||
| 1008 | +// This library is distributed in the hope that it will be useful, | ||
| 1009 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 1010 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 1011 | +// GNU General Public License for more details. | ||
| 1012 | + | ||
| 1013 | +// Under Section 7 of GPL version 3, you are granted additional | ||
| 1014 | +// permissions described in the GCC Runtime Library Exception, version | ||
| 1015 | +// 3.1, as published by the Free Software Foundation. | ||
| 1016 | + | ||
| 1017 | +// You should have received a copy of the GNU General Public License and | ||
| 1018 | +// a copy of the GCC Runtime Library Exception along with this program; | ||
| 1019 | +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see | ||
| 1020 | +// <http://www.gnu.org/licenses/>. | ||
| 1021 | + | ||
| 1022 | +/** @file ctype_inline.h | ||
| 1023 | + * This is an internal header file, included by other library headers. | ||
| 1024 | + * You should not attempt to use it directly. | ||
| 1025 | + */ | ||
| 1026 | + | ||
| 1027 | +// | ||
| 1028 | +// ISO C++ 14882: 22.1 Locales | ||
| 1029 | +// | ||
| 1030 | + | ||
| 1031 | +// ctype bits to be inlined go here. Non-inlinable (ie virtual do_*) | ||
| 1032 | +// functions go in ctype.cc | ||
| 1033 | + | ||
| 1034 | +_GLIBCXX_BEGIN_NAMESPACE(std) | ||
| 1035 | + | ||
| 1036 | + bool | ||
| 1037 | + ctype<char>:: | ||
| 1038 | + is(mask __m, char __c) const | ||
| 1039 | + { return _M_table[static_cast<unsigned char>(__c)] & __m; } | ||
| 1040 | + | ||
| 1041 | + const char* | ||
| 1042 | + ctype<char>:: | ||
| 1043 | + is(const char* __low, const char* __high, mask* __vec) const | ||
| 1044 | + { | ||
| 1045 | + while (__low < __high) | ||
| 1046 | + *__vec++ = _M_table[static_cast<unsigned char>(*__low++)]; | ||
| 1047 | + return __high; | ||
| 1048 | + } | ||
| 1049 | + | ||
| 1050 | + const char* | ||
| 1051 | + ctype<char>:: | ||
| 1052 | + scan_is(mask __m, const char* __low, const char* __high) const | ||
| 1053 | + { | ||
| 1054 | + while (__low < __high && !this->is(__m, *__low)) | ||
| 1055 | + ++__low; | ||
| 1056 | + return __low; | ||
| 1057 | + } | ||
| 1058 | + | ||
| 1059 | + const char* | ||
| 1060 | + ctype<char>:: | ||
| 1061 | + scan_not(mask __m, const char* __low, const char* __high) const | ||
| 1062 | + { | ||
| 1063 | + while (__low < __high && this->is(__m, *__low) != 0) | ||
| 1064 | + ++__low; | ||
| 1065 | + return __low; | ||
| 1066 | + } | ||
| 1067 | + | ||
| 1068 | +_GLIBCXX_END_NAMESPACE | ||
| 1069 | Index: gcc-4.5.3/libstdc++-v3/config/os/bionic/ctype_noninline.h | ||
| 1070 | =================================================================== | ||
| 1071 | --- /dev/null | ||
| 1072 | +++ gcc-4.5.3/libstdc++-v3/config/os/bionic/ctype_noninline.h | ||
| 1073 | @@ -0,0 +1,98 @@ | ||
| 1074 | +// Locale support -*- C++ -*- | ||
| 1075 | + | ||
| 1076 | +// Copyright (C) 2010 Free Software Foundation, Inc. | ||
| 1077 | +// | ||
| 1078 | +// This file is part of the GNU ISO C++ Library. This library is free | ||
| 1079 | +// software; you can redistribute it and/or modify it under the | ||
| 1080 | +// terms of the GNU General Public License as published by the | ||
| 1081 | +// Free Software Foundation; either version 3, or (at your option) | ||
| 1082 | +// any later version. | ||
| 1083 | + | ||
| 1084 | +// This library is distributed in the hope that it will be useful, | ||
| 1085 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 1086 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 1087 | +// GNU General Public License for more details. | ||
| 1088 | + | ||
| 1089 | +// Under Section 7 of GPL version 3, you are granted additional | ||
| 1090 | +// permissions described in the GCC Runtime Library Exception, version | ||
| 1091 | +// 3.1, as published by the Free Software Foundation. | ||
| 1092 | + | ||
| 1093 | +// You should have received a copy of the GNU General Public License and | ||
| 1094 | +// a copy of the GCC Runtime Library Exception along with this program; | ||
| 1095 | +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see | ||
| 1096 | +// <http://www.gnu.org/licenses/>. | ||
| 1097 | + | ||
| 1098 | +/** @file ctype_noninline.h | ||
| 1099 | + * This is an internal header file, included by other library headers. | ||
| 1100 | + * You should not attempt to use it directly. | ||
| 1101 | + */ | ||
| 1102 | + | ||
| 1103 | +// | ||
| 1104 | +// ISO C++ 14882: 22.1 Locales | ||
| 1105 | +// | ||
| 1106 | + | ||
| 1107 | +// Information as gleaned from /usr/include/ctype.h | ||
| 1108 | + | ||
| 1109 | + const ctype_base::mask* | ||
| 1110 | + ctype<char>::classic_table() throw() | ||
| 1111 | + { return _ctype_ + 1; } | ||
| 1112 | + | ||
| 1113 | + ctype<char>::ctype(__c_locale, const mask* __table, bool __del, | ||
| 1114 | + size_t __refs) | ||
| 1115 | + : facet(__refs), _M_del(__table != 0 && __del), | ||
| 1116 | + _M_toupper(NULL), _M_tolower(NULL), | ||
| 1117 | + _M_table(__table ? __table : classic_table()) | ||
| 1118 | + { | ||
| 1119 | + memset(_M_widen, 0, sizeof(_M_widen)); | ||
| 1120 | + _M_widen_ok = 0; | ||
| 1121 | + memset(_M_narrow, 0, sizeof(_M_narrow)); | ||
| 1122 | + _M_narrow_ok = 0; | ||
| 1123 | + } | ||
| 1124 | + | ||
| 1125 | + ctype<char>::ctype(const mask* __table, bool __del, size_t __refs) | ||
| 1126 | + : facet(__refs), _M_del(__table != 0 && __del), | ||
| 1127 | + _M_toupper(NULL), _M_tolower(NULL), | ||
| 1128 | + _M_table(__table ? __table : classic_table()) | ||
| 1129 | + { | ||
| 1130 | + memset(_M_widen, 0, sizeof(_M_widen)); | ||
| 1131 | + _M_widen_ok = 0; | ||
| 1132 | + memset(_M_narrow, 0, sizeof(_M_narrow)); | ||
| 1133 | + _M_narrow_ok = 0; | ||
| 1134 | + } | ||
| 1135 | + | ||
| 1136 | + char | ||
| 1137 | + ctype<char>::do_toupper(char __c) const | ||
| 1138 | + { | ||
| 1139 | + int __x = __c; | ||
| 1140 | + return (this->is(ctype_base::lower, __c) ? (__x - 'a' + 'A') : __x); | ||
| 1141 | + } | ||
| 1142 | + | ||
| 1143 | + const char* | ||
| 1144 | + ctype<char>::do_toupper(char* __low, const char* __high) const | ||
| 1145 | + { | ||
| 1146 | + while (__low < __high) | ||
| 1147 | + { | ||
| 1148 | + *__low = this->do_toupper(*__low); | ||
| 1149 | + ++__low; | ||
| 1150 | + } | ||
| 1151 | + return __high; | ||
| 1152 | + } | ||
| 1153 | + | ||
| 1154 | + char | ||
| 1155 | + ctype<char>::do_tolower(char __c) const | ||
| 1156 | + { | ||
| 1157 | + int __x = __c; | ||
| 1158 | + return (this->is(ctype_base::upper, __c) ? (__x - 'A' + 'a') : __x); | ||
| 1159 | + } | ||
| 1160 | + | ||
| 1161 | + const char* | ||
| 1162 | + ctype<char>::do_tolower(char* __low, const char* __high) const | ||
| 1163 | + { | ||
| 1164 | + while (__low < __high) | ||
| 1165 | + { | ||
| 1166 | + *__low = this->do_tolower(*__low); | ||
| 1167 | + ++__low; | ||
| 1168 | + } | ||
| 1169 | + return __high; | ||
| 1170 | + } | ||
| 1171 | + | ||
| 1172 | Index: gcc-4.5.3/libstdc++-v3/config/os/bionic/os_defines.h | ||
| 1173 | =================================================================== | ||
| 1174 | --- /dev/null | ||
| 1175 | +++ gcc-4.5.3/libstdc++-v3/config/os/bionic/os_defines.h | ||
| 1176 | @@ -0,0 +1,36 @@ | ||
| 1177 | +// Specific definitions for Bionic -*- C++ -*- | ||
| 1178 | + | ||
| 1179 | +// Copyright (C) 2010 Free Software Foundation, Inc. | ||
| 1180 | +// | ||
| 1181 | +// This file is part of the GNU ISO C++ Library. This library is free | ||
| 1182 | +// software; you can redistribute it and/or modify it under the | ||
| 1183 | +// terms of the GNU General Public License as published by the | ||
| 1184 | +// Free Software Foundation; either version 3, or (at your option) | ||
| 1185 | +// any later version. | ||
| 1186 | + | ||
| 1187 | +// This library is distributed in the hope that it will be useful, | ||
| 1188 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 1189 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 1190 | +// GNU General Public License for more details. | ||
| 1191 | + | ||
| 1192 | +// Under Section 7 of GPL version 3, you are granted additional | ||
| 1193 | +// permissions described in the GCC Runtime Library Exception, version | ||
| 1194 | +// 3.1, as published by the Free Software Foundation. | ||
| 1195 | + | ||
| 1196 | +// You should have received a copy of the GNU General Public License and | ||
| 1197 | +// a copy of the GCC Runtime Library Exception along with this program; | ||
| 1198 | +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see | ||
| 1199 | +// <http://www.gnu.org/licenses/>. | ||
| 1200 | + | ||
| 1201 | +/** @file os_defines.h | ||
| 1202 | + * This is an internal header file, included by other library headers. | ||
| 1203 | + * You should not attempt to use it directly. | ||
| 1204 | + */ | ||
| 1205 | + | ||
| 1206 | +#ifndef _GLIBCXX_OS_DEFINES | ||
| 1207 | +#define _GLIBCXX_OS_DEFINES 1 | ||
| 1208 | + | ||
| 1209 | +// System-specific #define, typedefs, corrections, etc, go here. This | ||
| 1210 | +// file will come before all others. | ||
| 1211 | + | ||
| 1212 | +#endif | ||
| 1213 | Index: gcc-4.5.3/libstdc++-v3/configure | ||
| 1214 | =================================================================== | ||
| 1215 | --- gcc-4.5.3.orig/libstdc++-v3/configure | ||
| 1216 | +++ gcc-4.5.3/libstdc++-v3/configure | ||
| 1217 | @@ -5185,7 +5185,7 @@ fi | ||
| 1218 | ## (Right now, this only matters for enable_wchar_t, but nothing prevents | ||
| 1219 | ## other macros from doing the same. This should be automated.) -pme | ||
| 1220 | |||
| 1221 | - # Check for uClibc since Linux platforms use different configuration | ||
| 1222 | + # Check for C library flavor since Linux platforms use different configuration | ||
| 1223 | # directories depending on the C library in use. | ||
| 1224 | cat confdefs.h - <<_ACEOF >conftest.$ac_ext | ||
| 1225 | /* end confdefs.h. */ | ||
| 1226 | @@ -5205,6 +5205,24 @@ fi | ||
| 1227 | rm -f conftest* | ||
| 1228 | |||
| 1229 | |||
| 1230 | + cat confdefs.h - <<_ACEOF >conftest.$ac_ext | ||
| 1231 | +/* end confdefs.h. */ | ||
| 1232 | + | ||
| 1233 | + #include <stdio.h> | ||
| 1234 | + #if __BIONIC__ | ||
| 1235 | + _using_bionic | ||
| 1236 | + #endif | ||
| 1237 | + | ||
| 1238 | +_ACEOF | ||
| 1239 | +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | | ||
| 1240 | + $EGREP "_using_bionic" >/dev/null 2>&1; then : | ||
| 1241 | + bionic=yes | ||
| 1242 | +else | ||
| 1243 | + bionic=no | ||
| 1244 | +fi | ||
| 1245 | +rm -f conftest* | ||
| 1246 | + | ||
| 1247 | + | ||
| 1248 | # Find platform-specific directories containing configuration info. | ||
| 1249 | # Also possibly modify flags used elsewhere, as needed by the platform. | ||
| 1250 | |||
| 1251 | @@ -14897,7 +14915,7 @@ void foo() | ||
| 1252 | } | ||
| 1253 | EOF | ||
| 1254 | old_CXXFLAGS="$CXXFLAGS" | ||
| 1255 | - CXXFLAGS=-S | ||
| 1256 | + CXXFLAGS="-S -fexceptions" | ||
| 1257 | if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 | ||
| 1258 | (eval $ac_compile) 2>&5 | ||
| 1259 | ac_status=$? | ||
| 1260 | Index: gcc-4.5.3/libstdc++-v3/configure.host | ||
| 1261 | =================================================================== | ||
| 1262 | --- gcc-4.5.3.orig/libstdc++-v3/configure.host | ||
| 1263 | +++ gcc-4.5.3/libstdc++-v3/configure.host | ||
| 1264 | @@ -238,6 +238,8 @@ case "${host_os}" in | ||
| 1265 | gnu* | linux* | kfreebsd*-gnu | knetbsd*-gnu) | ||
| 1266 | if [ "$uclibc" = "yes" ]; then | ||
| 1267 | os_include_dir="os/uclibc" | ||
| 1268 | + elif [ "$bionic" = "yes" ]; then | ||
| 1269 | + os_include_dir="os/bionic" | ||
| 1270 | else | ||
| 1271 | os_include_dir="os/gnu-linux" | ||
| 1272 | fi | ||
diff --git a/meta-oe/recipes-devtools/gcc/gcc-4.5/linaro/gcc-4.5-linaro-r99495.patch b/meta-oe/recipes-devtools/gcc/gcc-4.5/linaro/gcc-4.5-linaro-r99495.patch new file mode 100644 index 0000000000..bb866ce8d9 --- /dev/null +++ b/meta-oe/recipes-devtools/gcc/gcc-4.5/linaro/gcc-4.5-linaro-r99495.patch | |||
| @@ -0,0 +1,784 @@ | |||
| 1 | 2011-03-24 Revital Eres <revital.eres@linaro.org> | ||
| 2 | |||
| 3 | gcc/ | ||
| 4 | * loop-doloop.c (doloop_condition_get): Support new form of | ||
| 5 | doloop pattern and use prev_nondebug_insn instead of PREV_INSN. | ||
| 6 | * config/arm/thumb2.md (*thumb2_addsi3_compare0): Remove "*". | ||
| 7 | (doloop_end): New. | ||
| 8 | * config/arm/arm.md (*addsi3_compare0): Remove "*". | ||
| 9 | * ddg.c (check_closing_branch_deps, get_node_of_insn_uid): | ||
| 10 | New functions. | ||
| 11 | (create_ddg): Pass sbitmap containing do-loop related | ||
| 12 | instructions instead of closing_branch_deps parameter and call | ||
| 13 | check_closing_branch_deps function. | ||
| 14 | * ddg.h (create_ddg): Adjust the function declaration. | ||
| 15 | * modulo-sched.c (PS_STAGE_COUNT): Rename to CALC_STAGE_COUNT | ||
| 16 | and redefine. | ||
| 17 | (doloop_register_get): Handle NONDEBUG_INSN_P. | ||
| 18 | (stage_count): New field in struct partial_schedule. | ||
| 19 | (mark_doloop_insns, calculate_stage_count): New functions. | ||
| 20 | (normalize_sched_times): Rename to reset_sched_times and handle | ||
| 21 | incrementing the sched time of the nodes by a constant value | ||
| 22 | passed as parameter. | ||
| 23 | (duplicate_insns_of_cycles): Skip closing branch. | ||
| 24 | (sms_schedule_by_order): Schedule closing branch when | ||
| 25 | closing_branch_deps is true. | ||
| 26 | (ps_insn_find_column): Handle closing branch. | ||
| 27 | (sms_schedule): Call reset_sched_times and handle case where | ||
| 28 | do-loop pattern is not decoupled from the other loop instructions. | ||
| 29 | Support new form of doloop pattern. | ||
| 30 | (ps_insert_empty_row): Update calls to normalize_sched_times | ||
| 31 | and rotate_partial_schedule functions. | ||
| 32 | |||
| 33 | === modified file 'gcc/config/arm/arm.md' | ||
| 34 | --- old/gcc/config/arm/arm.md 2011-03-11 14:26:34 +0000 | ||
| 35 | +++ new/gcc/config/arm/arm.md 2011-03-24 07:45:38 +0000 | ||
| 36 | @@ -734,7 +734,7 @@ | ||
| 37 | "" | ||
| 38 | ) | ||
| 39 | |||
| 40 | -(define_insn "*addsi3_compare0" | ||
| 41 | +(define_insn "addsi3_compare0" | ||
| 42 | [(set (reg:CC_NOOV CC_REGNUM) | ||
| 43 | (compare:CC_NOOV | ||
| 44 | (plus:SI (match_operand:SI 1 "s_register_operand" "r, r") | ||
| 45 | |||
| 46 | === modified file 'gcc/config/arm/thumb2.md' | ||
| 47 | --- old/gcc/config/arm/thumb2.md 2011-02-08 10:51:58 +0000 | ||
| 48 | +++ new/gcc/config/arm/thumb2.md 2011-03-24 07:45:38 +0000 | ||
| 49 | @@ -1194,7 +1194,7 @@ | ||
| 50 | (set_attr "length" "2")] | ||
| 51 | ) | ||
| 52 | |||
| 53 | -(define_insn "*thumb2_addsi3_compare0" | ||
| 54 | +(define_insn "thumb2_addsi3_compare0" | ||
| 55 | [(set (reg:CC_NOOV CC_REGNUM) | ||
| 56 | (compare:CC_NOOV | ||
| 57 | (plus:SI (match_operand:SI 1 "s_register_operand" "l, 0, r") | ||
| 58 | @@ -1445,3 +1445,56 @@ | ||
| 59 | [(set_attr "length" "4,4,16") | ||
| 60 | (set_attr "predicable" "yes")] | ||
| 61 | ) | ||
| 62 | + | ||
| 63 | + | ||
| 64 | +;; Define the subtract-one-and-jump insns so loop.c | ||
| 65 | +;; knows what to generate. | ||
| 66 | +(define_expand "doloop_end" | ||
| 67 | + [(use (match_operand 0 "" "")) ; loop pseudo | ||
| 68 | + (use (match_operand 1 "" "")) ; iterations; zero if unknown | ||
| 69 | + (use (match_operand 2 "" "")) ; max iterations | ||
| 70 | + (use (match_operand 3 "" "")) ; loop level | ||
| 71 | + (use (match_operand 4 "" ""))] ; label | ||
| 72 | + "TARGET_32BIT" | ||
| 73 | + " | ||
| 74 | + { | ||
| 75 | + /* Currently SMS relies on the do-loop pattern to recognize loops | ||
| 76 | + where (1) the control part consists of all insns defining and/or | ||
| 77 | + using a certain 'count' register and (2) the loop count can be | ||
| 78 | + adjusted by modifying this register prior to the loop. | ||
| 79 | + ??? The possible introduction of a new block to initialize the | ||
| 80 | + new IV can potentially affect branch optimizations. */ | ||
| 81 | + if (optimize > 0 && flag_modulo_sched) | ||
| 82 | + { | ||
| 83 | + rtx s0; | ||
| 84 | + rtx bcomp; | ||
| 85 | + rtx loc_ref; | ||
| 86 | + rtx cc_reg; | ||
| 87 | + rtx insn; | ||
| 88 | + rtx cmp; | ||
| 89 | + | ||
| 90 | + /* Only use this on innermost loops. */ | ||
| 91 | + if (INTVAL (operands[3]) > 1) | ||
| 92 | + FAIL; | ||
| 93 | + | ||
| 94 | + if (GET_MODE (operands[0]) != SImode) | ||
| 95 | + FAIL; | ||
| 96 | + | ||
| 97 | + s0 = operands [0]; | ||
| 98 | + if (TARGET_THUMB2) | ||
| 99 | + insn = emit_insn (gen_thumb2_addsi3_compare0 (s0, s0, GEN_INT (-1))); | ||
| 100 | + else | ||
| 101 | + insn = emit_insn (gen_addsi3_compare0 (s0, s0, GEN_INT (-1))); | ||
| 102 | + | ||
| 103 | + cmp = XVECEXP (PATTERN (insn), 0, 0); | ||
| 104 | + cc_reg = SET_DEST (cmp); | ||
| 105 | + bcomp = gen_rtx_NE (VOIDmode, cc_reg, const0_rtx); | ||
| 106 | + loc_ref = gen_rtx_LABEL_REF (VOIDmode, operands [4]); | ||
| 107 | + emit_jump_insn (gen_rtx_SET (VOIDmode, pc_rtx, | ||
| 108 | + gen_rtx_IF_THEN_ELSE (VOIDmode, bcomp, | ||
| 109 | + loc_ref, pc_rtx))); | ||
| 110 | + DONE; | ||
| 111 | + }else | ||
| 112 | + FAIL; | ||
| 113 | + }") | ||
| 114 | + | ||
| 115 | |||
| 116 | === modified file 'gcc/ddg.c' | ||
| 117 | --- old/gcc/ddg.c 2010-07-19 08:58:53 +0000 | ||
| 118 | +++ new/gcc/ddg.c 2011-03-24 07:45:38 +0000 | ||
| 119 | @@ -60,6 +60,8 @@ | ||
| 120 | static ddg_edge_ptr create_ddg_edge (ddg_node_ptr, ddg_node_ptr, dep_type, | ||
| 121 | dep_data_type, int, int); | ||
| 122 | static void add_edge_to_ddg (ddg_ptr g, ddg_edge_ptr); | ||
| 123 | +static ddg_node_ptr get_node_of_insn_uid (ddg_ptr, int); | ||
| 124 | + | ||
| 125 | |||
| 126 | /* Auxiliary variable for mem_read_insn_p/mem_write_insn_p. */ | ||
| 127 | static bool mem_ref_p; | ||
| 128 | @@ -450,12 +452,65 @@ | ||
| 129 | sched_free_deps (head, tail, false); | ||
| 130 | } | ||
| 131 | |||
| 132 | +/* Given DOLOOP_INSNS which holds the instructions that | ||
| 133 | + belong to the do-loop part; mark closing_branch_deps field in ddg G | ||
| 134 | + as TRUE if the do-loop part's instructions are dependent on the other | ||
| 135 | + loop instructions. Otherwise mark it as FALSE. */ | ||
| 136 | +static void | ||
| 137 | +check_closing_branch_deps (ddg_ptr g, sbitmap doloop_insns) | ||
| 138 | +{ | ||
| 139 | + sbitmap_iterator sbi; | ||
| 140 | + unsigned int u = 0; | ||
| 141 | + | ||
| 142 | + EXECUTE_IF_SET_IN_SBITMAP (doloop_insns, 0, u, sbi) | ||
| 143 | + { | ||
| 144 | + ddg_edge_ptr e; | ||
| 145 | + ddg_node_ptr u_node = get_node_of_insn_uid (g, u); | ||
| 146 | + | ||
| 147 | + gcc_assert (u_node); | ||
| 148 | + | ||
| 149 | + for (e = u_node->in; e != 0; e = e->next_in) | ||
| 150 | + { | ||
| 151 | + ddg_node_ptr v_node = e->src; | ||
| 152 | + | ||
| 153 | + if (((unsigned int) INSN_UID (v_node->insn) == u) | ||
| 154 | + || DEBUG_INSN_P (v_node->insn)) | ||
| 155 | + continue; | ||
| 156 | + | ||
| 157 | + /* Ignore dependencies between memory writes and the | ||
| 158 | + jump. */ | ||
| 159 | + if (JUMP_P (u_node->insn) | ||
| 160 | + && e->type == OUTPUT_DEP | ||
| 161 | + && mem_write_insn_p (v_node->insn)) | ||
| 162 | + continue; | ||
| 163 | + if (!TEST_BIT (doloop_insns, INSN_UID (v_node->insn))) | ||
| 164 | + { | ||
| 165 | + g->closing_branch_deps = 1; | ||
| 166 | + return; | ||
| 167 | + } | ||
| 168 | + } | ||
| 169 | + for (e = u_node->out; e != 0; e = e->next_out) | ||
| 170 | + { | ||
| 171 | + ddg_node_ptr v_node = e->dest; | ||
| 172 | + | ||
| 173 | + if (((unsigned int) INSN_UID (v_node->insn) == u) | ||
| 174 | + || DEBUG_INSN_P (v_node->insn)) | ||
| 175 | + continue; | ||
| 176 | + if (!TEST_BIT (doloop_insns, INSN_UID (v_node->insn))) | ||
| 177 | + { | ||
| 178 | + g->closing_branch_deps = 1; | ||
| 179 | + return; | ||
| 180 | + } | ||
| 181 | + } | ||
| 182 | + } | ||
| 183 | + g->closing_branch_deps = 0; | ||
| 184 | +} | ||
| 185 | |||
| 186 | /* Given a basic block, create its DDG and return a pointer to a variable | ||
| 187 | of ddg type that represents it. | ||
| 188 | Initialize the ddg structure fields to the appropriate values. */ | ||
| 189 | ddg_ptr | ||
| 190 | -create_ddg (basic_block bb, int closing_branch_deps) | ||
| 191 | +create_ddg (basic_block bb, sbitmap doloop_insns) | ||
| 192 | { | ||
| 193 | ddg_ptr g; | ||
| 194 | rtx insn, first_note; | ||
| 195 | @@ -465,7 +520,6 @@ | ||
| 196 | g = (ddg_ptr) xcalloc (1, sizeof (struct ddg)); | ||
| 197 | |||
| 198 | g->bb = bb; | ||
| 199 | - g->closing_branch_deps = closing_branch_deps; | ||
| 200 | |||
| 201 | /* Count the number of insns in the BB. */ | ||
| 202 | for (insn = BB_HEAD (bb); insn != NEXT_INSN (BB_END (bb)); | ||
| 203 | @@ -538,6 +592,11 @@ | ||
| 204 | /* Build the data dependency graph. */ | ||
| 205 | build_intra_loop_deps (g); | ||
| 206 | build_inter_loop_deps (g); | ||
| 207 | + | ||
| 208 | + /* Check whether the do-loop part is decoupled from the other loop | ||
| 209 | + instructions. */ | ||
| 210 | + check_closing_branch_deps (g, doloop_insns); | ||
| 211 | + | ||
| 212 | return g; | ||
| 213 | } | ||
| 214 | |||
| 215 | @@ -831,6 +890,18 @@ | ||
| 216 | return NULL; | ||
| 217 | } | ||
| 218 | |||
| 219 | +/* Given the uid of an instruction UID return the node that represents it. */ | ||
| 220 | +static ddg_node_ptr | ||
| 221 | +get_node_of_insn_uid (ddg_ptr g, int uid) | ||
| 222 | +{ | ||
| 223 | + int i; | ||
| 224 | + | ||
| 225 | + for (i = 0; i < g->num_nodes; i++) | ||
| 226 | + if (uid == INSN_UID (g->nodes[i].insn)) | ||
| 227 | + return &g->nodes[i]; | ||
| 228 | + return NULL; | ||
| 229 | +} | ||
| 230 | + | ||
| 231 | /* Given a set OPS of nodes in the DDG, find the set of their successors | ||
| 232 | which are not in OPS, and set their bits in SUCC. Bits corresponding to | ||
| 233 | OPS are cleared from SUCC. Leaves the other bits in SUCC unchanged. */ | ||
| 234 | |||
| 235 | === modified file 'gcc/ddg.h' | ||
| 236 | --- old/gcc/ddg.h 2009-11-25 10:55:54 +0000 | ||
| 237 | +++ new/gcc/ddg.h 2011-03-24 07:45:38 +0000 | ||
| 238 | @@ -167,7 +167,7 @@ | ||
| 239 | }; | ||
| 240 | |||
| 241 | |||
| 242 | -ddg_ptr create_ddg (basic_block, int closing_branch_deps); | ||
| 243 | +ddg_ptr create_ddg (basic_block, sbitmap); | ||
| 244 | void free_ddg (ddg_ptr); | ||
| 245 | |||
| 246 | void print_ddg (FILE *, ddg_ptr); | ||
| 247 | |||
| 248 | === modified file 'gcc/loop-doloop.c' | ||
| 249 | --- old/gcc/loop-doloop.c 2010-07-19 08:58:53 +0000 | ||
| 250 | +++ new/gcc/loop-doloop.c 2011-03-24 07:45:38 +0000 | ||
| 251 | @@ -78,6 +78,8 @@ | ||
| 252 | rtx inc_src; | ||
| 253 | rtx condition; | ||
| 254 | rtx pattern; | ||
| 255 | + rtx cc_reg = NULL_RTX; | ||
| 256 | + rtx reg_orig = NULL_RTX; | ||
| 257 | |||
| 258 | /* The canonical doloop pattern we expect has one of the following | ||
| 259 | forms: | ||
| 260 | @@ -96,7 +98,16 @@ | ||
| 261 | 2) (set (reg) (plus (reg) (const_int -1)) | ||
| 262 | (set (pc) (if_then_else (reg != 0) | ||
| 263 | (label_ref (label)) | ||
| 264 | - (pc))). */ | ||
| 265 | + (pc))). | ||
| 266 | + | ||
| 267 | + Some targets (ARM) do the comparison before the branch, as in the | ||
| 268 | + following form: | ||
| 269 | + | ||
| 270 | + 3) (parallel [(set (cc) (compare ((plus (reg) (const_int -1), 0))) | ||
| 271 | + (set (reg) (plus (reg) (const_int -1)))]) | ||
| 272 | + (set (pc) (if_then_else (cc == NE) | ||
| 273 | + (label_ref (label)) | ||
| 274 | + (pc))) */ | ||
| 275 | |||
| 276 | pattern = PATTERN (doloop_pat); | ||
| 277 | |||
| 278 | @@ -104,19 +115,47 @@ | ||
| 279 | { | ||
| 280 | rtx cond; | ||
| 281 | rtx prev_insn = prev_nondebug_insn (doloop_pat); | ||
| 282 | + rtx cmp_arg1, cmp_arg2; | ||
| 283 | + rtx cmp_orig; | ||
| 284 | |||
| 285 | - /* We expect the decrement to immediately precede the branch. */ | ||
| 286 | + /* In case the pattern is not PARALLEL we expect two forms | ||
| 287 | + of doloop which are cases 2) and 3) above: in case 2) the | ||
| 288 | + decrement immediately precedes the branch, while in case 3) | ||
| 289 | + the compare and decrement instructions immediately precede | ||
| 290 | + the branch. */ | ||
| 291 | |||
| 292 | if (prev_insn == NULL_RTX || !INSN_P (prev_insn)) | ||
| 293 | return 0; | ||
| 294 | |||
| 295 | cmp = pattern; | ||
| 296 | - inc = PATTERN (PREV_INSN (doloop_pat)); | ||
| 297 | + if (GET_CODE (PATTERN (prev_insn)) == PARALLEL) | ||
| 298 | + { | ||
| 299 | + /* The third case: the compare and decrement instructions | ||
| 300 | + immediately precede the branch. */ | ||
| 301 | + cmp_orig = XVECEXP (PATTERN (prev_insn), 0, 0); | ||
| 302 | + if (GET_CODE (cmp_orig) != SET) | ||
| 303 | + return 0; | ||
| 304 | + if (GET_CODE (SET_SRC (cmp_orig)) != COMPARE) | ||
| 305 | + return 0; | ||
| 306 | + cmp_arg1 = XEXP (SET_SRC (cmp_orig), 0); | ||
| 307 | + cmp_arg2 = XEXP (SET_SRC (cmp_orig), 1); | ||
| 308 | + if (cmp_arg2 != const0_rtx | ||
| 309 | + || GET_CODE (cmp_arg1) != PLUS) | ||
| 310 | + return 0; | ||
| 311 | + reg_orig = XEXP (cmp_arg1, 0); | ||
| 312 | + if (XEXP (cmp_arg1, 1) != GEN_INT (-1) | ||
| 313 | + || !REG_P (reg_orig)) | ||
| 314 | + return 0; | ||
| 315 | + cc_reg = SET_DEST (cmp_orig); | ||
| 316 | + | ||
| 317 | + inc = XVECEXP (PATTERN (prev_insn), 0, 1); | ||
| 318 | + } | ||
| 319 | + else | ||
| 320 | + inc = PATTERN (prev_insn); | ||
| 321 | /* We expect the condition to be of the form (reg != 0) */ | ||
| 322 | cond = XEXP (SET_SRC (cmp), 0); | ||
| 323 | if (GET_CODE (cond) != NE || XEXP (cond, 1) != const0_rtx) | ||
| 324 | return 0; | ||
| 325 | - | ||
| 326 | } | ||
| 327 | else | ||
| 328 | { | ||
| 329 | @@ -162,11 +201,15 @@ | ||
| 330 | return 0; | ||
| 331 | |||
| 332 | if ((XEXP (condition, 0) == reg) | ||
| 333 | + /* For the third case: */ | ||
| 334 | + || ((cc_reg != NULL_RTX) | ||
| 335 | + && (XEXP (condition, 0) == cc_reg) | ||
| 336 | + && (reg_orig == reg)) | ||
| 337 | || (GET_CODE (XEXP (condition, 0)) == PLUS | ||
| 338 | - && XEXP (XEXP (condition, 0), 0) == reg)) | ||
| 339 | + && XEXP (XEXP (condition, 0), 0) == reg)) | ||
| 340 | { | ||
| 341 | if (GET_CODE (pattern) != PARALLEL) | ||
| 342 | - /* The second form we expect: | ||
| 343 | + /* For the second form we expect: | ||
| 344 | |||
| 345 | (set (reg) (plus (reg) (const_int -1)) | ||
| 346 | (set (pc) (if_then_else (reg != 0) | ||
| 347 | @@ -181,7 +224,24 @@ | ||
| 348 | (set (reg) (plus (reg) (const_int -1))) | ||
| 349 | (additional clobbers and uses)]) | ||
| 350 | |||
| 351 | - So we return that form instead. | ||
| 352 | + For the third form we expect: | ||
| 353 | + | ||
| 354 | + (parallel [(set (cc) (compare ((plus (reg) (const_int -1)), 0)) | ||
| 355 | + (set (reg) (plus (reg) (const_int -1)))]) | ||
| 356 | + (set (pc) (if_then_else (cc == NE) | ||
| 357 | + (label_ref (label)) | ||
| 358 | + (pc))) | ||
| 359 | + | ||
| 360 | + which is equivalent to the following: | ||
| 361 | + | ||
| 362 | + (parallel [(set (cc) (compare (reg, 1)) | ||
| 363 | + (set (reg) (plus (reg) (const_int -1))) | ||
| 364 | + (set (pc) (if_then_else (NE == cc) | ||
| 365 | + (label_ref (label)) | ||
| 366 | + (pc))))]) | ||
| 367 | + | ||
| 368 | + So we return the second form instead for the two cases. | ||
| 369 | + | ||
| 370 | */ | ||
| 371 | condition = gen_rtx_fmt_ee (NE, VOIDmode, inc_src, const1_rtx); | ||
| 372 | |||
| 373 | |||
| 374 | === modified file 'gcc/modulo-sched.c' | ||
| 375 | --- old/gcc/modulo-sched.c 2009-11-25 10:55:54 +0000 | ||
| 376 | +++ new/gcc/modulo-sched.c 2011-03-24 07:45:38 +0000 | ||
| 377 | @@ -116,8 +116,10 @@ | ||
| 378 | |||
| 379 | /* The number of different iterations the nodes in ps span, assuming | ||
| 380 | the stage boundaries are placed efficiently. */ | ||
| 381 | -#define PS_STAGE_COUNT(ps) ((PS_MAX_CYCLE (ps) - PS_MIN_CYCLE (ps) \ | ||
| 382 | - + 1 + (ps)->ii - 1) / (ps)->ii) | ||
| 383 | +#define CALC_STAGE_COUNT(min_cycle,max_cycle,ii) ((max_cycle - min_cycle \ | ||
| 384 | + + 1 + ii - 1) / ii) | ||
| 385 | +/* The stage count of ps. */ | ||
| 386 | +#define PS_STAGE_COUNT(ps) (((partial_schedule_ptr)(ps))->stage_count) | ||
| 387 | |||
| 388 | /* A single instruction in the partial schedule. */ | ||
| 389 | struct ps_insn | ||
| 390 | @@ -155,6 +157,8 @@ | ||
| 391 | int max_cycle; | ||
| 392 | |||
| 393 | ddg_ptr g; /* The DDG of the insns in the partial schedule. */ | ||
| 394 | + | ||
| 395 | + int stage_count; /* The stage count of the partial schedule. */ | ||
| 396 | }; | ||
| 397 | |||
| 398 | /* We use this to record all the register replacements we do in | ||
| 399 | @@ -195,6 +199,7 @@ | ||
| 400 | rtx, rtx); | ||
| 401 | static void duplicate_insns_of_cycles (partial_schedule_ptr, | ||
| 402 | int, int, int, rtx); | ||
| 403 | +static int calculate_stage_count (partial_schedule_ptr ps); | ||
| 404 | |||
| 405 | #define SCHED_ASAP(x) (((node_sched_params_ptr)(x)->aux.info)->asap) | ||
| 406 | #define SCHED_TIME(x) (((node_sched_params_ptr)(x)->aux.info)->time) | ||
| 407 | @@ -310,10 +315,10 @@ | ||
| 408 | either a single (parallel) branch-on-count or a (non-parallel) | ||
| 409 | branch immediately preceded by a single (decrement) insn. */ | ||
| 410 | first_insn_not_to_check = (GET_CODE (PATTERN (tail)) == PARALLEL ? tail | ||
| 411 | - : PREV_INSN (tail)); | ||
| 412 | + : prev_nondebug_insn (tail)); | ||
| 413 | |||
| 414 | for (insn = head; insn != first_insn_not_to_check; insn = NEXT_INSN (insn)) | ||
| 415 | - if (reg_mentioned_p (reg, insn)) | ||
| 416 | + if (reg_mentioned_p (reg, insn) && NONDEBUG_INSN_P (insn)) | ||
| 417 | { | ||
| 418 | if (dump_file) | ||
| 419 | { | ||
| 420 | @@ -332,6 +337,24 @@ | ||
| 421 | #endif | ||
| 422 | } | ||
| 423 | |||
| 424 | +/* Mark in DOLOOP_INSNS the instructions that belong to the do-loop part. | ||
| 425 | + Use TAIL to recognize that part. */ | ||
| 426 | +static void | ||
| 427 | +mark_doloop_insns (sbitmap doloop_insns, rtx tail) | ||
| 428 | +{ | ||
| 429 | + rtx first_insn_not_to_check, insn; | ||
| 430 | + | ||
| 431 | + /* This is the first instruction which belongs the doloop part. */ | ||
| 432 | + first_insn_not_to_check = (GET_CODE (PATTERN (tail)) == PARALLEL ? tail | ||
| 433 | + : prev_nondebug_insn (tail)); | ||
| 434 | + | ||
| 435 | + sbitmap_zero (doloop_insns); | ||
| 436 | + for (insn = first_insn_not_to_check; insn != NEXT_INSN (tail); | ||
| 437 | + insn = NEXT_INSN (insn)) | ||
| 438 | + if (NONDEBUG_INSN_P (insn)) | ||
| 439 | + SET_BIT (doloop_insns, INSN_UID (insn)); | ||
| 440 | +} | ||
| 441 | + | ||
| 442 | /* Check if COUNT_REG is set to a constant in the PRE_HEADER block, so | ||
| 443 | that the number of iterations is a compile-time constant. If so, | ||
| 444 | return the rtx that sets COUNT_REG to a constant, and set COUNT to | ||
| 445 | @@ -569,13 +592,12 @@ | ||
| 446 | } | ||
| 447 | } | ||
| 448 | |||
| 449 | -/* Bump the SCHED_TIMEs of all nodes to start from zero. Set the values | ||
| 450 | - of SCHED_ROW and SCHED_STAGE. */ | ||
| 451 | +/* Bump the SCHED_TIMEs of all nodes by AMOUNT. Set the values of | ||
| 452 | + SCHED_ROW and SCHED_STAGE. */ | ||
| 453 | static void | ||
| 454 | -normalize_sched_times (partial_schedule_ptr ps) | ||
| 455 | +reset_sched_times (partial_schedule_ptr ps, int amount) | ||
| 456 | { | ||
| 457 | int row; | ||
| 458 | - int amount = PS_MIN_CYCLE (ps); | ||
| 459 | int ii = ps->ii; | ||
| 460 | ps_insn_ptr crr_insn; | ||
| 461 | |||
| 462 | @@ -584,6 +606,10 @@ | ||
| 463 | { | ||
| 464 | ddg_node_ptr u = crr_insn->node; | ||
| 465 | int normalized_time = SCHED_TIME (u) - amount; | ||
| 466 | + int new_min_cycle = PS_MIN_CYCLE (ps) - amount; | ||
| 467 | + /* The first cycle in row zero after the rotation. */ | ||
| 468 | + int new_first_cycle_in_row_zero = | ||
| 469 | + new_min_cycle + ii - SMODULO (new_min_cycle, ii); | ||
| 470 | |||
| 471 | if (dump_file) | ||
| 472 | fprintf (dump_file, "crr_insn->node=%d, crr_insn->cycle=%d,\ | ||
| 473 | @@ -592,8 +618,30 @@ | ||
| 474 | gcc_assert (SCHED_TIME (u) >= ps->min_cycle); | ||
| 475 | gcc_assert (SCHED_TIME (u) <= ps->max_cycle); | ||
| 476 | SCHED_TIME (u) = normalized_time; | ||
| 477 | - SCHED_ROW (u) = normalized_time % ii; | ||
| 478 | - SCHED_STAGE (u) = normalized_time / ii; | ||
| 479 | + crr_insn->cycle = normalized_time; | ||
| 480 | + SCHED_ROW (u) = SMODULO (normalized_time, ii); | ||
| 481 | + | ||
| 482 | + /* If min_cycle is in row zero after the rotation then | ||
| 483 | + the stage count can be calculated by dividing the cycle | ||
| 484 | + with ii. Otherwise, the calculation is done by dividing the | ||
| 485 | + SMSed kernel into two intervals: | ||
| 486 | + | ||
| 487 | + 1) min_cycle <= interval 0 < first_cycle_in_row_zero | ||
| 488 | + 2) first_cycle_in_row_zero <= interval 1 < max_cycle | ||
| 489 | + | ||
| 490 | + Cycles in interval 0 are in stage 0. The stage of cycles | ||
| 491 | + in interval 1 should be added by 1 to take interval 0 into | ||
| 492 | + account. */ | ||
| 493 | + if (SMODULO (new_min_cycle, ii) == 0) | ||
| 494 | + SCHED_STAGE (u) = normalized_time / ii; | ||
| 495 | + else | ||
| 496 | + { | ||
| 497 | + if (crr_insn->cycle < new_first_cycle_in_row_zero) | ||
| 498 | + SCHED_STAGE (u) = 0; | ||
| 499 | + else | ||
| 500 | + SCHED_STAGE (u) = | ||
| 501 | + ((SCHED_TIME (u) - new_first_cycle_in_row_zero) / ii) + 1; | ||
| 502 | + } | ||
| 503 | } | ||
| 504 | } | ||
| 505 | |||
| 506 | @@ -646,9 +694,12 @@ | ||
| 507 | |||
| 508 | /* Do not duplicate any insn which refers to count_reg as it | ||
| 509 | belongs to the control part. | ||
| 510 | + If closing_branch_deps is true the closing branch is scheduled | ||
| 511 | + as well and thus should be ignored. | ||
| 512 | TODO: This should be done by analyzing the control part of | ||
| 513 | the loop. */ | ||
| 514 | - if (reg_mentioned_p (count_reg, u_node->insn)) | ||
| 515 | + if (reg_mentioned_p (count_reg, u_node->insn) | ||
| 516 | + || JUMP_P (ps_ij->node->insn)) | ||
| 517 | continue; | ||
| 518 | |||
| 519 | if (for_prolog) | ||
| 520 | @@ -894,7 +945,8 @@ | ||
| 521 | basic_block condition_bb = NULL; | ||
| 522 | edge latch_edge; | ||
| 523 | gcov_type trip_count = 0; | ||
| 524 | - | ||
| 525 | + sbitmap doloop_insns; | ||
| 526 | + | ||
| 527 | loop_optimizer_init (LOOPS_HAVE_PREHEADERS | ||
| 528 | | LOOPS_HAVE_RECORDED_EXITS); | ||
| 529 | if (number_of_loops () <= 1) | ||
| 530 | @@ -919,6 +971,7 @@ | ||
| 531 | setup_sched_infos (); | ||
| 532 | haifa_sched_init (); | ||
| 533 | |||
| 534 | + doloop_insns = sbitmap_alloc (get_max_uid () + 1); | ||
| 535 | /* Allocate memory to hold the DDG array one entry for each loop. | ||
| 536 | We use loop->num as index into this array. */ | ||
| 537 | g_arr = XCNEWVEC (ddg_ptr, number_of_loops ()); | ||
| 538 | @@ -1009,9 +1062,11 @@ | ||
| 539 | continue; | ||
| 540 | } | ||
| 541 | |||
| 542 | - /* Don't handle BBs with calls or barriers, or !single_set insns, | ||
| 543 | - or auto-increment insns (to avoid creating invalid reg-moves | ||
| 544 | - for the auto-increment insns). | ||
| 545 | + /* Don't handle BBs with calls or barriers or auto-increment insns | ||
| 546 | + (to avoid creating invalid reg-moves for the auto-increment insns), | ||
| 547 | + or !single_set with the exception of instructions that include | ||
| 548 | + count_reg---these instructions are part of the control part | ||
| 549 | + that do-loop recognizes. | ||
| 550 | ??? Should handle auto-increment insns. | ||
| 551 | ??? Should handle insns defining subregs. */ | ||
| 552 | for (insn = head; insn != NEXT_INSN (tail); insn = NEXT_INSN (insn)) | ||
| 553 | @@ -1021,7 +1076,8 @@ | ||
| 554 | if (CALL_P (insn) | ||
| 555 | || BARRIER_P (insn) | ||
| 556 | || (NONDEBUG_INSN_P (insn) && !JUMP_P (insn) | ||
| 557 | - && !single_set (insn) && GET_CODE (PATTERN (insn)) != USE) | ||
| 558 | + && !single_set (insn) && GET_CODE (PATTERN (insn)) != USE | ||
| 559 | + && !reg_mentioned_p (count_reg, insn)) | ||
| 560 | || (FIND_REG_INC_NOTE (insn, NULL_RTX) != 0) | ||
| 561 | || (INSN_P (insn) && (set = single_set (insn)) | ||
| 562 | && GET_CODE (SET_DEST (set)) == SUBREG)) | ||
| 563 | @@ -1048,14 +1104,16 @@ | ||
| 564 | |||
| 565 | continue; | ||
| 566 | } | ||
| 567 | - | ||
| 568 | - if (! (g = create_ddg (bb, 0))) | ||
| 569 | + mark_doloop_insns (doloop_insns, tail); | ||
| 570 | + if (! (g = create_ddg (bb, doloop_insns))) | ||
| 571 | { | ||
| 572 | if (dump_file) | ||
| 573 | fprintf (dump_file, "SMS create_ddg failed\n"); | ||
| 574 | continue; | ||
| 575 | } | ||
| 576 | - | ||
| 577 | + if (dump_file) | ||
| 578 | + fprintf (dump_file, "SMS closing_branch_deps: %d\n", | ||
| 579 | + g->closing_branch_deps); | ||
| 580 | g_arr[loop->num] = g; | ||
| 581 | if (dump_file) | ||
| 582 | fprintf (dump_file, "...OK\n"); | ||
| 583 | @@ -1157,11 +1215,13 @@ | ||
| 584 | |||
| 585 | ps = sms_schedule_by_order (g, mii, maxii, node_order); | ||
| 586 | |||
| 587 | - if (ps){ | ||
| 588 | - stage_count = PS_STAGE_COUNT (ps); | ||
| 589 | - gcc_assert(stage_count >= 1); | ||
| 590 | - } | ||
| 591 | - | ||
| 592 | + if (ps) | ||
| 593 | + { | ||
| 594 | + stage_count = calculate_stage_count (ps); | ||
| 595 | + gcc_assert(stage_count >= 1); | ||
| 596 | + PS_STAGE_COUNT(ps) = stage_count; | ||
| 597 | + } | ||
| 598 | + | ||
| 599 | /* Stage count of 1 means that there is no interleaving between | ||
| 600 | iterations, let the scheduling passes do the job. */ | ||
| 601 | if (stage_count <= 1 | ||
| 602 | @@ -1182,17 +1242,7 @@ | ||
| 603 | else | ||
| 604 | { | ||
| 605 | struct undo_replace_buff_elem *reg_move_replaces; | ||
| 606 | - | ||
| 607 | - if (dump_file) | ||
| 608 | - { | ||
| 609 | - fprintf (dump_file, | ||
| 610 | - "SMS succeeded %d %d (with ii, sc)\n", ps->ii, | ||
| 611 | - stage_count); | ||
| 612 | - print_partial_schedule (ps, dump_file); | ||
| 613 | - fprintf (dump_file, | ||
| 614 | - "SMS Branch (%d) will later be scheduled at cycle %d.\n", | ||
| 615 | - g->closing_branch->cuid, PS_MIN_CYCLE (ps) - 1); | ||
| 616 | - } | ||
| 617 | + int amount; | ||
| 618 | |||
| 619 | /* Set the stage boundaries. If the DDG is built with closing_branch_deps, | ||
| 620 | the closing_branch was scheduled and should appear in the last (ii-1) | ||
| 621 | @@ -1202,12 +1252,28 @@ | ||
| 622 | TODO: Revisit the issue of scheduling the insns of the | ||
| 623 | control part relative to the branch when the control part | ||
| 624 | has more than one insn. */ | ||
| 625 | - normalize_sched_times (ps); | ||
| 626 | - rotate_partial_schedule (ps, PS_MIN_CYCLE (ps)); | ||
| 627 | + amount = (g->closing_branch_deps)? SCHED_TIME (g->closing_branch) + 1: | ||
| 628 | + PS_MIN_CYCLE (ps); | ||
| 629 | + reset_sched_times (ps, amount); | ||
| 630 | + rotate_partial_schedule (ps, amount); | ||
| 631 | + | ||
| 632 | set_columns_for_ps (ps); | ||
| 633 | |||
| 634 | canon_loop (loop); | ||
| 635 | |||
| 636 | + if (dump_file) | ||
| 637 | + { | ||
| 638 | + fprintf (dump_file, | ||
| 639 | + "SMS succeeded %d %d (with ii, sc)\n", ps->ii, | ||
| 640 | + stage_count); | ||
| 641 | + print_partial_schedule (ps, dump_file); | ||
| 642 | + if (!g->closing_branch_deps) | ||
| 643 | + fprintf (dump_file, | ||
| 644 | + "SMS Branch (%d) will later be scheduled at \ | ||
| 645 | + cycle %d.\n", | ||
| 646 | + g->closing_branch->cuid, PS_MIN_CYCLE (ps) - 1); | ||
| 647 | + } | ||
| 648 | + | ||
| 649 | /* case the BCT count is not known , Do loop-versioning */ | ||
| 650 | if (count_reg && ! count_init) | ||
| 651 | { | ||
| 652 | @@ -1252,6 +1318,7 @@ | ||
| 653 | } | ||
| 654 | |||
| 655 | free (g_arr); | ||
| 656 | + sbitmap_free (doloop_insns); | ||
| 657 | |||
| 658 | /* Release scheduler data, needed until now because of DFA. */ | ||
| 659 | haifa_sched_finish (); | ||
| 660 | @@ -1759,8 +1826,9 @@ | ||
| 661 | RESET_BIT (tobe_scheduled, u); | ||
| 662 | continue; | ||
| 663 | } | ||
| 664 | - | ||
| 665 | - if (JUMP_P (insn)) /* Closing branch handled later. */ | ||
| 666 | + /* Closing branch handled later unless closing_branch_deps | ||
| 667 | + is true. */ | ||
| 668 | + if (JUMP_P (insn) && !g->closing_branch_deps) | ||
| 669 | { | ||
| 670 | RESET_BIT (tobe_scheduled, u); | ||
| 671 | continue; | ||
| 672 | @@ -1893,8 +1961,8 @@ | ||
| 673 | if (dump_file) | ||
| 674 | fprintf (dump_file, "split_row=%d\n", split_row); | ||
| 675 | |||
| 676 | - normalize_sched_times (ps); | ||
| 677 | - rotate_partial_schedule (ps, ps->min_cycle); | ||
| 678 | + reset_sched_times (ps, PS_MIN_CYCLE (ps)); | ||
| 679 | + rotate_partial_schedule (ps, PS_MIN_CYCLE (ps)); | ||
| 680 | |||
| 681 | rows_new = (ps_insn_ptr *) xcalloc (new_ii, sizeof (ps_insn_ptr)); | ||
| 682 | for (row = 0; row < split_row; row++) | ||
| 683 | @@ -2571,6 +2639,7 @@ | ||
| 684 | ps_insn_ptr next_ps_i; | ||
| 685 | ps_insn_ptr first_must_follow = NULL; | ||
| 686 | ps_insn_ptr last_must_precede = NULL; | ||
| 687 | + ps_insn_ptr last_in_row = NULL; | ||
| 688 | int row; | ||
| 689 | |||
| 690 | if (! ps_i) | ||
| 691 | @@ -2597,8 +2666,37 @@ | ||
| 692 | else | ||
| 693 | last_must_precede = next_ps_i; | ||
| 694 | } | ||
| 695 | + /* The closing branch must be the last in the row. */ | ||
| 696 | + if (must_precede | ||
| 697 | + && TEST_BIT (must_precede, next_ps_i->node->cuid) | ||
| 698 | + && JUMP_P (next_ps_i->node->insn)) | ||
| 699 | + return false; | ||
| 700 | + | ||
| 701 | + last_in_row = next_ps_i; | ||
| 702 | } | ||
| 703 | |||
| 704 | + /* If closing_branch_deps is true we are scheduling the closing | ||
| 705 | + branch as well. Make sure there is no dependent instruction after | ||
| 706 | + it as the branch should be the last instruction. */ | ||
| 707 | + if (JUMP_P (ps_i->node->insn)) | ||
| 708 | + { | ||
| 709 | + if (first_must_follow) | ||
| 710 | + return false; | ||
| 711 | + if (last_in_row) | ||
| 712 | + { | ||
| 713 | + /* Make the branch the last in the row. New instructions | ||
| 714 | + will be inserted at the beginning of the row or after the | ||
| 715 | + last must_precede instruction thus the branch is guaranteed | ||
| 716 | + to remain the last instruction in the row. */ | ||
| 717 | + last_in_row->next_in_row = ps_i; | ||
| 718 | + ps_i->prev_in_row = last_in_row; | ||
| 719 | + ps_i->next_in_row = NULL; | ||
| 720 | + } | ||
| 721 | + else | ||
| 722 | + ps->rows[row] = ps_i; | ||
| 723 | + return true; | ||
| 724 | + } | ||
| 725 | + | ||
| 726 | /* Now insert the node after INSERT_AFTER_PSI. */ | ||
| 727 | |||
| 728 | if (! last_must_precede) | ||
| 729 | @@ -2820,6 +2918,54 @@ | ||
| 730 | return ps_i; | ||
| 731 | } | ||
| 732 | |||
| 733 | +/* Calculate the stage count of the partial schedule PS. */ | ||
| 734 | +int | ||
| 735 | +calculate_stage_count (partial_schedule_ptr ps) | ||
| 736 | +{ | ||
| 737 | + int stage_count; | ||
| 738 | + | ||
| 739 | + /* If closing_branch_deps is false then the stage | ||
| 740 | + boundaries are placed efficiently, meaning that min_cycle will be | ||
| 741 | + placed at row 0. Otherwise, the closing branch will be placed in | ||
| 742 | + row ii-1. For the later case we assume the final SMSed kernel can | ||
| 743 | + be divided into two intervals. This assumption is used for the | ||
| 744 | + stage count calculation: | ||
| 745 | + | ||
| 746 | + 1) min_cycle <= interval 0 < first_cycle_in_row_zero | ||
| 747 | + 2) first_cycle_in_row_zero <= interval 1 < max_cycle | ||
| 748 | + */ | ||
| 749 | + stage_count = | ||
| 750 | + CALC_STAGE_COUNT (PS_MIN_CYCLE (ps), PS_MAX_CYCLE (ps), ps->ii); | ||
| 751 | + if (ps->g->closing_branch_deps) | ||
| 752 | + { | ||
| 753 | + int new_min_cycle; | ||
| 754 | + int new_min_cycle_row; | ||
| 755 | + int rotation_amount = SCHED_TIME (ps->g->closing_branch) + 1; | ||
| 756 | + | ||
| 757 | + /* This is the new value of min_cycle after the final rotation to | ||
| 758 | + bring closing branch into row ii-1. */ | ||
| 759 | + new_min_cycle = PS_MIN_CYCLE (ps) - rotation_amount; | ||
| 760 | + /* This is the row which the the new min_cycle will be placed in. */ | ||
| 761 | + new_min_cycle_row = SMODULO (new_min_cycle, ps->ii); | ||
| 762 | + /* If the row of min_cycle is zero then interval 0 is empty. | ||
| 763 | + Otherwise, we need to calculate interval 1 and add it by one | ||
| 764 | + to take interval 0 into account. */ | ||
| 765 | + if (new_min_cycle_row != 0) | ||
| 766 | + { | ||
| 767 | + int new_max_cycle, first_cycle_in_row_zero; | ||
| 768 | + | ||
| 769 | + new_max_cycle = PS_MAX_CYCLE (ps) - rotation_amount; | ||
| 770 | + first_cycle_in_row_zero = | ||
| 771 | + new_min_cycle + ps->ii - new_min_cycle_row; | ||
| 772 | + | ||
| 773 | + stage_count = | ||
| 774 | + CALC_STAGE_COUNT (first_cycle_in_row_zero, new_max_cycle, | ||
| 775 | + ps->ii) + 1; | ||
| 776 | + } | ||
| 777 | + } | ||
| 778 | + return stage_count; | ||
| 779 | +} | ||
| 780 | + | ||
| 781 | /* Rotate the rows of PS such that insns scheduled at time | ||
| 782 | START_CYCLE will appear in row 0. Updates max/min_cycles. */ | ||
| 783 | void | ||
| 784 | |||
diff --git a/meta-oe/recipes-devtools/gcc/gcc-4.5/linaro/gcc-4.5-linaro-r99498.patch b/meta-oe/recipes-devtools/gcc/gcc-4.5/linaro/gcc-4.5-linaro-r99498.patch new file mode 100644 index 0000000000..9c305cc651 --- /dev/null +++ b/meta-oe/recipes-devtools/gcc/gcc-4.5/linaro/gcc-4.5-linaro-r99498.patch | |||
| @@ -0,0 +1,186 @@ | |||
| 1 | 2011-02-16 Nathan Sidwell <nathan@codesourcery.com> | ||
| 2 | |||
| 3 | Issue #10439 | ||
| 4 | gcc/ | ||
| 5 | * config/arm/unwind-arm.c (enum __cxa_type_match_result): New. | ||
| 6 | (cxa_type_match): Correct declaration. | ||
| 7 | (__gnu_unwind_pr_common): Reconstruct | ||
| 8 | additional indirection when __cxa_type_match returns | ||
| 9 | succeeded_with_ptr_to_base. | ||
| 10 | |||
| 11 | libstdc++/ | ||
| 12 | * libsupc++/eh_arm.c (__cxa_type_match): Construct address of | ||
| 13 | thrown object here. Return succeded_with_ptr_to_base for all | ||
| 14 | pointer cases. | ||
| 15 | |||
| 16 | === modified file 'gcc/config/arm/unwind-arm.c' | ||
| 17 | --- old/gcc/config/arm/unwind-arm.c 2010-08-12 12:39:35 +0000 | ||
| 18 | +++ new/gcc/config/arm/unwind-arm.c 2011-04-08 10:41:46 +0000 | ||
| 19 | @@ -32,13 +32,18 @@ | ||
| 20 | typedef unsigned char bool; | ||
| 21 | |||
| 22 | typedef struct _ZSt9type_info type_info; /* This names C++ type_info type */ | ||
| 23 | +enum __cxa_type_match_result | ||
| 24 | + { | ||
| 25 | + ctm_failed = 0, | ||
| 26 | + ctm_succeeded = 1, | ||
| 27 | + ctm_succeeded_with_ptr_to_base = 2 | ||
| 28 | + }; | ||
| 29 | |||
| 30 | void __attribute__((weak)) __cxa_call_unexpected(_Unwind_Control_Block *ucbp); | ||
| 31 | bool __attribute__((weak)) __cxa_begin_cleanup(_Unwind_Control_Block *ucbp); | ||
| 32 | -bool __attribute__((weak)) __cxa_type_match(_Unwind_Control_Block *ucbp, | ||
| 33 | - const type_info *rttip, | ||
| 34 | - bool is_reference, | ||
| 35 | - void **matched_object); | ||
| 36 | +enum __cxa_type_match_result __attribute__((weak)) __cxa_type_match | ||
| 37 | + (_Unwind_Control_Block *ucbp, const type_info *rttip, | ||
| 38 | + bool is_reference, void **matched_object); | ||
| 39 | |||
| 40 | _Unwind_Ptr __attribute__((weak)) | ||
| 41 | __gnu_Unwind_Find_exidx (_Unwind_Ptr, int *); | ||
| 42 | @@ -1107,6 +1112,7 @@ | ||
| 43 | _uw rtti; | ||
| 44 | bool is_reference = (data[0] & uint32_highbit) != 0; | ||
| 45 | void *matched; | ||
| 46 | + enum __cxa_type_match_result match_type; | ||
| 47 | |||
| 48 | /* Check for no-throw areas. */ | ||
| 49 | if (data[1] == (_uw) -2) | ||
| 50 | @@ -1118,17 +1124,31 @@ | ||
| 51 | { | ||
| 52 | /* Match a catch specification. */ | ||
| 53 | rtti = _Unwind_decode_target2 ((_uw) &data[1]); | ||
| 54 | - if (!__cxa_type_match (ucbp, (type_info *) rtti, | ||
| 55 | - is_reference, | ||
| 56 | - &matched)) | ||
| 57 | - matched = (void *)0; | ||
| 58 | + match_type = __cxa_type_match (ucbp, | ||
| 59 | + (type_info *) rtti, | ||
| 60 | + is_reference, | ||
| 61 | + &matched); | ||
| 62 | } | ||
| 63 | + else | ||
| 64 | + match_type = ctm_succeeded; | ||
| 65 | |||
| 66 | - if (matched) | ||
| 67 | + if (match_type) | ||
| 68 | { | ||
| 69 | ucbp->barrier_cache.sp = | ||
| 70 | _Unwind_GetGR (context, R_SP); | ||
| 71 | - ucbp->barrier_cache.bitpattern[0] = (_uw) matched; | ||
| 72 | + // ctm_succeeded_with_ptr_to_base really | ||
| 73 | + // means _c_t_m indirected the pointer | ||
| 74 | + // object. We have to reconstruct the | ||
| 75 | + // additional pointer layer by using a temporary. | ||
| 76 | + if (match_type == ctm_succeeded_with_ptr_to_base) | ||
| 77 | + { | ||
| 78 | + ucbp->barrier_cache.bitpattern[2] | ||
| 79 | + = (_uw) matched; | ||
| 80 | + ucbp->barrier_cache.bitpattern[0] | ||
| 81 | + = (_uw) &ucbp->barrier_cache.bitpattern[2]; | ||
| 82 | + } | ||
| 83 | + else | ||
| 84 | + ucbp->barrier_cache.bitpattern[0] = (_uw) matched; | ||
| 85 | ucbp->barrier_cache.bitpattern[1] = (_uw) data; | ||
| 86 | return _URC_HANDLER_FOUND; | ||
| 87 | } | ||
| 88 | |||
| 89 | === modified file 'libstdc++-v3/libsupc++/eh_arm.cc' | ||
| 90 | --- old/libstdc++-v3/libsupc++/eh_arm.cc 2009-04-09 14:00:19 +0000 | ||
| 91 | +++ new/libstdc++-v3/libsupc++/eh_arm.cc 2011-04-08 10:41:46 +0000 | ||
| 92 | @@ -30,10 +30,11 @@ | ||
| 93 | using namespace __cxxabiv1; | ||
| 94 | |||
| 95 | |||
| 96 | -// Given the thrown type THROW_TYPE, pointer to a variable containing a | ||
| 97 | -// pointer to the exception object THROWN_PTR_P and a type CATCH_TYPE to | ||
| 98 | -// compare against, return whether or not there is a match and if so, | ||
| 99 | -// update *THROWN_PTR_P. | ||
| 100 | +// Given the thrown type THROW_TYPE, exception object UE_HEADER and a | ||
| 101 | +// type CATCH_TYPE to compare against, return whether or not there is | ||
| 102 | +// a match and if so, update *THROWN_PTR_P to point to either the | ||
| 103 | +// type-matched object, or in the case of a pointer type, the object | ||
| 104 | +// pointed to by the pointer. | ||
| 105 | |||
| 106 | extern "C" __cxa_type_match_result | ||
| 107 | __cxa_type_match(_Unwind_Exception* ue_header, | ||
| 108 | @@ -41,51 +42,51 @@ | ||
| 109 | bool is_reference __attribute__((__unused__)), | ||
| 110 | void** thrown_ptr_p) | ||
| 111 | { | ||
| 112 | - bool forced_unwind = __is_gxx_forced_unwind_class(ue_header->exception_class); | ||
| 113 | - bool foreign_exception = !forced_unwind && !__is_gxx_exception_class(ue_header->exception_class); | ||
| 114 | - bool dependent_exception = | ||
| 115 | - __is_dependent_exception(ue_header->exception_class); | ||
| 116 | + bool forced_unwind | ||
| 117 | + = __is_gxx_forced_unwind_class(ue_header->exception_class); | ||
| 118 | + bool foreign_exception | ||
| 119 | + = !forced_unwind && !__is_gxx_exception_class(ue_header->exception_class); | ||
| 120 | + bool dependent_exception | ||
| 121 | + = __is_dependent_exception(ue_header->exception_class); | ||
| 122 | __cxa_exception* xh = __get_exception_header_from_ue(ue_header); | ||
| 123 | __cxa_dependent_exception *dx = __get_dependent_exception_from_ue(ue_header); | ||
| 124 | const std::type_info* throw_type; | ||
| 125 | + void *thrown_ptr = 0; | ||
| 126 | |||
| 127 | if (forced_unwind) | ||
| 128 | throw_type = &typeid(abi::__forced_unwind); | ||
| 129 | else if (foreign_exception) | ||
| 130 | throw_type = &typeid(abi::__foreign_exception); | ||
| 131 | - else if (dependent_exception) | ||
| 132 | - throw_type = __get_exception_header_from_obj | ||
| 133 | - (dx->primaryException)->exceptionType; | ||
| 134 | else | ||
| 135 | - throw_type = xh->exceptionType; | ||
| 136 | - | ||
| 137 | - void* thrown_ptr = *thrown_ptr_p; | ||
| 138 | + { | ||
| 139 | + if (dependent_exception) | ||
| 140 | + xh = __get_exception_header_from_obj (dx->primaryException); | ||
| 141 | + throw_type = xh->exceptionType; | ||
| 142 | + // We used to require the caller set the target of thrown_ptr_p, | ||
| 143 | + // but that's incorrect -- the EHABI makes no such requirement | ||
| 144 | + // -- and not all callers will set it. Fortunately callers that | ||
| 145 | + // do initialize will always pass us the value we calculate | ||
| 146 | + // here, so there's no backwards compatibility problem. | ||
| 147 | + thrown_ptr = __get_object_from_ue (ue_header); | ||
| 148 | + } | ||
| 149 | + | ||
| 150 | + __cxa_type_match_result result = ctm_succeeded; | ||
| 151 | |||
| 152 | // Pointer types need to adjust the actual pointer, not | ||
| 153 | // the pointer to pointer that is the exception object. | ||
| 154 | // This also has the effect of passing pointer types | ||
| 155 | // "by value" through the __cxa_begin_catch return value. | ||
| 156 | if (throw_type->__is_pointer_p()) | ||
| 157 | - thrown_ptr = *(void**) thrown_ptr; | ||
| 158 | + { | ||
| 159 | + thrown_ptr = *(void**) thrown_ptr; | ||
| 160 | + // We need to indicate the indirection to our caller. | ||
| 161 | + result = ctm_succeeded_with_ptr_to_base; | ||
| 162 | + } | ||
| 163 | |||
| 164 | if (catch_type->__do_catch(throw_type, &thrown_ptr, 1)) | ||
| 165 | { | ||
| 166 | *thrown_ptr_p = thrown_ptr; | ||
| 167 | - | ||
| 168 | - if (typeid(*catch_type) == typeid (typeid(void*))) | ||
| 169 | - { | ||
| 170 | - const __pointer_type_info *catch_pointer_type = | ||
| 171 | - static_cast<const __pointer_type_info *> (catch_type); | ||
| 172 | - const __pointer_type_info *throw_pointer_type = | ||
| 173 | - static_cast<const __pointer_type_info *> (throw_type); | ||
| 174 | - | ||
| 175 | - if (typeid (*catch_pointer_type->__pointee) != typeid (void) | ||
| 176 | - && (*catch_pointer_type->__pointee != | ||
| 177 | - *throw_pointer_type->__pointee)) | ||
| 178 | - return ctm_succeeded_with_ptr_to_base; | ||
| 179 | - } | ||
| 180 | - | ||
| 181 | - return ctm_succeeded; | ||
| 182 | + return result; | ||
| 183 | } | ||
| 184 | |||
| 185 | return ctm_failed; | ||
| 186 | |||
diff --git a/meta-oe/recipes-devtools/gcc/gcc-4.5/linaro/gcc-4.5-linaro-r99502.patch b/meta-oe/recipes-devtools/gcc/gcc-4.5/linaro/gcc-4.5-linaro-r99502.patch new file mode 100644 index 0000000000..59bf01cc56 --- /dev/null +++ b/meta-oe/recipes-devtools/gcc/gcc-4.5/linaro/gcc-4.5-linaro-r99502.patch | |||
| @@ -0,0 +1,134 @@ | |||
| 1 | 2011-04-26 Chung-Lin Tang <cltang@codesourcery.com> | ||
| 2 | |||
| 3 | Backport from mainline: | ||
| 4 | |||
| 5 | 2011-03-21 Chung-Lin Tang <cltang@codesourcery.com> | ||
| 6 | |||
| 7 | gcc/ | ||
| 8 | * simplify-rtx.c (simplify_binary_operation_1): Handle | ||
| 9 | (xor (and A B) C) case when B and C are both constants. | ||
| 10 | |||
| 11 | gcc/testsuite/ | ||
| 12 | * gcc.target/arm/xor-and.c: New. | ||
| 13 | |||
| 14 | 2011-03-18 Chung-Lin Tang <cltang@codesourcery.com> | ||
| 15 | |||
| 16 | gcc/ | ||
| 17 | * combine.c (try_combine): Do simplification only call of | ||
| 18 | subst() on i2 even when i1 is present. Update comments. | ||
| 19 | |||
| 20 | gcc/testsuite/ | ||
| 21 | * gcc.target/arm/unsigned-extend-1.c: New. | ||
| 22 | |||
| 23 | === modified file 'gcc/combine.c' | ||
| 24 | --- old/gcc/combine.c 2011-01-06 11:02:44 +0000 | ||
| 25 | +++ new/gcc/combine.c 2011-04-14 13:58:12 +0000 | ||
| 26 | @@ -2939,7 +2939,7 @@ | ||
| 27 | /* It is possible that the source of I2 or I1 may be performing | ||
| 28 | an unneeded operation, such as a ZERO_EXTEND of something | ||
| 29 | that is known to have the high part zero. Handle that case | ||
| 30 | - by letting subst look at the innermost one of them. | ||
| 31 | + by letting subst look at the inner insns. | ||
| 32 | |||
| 33 | Another way to do this would be to have a function that tries | ||
| 34 | to simplify a single insn instead of merging two or more | ||
| 35 | @@ -2964,11 +2964,9 @@ | ||
| 36 | subst_low_luid = DF_INSN_LUID (i1); | ||
| 37 | i1src = subst (i1src, pc_rtx, pc_rtx, 0, 0, 0); | ||
| 38 | } | ||
| 39 | - else | ||
| 40 | - { | ||
| 41 | - subst_low_luid = DF_INSN_LUID (i2); | ||
| 42 | - i2src = subst (i2src, pc_rtx, pc_rtx, 0, 0, 0); | ||
| 43 | - } | ||
| 44 | + | ||
| 45 | + subst_low_luid = DF_INSN_LUID (i2); | ||
| 46 | + i2src = subst (i2src, pc_rtx, pc_rtx, 0, 0, 0); | ||
| 47 | } | ||
| 48 | |||
| 49 | n_occurrences = 0; /* `subst' counts here */ | ||
| 50 | |||
| 51 | === modified file 'gcc/simplify-rtx.c' | ||
| 52 | --- old/gcc/simplify-rtx.c 2010-06-25 20:11:56 +0000 | ||
| 53 | +++ new/gcc/simplify-rtx.c 2011-04-14 13:58:12 +0000 | ||
| 54 | @@ -2413,6 +2413,46 @@ | ||
| 55 | XEXP (op0, 1), mode), | ||
| 56 | op1); | ||
| 57 | |||
| 58 | + /* Given (xor (and A B) C), using P^Q == (~P&Q) | (~Q&P), | ||
| 59 | + we can transform like this: | ||
| 60 | + (A&B)^C == ~(A&B)&C | ~C&(A&B) | ||
| 61 | + == (~A|~B)&C | ~C&(A&B) * DeMorgan's Law | ||
| 62 | + == ~A&C | ~B&C | A&(~C&B) * Distribute and re-order | ||
| 63 | + Attempt a few simplifications when B and C are both constants. */ | ||
| 64 | + if (GET_CODE (op0) == AND | ||
| 65 | + && CONST_INT_P (op1) | ||
| 66 | + && CONST_INT_P (XEXP (op0, 1))) | ||
| 67 | + { | ||
| 68 | + rtx a = XEXP (op0, 0); | ||
| 69 | + rtx b = XEXP (op0, 1); | ||
| 70 | + rtx c = op1; | ||
| 71 | + HOST_WIDE_INT bval = INTVAL (b); | ||
| 72 | + HOST_WIDE_INT cval = INTVAL (c); | ||
| 73 | + | ||
| 74 | + rtx na_c | ||
| 75 | + = simplify_binary_operation (AND, mode, | ||
| 76 | + simplify_gen_unary (NOT, mode, a, mode), | ||
| 77 | + c); | ||
| 78 | + if ((~cval & bval) == 0) | ||
| 79 | + { | ||
| 80 | + /* Try to simplify ~A&C | ~B&C. */ | ||
| 81 | + if (na_c != NULL_RTX) | ||
| 82 | + return simplify_gen_binary (IOR, mode, na_c, | ||
| 83 | + GEN_INT (~bval & cval)); | ||
| 84 | + } | ||
| 85 | + else | ||
| 86 | + { | ||
| 87 | + /* If ~A&C is zero, simplify A&(~C&B) | ~B&C. */ | ||
| 88 | + if (na_c == const0_rtx) | ||
| 89 | + { | ||
| 90 | + rtx a_nc_b = simplify_gen_binary (AND, mode, a, | ||
| 91 | + GEN_INT (~cval & bval)); | ||
| 92 | + return simplify_gen_binary (IOR, mode, a_nc_b, | ||
| 93 | + GEN_INT (~bval & cval)); | ||
| 94 | + } | ||
| 95 | + } | ||
| 96 | + } | ||
| 97 | + | ||
| 98 | /* (xor (comparison foo bar) (const_int 1)) can become the reversed | ||
| 99 | comparison if STORE_FLAG_VALUE is 1. */ | ||
| 100 | if (STORE_FLAG_VALUE == 1 | ||
| 101 | |||
| 102 | === added file 'gcc/testsuite/gcc.target/arm/unsigned-extend-1.c' | ||
| 103 | --- old/gcc/testsuite/gcc.target/arm/unsigned-extend-1.c 1970-01-01 00:00:00 +0000 | ||
| 104 | +++ new/gcc/testsuite/gcc.target/arm/unsigned-extend-1.c 2011-04-14 13:58:12 +0000 | ||
| 105 | @@ -0,0 +1,9 @@ | ||
| 106 | +/* { dg-do compile } */ | ||
| 107 | +/* { dg-options "-O2 -march=armv6" } */ | ||
| 108 | + | ||
| 109 | +unsigned char foo (unsigned char c) | ||
| 110 | +{ | ||
| 111 | + return (c >= '0') && (c <= '9'); | ||
| 112 | +} | ||
| 113 | + | ||
| 114 | +/* { dg-final { scan-assembler-not "uxtb" } } */ | ||
| 115 | |||
| 116 | === added file 'gcc/testsuite/gcc.target/arm/xor-and.c' | ||
| 117 | --- old/gcc/testsuite/gcc.target/arm/xor-and.c 1970-01-01 00:00:00 +0000 | ||
| 118 | +++ new/gcc/testsuite/gcc.target/arm/xor-and.c 2011-04-14 13:58:12 +0000 | ||
| 119 | @@ -0,0 +1,14 @@ | ||
| 120 | +/* { dg-do compile } */ | ||
| 121 | +/* { dg-options "-O -march=armv6" } */ | ||
| 122 | + | ||
| 123 | +unsigned short foo (unsigned short x) | ||
| 124 | +{ | ||
| 125 | + x ^= 0x4002; | ||
| 126 | + x >>= 1; | ||
| 127 | + x |= 0x8000; | ||
| 128 | + return x; | ||
| 129 | +} | ||
| 130 | + | ||
| 131 | +/* { dg-final { scan-assembler "orr" } } */ | ||
| 132 | +/* { dg-final { scan-assembler-not "mvn" } } */ | ||
| 133 | +/* { dg-final { scan-assembler-not "uxth" } } */ | ||
| 134 | |||
