This repository was archived by the owner on Mar 28, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +19
-4
lines changed Expand file tree Collapse file tree 3 files changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -232,8 +232,9 @@ void ScalarEnumerationTraits<ELFYAML::ELF_ELFCLASS>::enumeration(
232
232
void ScalarEnumerationTraits<ELFYAML::ELF_ELFDATA>::enumeration(
233
233
IO &IO, ELFYAML::ELF_ELFDATA &Value) {
234
234
#define ECase (X ) IO.enumCase(Value, #X, ELF::X)
235
- // Since the semantics of ELFDATANONE is "invalid", just don't accept it
236
- // here.
235
+ // ELFDATANONE is an invalid data encoding, but we accept it because
236
+ // we want to be able to produce invalid binaries for the tests.
237
+ ECase (ELFDATANONE);
237
238
ECase (ELFDATA2LSB);
238
239
ECase (ELFDATA2MSB);
239
240
#undef ECase
Original file line number Diff line number Diff line change
1
+ # # We have a YAML file describing an invalid data type.
2
+ # # Check we are able to produce the invalid binary.
3
+
4
+ # RUN: yaml2obj %s -o %t.o
5
+
6
+ # # Check that EI_DATA field is ELFDATANONE(0)
7
+ # RUN: od -b %t.o +5 | FileCheck %s
8
+ # CHECK: 0000005 000
9
+
10
+ --- !ELF
11
+ FileHeader :
12
+ Class : ELFCLASS64
13
+ Data : ELFDATANONE
14
+ Type : ET_REL
15
+ Machine : EM_X86_64
Original file line number Diff line number Diff line change @@ -207,8 +207,7 @@ void ELFState<ELFT>::initELFHeader(Elf_Ehdr &Header) {
207
207
Header.e_ident [EI_MAG2] = ' L' ;
208
208
Header.e_ident [EI_MAG3] = ' F' ;
209
209
Header.e_ident [EI_CLASS] = ELFT::Is64Bits ? ELFCLASS64 : ELFCLASS32;
210
- bool IsLittleEndian = ELFT::TargetEndianness == support::little;
211
- Header.e_ident [EI_DATA] = IsLittleEndian ? ELFDATA2LSB : ELFDATA2MSB;
210
+ Header.e_ident [EI_DATA] = Doc.Header .Data ;
212
211
Header.e_ident [EI_VERSION] = EV_CURRENT;
213
212
Header.e_ident [EI_OSABI] = Doc.Header .OSABI ;
214
213
Header.e_ident [EI_ABIVERSION] = Doc.Header .ABIVersion ;
You can’t perform that action at this time.
0 commit comments