forked from Imagelibrary/binutils-gdb
PE: don't corrupt section flags when linking from ELF objects
Linking EFI executables from ELF object files can result in corrupted COFF section flags if the section's alignment is too high. Issue a diagnostic in that case, erroring out if this is not a final link, and make sure only in-range values get written to the output image. While doing this also make tic80 use the generic alignment macros instead of custom #ifdef-ary. No testsuite regressions for the range of COFF/PE targets that actually cross-build in the first place on x86-64-linux.
This commit is contained in:
@@ -104,7 +104,10 @@
|
||||
|
||||
/* Encode alignment power into IMAGE_SCN_ALIGN bits of s_flags. */
|
||||
#define COFF_ENCODE_ALIGNMENT(SECTION, ALIGNMENT_POWER) \
|
||||
((SECTION).s_flags |= IMAGE_SCN_ALIGN_POWER_CONST ((ALIGNMENT_POWER)))
|
||||
((SECTION).s_flags |= IMAGE_SCN_ALIGN_POWER_CONST ((ALIGNMENT_POWER) <= 13 \
|
||||
? (ALIGNMENT_POWER) : 13))
|
||||
#define COFF_DECODE_ALIGNMENT(X) \
|
||||
IMAGE_SCN_ALIGN_POWER_NUM ((X) & IMAGE_SCN_ALIGN_POWER_BIT_MASK)
|
||||
|
||||
#define IMAGE_SCN_LNK_NRELOC_OVFL 0x01000000 /* Section contains extended relocations. */
|
||||
#define IMAGE_SCN_MEM_NOT_CACHED 0x04000000 /* Section is not cachable. */
|
||||
|
||||
Reference in New Issue
Block a user