Commit graph

30 commits

Author SHA1 Message Date
Val Snyder
7ff29b8c37
Bump copyright dates for 2025 2025-02-14 10:24:30 -05:00
Micah Snyder
9cb28e51e6 Bump copyright dates for 2024 2024-01-22 11:27:17 -05:00
Micah Snyder
6eebecc303 Bump copyright for 2023 2023-02-12 11:20:22 -08:00
Micah Snyder
15eef50656 Code cleanup: Refactor to clean up formatting issues
Refactored the clamscan code that determines 'what to scan' in order
to clean up some very messy logic and also to get around a difference in
how vscode and clang-format handle formatting #ifdef blocks in the
middle of an else/if.

In addition to refactoring, there is a slight behavior improvement. With
this change, doing `clamscan blah -` will now scan `blah` and then also
scan `stdin`.  You can even do `clamscan - blah` to now scan `stdin` and
then scan `blah`. Before, The `-` had to be the only "filename" argument
in order to scan from stdin.

In addition, added a bunch of extra empty lines or changing multi-line
function calls to single-line function calls in order to get around a
bug in clang-format with these two options do not playing nice together:
- AlignConsecutiveAssignments: true
- AlignAfterOpenBracket: true

AlignAfterOpenBracket is not taking account the spaces inserted by
AlignConsecutiveAssignments, so you end up with stuff like this:
```c
    bleeblah = 1;
    blah     = function(arg1,
                    arg2,
                    arg3);

                //  ^--- these args 4-left from where they should be.
```

VSCode, meanwhile, somehow fixes this whitespace issue so code that is
correctly formatted by VSCode doesn't have this bug, meaning that:

1. The clang-format check in GH Actions fails.
2. We'd all have to stop using format-on-save in VSCode and accept the
  bug if we wanted those GH Actions tests to pass.

Adding an empty line before variable assignments from multi-line
function calls evades the buggy behavior.

This commit should resolve the clang-format github action test failures,
for now.
2022-03-22 10:42:46 -07:00
Andy Ragusa
90904d5a7a CMake: Make BYTECODE_RUNTIME parameter case-insensitive
Also:
- Removed an unused DEBUG_TYPE define that was throwing warnings.
- Added default behavior for unexpected platform OS to reduce warnings.
2022-03-09 20:35:42 -08:00
Andy Ragusa
4b83bcf0c5 Updated llvm runtime to support llvm versions 8, 9, 10, 11, 12
Modified bytecode JIT code to support llvm versions 8, 9, 10, 11, 12.
Additionally updated FindLLVM.cmake to the current version, found at
https://github.com/ldc-developers/ldc/blob/master/cmake/Modules/FindLLVM.cmake,
as well as making modifications suggested by Micah Snyder to check VERSION_LESS
in CMakeLists.txt to avoid having modifications to FindLLVM.cmake.
2022-03-09 20:35:42 -08:00
mko-x
a21cc6dcd7
Add explicit log level parameter to application logging API
* Added loglevel parameter to logg()

* Fix logg and mprintf internals with new loglevels

* Update all logg calls to set loglevel

* Update all mprintf calls to set loglevel

* Fix hidden logg calls

* Executed clam-format
2022-02-15 15:13:55 -08:00
micasnyd
140c88aa4e Bump copyright for 2022
Includes minor format corrections.
2022-01-09 14:23:25 -07:00
Micah Snyder
d46832d5cf clamav.net URL update for new docs, github issues
Replace new bugzilla ticket links with links to github issues.
Replace clamav.net/documentation links with docs.clamav.net equivalents.
2021-07-17 15:28:02 -07:00
Micah Snyder
b0fc4c1346 clang-format: c++ bytecode source
Previously we'd not clang-formatted the c++ bytecode files because:
A) It's a massive difference in format
B) I wasn't sure, at the time, which code was "ours"

Reformatting now that the LLVM source is all removed and before it gets
updated to support modern LLVM versions.
2021-07-05 15:19:02 -07:00
Micah Snyder
da23b1ceab CMake: Fix support for external LLVM (3.6)
Have to manually link libtinfo (`-ltinfo`) because our FindLLVM
didn't add it to the LLVM_LIBRARIES variable for us. See:
- https://stackoverflow.com/questions/21477407/llvm-3-5-fails-to-link

Have to remove the CXX_STANDARD setting at the top of CMakeLists.txt
because of c++90 / c++11 ABI compatibility issues w/ LLVM. See:
- https://maleadt.github.io/LLVM.jl/dev/man/troubleshooting/

Rename "llvm/Config/config.h" "llvm/Config/llvm-config.h" because
LLVM renamed it in 2.8.

Have to link LLVM manually with the test binaries that use the
clamav object library instead of libclamav shared library.
CMake does not propagate library dependencies from object files.

I tested on ubuntu:16.04 with LLVM 3.6 built from source using:
```
/usr/local/bin/cmake .. -D CMAKE_INSTALL_PREFIX=/opt/llvm/3.6 \
  -D LLVM_ENABLE_RTTI=ON
```
Then built clamav w/:
```
/usr/local/bin/cmake .. -D CMAKE_INSTALL_PREFIX=`pwd`/install \
  -D BYTECODE_RUNTIME="llvm" \
  -D LLVM_ROOT_DIR="/opt/llvm/3.6" \
  -D LLVM_FIND_VERSION="3.6.0" && make && make install
```
2021-05-19 14:20:59 -07:00
Micah Snyder (micasnyd)
b9ca6ea103 Update copyright dates for 2021
Also fixes up clang-format.
2021-03-19 15:12:26 -07:00
Micah Snyder
206dbaefe8 Update copyright dates for 2020 2020-01-03 15:44:07 -05:00
Micah Snyder
52cddcbcfd Updating and cleaning up copyright notices. 2019-10-02 16:08:18 -04:00
Micah Snyder
964a1e7321 Converting http urls to https urls. Primary focus was on clamav.net urls. I updated a couple others and fixes a few broken links as well. There are many (non-clamav.net) urls I didn't address, especially in 3rd party or contrib code. 2018-04-02 07:58:33 -04:00
Kevin Lin
2c859ec754 bb#11414 - integrate patch for LLVM 3.6 support 2015-10-29 17:48:45 -04:00
Mickey Sola
46a35abe56 mass update of copyright headers 2015-09-17 13:41:26 -04:00
Kevin Lin
9f8df4ae4b unified bytecode version macros into LLVM_VERSION macro 2014-07-25 12:47:18 -04:00
Kevin Lin
34d8b8cfc7 bb#10981 - applied LLVM 3.1-3.4 patch for testing
Conflicts:

	libclamav/c++/Makefile.am
	libclamav/c++/bytecode2llvm.cpp
2014-07-25 12:26:04 -04:00
David Raynor
19f9dadff6 Quiet Minix warning bb#5325 2012-06-22 16:58:21 -04:00
Török Edvin
0c79cc5529 Support building with external LLVM 2.9, and drop support for building with external 2.8
Internal version is an LLVM 2.8 with 2 patches backported from LLVM 2.9 to fix a
crash on AVX chips.
So drop support for building with external LLVM 2.8, and add support for
building with external LLVM 2.9 instead.

Caveat:
 stack smashing protection is broken on LLVM 2.9 so it is disabled

Example on Debian:
apt-get install llvm-2.9-dev
./configure --enable-llvm --with-system-llvm=/usr/bin/llvm-config-2.9
2011-05-06 16:16:33 +03:00
Török Edvin
dec93ea86f Fix bytecode and autoitea06 for Apple-style universal builds (bb #2030)
Bytecode needs to enable both PPC and X86, link in all targets,
and autoit needs fpu_endian == cpu_endian for universal builds.
2010-10-18 11:27:06 +03:00
Török Edvin
ef226b8a0e Really don't warn about x86_64 vs i386 mismatch (bb #2214). 2010-08-31 15:51:06 +03:00
Török Edvin
f4253c163f Don't warn on x86_64 vs i386 mismatches (bb #2214).
With -m32 LLVM gets the target arch right, and configure gets it wrong.
LLVM's detection always overrides the arch, so don't warn on these mismatches.

startup.cbc will get the correct arch when JIT is available, which is the only
case where the arch matters anyway.
When there is no JIT the arch reported to startup.cbc will be configure's which might be wrong.
But since there is no JIT startup.cbc shouldn't need to check the arch anyway.
It will still be able to detect sparc vs x86 though, not 32 vs 64-bit.
2010-08-18 11:01:33 +03:00
Török Edvin
f55cd65e80 Turn off win32 vs win64 mismatch warning.
LLVM doesn't have the notion of win64 in its triple parser.
2010-08-12 22:34:40 +03:00
Török Edvin
bc3a632815 Typo. 2010-08-09 19:57:30 +03:00
Török Edvin
5cd4ee8808 Mac OS X can run 64-bit app on 32-bit kernel (bb #2153).
So don't warn for these mismatches.
2010-08-09 19:47:32 +03:00
aCaB
1bb5a24d3e win32 fixes: bb#2152 and bb#2153 2010-08-05 12:08:13 +02:00
Török Edvin
69650bea38 win32 build fix.
forgot to commit.
2010-07-29 22:17:30 +03:00
Török Edvin
c85060ff79 Move environment detection code to bytecode_detect.c.
This is in preparation for bug #2078, so that the bytecodes can turn themselves off
based on more than just the arch itself.
2010-07-29 13:48:13 +03:00