Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
1563003
Latest stdio destructor changes was creating a bad problem subtractin…
afxgroup Jan 14, 2025
d0ce9f2
Duplicate IO handles on CreateNewProc
afxgroup Jan 14, 2025
ceeeecb
Merge branch 'development' of github.com:AmigaLabs/clib4 into develop…
afxgroup Jan 14, 2025
5827b22
Merge branch 'development' of github.com:AmigaLabs/clib4 into develop…
afxgroup Jan 19, 2025
b6f9bdd
More WINDOWS to LINUX file ending conversion
afxgroup Jan 21, 2025
107cfed
Wrong Printf version requirement printing
afxgroup Jan 28, 2025
bd6b295
Merge branch 'development' of github.com:AmigaLabs/clib4 into line_en…
afxgroup Jan 28, 2025
2f80f55
Get DOSIFace in pthread_create from extern _IDOS
afxgroup Jan 30, 2025
7676191
Merge branch 'afxgroup' of github.com:AmigaLabs/clib4 into afxgroup
afxgroup Jan 30, 2025
989e54f
Added %b format type in printf
afxgroup Feb 8, 2025
ebd6998
Fix on dcngettext was crashing on bindtextdomain and on destructor
afxgroup Feb 9, 2025
03053e5
Added Amiga-1251 charset to iconv
afxgroup Feb 9, 2025
39f9de7
Removed __set_errno from librt since it isn't exported and undefined …
afxgroup Feb 12, 2025
6f9e9d7
Added dlopen example to test shared objects alog rpath and soname
afxgroup Feb 23, 2025
0894c8c
Removed some quirks from dlopen examples
afxgroup Feb 23, 2025
e9e190c
Added static_assert in assert.h
afxgroup Feb 28, 2025
2a0ea0f
Reverted back flock.c changes
afxgroup Feb 28, 2025
11e4d31
Merge branch 'development' of github.com:AmigaLabs/clib4 into afxgroup
afxgroup Feb 28, 2025
52259e3
Changed back (again..) flock.c
afxgroup Feb 28, 2025
4853e6b
Merge branch 'development' of github.com:AmigaLabs/clib4 into afxgroup
afxgroup Feb 28, 2025
06216df
implemented NETBSD getvfsstat function and added an example to test i…
afxgroup Mar 2, 2025
4ed6ea5
Merge branch 'development' of github.com:AmigaLabs/clib4 into afxgroup
afxgroup Mar 2, 2025
c29dac5
__time_delay was not working if wasn't in main thread
afxgroup Mar 6, 2025
1fad70a
Merge branch 'development' of github.com:AmigaLabs/clib4 into afxgroup
afxgroup Mar 6, 2025
c332fbd
Reworked tzset() function. Now parsing of POSIX time zones works corr…
afxgroup Mar 8, 2025
c5b3418
Merge branch 'development' of github.com:AmigaLabs/clib4 into afxgroup
afxgroup Mar 8, 2025
d3d3942
Added baserel support
afxgroup Mar 16, 2025
84d1592
Merge branch 'development' of github.com:AmigaLabs/clib4 into baserel
afxgroup Mar 16, 2025
31a0380
Moved library initialization from _main to libOpen (finally..) now it…
afxgroup Mar 20, 2025
bdcd805
Small changes on constructors when called from a .library
afxgroup Mar 21, 2025
0c1b426
Some small fixes for constructor issues
afxgroup Mar 21, 2025
3aa0409
Fixed a problem on timespec was using 64 bit time and was causing wro…
afxgroup Mar 21, 2025
8f7bd49
Fixed a problem on gettimeofday if ITimer was null
afxgroup Mar 21, 2025
9948863
Changes to fix exe when run from wb
afxgroup Mar 23, 2025
8a31b60
Optimized some string functions
afxgroup Apr 1, 2025
c49a57c
Added backtrace functions
afxgroup Apr 2, 2025
18e26b9
Added dladdr function (not yet finished). Some backtrace refactoring
afxgroup Apr 5, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
196 changes: 196 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@
# Generated by CLion for GNU
BasedOnStyle: LLVM

AccessModifierOffset: -2
AlwaysBreakAfterReturnType: TopLevel
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterClass: true
AfterControlStatement: true
AfterEnum: true
AfterFunction: true
AfterNamespace: false
AfterObjCDeclaration: true
AfterStruct: true
AfterUnion: true
BeforeCatch: true
BeforeElse: true
IndentBraces: true
SplitEmptyFunction: false
BreakBeforeBinaryOperators: All
BreakBeforeBraces: Custom
BreakBeforeTernaryOperators: true
ColumnLimit: 80
ConstructorInitializerIndentWidth: 2
ContinuationIndentWidth: 2
ForEachMacros: [
'FOR_ALL_BB_FN',
'FOR_ALL_EH_REGION',
'FOR_ALL_EH_REGION_AT',
'FOR_ALL_EH_REGION_FN',
'FOR_ALL_INHERITED_FIELDS',
'FOR_ALL_PREDICATES',
'FOR_BB_BETWEEN',
'FOR_BB_INSNS',
'FOR_BB_INSNS_REVERSE',
'FOR_BB_INSNS_REVERSE_SAFE',
'FOR_BB_INSNS_SAFE',
'FOR_BODY',
'FOR_COND',
'FOR_EACH_2XWIDER_MODE',
'FOR_EACH_ACTUAL_CHILD',
'FOR_EACH_AGGR_INIT_EXPR_ARG',
'FOR_EACH_ALIAS',
'FOR_EACH_ALLOCNO',
'FOR_EACH_ALLOCNO_CONFLICT',
'FOR_EACH_ALLOCNO_IN_ALLOCNO_SET',
'FOR_EACH_ALLOCNO_OBJECT',
'FOR_EACH_ARTIFICIAL_DEF',
'FOR_EACH_ARTIFICIAL_USE',
'FOR_EACH_BB',
'FOR_EACH_BB_FN',
'FOR_EACH_BB_IN_BITMAP',
'FOR_EACH_BB_IN_BITMAP_REV',
'FOR_EACH_BB_IN_REGION',
'FOR_EACH_BB_IN_SBITMAP',
'FOR_EACH_BB_REVERSE',
'FOR_EACH_BB_REVERSE_FN',
'FOR_EACH_BB_REVERSE_IN_REGION',
'FOR_EACH_BIT_IN_MINMAX_SET',
'FOR_EACH_BSI_IN_REVERSE',
'FOR_EACH_CALL_EXPR_ARG',
'FOR_EACH_CHILD',
'FOR_EACH_CLONE',
'FOR_EACH_CODE_MAPPING',
'FOR_EACH_COND_FN_PAIR',
'FOR_EACH_CONFLICT',
'FOR_EACH_CONST_CALL_EXPR_ARG',
'FOR_EACH_CONSTRUCTOR_ELT',
'FOR_EACH_CONSTRUCTOR_VALUE',
'FOR_EACH_COPY',
'FOR_EACH_DEF',
'FOR_EACH_DEFINED_FUNCTION',
'FOR_EACH_DEFINED_SYMBOL',
'FOR_EACH_DEFINED_VARIABLE',
'FOR_EACH_DEP',
'FOR_EACH_DEP_LINK',
'FOR_EACH_EDGE',
'FOR_EACH_ELEMENT',
'FOR_EACH_ELIM_GRAPH_PRED',
'FOR_EACH_ELIM_GRAPH_SUCC',
'FOR_EACH_EXPR',
'FOR_EACH_EXPR_1',
'FOR_EACH_EXPR_ID_IN_SET',
'FOR_EACH_FLOAT_OPERATOR',
'FOR_EACH_FP_TYPE',
'FOR_EACH_FUNCTION',
'FOREACH_FUNCTION_ARGS',
'FOREACH_FUNCTION_ARGS_PTR',
'FOR_EACH_FUNCTION_WITH_GIMPLE_BODY',
'FOR_EACH_GORI_EXPORT_NAME',
'FOR_EACH_GORI_IMPORT_NAME',
'FOR_EACH_HASH_TABLE_ELEMENT',
'FOR_EACH_HTAB_ELEMENT',
'FOR_EACH_IMM_USE_FAST',
'FOR_EACH_IMM_USE_ON_STMT',
'FOR_EACH_IMM_USE_SAFE',
'FOR_EACH_IMM_USE_STMT',
'FOR_EACH_INSN',
'FOR_EACH_INSN_1',
'FOR_EACH_INSN_DEF',
'FOR_EACH_INSN_EQ_USE',
'FOR_EACH_INSN_INFO_DEF',
'FOR_EACH_INSN_INFO_EQ_USE',
'FOR_EACH_INSN_INFO_MW',
'FOR_EACH_INSN_INFO_USE',
'FOR_EACH_INSN_USE',
'FOR_EACH_INT_OPERATOR',
'FOR_EACH_INT_TYPE',
'FOR_EACH_INV',
'FOR_EACH_LOAD_BROADCAST',
'FOR_EACH_LOAD_BROADCAST_IMM',
'FOR_EACH_LOCAL_DECL',
'FOR_EACH_LOG_LINK',
'FOR_EACH_LOOP',
'FOR_EACH_LOOP_BREAK',
'FOR_EACH_LOOP_FN',
'FOR_EACH_MODE',
'FOR_EACH_MODE_FROM',
'FOR_EACH_MODE_IN_CLASS',
'FOR_EACH_MODE_UNTIL',
'FOR_EACH_NEST_INFO',
'FOR_EACH_OBJECT',
'FOR_EACH_OBJECT_CONFLICT',
'FOR_EACH_OP',
'FOR_EACH_PARTITION_PAIR',
'FOR_EACH_PHI',
'FOR_EACH_PHI_ARG',
'FOR_EACH_PHI_OR_STMT_DEF',
'FOR_EACH_PHI_OR_STMT_USE',
'FOR_EACH_POP',
'FOR_EACH_PREF',
'FOR_EACH_REF',
'FOR_EACH_REFERENCED_VAR',
'FOR_EACH_REFERENCED_VAR_IN_BITMAP',
'FOR_EACH_REFERENCED_VAR_SAFE',
'FOR_EACH_REF_REV',
'FOR_EACH_REGNO',
'FOR_EACH_SCALAR',
'FOR_EACH_SIGNED_TYPE',
'FOR_EACH_SSA',
'FOR_EACH_SSA_DEF_OPERAND',
'FOR_EACH_SSA_MAYDEF_OPERAND',
'FOR_EACH_SSA_MUST_AND_MAY_DEF_OPERAND',
'FOR_EACH_SSA_MUSTDEF_OPERAND',
'FOR_EACH_SSA_NAME',
'FOR_EACH_SSA_TREE_OPERAND',
'FOR_EACH_SSA_USE_OPERAND',
'FOR_EACH_SSA_VDEF_OPERAND',
'FOR_EACH_STATIC_INITIALIZER',
'FOR_EACH_STATIC_VARIABLE',
'FOR_EACH_STMT_IN_REVERSE',
'FOR_EACH_SUBINSN',
'FOR_EACH_SUBRTX',
'FOR_EACH_SUBRTX_PTR',
'FOR_EACH_SUBRTX_VAR',
'FOR_EACH_SUCC',
'FOR_EACH_SUCC_1',
'FOR_EACH_SYMBOL',
'FOR_EACH_TYPE',
'FOR_EACH_UNSIGNED_TYPE',
'FOR_EACH_VALUE_ID_IN_SET',
'FOR_EACH_VARIABLE',
'FOR_EACH_VEC_ELT',
'FOR_EACH_VEC_ELT_FROM',
'FOR_EACH_VEC_ELT_REVERSE',
'FOR_EACH_VEC_SAFE_ELT',
'FOR_EACH_VEC_SAFE_ELT_REVERSE',
'FOR_EACH_WIDER_MODE',
'FOR_EXPR',
'FOR_INIT_STMT',
'FOR_SCOPE',
'EXECUTE_IF_SET_IN_BITMAP',
'EXECUTE_IF_AND_IN_BITMAP',
'EXECUTE_IF_AND_COMPL_IN_BITMAP',
'EXECUTE_IF_SET_IN_REG_SET',
'EXECUTE_IF_SET_IN_HARD_REG_SET',
'EXECUTE_IF_AND_COMPL_IN_REG_SET',
'EXECUTE_IF_AND_IN_REG_SET',
'EXECUTE_IF_SET_IN_SPARSESET'
]
IndentCaseLabels: false
NamespaceIndentation: None
PenaltyBreakBeforeFirstCallParameter: 100
PointerAlignment: Right
SortIncludes: false
SpaceAfterCStyleCast: true
SpaceBeforeParens: Always
SpacesBeforeTrailingComments: 1
UseTab: Always
AlignEscapedNewlines: Right
AlignTrailingComments: true
AllowShortFunctionsOnASingleLine: All
AlwaysBreakTemplateDeclarations: MultiLine
KeepEmptyLinesAtTheStartOfBlocks: false
Standard: Auto
4 changes: 2 additions & 2 deletions GNUmakefile.os4
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ WARNINGS := \
-Wundef -Wmissing-declarations -Wunused -Wwrite-strings -Wno-unused-value -Wno-comment -Wno-missing-braces \
-Wno-deprecated-declarations -Wno-sign-compare -Wno-unused-variable -Wno-parentheses -Wno-missing-prototypes \
-Wstrict-aliasing -Wno-shadow -Wno-discarded-qualifiers -Wno-unused-function -Wno-unused-parameter -Wno-strict-aliasing \
-Wno-type-limits -Wno-cast-function-type -Wno-frame-address -Wno-error=unused-but-set-variable -Werror \
-Wno-type-limits -Wno-cast-function-type -Wno-frame-address -Wno-error=unused-but-set-variable -Wno-stringop-overflow -Werror \
# -Wbad-function-cast -Wconversion -Wformat

PIC := -fPIC -DPIC
Expand Down Expand Up @@ -279,7 +279,7 @@ version:
# Shared clib4.library rules

clib4.library.debug: $(OBJ_C_LIB)
$(VERBOSE)$(CC) -o $(BUILD_DIR)/$@ $(CFLAGS) $(BUILD_DIR)/shared/shared_library/clib4.o $(BUILD_DIR)/shared/shared_library/math.o $(OBJ_C_LIB) $(OUTPUT_LIB)/crtend.o $(DLIBS) -Wl,--cref,-M,-Map=$(BUILD_DIR)/$@.map
$(VERBOSE)$(CC) -o $(BUILD_DIR)/$@ $(CFLAGS) $(BUILD_DIR)/shared/shared_library/clib4.o $(BUILD_DIR)/shared/shared_library/math.o $(OBJ_C_LIB) $(OUTPUT_LIB)/crtend.o $(DLIBS) -Wl,-export-dynamic -Wl,--cref,-M,-Map=$(BUILD_DIR)/$@.map

clib4.library: clib4.library.debug
cp $(BUILD_DIR)/$< $(BUILD_DIR)/$@
Expand Down
9 changes: 6 additions & 3 deletions libc.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ endif

C_BASE := \
libc_init_global.o \
debug/amigaos_symbols_callback.o \
getclib4.o \
errno_data.o

Expand Down Expand Up @@ -152,6 +153,9 @@ C_POSIX := \
posix/glob.o \
posix/globfree.o \
posix/basename.o \
debug/backtrace.o \
debug/backtrace_symbols.o \
debug/backtrace_symbols_fd.o \
posix/dirname.o \
posix/memalign.o \
posix/mmap.o \
Expand Down Expand Up @@ -488,6 +492,7 @@ C_STDLIB := \
stdlib/calloc.o \
stdlib/div.o \
stdlib/divsi3.o \
stdlib/dladdr.o \
stdlib/dlclose.o \
stdlib/dlerror.o \
stdlib/dlopen.o \
Expand Down Expand Up @@ -592,17 +597,15 @@ C_STRING := \
cpu/generic/bcopy.o \
cpu/generic/strcat.o \
cpu/generic/strchr.o \
cpu/generic/strcpy.o \
cpu/generic/strcmp.o \
cpu/generic/strlen.o \
string/rindex.o \
string/stccpy.o \
string/stpcpy.o \
string/stpncpy.o \
string/strcasestr.o \
string/strcat.o \
string/strchr.o \
string/strchrnul.o \
string/strcmp.o \
string/strcoll.o \
string/strcpy.o \
string/strcspn.o \
Expand Down
42 changes: 38 additions & 4 deletions library/cpu/4xx/ppc4xx.inc
Original file line number Diff line number Diff line change
Expand Up @@ -125,15 +125,49 @@
#define cr7_3 31


#define function_prolog(func_name) .text; \
#define function_prolog(func_name) \
.text; \
.align 2; \
.globl func_name; \
func_name:
#define function_epilog(func_name) .type func_name,@function; \

#define function_prolog_alignedto(func_name, xalign, xwords) \
.text; \
.globl func_name; \
.align xalign; \
EALIGN_W_##xwords; \
func_name:

#define function_epilog(func_name) \
.type func_name,@function; \
.size func_name,.-func_name

#define function_call(func_name) bl func_name

#endif

#define EALIGN_W_0 /* No words to insert. */
#define EALIGN_W_1 nop
#define EALIGN_W_2 nop;nop
#define EALIGN_W_3 nop;nop;nop
#define EALIGN_W_4 EALIGN_W_3;nop
#define EALIGN_W_5 EALIGN_W_4;nop
#define EALIGN_W_6 EALIGN_W_5;nop
#define EALIGN_W_7 EALIGN_W_6;nop

#define stringify_in_c(...) __VA_ARGS__
#define ASM_CONST(x) x

#define PPC_LL stringify_in_c(lwz)
#define PPC_STL stringify_in_c(stw)
#define PPC_STLU stringify_in_c(stwu)
#define PPC_LCMPI stringify_in_c(cmpwi)
#define PPC_LONG stringify_in_c(.long)
#define PPC_LONG_ALIGN stringify_in_c(.balign 4)
#define PPC_TLNEI stringify_in_c(twnei)
#define PPC_LLARX(t, a, b, eh) PPC_LWARX(t, a, b, eh)
#define PPC_STLCX stringify_in_c(stwcx.)
#define PPC_CNTLZL stringify_in_c(cntlzw)
#define PPC_MTOCRF stringify_in_c(mtcrf)
#define PPC_LR_STKOFF 4
#define PPC_MIN_STKFRM 16

#endif
15 changes: 13 additions & 2 deletions library/cpu/generic/strcat.S
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
/*
* String handling functions for PowerPC.
*
* Copyright (C) 1996 Paul Mackerras.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*/

#include "../4xx/ppc4xx.inc"

function_prolog(__strcat_ppc)
function_prolog(strcat)
addi r5,r3,-1
addi r4,r4,-1
1: lbzu r0,1(r5)
Expand All @@ -13,4 +24,4 @@ function_prolog(__strcat_ppc)
bne 1b
blr

function_epilog(__strcat_ppc)
function_epilog(strcat)
26 changes: 26 additions & 0 deletions library/cpu/generic/strcmp.S
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* String handling functions for PowerPC.
*
* Copyright (C) 1996 Paul Mackerras.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*/

#include "../4xx/ppc4xx.inc"

PPC_LONG_ALIGN

function_prolog(strcmp)
addi r5,r3,-1
addi r4,r4,-1
1: lbzu r3,1(r5)
cmpwi 1,r3,0
lbzu r0,1(r4)
subf. r3,r0,r3
beqlr 1
beq 1b
blr
function_epilog(strcmp)
Loading