*** src/gas/config/tc-ip2k.h 26 Nov 2002 18:30:41 -0000 --- src/gas/config/tc-ip2k.h 17 Dec 2002 23:07:11 -0000 *************** *** 61,66 **** --- 61,69 ---- #define TC_FORCE_RELOCATION(FIX) ip2k_force_relocation (FIX) extern int ip2k_force_relocation PARAMS ((struct fix *)); + #define tc_fix_adjustable(X) ip2k_fix_adjustable(X) + extern int ip2k_fix_adjustable PARAMS ((struct fix *)); + #define tc_gen_reloc gas_cgen_tc_gen_reloc #define md_elf_section_flags ip2k_elf_section_flags *** src/gas/config/tc-ip2k.c 13 Dec 2002 21:37:24 -0000 --- src/gas/config/tc-ip2k.c 18 Dec 2002 19:35:46 -0000 *************** ip2k_force_relocation (fix) *** 420,425 **** --- 420,453 ---- return S_FORCE_RELOC (fix->fx_addsy); } + /* Here we decide which fixups can be adjusted to make them relative + to the beginning of the section instead of the symbol. Basically + we need to make sure that the linker relaxation is done + correctly, so in some cases we force the original symbol to be + used. */ + int + ip2k_fix_adjustable (fix) + fixS *fix; + { + switch (fix->fx_cgen.opinfo) + { + case BFD_RELOC_IP2K_ADDR16CJP: + case BFD_RELOC_IP2K_PAGE3: + case BFD_RELOC_IP2K_LO8DATA: + case BFD_RELOC_IP2K_HI8DATA: + case BFD_RELOC_IP2K_EX8DATA: + case BFD_RELOC_IP2K_LO8INSN: + case BFD_RELOC_IP2K_HI8INSN: + if ((fix->fx_addsy) && (!S_IS_LOCAL (fix->fx_addsy))) + /* Let the linker resolve these so the linker can relax correctly. */ + return 0; + else + return 1; + default: + return 1; + } + } + void ip2k_apply_fix3 (fixP, valueP, seg) fixS *fixP;