Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 267 by rgovostes: getShadowMapping is hard to extend for new platforms
http://code.google.com/p/address-sanitizer/issues/detail?id=267

The calculation of Mapping.Offset is fairly complicated. First there are several nested ternary operators:

  Mapping.Offset = IsAndroid ? 0 :
      (LongSize == 32 ?
        (IsMIPS32 ? kMIPS32_ShadowOffset32 :
          (IsFreeBSD ? kFreeBSD_ShadowOffset32 : kDefaultShadowOffset32)) :
       IsPPC64 ? kPPC64_ShadowOffset64 : kDefaultShadowOffset64);

Then there is this conditional which overrides the above calculation for some platforms, but there is no comment describing why:

  if (!IsAndroid && ClShort64BitOffset && IsX86_64 && !IsMacOSX) {
    assert(LongSize == 64);
    Mapping.Offset = (IsFreeBSD ?
kFreeBSD_ShadowOffset64 : kDefaultShort64bitShadowOffset);
  }

And then another which is also not entirely explained:

  if (!IsAndroid && ClMappingOffsetLog >= 0) {
    // Zero offset log is the special case.
Mapping.Offset = (ClMappingOffsetLog == 0) ? 0 : 1ULL << ClMappingOffsetLog;
  }

It's unclear to me the best way to extend this for new targets.

--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
You received this message because you are subscribed to the Google Groups 
"address-sanitizer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to