Skip to content

Commit 23ffafa

Browse files
authored
Merge pull request #2498 from toyowata/master
Fix multiple definition errors in GCC_CR build
2 parents 390cfc4 + b7536b8 commit 23ffafa

File tree

9 files changed

+6
-53
lines changed

9 files changed

+6
-53
lines changed

hal/common/retarget.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -752,7 +752,7 @@ extern "C" void __iar_argc_argv() {
752752
// Provide implementation of _sbrk (low-level dynamic memory allocation
753753
// routine) for GCC_ARM which compares new heap pointer with MSP instead of
754754
// SP. This make it compatible with RTX RTOS thread stacks.
755-
#if defined(TOOLCHAIN_GCC_ARM)
755+
#if defined(TOOLCHAIN_GCC_ARM) || defined(TOOLCHAIN_GCC_CR)
756756
// Linker defined symbol used by _sbrk to indicate where heap should start.
757757
extern "C" int __end__;
758758

@@ -803,7 +803,7 @@ extern "C" caddr_t _sbrk(int incr) {
803803
#endif
804804
#endif
805805

806-
#if defined TOOLCHAIN_GCC_ARM
806+
#if defined(TOOLCHAIN_GCC_ARM) || defined(TOOLCHAIN_GCC_CR)
807807
extern "C" void _exit(int return_code) {
808808
#else
809809
namespace std {
@@ -827,7 +827,7 @@ extern "C" void exit(int return_code) {
827827
while (1);
828828
}
829829

830-
#if !defined(TOOLCHAIN_GCC_ARM)
830+
#if !defined(TOOLCHAIN_GCC_ARM) && !defined(TOOLCHAIN_GCC_CR)
831831
} //namespace std
832832
#endif
833833

hal/targets/cmsis/TARGET_NXP/TARGET_LPC11U6X/TOOLCHAIN_GCC_CR/TARGET_LPC11U68/startup_LPC11U68.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -191,11 +191,3 @@ AFTER_VECTORS void IntDefaultHandler (void) {}
191191

192192
int __aeabi_atexit(void *object, void (*destructor)(void *), void *dso_handle) {return 0;}
193193
}
194-
195-
#include <stdlib.h>
196-
197-
void *operator new(size_t size) {return malloc(size);}
198-
void *operator new[](size_t size){return malloc(size);}
199-
200-
void operator delete(void *p) {free(p);}
201-
void operator delete[](void *p) {free(p);}

hal/targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/TOOLCHAIN_GCC_CR/TARGET_LPC11U35_501/LPC11U35.ld

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* mbed - LPC11U35 linker script
22
* Based linker script generated by Code Red Technologies Red Suite 4.1
33
*/
4-
GROUP(libgcc.a libc_s.a libstdc++_s.a libm.a libcr_newlib_nohost.a crti.o crtn.o crtbegin.o crtend.o)
4+
GROUP(libgcc.a libc.a libstdc++.a libm.a libcr_newlib_nohost.a crti.o crtn.o crtbegin.o crtend.o)
55

66
MEMORY
77
{

hal/targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/TOOLCHAIN_GCC_CR/startup_LPC11xx.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -152,14 +152,6 @@ AFTER_VECTORS void PendSV_Handler (void) {while(1){}}
152152
AFTER_VECTORS void SysTick_Handler (void) {while(1){}}
153153
AFTER_VECTORS void IntDefaultHandler(void) {while(1){}}
154154

155-
#include <stdlib.h>
156-
157-
void *operator new (size_t size) {return malloc(size);}
158-
void *operator new[](size_t size) {return malloc(size);}
159-
160-
void operator delete (void *p) {free(p);}
161-
void operator delete[](void *p) {free(p);}
162-
163155
int __aeabi_atexit(void *object, void (*destructor)(void *), void *dso_handle) {
164156
return 0;
165157
}

hal/targets/cmsis/TARGET_NXP/TARGET_LPC11XX_11CXX/TOOLCHAIN_GCC_CR/TARGET_LPC11XX/LPC1114.ld

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
/* mbed - LPC1114 linker script
22
* Based linker script generated by Code Red Technologies Red Suite 4.1
33
*/
4-
GROUP(libgcc.a libc_s.a libstdc++_s.a libm.a libcr_newlib_nohost.a crti.o crtn.o crtbegin.o crtend.o)
4+
GROUP(libgcc.a libc.a libstdc++.a libm.a libcr_newlib_nohost.a crti.o crtn.o crtbegin.o crtend.o)
5+
56
MEMORY
67
{
78
/* Define each memory region */

hal/targets/cmsis/TARGET_NXP/TARGET_LPC11XX_11CXX/TOOLCHAIN_GCC_CR/TARGET_LPC11XX/startup_LPC11xx.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -152,14 +152,6 @@ AFTER_VECTORS void PendSV_Handler (void) {while(1){}}
152152
AFTER_VECTORS void SysTick_Handler (void) {while(1){}}
153153
AFTER_VECTORS void IntDefaultHandler(void) {while(1){}}
154154

155-
#include <stdlib.h>
156-
157-
void *operator new (size_t size) {return malloc(size);}
158-
void *operator new[](size_t size) {return malloc(size);}
159-
160-
void operator delete (void *p) {free(p);}
161-
void operator delete[](void *p) {free(p);}
162-
163155
int __aeabi_atexit(void *object, void (*destructor)(void *), void *dso_handle) {
164156
return 0;
165157
}

hal/targets/cmsis/TARGET_NXP/TARGET_LPC15XX/TOOLCHAIN_GCC_CR/startup_LPC15xx.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -209,11 +209,3 @@ AFTER_VECTORS void IntDefaultHandler (void) {}
209209

210210
int __aeabi_atexit(void *object, void (*destructor)(void *), void *dso_handle) {return 0;}
211211
}
212-
213-
#include <stdlib.h>
214-
215-
void *operator new(size_t size) {return malloc(size);}
216-
void *operator new[](size_t size){return malloc(size);}
217-
218-
void operator delete(void *p) {free(p);}
219-
void operator delete[](void *p) {free(p);}

hal/targets/cmsis/TARGET_NXP/TARGET_LPC176X/TOOLCHAIN_GCC_CR/startup_LPC17xx.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -173,11 +173,3 @@ AFTER_VECTORS void IntDefaultHandler (void) {}
173173

174174
int __aeabi_atexit(void *object, void (*destructor)(void *), void *dso_handle) {return 0;}
175175
}
176-
177-
#include <stdlib.h>
178-
179-
void *operator new(size_t size) {return malloc(size);}
180-
void *operator new[](size_t size){return malloc(size);}
181-
182-
void operator delete(void *p) {free(p);}
183-
void operator delete[](void *p) {free(p);}

hal/targets/cmsis/TARGET_NXP/TARGET_LPC408X/TOOLCHAIN_GCC_CR/startup_lpc407x_8x.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -428,11 +428,3 @@ void IntDefaultHandler(void)
428428
{
429429
}
430430
}
431-
432-
#include <stdlib.h>
433-
434-
void *operator new(size_t size) {return malloc(size);}
435-
void *operator new[](size_t size){return malloc(size);}
436-
437-
void operator delete(void *p) {free(p);}
438-
void operator delete[](void *p) {free(p);}

0 commit comments

Comments
 (0)