typeObjC1Class, // ObjC1 class [Darwin]
typeLazyPointer, // pointer through which a stub jumps
typeLazyDylibPointer, // pointer through which a stub jumps [Darwin]
+ typeNonLazyPointer, // pointer to external symbol
typeCFString, // NS/CFString object [Darwin]
typeGOT, // pointer to external symbol
typeInitializerPtr, // pointer to initializer function
case typeObjC1Class:
case typeLazyPointer:
case typeLazyDylibPointer:
+ case typeNonLazyPointer:
case typeThunkTLV:
case typeRWNote:
return permRW_;
ReferenceInfo stubHelperReferenceToImm;
ReferenceInfo stubHelperReferenceToHelperCommon;
+ DefinedAtom::ContentType stubHelperImageCacheContentType;
+
uint32_t stubHelperCommonSize;
uint8_t stubHelperCommonAlignment;
uint8_t stubHelperCommonBytes[36];
{ Reference::KindArch::ARM, lazyImmediateLocation, 8, 0 },
{ Reference::KindArch::ARM, arm_b24, 4, 0 },
+ // Stub helper image cache content type
+ DefinedAtom::typeGOT,
+
// Stub Helper-Common size and code
36,
// Stub helper alignment
{ Reference::KindArch::AArch64, lazyImmediateLocation, 8, 0 },
{ Reference::KindArch::AArch64, branch26, 4, 0 },
+ // Stub helper image cache content type
+ DefinedAtom::typeGOT,
+
// Stub Helper-Common size and code
24,
// Stub helper alignment
{ Reference::KindArch::x86, lazyImmediateLocation, 1, 0 },
{ Reference::KindArch::x86, branch32, 6, 0 },
+ // Stub helper image cache content type
+ DefinedAtom::typeNonLazyPointer,
+
// Stub Helper-Common size and code
12,
// Stub helper alignment
{ Reference::KindArch::x86_64, lazyImmediateLocation, 1, 0 },
{ Reference::KindArch::x86_64, branch32, 6, 0 },
+ // Stub helper image cache content type
+ DefinedAtom::typeNonLazyPointer,
+
// Stub Helper-Common size and code
16,
// Stub helper alignment
typeTerminatorPtr),
ENTRY("__DATA", "__got", S_NON_LAZY_SYMBOL_POINTERS,
typeGOT),
+ ENTRY("__DATA", "__nl_symbol_ptr", S_NON_LAZY_SYMBOL_POINTERS,
+ typeNonLazyPointer),
ENTRY("__DATA", "__thread_vars", S_THREAD_LOCAL_VARIABLES,
typeThunkTLV),
ENTRY("__DATA", "__thread_data", S_THREAD_LOCAL_REGULAR,
//
class NonLazyPointerAtom : public SimpleDefinedAtom {
public:
- NonLazyPointerAtom(const File &file, bool is64)
- : SimpleDefinedAtom(file), _is64(is64) { }
+ NonLazyPointerAtom(const File &file, bool is64, ContentType contentType)
+ : SimpleDefinedAtom(file), _is64(is64), _contentType(contentType) { }
ContentType contentType() const override {
- return DefinedAtom::typeGOT;
+ return _contentType;
}
Alignment alignment() const override {
private:
const bool _is64;
+ const ContentType _contentType;
};
//
SimpleDefinedAtom *helperCommonAtom =
new (_file.allocator()) StubHelperCommonAtom(_file, _stubInfo);
SimpleDefinedAtom *helperCacheNLPAtom =
- new (_file.allocator()) NonLazyPointerAtom(_file, _ctx.is64Bit());
+ new (_file.allocator()) NonLazyPointerAtom(_file, _ctx.is64Bit(),
+ _stubInfo.stubHelperImageCacheContentType);
SimpleDefinedAtom *helperBinderNLPAtom =
- new (_file.allocator()) NonLazyPointerAtom(_file, _ctx.is64Bit());
+ new (_file.allocator()) NonLazyPointerAtom(_file, _ctx.is64Bit(),
+ _stubInfo.stubHelperImageCacheContentType);
addReference(helperCommonAtom, _stubInfo.stubHelperCommonReferenceToCache,
helperCacheNLPAtom);
addOptReference(
# CHECK-DYLIBS-NEXT: offset
# CHECK-DYLIBS-NEXT: align 2^2 (4)
+# Make sure the __nl_symbol_ptr section is used instea of __got as this is x86_64
+# CHECK-DYLIBS: sectname __nl_symbol_ptr
+# CHECK-DYLIBS-NEXT: segname __DATA
+
# CHECK-DYLIBS: cmd LC_LOAD_DYLIB
# CHECK-DYLIBS: name /usr/lib/libbar.dylib (offset 24)
# CHECK-DYLIBS: current version 2.3.0