Hi Ard,

Sorry, I cannot preserve the CC list as the groups.io interface doesn't seem to 
allow it. Can you please CC me on future revisions?

This patch will badly corrupt binaries. I cannot cite a source right now (if 
you want me to, please remind me in your response, so I can look it up 
tomorrow), but for X64 (but not IA32, which is why this is enabled there), 
relocs are relative to the first *writable* segment. In other words, any 
relocation to __TEXT will badly corrupt binaries this way.

In AUDK, we support this with two essential changes. The first is that we 
always generate a writable dummy segment at the beginning of the address space 
[1], making the relocs relative to the image base. The second is that in 
ocmtoc, our fork of the abandoned (and pretty badly-bugged) Apple mtoc, we 
explicitly require this segment to be present and verify its virtual address is 
the minimum virtual address [2]. It is then omitted from the conversion process 
[3]. I suggest you replicate these changes and fully switch to ocmtoc for 
XCODE5 builds.

Best regards,
Marvin

[1]
https://github.com/acidanthera/audk/blob/c382e9c571c7d5f39ba53b46a0c723c7943f33c5/BaseTools/Conf/tools_def.template#L2976-L2988

[2]
https://github.com/acidanthera/ocmtoc/blob/b0152c51beae264770c3faf0d213f9594ee043be/efitools/mtoc.c#L1097-L1123
https://github.com/acidanthera/ocmtoc/blob/b0152c51beae264770c3faf0d213f9594ee043be/efitools/mtoc.c#L1204-L1214

[3]
https://github.com/acidanthera/ocmtoc/blob/b0152c51beae264770c3faf0d213f9594ee043be/efitools/mtoc.c#L1307-L1311


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#102219): https://edk2.groups.io/g/devel/message/102219
Mute This Topic: https://groups.io/mt/97960758/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to