[PATCH] D28898: [ELF] - Allow emulation to be different from input objects target.

Rafael Avila de Espindola via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 19 13:06:17 PST 2017


George Rimar via Phabricator <reviews at reviews.llvm.org> writes:

> +// Create target. If emulation option specified then replace
> +// target's default parameters with emulated target parameters.
> +static TargetInfo *createEmulation() {
> +  TargetInfo *Target = createTarget(Config->EKind, Config->EMachine);
> +  if (Config->Emulation.empty())
> +    return Target;
> +
> +  ELFKind EmuKind;
> +  uint16_t EmuMachine;
> +  uint8_t EmuOSABI;
> +  std::tie(EmuKind, EmuMachine, EmuOSABI) = parseEmulation(Config->Emulation);
> +
> +  // OSABI is overriden when emulation is specified.
> +  Config->OSABI = EmuOSABI;
> +
> +  TargetInfo *EmuTarget = createTarget(EmuKind, EmuMachine);
> +  Target->PageSize = EmuTarget->PageSize;
> +  Target->DefaultMaxPageSize = EmuTarget->DefaultMaxPageSize;
> +  Target->DefaultImageBase = EmuTarget->DefaultImageBase;

This is extremely suspicious. Can you end up with the AArch64 page on
x86-64? Does bfd and gold accept all -m options or only cases like
x86/x86-64?

What test fails if you just ignore -m if there is a .o file?

Cheers,
Rafael


More information about the llvm-commits mailing list