Skip to content

Commit f46fb9e

Browse files
committed
Typo fixes (DerekSelander#7)
* Update index.md * Fix xxd argument -l is len, -c is cols * Not the Union of European Leagues of Basketball * Add implementations to ObjC classes. In my testing with clang-1001.0.46.4 there's no __objc_classlist generated unless the declared classes have implementations.
1 parent 49a0b64 commit f46fb9e

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

docs/index.md

+10-4
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ Below the `__PAGEZERO` segment, there's the `__TEXT` segment. This segment has r
232232
Think of this 5 value in bits...
233233

234234
```none
235-
exeuctable writeable readable
235+
executable writeable readable
236236
1 0 1
237237
```
238238

@@ -358,15 +358,15 @@ The `size` member indicates the size of the `__DATA.__data` section (which is 8
358358
Verify this with `xxd` again by dumping the raw bytes at offset **4096** (or equivalent for your compilation):
359359

360360
```bash
361-
lolgrep:/tmp$ xxd -g 4 -e -s 4096 -c 8 ex
361+
lolgrep:/tmp$ xxd -g 4 -e -s 4096 -l 8 ex
362362
00001000: 00000008 00000007 ........
363363
```
364364

365365
Breaking the options down:
366366
* `-g 4` : group into 4 bytes
367367
* `-e` : little endian mode
368368
* `-s 4096`: Start at offset 4096, given by the `offset` member
369-
* `-c 8` : Stop after displaying 8 bytes (each int was 4 bytes)
369+
* `-l 8` : Stop after displaying 8 bytes (each int was 4 bytes)
370370

371371
At offset 4096 (or 0x1000 in hex) the value of 8 followed by the value of 7, matches the assigned values for `SomeGlobalInt` and `SecondGlobalInt` in the source code.
372372

@@ -813,7 +813,7 @@ yay
813813

814814
In a `MH_EXECUTE` type image, any C/Objective-C/Swift function don't need to be externally available so that information can be removed from the symbol table. Why is that? A `MH_EXECUTE` type of file should be ran by itself, it shouldn't be loaded into another address space!
815815

816-
> **Note:** Just because there's no symbol in the symbol table for some code doesn't mean that you can't infer that a function is there. The **`LC_FUNCTION_STARTS`** load command will export a list of all the function/method locations (*only code, NOT data*) that are implemented by an image. This information is formatted in **[ULEB](https://en.wikipedia.org/wiki/ULEB)**. This is useful for debuggers and crash analytics.
816+
> **Note:** Just because there's no symbol in the symbol table for some code doesn't mean that you can't infer that a function is there. The **`LC_FUNCTION_STARTS`** load command will export a list of all the function/method locations (*only code, NOT data*) that are implemented by an image. This information is formatted in **[ULEB](https://en.wikipedia.org/wiki/LEB128#Unsigned_LEB128)**. This is useful for debuggers and crash analytics.
817817
818818
What if the above code was compiled as a shared library? What would happen to the symbol table? Compile ex4.c, but now add the **`-shared`** option:
819819

@@ -867,9 +867,15 @@ Build up an executable with Objective-C code and name it **ex5.m**:
867867
@interface AClass : NSObject
868868
@end
869869

870+
@implementation AClass
871+
@end
872+
870873
@interface AnotherClass : AClass
871874
@end
872875

876+
@implementation AnotherClass
877+
@end
878+
873879
int main() { return 0; }
874880
```
875881

0 commit comments

Comments
 (0)