@@ -17902,50 +17902,45 @@ aarch64_classify_symbol (rtx x, HOST_WIDE_INT offset)
1790217902
1790317903 switch (aarch64_cmodel)
1790417904 {
17905+ case AARCH64_CMODEL_TINY_PIC:
1790517906 case AARCH64_CMODEL_TINY:
17907+ /* With -fPIC non-local symbols use the GOT. For orthogonality
17908+ always use the GOT for extern weak symbols. */
17909+ if ((flag_pic || SYMBOL_REF_WEAK (x))
17910+ && !aarch64_symbol_binds_local_p (x))
17911+ return SYMBOL_TINY_GOT;
17912+
1790617913 /* When we retrieve symbol + offset address, we have to make sure
1790717914 the offset does not cause overflow of the final address. But
1790817915 we have no way of knowing the address of symbol at compile time
1790917916 so we can't accurately say if the distance between the PC and
1791017917 symbol + offset is outside the addressible range of +/-1MB in the
1791117918 TINY code model. So we limit the maximum offset to +/-64KB and
1791217919 assume the offset to the symbol is not larger than +/-(1MB - 64KB).
17913- If offset_within_block_p is true we allow larger offsets.
17914- Furthermore force to memory if the symbol is a weak reference to
17915- something that doesn't resolve to a symbol in this module. */
17916-
17917- if (SYMBOL_REF_WEAK (x) && !aarch64_symbol_binds_local_p (x))
17918- return SYMBOL_FORCE_TO_MEM;
17920+ If offset_within_block_p is true we allow larger offsets. */
1791917921 if (!(IN_RANGE (offset, -0x10000, 0x10000)
1792017922 || offset_within_block_p (x, offset)))
1792117923 return SYMBOL_FORCE_TO_MEM;
1792217924
1792317925 return SYMBOL_TINY_ABSOLUTE;
1792417926
17927+
17928+ case AARCH64_CMODEL_SMALL_SPIC:
17929+ case AARCH64_CMODEL_SMALL_PIC:
1792517930 case AARCH64_CMODEL_SMALL:
17931+ if ((flag_pic || SYMBOL_REF_WEAK (x))
17932+ && !aarch64_symbol_binds_local_p (x))
17933+ return aarch64_cmodel == AARCH64_CMODEL_SMALL_SPIC
17934+ ? SYMBOL_SMALL_GOT_28K : SYMBOL_SMALL_GOT_4G;
17935+
1792617936 /* Same reasoning as the tiny code model, but the offset cap here is
1792717937 1MB, allowing +/-3.9GB for the offset to the symbol. */
17928-
17929- if (SYMBOL_REF_WEAK (x) && !aarch64_symbol_binds_local_p (x))
17930- return SYMBOL_FORCE_TO_MEM;
1793117938 if (!(IN_RANGE (offset, -0x100000, 0x100000)
1793217939 || offset_within_block_p (x, offset)))
1793317940 return SYMBOL_FORCE_TO_MEM;
1793417941
1793517942 return SYMBOL_SMALL_ABSOLUTE;
1793617943
17937- case AARCH64_CMODEL_TINY_PIC:
17938- if (!aarch64_symbol_binds_local_p (x))
17939- return SYMBOL_TINY_GOT;
17940- return SYMBOL_TINY_ABSOLUTE;
17941-
17942- case AARCH64_CMODEL_SMALL_SPIC:
17943- case AARCH64_CMODEL_SMALL_PIC:
17944- if (!aarch64_symbol_binds_local_p (x))
17945- return (aarch64_cmodel == AARCH64_CMODEL_SMALL_SPIC
17946- ? SYMBOL_SMALL_GOT_28K : SYMBOL_SMALL_GOT_4G);
17947- return SYMBOL_SMALL_ABSOLUTE;
17948-
1794917944 case AARCH64_CMODEL_LARGE:
1795017945 /* This is alright even in PIC code as the constant
1795117946 pool reference is always PC relative and within
0 commit comments