+2004-06-07 David Ayers <d.ayers@inode.at>
+ Ziemowit Laski <zlaski@apple.com>
+
+ * lib/objc.exp (objc_target_compile): Revert the '-framework
+ Foundation' flag fix, since bare Darwin does not ship
+ with the Foundation framework.
+ * objc/execute/next_mapping.h: Provide a local NSConstantString
+ @interface and @implementation.
+ (objc_string_init): A constructor function, used to initialize
+ the NSConstantString meta-class object.
+ * objc/execute/string1.m: Include "next_mapping.h" instead of
+ <Foundation/NSString.h>.
+ * objc/execute/string2.m: Likewise.
+ * objc/execute/string3.m: Likewise.
+ * objc/execute/string4.m: Likewise.
+
2004-06-06 H.J. Lu <hongjiu.lu@intel.com>
* gcc.c-torture/execute/ieee/fp-cmp-4.c (FLOAT): New. Default
global TOOL_OPTIONS
global ld_library_path
global objc_libgcc_s_path
- global target_triplet
set ld_library_path ".:${objc_libgcc_s_path}"
lappend options "libs=-lobjc"
lappend options "additional_flags=${objc_link_flags}"
append ld_library_path ":${libobjc_dir}"
}
-
- # If we are running on Darwin, we'll need to point the linker at
- # the Foundation framework, where many goodies (e.g., NSConstantString)
- # reside.
- if { [string match "*-*-darwin*" $target_triplet] } {
- lappend options "libs=-framework Foundation"
- }
-
lappend options "compiler=$OBJC_UNDER_TEST"
# On IRIX 6, we have to set variables akin to LD_LIBRARY_PATH, but
/* This file "renames" various ObjC GNU runtime entry points
(and fakes the existence of several others)
if the NeXT runtime is being used. */
-/* Author: Ziemowit Laski <zlaski@apple.com> */
+/* Authors: Ziemowit Laski <zlaski@apple.com> */
+/* David Ayers <d.ayers@inode.at> */
#ifdef __NEXT_RUNTIME__
#include <objc/objc-class.h>
+#include <objc/Object.h>
#include <ctype.h>
#define objc_get_class(C) objc_getClass(C)
*type = layout->prev_type;
}
+/* A small, portable NSConstantString implementation for use with the NeXT
+ runtime.
+
+ On full-fledged Mac OS X systems, NSConstantString is provided
+ as part of the Foundation framework. However, on bare Darwin systems,
+ Foundation is not included, and hence there is no NSConstantString
+ implementation to link against.
+
+ This code is derived from the GNU runtime's NXConstantString implementation.
+*/
+
+struct objc_class _NSConstantStringClassReference;
+
+@interface NSConstantString : Object
+{
+ char *c_string;
+ unsigned int len;
+}
+
+-(const char *) cString;
+-(unsigned int) length;
+
+@end
+
+@implementation NSConstantString
+
+-(const char *) cString
+{
+ return (c_string);
+}
+
+-(unsigned int) length
+{
+ return (len);
+}
+
+@end
+
+/* The NSConstantString metaclass will need to be initialized before we can
+ send messages to strings. */
+
+void objc_constant_string_init (void) __attribute__((constructor));
+void objc_constant_string_init (void) {
+ memcpy (&_NSConstantStringClassReference,
+ objc_getClass ("NSConstantString"),
+ sizeof (_NSConstantStringClassReference));
+}
+
#endif /* #ifdef __NEXT_RUNTIME__ */
#include <stdlib.h>
#ifdef __NEXT_RUNTIME__
-#import <Foundation/NSString.h>
+#include "next_mapping.h"
#else
#include <objc/NXConstStr.h>
#endif
#include <stdlib.h>
#ifdef __NEXT_RUNTIME__
-#import <Foundation/NSString.h>
+#include "next_mapping.h"
#else
#include <objc/NXConstStr.h>
#endif
#include <stdlib.h>
#ifdef __NEXT_RUNTIME__
-#import <Foundation/NSString.h>
+#include "next_mapping.h"
#else
#include <objc/NXConstStr.h>
#endif
#include <stdlib.h>
#ifdef __NEXT_RUNTIME__
-#import <Foundation/NSString.h>
+#include "next_mapping.h"
#else
#include <objc/NXConstStr.h>
#endif