"Fossies" - the Fresh Open Source Software Archive 
Member "ncc-2.8/doc/hacking.GLIBC" (30 Dec 2002, 1149 Bytes) of package /linux/privat/old/ncc-2.8.tar.gz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
1 glibc (2.0.x)
2 =============
3
4 The simplest way to hack glibc is to create a file configparms
5 including:
6
7 prefix = /trashcan/place
8 CC := ncc -ncgcc -ncoo -ncspp
9 default_flags :=
10
11 and then ./configure
12
13 PROBLEMS
14 --------
15
16 glibc very often uses a macro weak_alias.
17
18 weak_alias (__strdup, strdup)
19
20 is expanded to:
21
22 extern __typeof__(__strdup) strdup __attribute__((weak));
23
24 Now, that is strange in many aspects.
25 The __attribute__ keyword disappears from the nognu macros and
26 eventually ncc sees:
27
28 extern __typeof__(__strdup) strdup;
29
30 __strdup is a function, and K&R sais that type "function"
31 is converted to "pointer to function" in certain cases in expressions,
32 and typeof gives the type of an expression.
33
34 So we have a problem here.
35
36 This is how I did it:
37
38 - edit libc-symbols.c
39 - add the following lines at the end:
40
41 #ifdef __NCC__
42 #undef weak_alias
43 #define weak_alias(x,y)
44 #endif
45
46 or using ncc keys to show that strdup actually calls __strdup:
47
48 #ifdef __NCC__
49 #undef weak_alias
50 #define weak_alias(x,y) \
51 char x##y##_weakalias [] = \
52 "ncc-key
53 D: "#y"()
54 F: "#x"()
55 ";
56 #endif
57
58 - the same thing probably for strong_alias and similar macros