Is there a way to control which section of the executable a specific NSString
literal goes into? I’ve tried using the ‘section’ attribute, but it has no
effect:
__attribute__((section(“__TEXT,__foo”))) static NSString* const kFoo =
@“Foobar”;
The above doesn’t change where the string appears; there is no __TEXT,__foo
section in the binary at all, and the string is still in the default
__TEXT,__cstring section.
I’m asking because the project I work on includes a lot of logging calls, which
are left in the release build so that logging can be turned on for
troubleshooting in the field, but for reasons of cache locality I’d like the
resulting strings (and ideally the code) not to be mixed in with the rest of
the executable.
(Moving the code itself out of the way seems to be a non-starter. I’ve tried
using some macro hackery to put the actual _log(…) call in a block, but adding
a ‘section’ attribute to the block produces a compiler error saying that only
functions and globals can have a section assigned.)
—Jens
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/xcode-users/archive%40mail-archive.com
This email sent to [email protected]