Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
clean-and-itasks
clean-ide
Commits
33fce725
Commit
33fce725
authored
Jun 30, 2006
by
John van Groningen
Browse files
allow scattered PPC_RELOC_LO16 or PPC_RELOC_HA16 relocation
followed by non scattered PPC_RELOC_PAIR
parent
9c71afbd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Mac/mach_o_linker.icl
View file @
33fce725
...
...
@@ -223,8 +223,11 @@ mark_used_modules main_symbol_n main_file_n exception_symbols marked_bool_a0 mar
= mark_relocations_module (relocation_n+2) n_relocations relocation_string marked_bool_a xcoff_a files;
| r_type==PPC_RELOC_LO16 || r_type==PPC_RELOC_HA16
# relocation_index2=relocation_index+SIZE_OF_RELOCATION;
#
r_kind2
=
relocation_string
BYTE
relocation_index2
;
|
relocation_string
BYTE
relocation_index2
bitand
0x80
==
0
||
r_kind2
bitand
0xf
<>
PPC_RELOC_PAIR
# r_kind2_scattered = relocation_string BYTE relocation_index2;
# r_kind2_not_scattered = relocation_string BYTE (relocation_index2+7);
| if (relocation_string BYTE relocation_index2 bitand 0x80<>0)
(r_kind2_scattered bitand 0xf<>PPC_RELOC_PAIR)
(r_kind2_not_scattered bitand 0xf<>PPC_RELOC_PAIR)
= abort ("mark_relocations_module: PPC_RELOC_PAIR expected "+++toString r_type);
# relocation_value=relocation_string ILONG (relocation_index+4);
# (section_offsets,xcoff_a) = xcoff_a![file_n].symbol_table.section_offsets;
...
...
@@ -927,14 +930,50 @@ relocate_text_or_data n_relocations virtual_address aligned_module_offset first_
# new_relocations = store_new_scattered_relocation r_kind new_address new_relocation_index new_relocations;
= relocate_text_or_data (inc relocation_n) (inc new_relocation_n) symbol_a text_a new_relocations;
# relocation_index2=relocation_index+SIZE_OF_RELOCATION;
| r_type==PPC_RELOC_LO16
# r_kind2_scattered = relocations BYTE relocation_index2;
# r_kind2_not_scattered = relocations BYTE (relocation_index2+7);
| if (relocations BYTE relocation_index2 bitand 0x80<>0)
(r_kind2_scattered bitand 0xf<>PPC_RELOC_PAIR)
(r_kind2_not_scattered bitand 0xf<>PPC_RELOC_PAIR)
= abort_relocate_text_or_data_pair_expected PPC_RELOC_LO16;
# r_address2 = relocations IWORD (relocation_index2+2);
# address1 = determine_new_address r_value first_symbol_n section_offsets symbol_a module_offset_a section_addresses;
#! old_lo16 = text_a IWORD (r_address+2);
# old_offset = (r_address2<<16)+old_lo16;
# new_offset = address1+(old_offset-r_value);
# text_a = {text_a & [r_address+2]=toChar (new_offset>>8),[r_address+3]=toChar new_offset };
# new_relocations = store_new_scattered_relocation_and_copy_pair r_kind address1 new_relocation_index relocation_index new_relocations relocations;
# new_relocations = {new_relocations & [new_relocation_index+10]=toChar (new_offset>>24),
[new_relocation_index+11]=toChar (new_offset>>16)};
= relocate_text_or_data (relocation_n+2) (new_relocation_n+2) symbol_a text_a new_relocations;
| r_type==PPC_RELOC_HA16
# r_kind2_scattered = relocations BYTE relocation_index2;
# r_kind2_not_scattered = relocations BYTE (relocation_index2+7);
| if (relocations BYTE relocation_index2 bitand 0x80<>0)
(r_kind2_scattered bitand 0xf<>PPC_RELOC_PAIR)
(r_kind2_not_scattered bitand 0xf<>PPC_RELOC_PAIR)
= abort_relocate_text_or_data_pair_expected PPC_RELOC_HA16;
# r_address2 = relocations IWORD (relocation_index2+2);
# address1 = determine_new_address r_value first_symbol_n section_offsets symbol_a module_offset_a section_addresses;
#! old_ha16 = text_a IWORD (r_address+2);
# old_offset = (old_ha16<<16)+((r_address2<<16)>>16);
# new_offset = address1+(old_offset-r_value);
# new_offset_ha16 = (new_offset-((new_offset<<16)>>16))>>16;
# text_a = {text_a & [r_address+2]=toChar (new_offset_ha16>>8),[r_address+3]=toChar new_offset_ha16 };
# new_relocations = store_new_scattered_relocation_and_copy_pair r_kind address1 new_relocation_index relocation_index new_relocations relocations;
# new_relocations = {new_relocations & [new_relocation_index+10]=toChar (new_offset>>8),
[new_relocation_index+11]=toChar (new_offset)};
= relocate_text_or_data (relocation_n+2) (new_relocation_n+2) symbol_a text_a new_relocations;
# r_kind2 = relocations BYTE relocation_index2;
# r_value2=relocations ILONG (relocation_index2+4);
| relocations BYTE relocation_index2 bitand 0x80==0 || r_kind2 bitand 0xf<>PPC_RELOC_PAIR
=
abort
(
"relocate_text_or_data: PPC_RELOC_PAIR expected "
+++
toString
r_type
);
= abort_relocate_text_or_data_pair_expected r_type;
# address1 = determine_new_address r_value first_symbol_n section_offsets symbol_a module_offset_a section_addresses;
# address2 = determine_new_address r_value2 first_symbol_n section_offsets symbol_a module_offset_a section_addresses;
| r_type==PPC_RELOC_HA16_SECTDIFF
# r_address2 = relocations ITBYTE (relocation_index2+1);
#
address1
=
determine_new_address
r_value
first_symbol_n
section_offsets
symbol_a
module_offset_a
section_addresses
;
#
address2
=
determine_new_address
r_value2
first_symbol_n
section_offsets
symbol_a
module_offset_a
section_addresses
;
#! old_ha16 = text_a IWORD (r_address+2);
# old_diff = (old_ha16<<16)+((r_address2<<16)>>16);
# addend=(r_value-r_value2)-old_diff;
...
...
@@ -951,8 +990,6 @@ relocate_text_or_data n_relocations virtual_address aligned_module_offset first_
= relocate_text_or_data (relocation_n+2) (new_relocation_n+2) symbol_a text_a new_relocations;
| r_type==PPC_RELOC_LO16_SECTDIFF
# r_address2 = relocations ITBYTE (relocation_index2+1);
#
address1
=
determine_new_address
r_value
first_symbol_n
section_offsets
symbol_a
module_offset_a
section_addresses
;
#
address2
=
determine_new_address
r_value2
first_symbol_n
section_offsets
symbol_a
module_offset_a
section_addresses
;
#! old_lo16 = text_a IWORD (r_address+2);
# old_diff = (r_address2<<16)+old_lo16;
# addend=(r_value-r_value2)-old_diff;
...
...
@@ -967,8 +1004,6 @@ relocate_text_or_data n_relocations virtual_address aligned_module_offset first_
[new_relocation_index+11]=toChar (new_diff>>16)};
= relocate_text_or_data (relocation_n+2) (new_relocation_n+2) symbol_a text_a new_relocations;
| r_type==PPC_RELOC_SECTDIFF || r_type==PPC_RELOC_LOCAL_SECTDIFF
#
address1
=
determine_new_address
r_value
first_symbol_n
section_offsets
symbol_a
module_offset_a
section_addresses
;
#
address2
=
determine_new_address
r_value2
first_symbol_n
section_offsets
symbol_a
module_offset_a
section_addresses
;
#! old_diff = text_a ILONG r_address;
# addend=(r_value-r_value2)-old_diff;
# new_diff = (address1-address2)+addend;
...
...
@@ -979,31 +1014,6 @@ relocate_text_or_data n_relocations virtual_address aligned_module_offset first_
[new_relocation_index+14]=toChar (address2>>8),
[new_relocation_index+15]=toChar address2};
= relocate_text_or_data (relocation_n+2) (new_relocation_n+2) symbol_a text_a new_relocations;
|
r_type
==
PPC_RELOC_LO16
#
r_address2
=
relocations
IWORD
(
relocation_index2
+2
);
#
address1
=
determine_new_address
r_value
first_symbol_n
section_offsets
symbol_a
module_offset_a
section_addresses
;
#!
old_lo16
=
text_a
IWORD
(
r_address
+2
);
#
old_offset
=
(
r_address2
<<
16
)+
old_lo16
;
#
new_offset
=
address1
+(
old_offset
-
r_value
);
#
text_a
=
{
text_a
&
[
r_address
+2
]=
toChar
(
new_offset
>>
8
),[
r_address
+3
]=
toChar
new_offset
};
#
new_relocations
=
store_new_scattered_relocation_and_copy_pair
r_kind
address1
new_relocation_index
relocation_index
new_relocations
relocations
;
#
new_relocations
=
{
new_relocations
&
[
new_relocation_index
+10
]=
toChar
(
new_offset
>>
24
),
[
new_relocation_index
+11
]=
toChar
(
new_offset
>>
16
)};
=
relocate_text_or_data
(
relocation_n
+2
)
(
new_relocation_n
+2
)
symbol_a
text_a
new_relocations
;
|
r_type
==
PPC_RELOC_HA16
#
r_address2
=
relocations
IWORD
(
relocation_index2
+2
);
#
address1
=
determine_new_address
r_value
first_symbol_n
section_offsets
symbol_a
module_offset_a
section_addresses
;
#!
old_ha16
=
text_a
IWORD
(
r_address
+2
);
#
old_offset
=
(
old_ha16
<<
16
)+((
r_address2
<<
16
)>>
16
);
#
new_offset
=
address1
+(
old_offset
-
r_value
);
#
new_offset_ha16
=
(
new_offset
-((
new_offset
<<
16
)>>
16
))>>
16
;
#
text_a
=
{
text_a
&
[
r_address
+2
]=
toChar
(
new_offset_ha16
>>
8
),[
r_address
+3
]=
toChar
new_offset_ha16
};
#
new_relocations
=
store_new_scattered_relocation_and_copy_pair
r_kind
address1
new_relocation_index
relocation_index
new_relocations
relocations
;
#
new_relocations
=
{
new_relocations
&
[
new_relocation_index
+10
]=
toChar
(
new_offset
>>
8
),
[
new_relocation_index
+11
]=
toChar
(
new_offset
)};
=
relocate_text_or_data
(
relocation_n
+2
)
(
new_relocation_n
+2
)
symbol_a
text_a
new_relocations
;
= abort ("relocate_text_or_data (scattered) "+++toString r_type);
# r_kind = relocations BYTE (relocation_index+7);
# r_type=r_kind bitand 0xf;
...
...
@@ -1221,6 +1231,9 @@ relocate_text_or_data n_relocations virtual_address aligned_module_offset first_
}
= abort ("relocate_text_or_data: PPC_RELOC_BR24 not extern");
= abort ("relocate_text_or_data "+++toString r_type);
abort_relocate_text_or_data_pair_expected r_kind
= abort ("relocate_text_or_data: PPC_RELOC_PAIR expected "+++toString r_kind);
}
store_new_relocation r_kind new_r_symbolnum new_relocation_index new_relocations
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment