aboutsummaryrefslogtreecommitdiff
path: root/bfd/coff-tic80.c
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@novell.com>2017-11-13 12:26:12 +0100
committerJan Beulich <jbeulich@suse.com>2017-11-13 12:26:12 +0100
commit5be87c8fa74c9ae6684bea571b4157ad1966d008 (patch)
tree03ab623efa8dc04c95e82d4c6b05b9eb3ab346c4 /bfd/coff-tic80.c
parentb76bc5d54e36f15efd954898d9aa075c2bea02dd (diff)
downloadgdb-5be87c8fa74c9ae6684bea571b4157ad1966d008.zip
gdb-5be87c8fa74c9ae6684bea571b4157ad1966d008.tar.gz
gdb-5be87c8fa74c9ae6684bea571b4157ad1966d008.tar.bz2
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.
Diffstat (limited to 'bfd/coff-tic80.c')
-rw-r--r--bfd/coff-tic80.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/bfd/coff-tic80.c b/bfd/coff-tic80.c
index 253ea94..d23a6f4 100644
--- a/bfd/coff-tic80.c
+++ b/bfd/coff-tic80.c
@@ -42,6 +42,8 @@
#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (2)
#define COFF_ALIGN_IN_SECTION_HEADER 1
#define COFF_ALIGN_IN_SFLAGS 1
+#define COFF_ENCODE_ALIGNMENT(S,X) ((S).s_flags |= (((unsigned)(X) & 0xf) << 8))
+#define COFF_DECODE_ALIGNMENT(X) (((X) >> 8) & 0xf)
#define GET_SCNHDR_FLAGS H_GET_16
#define PUT_SCNHDR_FLAGS H_PUT_16